Documentation ¶
Index ¶
Constants ¶
View Source
const ( LLDP_MAX_TTL = 65535 LLDP_PROTO_DST_MAC = "01:80:c2:00:00:0e" LLDP_TOTAL_TLV_SUPPORTED = 8 )
Variables ¶
This section is empty.
Functions ¶
func EncodeMandatoryTLV ¶
Encode Mandatory tlv, chassis id and port id
func EncodeMgmtTLV ¶
func EncodeMgmtTLV(tlv *layers.LLDPMgmtAddress) []byte
TLV Type = 8, 7 bits ---- |--> 2 bytes * TLV Length = 9 bits.... ---- * Value: N bytes * Subtype is 1 byte * Address is []byte * IntefaceSubtype is 1 byte * IntefaceNumber uint32 <<< this is system interface number which is IfIndex in our case * OID string
func EncodeTLV ¶
func EncodeTLV(tlv *layers.LinkLayerDiscoveryValue) []byte
Marshall tlv information into binary form 1) Check type value 2) Check Length
Types ¶
type RX ¶
type RX struct { RxRunning bool // ethernet frame Info (used for rx/tx) SrcMAC net.HardwareAddr // NOTE: Please be informed this is Peer Mac Addr DstMAC net.HardwareAddr // lldp rx information RxFrame *layers.LinkLayerDiscovery RxLinkInfo *layers.LinkLayerDiscoveryInfo ClearCacheTimer *time.Timer // cache last packet and see if we need to update current information or not LastPkt []byte }
func (*RX) CheckPeerEntry ¶
* Handle TTL timer. Once the timer expires, we will delete the remote entry * if timer is running then reset the value
func (*RX) VerifyFrame ¶
func (p *RX) VerifyFrame(lldpInfo *layers.LinkLayerDiscovery) error
Upon receiving incoming packet check whether all the madatory layer info is
* correct or not.. If not then treat the packet as corrupted and move on
type TX ¶
type TX struct { DstMAC net.HardwareAddr MessageTxInterval int MessageTxHoldMultiplier int TxTimer *time.Timer // contains filtered or unexported fields }
func (*TX) DeleteCacheFrame ¶
func (t *TX) DeleteCacheFrame()
We have deleted the pcap handler and hence we will invalid the cache buffer
func (*TX) Frame ¶
Function to send out lldp frame to peer on timer expiry.
* if a cache entry is present then use that otherwise create a new lldp frame * A new frame will be constructed: * 1) if it is first time send * 2) if there is config object update
func (*TX) StopTxTimer ¶
func (t *TX) StopTxTimer()
Stop Send Tx timer... as we have already delete the pcap handle
Click to show internal directories.
Click to hide internal directories.