lldp_procedures.c
Go to the documentation of this file.
1 /**
2  * @file lldp_procedures.c
3  * @brief LLDP state machine procedures
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL LLDP_TRACE_LEVEL
33 
34 //Dependencies
35 #include <limits.h>
36 #include "core/net.h"
37 #include "lldp/lldp.h"
38 #include "lldp/lldp_procedures.h"
39 #include "lldp/lldp_misc.h"
40 #include "lldp/lldp_debug.h"
41 #include "debug.h"
42 
43 //Check TCP/IP stack configuration
44 #if (LLDP_SUPPORT == ENABLED)
45 
46 
47 /**
48  * @brief Construct an information LLDPDU (10.5.4.2.1)
49  * @param[in] port Pointer to the port context
50  **/
51 
53 {
54 #if (LLDP_TX_MODE_SUPPORT == ENABLED)
55  error_t error;
56  uint_t i;
57  uint_t j;
58  LldpTlv tlv;
59  LldpAgentContext *context;
60  uint8_t ttl[2];
61 
62  //Point to the LLDP agent context
63  context = port->context;
64 
65  //Extract the selected information from the local system MIB
66  context->lldpdu = context->txInfo;
67 
68  //The TTL field shall contain an integer value in the range 0 to 65535
69  //seconds and shall be set to the computed value of txTTL at the time
70  //the LLDPDU is constructed
71  port->txTTL = MIN(65535, context->msgTxInterval * context->msgTxHold);
72 
73  //Convert the value to network byte order
74  STORE16BE(port->txTTL, ttl);
75 
76  //Set the Time To Live TLV with the TTL value set equal to txTTL
77  lldpSetTlv(&context->lldpdu, LLDP_TLV_TYPE_TIME_TO_LIVE, 0, ttl,
78  sizeof(ttl), TRUE);
79 
80  //Check whether the System Name TLV is enabled for transmission
81  if((port->basicTlvFilter & LLDP_BASIC_TLV_FILTER_SYS_NAME) == 0)
82  {
83  //Remove the System Name TLV from the LLDPDU
84  lldpDeleteTlv(&context->lldpdu, LLDP_TLV_TYPE_SYS_NAME, 0);
85  }
86 
87  //Check whether the System Description TLV is enabled for transmission
88  if((port->basicTlvFilter & LLDP_BASIC_TLV_FILTER_SYS_DESC) == 0)
89  {
90  //Remove the System Description TLV from the LLDPDU
91  lldpDeleteTlv(&context->lldpdu, LLDP_TLV_TYPE_SYS_DESC, 0);
92  }
93 
94  //Check whether the System Capabilities TLV is enabled for transmission
95  if((port->basicTlvFilter & LLDP_BASIC_TLV_FILTER_SYS_CAP) == 0)
96  {
97  //Remove the System Capabilities TLV from the LLDPDU
98  lldpDeleteTlv(&context->lldpdu, LLDP_TLV_TYPE_SYS_CAP, 0);
99  }
100 
101  //Loop through the list of management addresses
102  for(i = 0, j = 0; i < LLDP_MAX_MGMT_ADDRS; i++)
103  {
104  //Check whether the current management address is configured
105  if((context->mgmtAddrMap & (1U << i)) != 0)
106  {
107  //An individual LLDPDU may contain more than one Management Address
108  //TLV (refer to IEEE 802.1AB-2005, section 9.5.9.9)
109  if((port->mgmtAddrFilter & (1U << i)) != 0)
110  {
111  j++;
112  }
113  else
114  {
115  //Remove the current management address
116  lldpDeleteTlv(&context->lldpdu, LLDP_TLV_TYPE_MGMT_ADDR, j);
117  }
118  }
119  }
120 
121  //Extract the first port-specific TLV
122  error = lldpGetFirstTlv(&port->txInfo, &tlv);
123 
124  //Copy port-specific TLVs
125  while(!error)
126  {
127  //Check TLV type
129  {
130  //If the End Of LLDPDU TLV is present, any octets that follow it are
131  //discarded
132  break;
133  }
134  else if(tlv.type == LLDP_TLV_TYPE_PORT_DESC)
135  {
136  //Check whether the Port Description TLV is enabled for transmission
137  if((port->basicTlvFilter & LLDP_BASIC_TLV_FILTER_PORT_DESC) != 0)
138  {
139  //Add the Port Description TLV to the LLDPDU
140  lldpSetTlv(&context->lldpdu, LLDP_TLV_TYPE_PORT_DESC, 0, tlv.value,
141  tlv.length, TRUE);
142  }
143  }
144  else
145  {
146  //Add the TLV to the LLDPDU
147  lldpSetTlv(&context->lldpdu, tlv.type, UINT_MAX, tlv.value,
148  tlv.length, FALSE);
149  }
150 
151  //Extract the next port-specific TLV
152  error = lldpGetNextTlv(&port->txInfo, &tlv);
153  }
154 #endif
155 }
156 
157 
158 /**
159  * @brief Construct a shutdown LLDPDU (10.5.4.2.2)
160  * @param[in] port Pointer to the port context
161  **/
162 
164 {
165 #if (LLDP_TX_MODE_SUPPORT == ENABLED)
166  error_t error;
167  size_t n;
168  const uint8_t *p;
169  uint16_t ttl;
170  LldpAgentContext *context;
171 
172  //Point to the LLDP agent context
173  context = port->context;
174 
175  //Flush buffer
176  context->lldpdu.length = 0;
177 
178  //Extract the Chassis ID TLV from the local system MIB
179  error = lldpGetTlv(&context->txInfo, LLDP_TLV_TYPE_CHASSIS_ID, 0, &p, &n);
180 
181  //Chassis ID TLV found?
182  if(!error)
183  {
184  //The first TLV must be the Chassis ID TLV
185  lldpSetTlv(&context->lldpdu, LLDP_TLV_TYPE_CHASSIS_ID, 0, p, n, TRUE);
186  }
187 
188  //Extract the Port ID TLV from the local system MIB
189  error = lldpGetTlv(&port->txInfo, LLDP_TLV_TYPE_PORT_ID, 0, &p, &n);
190 
191  //Port ID TLV found?
192  if(!error)
193  {
194  //The second TLV must be the Port ID TLV
195  lldpSetTlv(&context->lldpdu, LLDP_TLV_TYPE_PORT_ID, 0, p, n, TRUE);
196  }
197 
198  //The TTL field must be set to zero
199  ttl = HTONS(0);
200 
201  //The third TLV must be the Time To Live TLV
202  lldpSetTlv(&context->lldpdu, LLDP_TLV_TYPE_TIME_TO_LIVE, 0,
203  (uint8_t *) &ttl, sizeof(uint16_t), TRUE);
204 
205  //An End Of LLDPDU TLV is necessary to prevent non-zero pad octets from
206  //being interpreted by the receiving LLDP agent as another TLV
207  lldpSetTlv(&context->lldpdu, LLDP_TLV_TYPE_END_OF_LLDPDU, 0, NULL, 0, TRUE);
208 #endif
209 }
210 
211 
212 /**
213  * @brief Send an LLDPDU to the MAC for transmission (10.5.4.2.3)
214  * @param[in] port Pointer to the port context
215  **/
216 
218 {
219 #if (LLDP_TX_MODE_SUPPORT == ENABLED)
220  SocketMsg msg;
221  LldpAgentContext *context;
222 
223  //Point to the LLDP agent context
224  context = port->context;
225 
226  //Any registered callback?
227  if(context->sendCallback != NULL)
228  {
229  //Invoke user callback function
230  context->sendCallback(port, &context->lldpdu);
231  }
232 
233  //Debug message
234  TRACE_DEBUG("Sending LLDPDU (%" PRIuSIZE " bytes)...\r\n",
235  context->lldpdu.length);
236 
237  //Dump the contents of the LLDPDU for debugging purpose
238  lldpDumpDataUnit(&context->lldpdu);
239 
240  //Point to the LLDP data unit
241  msg = SOCKET_DEFAULT_MSG;
242  msg.data = context->lldpdu.data;
243  msg.length = context->lldpdu.length;
244 
245  //Prepend the source and destinations addresses and the LLDP Ethertype
246  //to each LLDPDU
247  msg.srcMacAddr = port->macAddr;
249  msg.ethType = ETH_TYPE_LLDP;
250 
251 #if (ETH_PORT_TAGGING_SUPPORT == ENABLED)
252  //Specify the destination port
253  msg.switchPort = port->portIndex;
254 #endif
255 
256  //Debug message
257  TRACE_INFO("Sending LLDP frame on port %u (%" PRIuSIZE " bytes)...\r\n",
258  port->portIndex, context->lldpdu.length);
259 
260  //Send the LLDP frame to the MAC for transmission
261  socketSendMsg(context->socket, &msg, 0);
262 
263  //Increment the count of all LLDP frames transmitted through the port
264  port->statsFramesOutTotal++;
265 #endif
266 }
267 
268 
269 /**
270  * @brief Initialize the LLDP transmit module (10.5.4.2.3)
271  * @param[in] port Pointer to the port context
272  **/
273 
275 {
276 #if (LLDP_TX_MODE_SUPPORT == ENABLED)
277  //The variable somethingChangedLocal shall be set to FALSE
278  port->somethingChangedLocal = FALSE;
279 #endif
280 }
281 
282 
283 /**
284  * @brief Delete aged entries from the remote systems MIB (10.5.5.2.1)
285  * @param[in] port Pointer to the port context
286  **/
287 
289 {
290 #if (LLDP_RX_MODE_SUPPORT == ENABLED)
291  uint_t i;
292  LldpAgentContext *context;
293  LldpNeighborEntry *entry;
294 
295  //Point to the LLDP agent context
296  context = port->context;
297 
298  //Loop through the remote systems MIB
299  for(i = 0; i < context->numNeighbors; i++)
300  {
301  //Point to the current entry
302  entry = &context->neighbors[i];
303 
304  //Check whether the entry is valid
305  if(entry->rxInfo.length > 0)
306  {
307  //Matching port index?
308  if(entry->portIndex == port->portIndex)
309  {
310  //Check whether the TTL has expired
311  if(entry->rxInfoTTL == 0)
312  {
313  //Invalidate the current entry
315 
316  //Save the time at which an entry was created, modified, or
317  //deleted
318  context->statsRemTablesLastChangeTime = osGetSystemTime64() / 10;
319 
320  //Number of times the complete set of information advertised by
321  //a particular MSAP has been deleted from tables
322  context->statsRemTablesDeletes++;
323 
324  //Number of times the complete set of information advertised by
325  //a particular MSAP has been deleted from tables because the
326  //information timeliness interval has expired
327  if(port->rxInfoAge)
328  {
329  context->statsRemTablesAgeouts++;
330  }
331  }
332  }
333  }
334  }
335 #endif
336 }
337 
338 
339 /**
340  * @brief Update MIB objects with TLVs contained in the received LLDPDU (10.5.5.2.2)
341  * @param[in] port Pointer to the port context
342  **/
343 
345 {
346 #if (LLDP_RX_MODE_SUPPORT == ENABLED)
347  LldpAgentContext *context;
348  LldpNeighborEntry *entry;
349 
350  //Point to the LLDP agent context
351  context = port->context;
352 
353  //Compare the MSAP identifier in the current LLDPDU with the MSAP
354  //identifiers in the LLDP remote systems MIB
355  entry = lldpFindNeighborEntry(context, &context->lldpdu);
356 
357  //Any matching entry?
358  if(entry != NULL)
359  {
360  //If a match is found, replace all current information associated
361  //with the MSAP identifier in the LLDP remote systems MIB with the
362  //information in the current LLDPDU
363  entry->rxInfo = context->lldpdu;
364 
365  //Set the timing counter rxInfoTTL associated with the MSAP identifier
366  //to rxTTL
367  entry->rxInfoTTL = context->rxTTL;
368 
369  //This index value is used to identify the port on which the LLDPDU
370  //was received
371  entry->portIndex = port->portIndex;
372 
373  //Each time the entry is updated, the current value of sysUpTime is
374  //recorded in the associated timestamp
375  entry->timeMark = osGetSystemTime64() / 10;
376 
377  //Save the time at which an entry was created, modified, or deleted
378  context->statsRemTablesLastChangeTime = entry->timeMark;
379  }
380  else
381  {
382  //If no match is found, create a new MIB structure to receive
383  //information associated with the new MSAP identifier, and set these
384  //MIB objects to the values indicated in their respective TLVs
385  entry = lldpCreateNeighborEntry(context);
386 
387  //Sufficient space available in the remote systems MIB?
388  if(entry != NULL)
389  {
390  //An agent is encouraged to assign monotonically increasing index
391  //values to new entries, starting with one, after each reboot
392  context->index++;
393 
394  //The index is used by the agent to identify a particular connection
395  //instance
396  entry->index = context->index;
397 
398  //The timestamp is used to implement time-filtered rows
399  entry->timeMark = osGetSystemTime64() / 10;
400 
401  //Copy the information contained in the received LLDPDU
402  entry->rxInfo = context->lldpdu;
403 
404  //Number of seconds remaining until the information is no longer valid
405  entry->rxInfoTTL = context->rxTTL;
406 
407  //This index value is used to identify the port on which the LLDPDU
408  //was received
409  entry->portIndex = port->portIndex;
410 
411  //Save the time at which an entry was created, modified, or deleted
412  context->statsRemTablesLastChangeTime = entry->timeMark;
413 
414  //Number of times the complete set of information advertised by a
415  //particular MSAP has been inserted into tables
416  context->statsRemTablesInserts++;
417  }
418  }
419 #endif
420 }
421 
422 
423 /**
424  * @brief Initialize the LLDP receive module (10.5.5.2.3)
425  * @param[in] port Pointer to the port context
426  **/
427 
429 {
430 #if (LLDP_RX_MODE_SUPPORT == ENABLED)
431  uint_t i;
432  LldpAgentContext *context;
433  LldpNeighborEntry *entry;
434 
435  //Point to the LLDP agent context
436  context = port->context;
437 
438  //The variable tooManyNeighbors shall be set to FALSE
439  context->tooManyNeighbors = FALSE;
440 
441  //All information in the remote systems MIB associated with this port
442  //shall be deleted
443  for(i = 0; i < context->numNeighbors; i++)
444  {
445  //Point to the current entry
446  entry = &context->neighbors[i];
447 
448  //Check whether the entry is valid
449  if(entry->rxInfo.length > 0)
450  {
451  //Matching port number?
452  if(entry->portIndex == port->portIndex)
453  {
454  //Invalidate the current entry
456 
457  //Save the time at which an entry was created, modified, or deleted
458  context->statsRemTablesLastChangeTime = osGetSystemTime64() / 10;
459 
460  //Number of times the complete set of information advertised by a
461  //particular MSAP has been deleted from tables
462  context->statsRemTablesDeletes++;
463  }
464  }
465  }
466 #endif
467 }
468 
469 
470 /**
471  * @brief Process incoming LLDP frame (10.5.5.2.4)
472  * @param[in] port Pointer to the port context
473  **/
474 
476 {
477 #if (LLDP_RX_MODE_SUPPORT == ENABLED)
478  error_t error;
479  LldpAgentContext *context;
480  LldpNeighborEntry *entry;
481 
482  //Point to the LLDP agent context
483  context = port->context;
484 
485  //Dump the contents of the LLDPDU for debugging purpose
486  lldpDumpDataUnit(&context->lldpdu);
487 
488  //The statsFramesInTotal counter for the port shall be incremented
489  port->statsFramesInTotal++;
490 
491  //Perform LLDPDU validation
492  error = lldpCheckDataUnit(port, &context->lldpdu);
493 
494  //Valid LLDPDU?
495  if(!error)
496  {
497  //Check the TTL value of the received LLDPDU
498  if(context->rxTTL > 0)
499  {
500  //Checking whether or not the current LLDPDU represents a new MSAP
501  //identifier
502  entry = lldpFindNeighborEntry(context, &context->lldpdu);
503 
504  //Matching MSAP identifier found?
505  if(entry != NULL)
506  {
507  //If rxTTL is non-zero and the LLDPDU's MSAP identifier is
508  //associated with an existing LLDP remote systems MIB, compare
509  //all current information in the LLDP remote systems MIB with
510  //the information in the TLVs just received
511  if(entry->portIndex == port->portIndex &&
512  entry->rxInfo.length == context->lldpdu.length &&
513  osMemcmp(entry->rxInfo.data, context->lldpdu.data, context->lldpdu.length) == 0)
514  {
515  //If no differences are found, set the control variable
516  //rxChanges to FALSE, set the timing counter rxInfoTTL
517  //associated with the MSAP identifier to rxTTL, and wait
518  //for the next LLDPDU
519  context->rxChanges = FALSE;
520  entry->rxInfoTTL = context->rxTTL;
521  }
522  else
523  {
524  //If any differences are found and there is sufficient space
525  //in the LLDP remote systems MIB to store the new LLDPDU, set
526  //the control variable rxChanges to TRUE and perform the LLDP
527  //remote systems MIB update process
528  context->rxChanges = TRUE;
529  }
530  }
531  else
532  {
533  //If rxTTL is non-zero and the LLDPDU's MSAP identifier is not
534  //associated with an existing LLDP remote systems MIB, determine
535  //if sufficient space exists in the LLDP remote systems MIB to
536  //accommodate the current LLDPDU
537  entry = lldpCreateNeighborEntry(context);
538 
539  //Sufficient space available in the remote systems MIB?
540  if(entry != NULL)
541  {
542  //Perform the LLDP remote systems MIB update procedure
543  context->rxChanges = TRUE;
544  }
545  else
546  {
547  //Set the flag variable tooManyNeighbors to TRUE
548  context->tooManyNeighbors = TRUE;
549 
550  //Update value of the tooManyNeighborsTimer
551  if(context->rxTTL > context->tooManyNeighborsTimer)
552  {
553  context->tooManyNeighborsTimer = context->rxTTL;
554  }
555 
556  //The received LLDPDU is discarded
557  port->statsFramesDiscardedTotal++;
558 
559  //Number of times the complete set of information advertised
560  //by a particular MSAP could not be entered into tables
561  //because of insufficient resources
562  context->statsRemTablesDrops++;
563  }
564  }
565  }
566  else
567  {
568  //If rxTTL is zero, delete all information associated with the
569  //MSAP identifier from the LLDP remote systems MIB
570  entry = lldpFindNeighborEntry(context, &context->lldpdu);
571 
572  //Any matching entry found in the remote systems MIB?
573  if(entry != NULL)
574  {
575  //This index value is used to identify the port on which the
576  //LLDPDU was received
577  entry->portIndex = port->portIndex;
578 
579  //Delete the entry
580  entry->rxInfoTTL = 0;
581  }
582  }
583  }
584 #endif
585 }
586 
587 #endif
unsigned int uint_t
Definition: compiler_port.h:50
#define PRIuSIZE
#define HTONS(value)
Definition: cpu_endian.h:410
#define STORE16BE(a, p)
Definition: cpu_endian.h:262
Debugging facilities.
#define TRACE_DEBUG(...)
Definition: debug.h:107
#define TRACE_INFO(...)
Definition: debug.h:95
uint8_t n
uint32_t ttl
Definition: dns_common.h:221
uint16_t port
Definition: dns_common.h:267
error_t
Error codes.
Definition: error.h:43
@ ETH_TYPE_LLDP
Definition: ethernet.h:171
LLDP (Link Layer Discovery Protocol)
#define LldpPortEntry
Definition: lldp.h:44
@ LLDP_BASIC_TLV_FILTER_SYS_NAME
System Name TLV.
Definition: lldp.h:202
@ LLDP_BASIC_TLV_FILTER_SYS_DESC
System Description TLV.
Definition: lldp.h:203
@ LLDP_BASIC_TLV_FILTER_SYS_CAP
System Capabilities TLV.
Definition: lldp.h:204
@ LLDP_BASIC_TLV_FILTER_PORT_DESC
Port Description TLV.
Definition: lldp.h:201
#define LLDP_MAX_MGMT_ADDRS
Definition: lldp.h:101
#define LldpAgentContext
Definition: lldp.h:40
void lldpDumpDataUnit(LldpDataUnit *lldpdu)
Dump LLDP data unit.
Definition: lldp_debug.c:126
Data logging functions for debugging purpose (LLDP)
void lldpDeleteNeighborEntry(LldpNeighborEntry *entry)
Remove an entry from the remote systems MIB.
Definition: lldp_misc.c:528
LldpNeighborEntry * lldpFindNeighborEntry(LldpAgentContext *context, LldpDataUnit *lldpdu)
Search the remote systems MIB for a matching MSAP identifier.
Definition: lldp_misc.c:476
const MacAddr LLDP_MULTICAST_ADDR
Definition: lldp_misc.c:46
error_t lldpCheckDataUnit(LldpPortEntry *port, LldpDataUnit *lldpdu)
LLDP data unit validation.
Definition: lldp_misc.c:242
LldpNeighborEntry * lldpCreateNeighborEntry(LldpAgentContext *context)
Create a new entry in the remote systems MIB.
Definition: lldp_misc.c:444
Helper functions for LLDP.
void lldpRxInitializeLLDP(LldpPortEntry *port)
Initialize the LLDP receive module (10.5.5.2.3)
void lldpMibConstrInfoLldpdu(LldpPortEntry *port)
Construct an information LLDPDU (10.5.4.2.1)
void lldpTxFrame(LldpPortEntry *port)
Send an LLDPDU to the MAC for transmission (10.5.4.2.3)
void lldpRxProcessFrame(LldpPortEntry *port)
Process incoming LLDP frame (10.5.5.2.4)
void lldpTxInitializeLLDP(LldpPortEntry *port)
Initialize the LLDP transmit module (10.5.4.2.3)
void lldpMibConstrShutdownLldpdu(LldpPortEntry *port)
Construct a shutdown LLDPDU (10.5.4.2.2)
void lldpMibDeleteObjects(LldpPortEntry *port)
Delete aged entries from the remote systems MIB (10.5.5.2.1)
void lldpMibUpdateObjects(LldpPortEntry *port)
Update MIB objects with TLVs contained in the received LLDPDU (10.5.5.2.2)
LLDP state machine procedures.
error_t lldpGetNextTlv(LldpDataUnit *lldpdu, LldpTlv *tlv)
Extract the next TLV from an LLDPDU.
Definition: lldp_tlv.c:264
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.
Definition: lldp_tlv.c:56
error_t lldpDeleteTlv(LldpDataUnit *lldpdu, uint8_t type, uint_t index)
Remove a TLV from a LLDPDU.
Definition: lldp_tlv.c:320
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.
Definition: lldp_tlv.c:200
error_t lldpGetFirstTlv(LldpDataUnit *lldpdu, LldpTlv *tlv)
Extract the first TLV from an LLDPDU.
Definition: lldp_tlv.c:247
@ LLDP_TLV_TYPE_CHASSIS_ID
Chassis ID.
Definition: lldp_tlv.h:94
@ LLDP_TLV_TYPE_MGMT_ADDR
Management Address.
Definition: lldp_tlv.h:101
@ LLDP_TLV_TYPE_SYS_NAME
System Name.
Definition: lldp_tlv.h:98
@ LLDP_TLV_TYPE_SYS_CAP
System Capabilities.
Definition: lldp_tlv.h:100
@ LLDP_TLV_TYPE_END_OF_LLDPDU
End Of LLDPDU.
Definition: lldp_tlv.h:93
@ LLDP_TLV_TYPE_SYS_DESC
System Description.
Definition: lldp_tlv.h:99
@ LLDP_TLV_TYPE_TIME_TO_LIVE
Time To Live.
Definition: lldp_tlv.h:96
@ LLDP_TLV_TYPE_PORT_ID
Port ID.
Definition: lldp_tlv.h:95
@ LLDP_TLV_TYPE_PORT_DESC
Port Description.
Definition: lldp_tlv.h:97
uint8_t p
Definition: ndp.h:300
TCP/IP stack core.
#define MIN(a, b)
Definition: os_port.h:63
#define osMemcmp(p1, p2, length)
Definition: os_port.h:153
#define TRUE
Definition: os_port.h:50
#define FALSE
Definition: os_port.h:46
#define osGetSystemTime64()
const SocketMsg SOCKET_DEFAULT_MSG
Definition: socket.c:52
error_t socketSendMsg(Socket *socket, const SocketMsg *message, uint_t flags)
Send a message to a connectionless socket.
Definition: socket.c:1094
LLDP neighbor entry.
Definition: lldp.h:260
uint32_t timeMark
Timestamp used to implement time-filtered rows.
Definition: lldp.h:262
uint32_t index
Arbitrary local integer value used to identify the entry.
Definition: lldp.h:261
LldpDataUnit rxInfo
Remote system information.
Definition: lldp.h:265
uint_t portIndex
Port on which the LLDPDU was received.
Definition: lldp.h:263
uint_t rxInfoTTL
Time remaining until the information is no longer valid.
Definition: lldp.h:264
TLV structure.
Definition: lldp_tlv.h:200
uint8_t type
Definition: lldp_tlv.h:202
uint8_t * value
Definition: lldp_tlv.h:204
size_t length
Definition: lldp_tlv.h:203
Message and ancillary data.
Definition: socket.h:230
MacAddr srcMacAddr
Source MAC address.
Definition: socket.h:243
void * data
Pointer to the payload.
Definition: socket.h:231
MacAddr destMacAddr
Destination MAC address.
Definition: socket.h:244
size_t length
Actual length of the payload, in bytes.
Definition: socket.h:233
uint16_t ethType
Ethernet type field.
Definition: socket.h:245
uint8_t switchPort
Switch port identifier.
Definition: socket.h:248