controlplane

package
v0.0.0-...-7296722 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ControlProcs map[int]map[string]ControlProcessFuncPair
View Source
var (
	MessageStore sync.Map
)

Functions

func RegisterLayerProc

func RegisterLayerProc(layer int, name string, pair ControlProcessFuncPair)

func StoreMessage

func StoreMessage(msg ControlMessage) []byte

StoreMessage saves the ControlMessage and returns an 8-byte ID for the Pipeline payload

Types

type ControlMessage

type ControlMessage struct {
	InFrame      *dataplane.IncomingFrame
	PreMessage   interface{} // To be able to reconstruct the packet again
	LayerPayload interface{} // To separate each leayer payload
	OutPorts     []*dataplane.SwitchPort
	ParentSwitch *Switch
	NextHop      string // IP address of the next hop (in case of routed traffic)
}

func DropMessage

func DropMessage(payload []byte) (ControlMessage, bool)

DropMessage deletes the message mapping when fully consumed by the Dataplane natively

func FetchMessage

func FetchMessage(payload []byte) (ControlMessage, bool)

FetchMessage retrieves the original ControlMessage using the byte slice payload

type ControlProcessFuncPair

type ControlProcessFuncPair struct {
	InFunc  func(proc pipeline.PipelineProcess, msg pipeline.PipelineMessage) pipeline.PipelineMessage
	OutFunc func(proc pipeline.PipelineProcess, msg pipeline.PipelineMessage) pipeline.PipelineMessage
	Init    func(sw *Switch)
}

type LayerStor

type LayerStor map[string]ProcStor // Proc Name to ProcStro

type ProcStor

type ProcStor map[string]interface{} // Key to Val

type Switch

type Switch struct {
	Name  string
	Ports map[string]*dataplane.SwitchPort
	Stor  SwitchProcStor
	// contains filtered or unexported fields
}

func NewSwitch

func NewSwitch(name string, cfg config.Config, wg *sync.WaitGroup) *Switch

func (*Switch) AddSwitchPort

func (sw *Switch) AddSwitchPort(name string, swCfg config.SwitchPortConfig) (*dataplane.SwitchPort, error)

func (*Switch) ConsumerLoop

func (sw *Switch) ConsumerLoop()

func (*Switch) DelSwitchPort

func (sw *Switch) DelSwitchPort(name string)

func (*Switch) DownPort

func (sw *Switch) DownPort(name string)

func (*Switch) SendFrame

func (sw *Switch) SendFrame(frame *ethernet.Frame, OutPorts ...*dataplane.SwitchPort)

func (*Switch) Start

func (sw *Switch) Start()

func (*Switch) Stop

func (sw *Switch) Stop()

func (*Switch) SwitchLoop

func (sw *Switch) SwitchLoop()

func (*Switch) UpPort

func (sw *Switch) UpPort(name string)

type SwitchProcStor

type SwitchProcStor map[int]LayerStor // Layer Number to LayerStor

func (SwitchProcStor) GetStor

func (swStor SwitchProcStor) GetStor(layer int, name string) ProcStor

Jump to

Keyboard shortcuts

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