Created
October 31, 2020 12:24
-
-
Save zeroFruit/e11dbb5eb956a825049093d416969950 to your computer and use it in GitHub Desktop.
Modeling the Internet from the scratch: Link-layer, LAN, Switch - Code snippet: Switch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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