Go to the documentation of this file.
32 #define TRACE_LEVEL LLDP_TRACE_LEVEL
44 #if (LLDP_SUPPORT == ENABLED)
54 #if (LLDP_TX_MODE_SUPPORT == ENABLED)
63 context =
port->context;
66 context->lldpdu = context->txInfo;
71 port->txTTL =
MIN(65535, context->msgTxInterval * context->msgTxHold);
105 if((context->mgmtAddrMap & (1U << i)) != 0)
109 if((
port->mgmtAddrFilter & (1U << i)) != 0)
165 #if (LLDP_TX_MODE_SUPPORT == ENABLED)
173 context =
port->context;
176 context->lldpdu.length = 0;
203 (uint8_t *) &
ttl,
sizeof(uint16_t),
TRUE);
219 #if (LLDP_TX_MODE_SUPPORT == ENABLED)
224 context =
port->context;
227 if(context->sendCallback != NULL)
230 context->sendCallback(
port, &context->lldpdu);
235 context->lldpdu.length);
242 msg.
data = context->lldpdu.data;
243 msg.
length = context->lldpdu.length;
251 #if (ETH_PORT_TAGGING_SUPPORT == ENABLED)
258 port->portIndex, context->lldpdu.length);
264 port->statsFramesOutTotal++;
276 #if (LLDP_TX_MODE_SUPPORT == ENABLED)
290 #if (LLDP_RX_MODE_SUPPORT == ENABLED)
296 context =
port->context;
299 for(i = 0; i < context->numNeighbors; i++)
302 entry = &context->neighbors[i];
305 if(entry->
rxInfo.length > 0)
322 context->statsRemTablesDeletes++;
329 context->statsRemTablesAgeouts++;
346 #if (LLDP_RX_MODE_SUPPORT == ENABLED)
351 context =
port->context;
363 entry->
rxInfo = context->lldpdu;
378 context->statsRemTablesLastChangeTime = entry->
timeMark;
396 entry->
index = context->index;
402 entry->
rxInfo = context->lldpdu;
412 context->statsRemTablesLastChangeTime = entry->
timeMark;
416 context->statsRemTablesInserts++;
430 #if (LLDP_RX_MODE_SUPPORT == ENABLED)
436 context =
port->context;
439 context->tooManyNeighbors =
FALSE;
443 for(i = 0; i < context->numNeighbors; i++)
446 entry = &context->neighbors[i];
449 if(entry->
rxInfo.length > 0)
462 context->statsRemTablesDeletes++;
477 #if (LLDP_RX_MODE_SUPPORT == ENABLED)
483 context =
port->context;
489 port->statsFramesInTotal++;
498 if(context->rxTTL > 0)
512 entry->
rxInfo.length == context->lldpdu.length &&
513 osMemcmp(entry->
rxInfo.data, context->lldpdu.data, context->lldpdu.length) == 0)
519 context->rxChanges =
FALSE;
528 context->rxChanges =
TRUE;
543 context->rxChanges =
TRUE;
548 context->tooManyNeighbors =
TRUE;
551 if(context->rxTTL > context->tooManyNeighborsTimer)
553 context->tooManyNeighborsTimer = context->rxTTL;
557 port->statsFramesDiscardedTotal++;
562 context->statsRemTablesDrops++;
error_t lldpGetFirstTlv(LldpDataUnit *lldpdu, LldpTlv *tlv)
Extract the first TLV from an LLDPDU.
uint32_t timeMark
Timestamp used to implement time-filtered rows.
@ LLDP_TLV_TYPE_SYS_CAP
System Capabilities.
error_t lldpDeleteTlv(LldpDataUnit *lldpdu, uint8_t type, uint_t index)
Remove a TLV from a LLDPDU.
void lldpDumpDataUnit(LldpDataUnit *lldpdu)
Dump LLDP data unit.
Message and ancillary data.
@ LLDP_TLV_TYPE_MGMT_ADDR
Management Address.
error_t lldpGetNextTlv(LldpDataUnit *lldpdu, LldpTlv *tlv)
Extract the next TLV from an LLDPDU.
void * data
Pointer to the payload.
#define osMemcmp(p1, p2, length)
@ LLDP_BASIC_TLV_FILTER_SYS_DESC
System Description TLV.
const MacAddr LLDP_MULTICAST_ADDR
void lldpMibDeleteObjects(LldpPortEntry *port)
Delete aged entries from the remote systems MIB (10.5.5.2.1)
error_t lldpSetTlv(LldpDataUnit *lldpdu, uint8_t type, uint_t index, const uint8_t *value, size_t length, bool_t replace)
Add or replace a TLV.
@ LLDP_TLV_TYPE_END_OF_LLDPDU
End Of LLDPDU.
uint16_t ethType
Ethernet type field.
Data logging functions for debugging purpose (LLDP)
error_t socketSendMsg(Socket *socket, const SocketMsg *message, uint_t flags)
Send a message to a connectionless socket.
const SocketMsg SOCKET_DEFAULT_MSG
size_t length
Actual length of the payload, in bytes.
LldpNeighborEntry * lldpCreateNeighborEntry(LldpAgentContext *context)
Create a new entry in the remote systems MIB.
error_t lldpCheckDataUnit(LldpPortEntry *port, LldpDataUnit *lldpdu)
LLDP data unit validation.
@ LLDP_BASIC_TLV_FILTER_SYS_NAME
System Name TLV.
void lldpTxFrame(LldpPortEntry *port)
Send an LLDPDU to the MAC for transmission (10.5.4.2.3)
LLDP state machine procedures.
void lldpDeleteNeighborEntry(LldpNeighborEntry *entry)
Remove an entry from the remote systems MIB.
uint_t rxInfoTTL
Time remaining until the information is no longer valid.
@ LLDP_BASIC_TLV_FILTER_PORT_DESC
Port Description TLV.
uint8_t switchPort
Switch port identifier.
Helper functions for LLDP.
error_t lldpGetTlv(LldpDataUnit *lldpdu, uint8_t type, uint_t index, const uint8_t **value, size_t *length)
Search a LLDPDU for a given TLV.
@ LLDP_TLV_TYPE_SYS_NAME
System Name.
MacAddr srcMacAddr
Source MAC address.
@ LLDP_TLV_TYPE_CHASSIS_ID
Chassis ID.
MacAddr destMacAddr
Destination MAC address.
uint_t portIndex
Port on which the LLDPDU was received.
void lldpMibConstrShutdownLldpdu(LldpPortEntry *port)
Construct a shutdown LLDPDU (10.5.4.2.2)
void lldpTxInitializeLLDP(LldpPortEntry *port)
Initialize the LLDP transmit module (10.5.4.2.3)
@ LLDP_TLV_TYPE_SYS_DESC
System Description.
#define LLDP_MAX_MGMT_ADDRS
void lldpMibConstrInfoLldpdu(LldpPortEntry *port)
Construct an information LLDPDU (10.5.4.2.1)
LldpNeighborEntry * lldpFindNeighborEntry(LldpAgentContext *context, LldpDataUnit *lldpdu)
Search the remote systems MIB for a matching MSAP identifier.
void lldpRxInitializeLLDP(LldpPortEntry *port)
Initialize the LLDP receive module (10.5.5.2.3)
#define osGetSystemTime64()
uint32_t index
Arbitrary local integer value used to identify the entry.
void lldpRxProcessFrame(LldpPortEntry *port)
Process incoming LLDP frame (10.5.5.2.4)
@ LLDP_TLV_TYPE_PORT_ID
Port ID.
void lldpMibUpdateObjects(LldpPortEntry *port)
Update MIB objects with TLVs contained in the received LLDPDU (10.5.5.2.2)
LLDP (Link Layer Discovery Protocol)
@ LLDP_TLV_TYPE_TIME_TO_LIVE
Time To Live.
@ LLDP_TLV_TYPE_PORT_DESC
Port Description.
@ LLDP_BASIC_TLV_FILTER_SYS_CAP
System Capabilities TLV.
LldpDataUnit rxInfo
Remote system information.