protocol

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package registry is the registry of protocol on the dataplane.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Matched(*packetio.PacketOut) bool  // returns true if this protocol can handle the packet.
	Process(*packetio.PacketOut) error // processes the packet and update internal data structure if necessary.
}

Handler handles a protocol.

type Registry

type Registry struct {
	pktiopb.PacketIO_CPUPacketStreamClient
	// contains filtered or unexported fields
}

Registry is the repository of protocol handler.

func NewRegistry

NewRegistry takes a packet stream client and returns an empty registry.

func (*Registry) Context

func (r *Registry) Context() context.Context

Context returns the context of gPRC client.

func (*Registry) Deregister

func (r *Registry) Deregister(name string) error

Deregister removes a protocol handler from the registry.

func (*Registry) Recv

func (r *Registry) Recv() (*packetio.PacketOut, error)

Recv returns the packet that is not processed by any protocol.

func (*Registry) Register

func (r *Registry) Register(name string, h Handler) error

Register adds a new protocol handler to the registry.

func (*Registry) Send

func (r *Registry) Send(pkt *packetio.PacketIn) error

Send sends the packet via the streaming client it holds.

func (*Registry) Start

func (r *Registry) Start()

Start starts a goroutine to intecept the packets from the psc stream client. The packet will be sent to the protocol handler if it is available in the registry, or sent to bypass queue so that it will be processed by the default packet IO manager.

func (*Registry) Stop

func (r *Registry) Stop()

Stop stops the registry.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL