Skip to content

Instantly share code, notes, and snippets.

@zeroFruit

zeroFruit/swch.go

Created Oct 31, 2020
Embed
What would you like to do?
Modeling the Internet from the scratch: Link-layer, LAN, Switch - Code snippet: Switch
type ForwardEntry struct {
// Incoming is port id attached to switch
Incoming Id
// Addr is destination node address
Addr types.HwAddr
// Time is timestamp when this entry is created
Time time.Time
}
type FrameForwardTable struct {
entries []ForwardEntry
}
type Switch struct {
PortList map[Id]Port
Table *FrameForwardTable
frmDec *FrameDecoder
frmEnc *FrameEncoder
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.