lldp.h
Go to the documentation of this file.
1 /**
2  * @file lldp.h
3  * @brief LLDP (Link Layer Discovery Protocol)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2023 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.2.4
29  **/
30 
31 #ifndef _LLDP_H
32 #define _LLDP_H
33 
34 //Forward declaration of LldpDataUnit structure
35 struct _LldpDataUnit;
36 #define LldpDataUnit struct _LldpDataUnit
37 
38 //Forward declaration of LldpAgentContext structure
39 struct _LldpAgentContext;
40 #define LldpAgentContext struct _LldpAgentContext
41 
42 //Forward declaration of LldpPortEntry structure
43 struct _LldpPortEntry;
44 #define LldpPortEntry struct _LldpPortEntry
45 
46 //Dependencies
47 #include "core/net.h"
48 #include "lldp/lldp_rx_fsm.h"
49 #include "lldp/lldp_tx_fsm.h"
50 #include "lldp/lldp_tlv.h"
51 
52 //LLDP agent support
53 #ifndef LLDP_SUPPORT
54  #define LLDP_SUPPORT DISABLED
55 #elif (LLDP_SUPPORT != ENABLED && LLDP_SUPPORT != DISABLED)
56  #error LLDP_SUPPORT parameter is not valid
57 #endif
58 
59 //LLDP TX mode support
60 #ifndef LLDP_TX_MODE_SUPPORT
61  #define LLDP_TX_MODE_SUPPORT ENABLED
62 #elif (LLDP_TX_MODE_SUPPORT != ENABLED && LLDP_TX_MODE_SUPPORT != DISABLED)
63  #error LLDP_TX_MODE_SUPPORT parameter is not valid
64 #endif
65 
66 //LLDP RX mode support
67 #ifndef LLDP_RX_MODE_SUPPORT
68  #define LLDP_RX_MODE_SUPPORT ENABLED
69 #elif (LLDP_RX_MODE_SUPPORT != ENABLED && LLDP_RX_MODE_SUPPORT != DISABLED)
70  #error LLDP_RX_MODE_SUPPORT parameter is not valid
71 #endif
72 
73 //Stack size required to run the LLDP agent
74 #ifndef LLDP_TASK_STACK_SIZE
75  #define LLDP_TASK_STACK_SIZE 500
76 #elif (LLDP_TASK_STACK_SIZE < 1)
77  #error LLDP_TASK_STACK_SIZE parameter is not valid
78 #endif
79 
80 //Priority at which the LLDP agent should run
81 #ifndef LLDP_TASK_PRIORITY
82  #define LLDP_TASK_PRIORITY OS_TASK_PRIORITY_NORMAL
83 #endif
84 
85 //LLDP tick interval (in milliseconds)
86 #ifndef LLDP_TICK_INTERVAL
87  #define LLDP_TICK_INTERVAL 1000
88 #elif (LLDP_TICK_INTERVAL < 10)
89  #error LLDP_TICK_INTERVAL parameter is not valid
90 #endif
91 
92 //Maximum LLDP data unit size
93 #ifndef LLDP_MAX_LLDPDU_SIZE
94  #define LLDP_MAX_LLDPDU_SIZE 500
95 #elif (LLDP_MAX_LLDPDU_SIZE < 100 || LLDP_MAX_LLDPDU_SIZE > 1500)
96  #error LLDP_MAX_LLDPDU_SIZE parameter is not valid
97 #endif
98 
99 //Maximum number of management addresses
100 #ifndef LLDP_MAX_MGMT_ADDRS
101  #define LLDP_MAX_MGMT_ADDRS 10
102 #elif (LLDP_MAX_MGMT_ADDRS < 1 || LLDP_MAX_MGMT_ADDRS > 32)
103  #error LLDP_MAX_MGMT_ADDRS parameter is not valid
104 #endif
105 
106 //Minimum msgTxInterval value
107 #define LLDP_MIN_MSG_TX_INTERVAL 1
108 //Default msgTxInterval value
109 #define LLDP_DEFAULT_MSG_TX_INTERVAL 30
110 //Maximum msgTxInterval value
111 #define LLDP_MAX_MSG_TX_INTERVAL 3600
112 
113 //Minimum msgTxHold value
114 #define LLDP_MIN_MSG_TX_HOLD 1
115 //Default msgTxHold value
116 #define LLDP_DEFAULT_MSG_TX_HOLD 4
117 //Maximum msgTxHold value
118 #define LLDP_MAX_MSG_TX_HOLD 100
119 
120 //Minimum reinitDelay value
121 #define LLDP_MIN_REINIT_DELAY 1
122 //Default reinitDelay value
123 #define LLDP_DEFAULT_REINIT_DELAY 2
124 //Maximum reinitDelay value
125 #define LLDP_MAX_REINIT_DELAY 10
126 
127 //Minimum txDelay value
128 #define LLDP_MIN_TX_DELAY 1
129 //Default txDelay value
130 #define LLDP_DEFAULT_TX_DELAY 2
131 //Maximum txDelay value
132 #define LLDP_MAX_TX_DELAY 900
133 
134 //Minimum notification interval
135 #define LLDP_MIN_NOTIFICATION_INTERVAL 5
136 //Default notification interval
137 #define LLDP_DEFAULT_NOTIFICATION_INTERVAL 5
138 //Maximum notification interval
139 #define LLDP_MAX_NOTIFICATION_INTERVAL 3600
140 
141 //Management address filter
142 #define LLDP_MGMT_ADDR_FILTER_0 0x00000001
143 #define LLDP_MGMT_ADDR_FILTER_1 0x00000002
144 #define LLDP_MGMT_ADDR_FILTER_2 0x00000004
145 #define LLDP_MGMT_ADDR_FILTER_3 0x00000008
146 #define LLDP_MGMT_ADDR_FILTER_4 0x00000010
147 #define LLDP_MGMT_ADDR_FILTER_5 0x00000020
148 #define LLDP_MGMT_ADDR_FILTER_6 0x00000040
149 #define LLDP_MGMT_ADDR_FILTER_7 0x00000080
150 #define LLDP_MGMT_ADDR_FILTER_8 0x00000100
151 #define LLDP_MGMT_ADDR_FILTER_9 0x00000200
152 #define LLDP_MGMT_ADDR_FILTER_10 0x00000400
153 #define LLDP_MGMT_ADDR_FILTER_11 0x00000800
154 #define LLDP_MGMT_ADDR_FILTER_12 0x00001000
155 #define LLDP_MGMT_ADDR_FILTER_13 0x00002000
156 #define LLDP_MGMT_ADDR_FILTER_14 0x00004000
157 #define LLDP_MGMT_ADDR_FILTER_15 0x00008000
158 #define LLDP_MGMT_ADDR_FILTER_16 0x00010000
159 #define LLDP_MGMT_ADDR_FILTER_17 0x00020000
160 #define LLDP_MGMT_ADDR_FILTER_18 0x00040000
161 #define LLDP_MGMT_ADDR_FILTER_19 0x00080000
162 #define LLDP_MGMT_ADDR_FILTER_20 0x00100000
163 #define LLDP_MGMT_ADDR_FILTER_21 0x00200000
164 #define LLDP_MGMT_ADDR_FILTER_22 0x00400000
165 #define LLDP_MGMT_ADDR_FILTER_23 0x00800000
166 #define LLDP_MGMT_ADDR_FILTER_24 0x01000000
167 #define LLDP_MGMT_ADDR_FILTER_25 0x02000000
168 #define LLDP_MGMT_ADDR_FILTER_26 0x04000000
169 #define LLDP_MGMT_ADDR_FILTER_27 0x08000000
170 #define LLDP_MGMT_ADDR_FILTER_28 0x10000000
171 #define LLDP_MGMT_ADDR_FILTER_29 0x20000000
172 #define LLDP_MGMT_ADDR_FILTER_30 0x40000000
173 #define LLDP_MGMT_ADDR_FILTER_31 0x80000000
174 #define LLDP_MGMT_ADDR_FILTER_ALL 0xFFFFFFFF
175 
176 //C++ guard
177 #ifdef __cplusplus
178 extern "C" {
179 #endif
180 
181 
182 /**
183  * @brief Administrative status
184  **/
185 
186 typedef enum
187 {
188  LLDP_ADMIN_STATUS_DISABLED = 0, ///<The local LLDP agent can neither transmit or receive LLDP frames
189  LLDP_ADMIN_STATUS_ENABLED_TX_ONLY = 1, ///<The local LLDP agent can only transmit LLDP frames
190  LLDP_ADMIN_STATUS_ENABLED_RX_ONLY = 2, ///<The local LLDP agent can only receive LLDP frames
191  LLDP_ADMIN_STATUS_ENABLED_TX_RX = 3, ////The local LLDP agent can both transmit and receive LLDP frames
193 
194 
195 /**
196  * @brief Basic TLV filter
197  **/
198 
199 typedef enum
200 {
201  LLDP_BASIC_TLV_FILTER_PORT_DESC = 0x01, ///<Port Description TLV
202  LLDP_BASIC_TLV_FILTER_SYS_NAME = 0x02, ///<System Name TLV
203  LLDP_BASIC_TLV_FILTER_SYS_DESC = 0x04, ///<System Description TLV
204  LLDP_BASIC_TLV_FILTER_SYS_CAP = 0x08, ///<System Capabilities TLV
205  LLDP_BASIC_TLV_FILTER_ALL = 0x0F ///<All Basic TLVs
207 
208 
209 /**
210  * @brief LLDP frame transmission callback function
211  **/
212 
213 typedef void (*LldpSendCallback)(LldpPortEntry *port, LldpDataUnit *lldpdu);
214 
215 
216 /**
217  * @brief LLDP frame reception callback function
218  **/
219 
221 
222 
223 /**
224  * @brief Tick callback function
225  **/
226 
228 
229 
230 /**
231  * @brief LLDP data unit
232  **/
233 
235 {
237  size_t length;
238  size_t pos;
239 };
240 
241 
242 /**
243  * @brief MSAP identifier
244  **/
245 
246 typedef struct
247 {
248  const uint8_t *chassisId; ///<Chassis identifier
249  size_t chassisIdLen; ///<Length of the chassis identifier, in bytes
250  const uint8_t *portId; ///<Port identifier
251  size_t portIdLen; ///<Length of the port identifier, in bytes
252 } LldpMsapId;
253 
254 
255 /**
256  * @brief LLDP neighbor entry
257  **/
258 
259 typedef struct
260 {
261  uint32_t index; ///<Arbitrary local integer value used to identify the entry
262  uint32_t timeMark; ///<Timestamp used to implement time-filtered rows
263  uint_t portIndex; ///<Port on which the LLDPDU was received
264  uint_t rxInfoTTL; ///<Time remaining until the information is no longer valid
265  LldpDataUnit rxInfo; ///<Remote system information
267 
268 
269 /**
270  * @brief LLDP port entry
271  **/
272 
274 {
275  LldpAgentContext *context; ///<LLDP agent context
276  uint8_t portIndex; ///<Port index
277  LldpAdminStatus adminStatus; ///<Indicates whether the local LLDP agent is enabled
278  bool_t portEnabled; ///<Operational state of the MAC service supporting the port
279 
280 #if (LLDP_TX_MODE_SUPPORT == ENABLED)
281  MacAddr macAddr; ///<MAC address of the port
282  LldpDataUnit txInfo; ///<Local system information
283  uint8_t basicTlvFilter; ///<Bit-map indicating the basic TLVs enabled for transmission
284  uint32_t mgmtAddrFilter; ///<Bit-map indicating the management addresses enabled for transmission
285  LldpTxState txState; ///<LLDP transmit state
286  uint_t txShutdownWhile; ///<Number of seconds remaining until LLDP re-initialization can occur
287  uint_t txDelayWhile; ///<Minimum delay between transmission of successive LLDP frames
288  uint_t txTTR; ///<Transmit time to refresh timer
289  bool_t somethingChangedLocal; ///<Status/value of one or more objects in the LLDP local system MIB has changed
290  uint_t txTTL; ///<Time remaining before information in the outgoing LLDPDU will no longer be valid
291  uint32_t statsFramesOutTotal; ///<Count of all LLDP frames transmitted
292  uint32_t lldpduLengthErrors; ///<The number of LLDPDU length errors recorded for the port
293 #endif
294 
295 #if (LLDP_RX_MODE_SUPPORT == ENABLED)
296  LldpRxState rxState; ///<LLDP receive state
297  bool_t notificationEnable; ///<Enable or disable notifications
298  bool_t rcvFrame; ///<An LLDP frame has been recognized by the LLDP LSAP function
299  uint_t rxInfoAge; ///<The rxInfoTTL timing counter has expired
300  uint32_t statsFramesDiscardedTotal; ///<Count of all LLDPDUs received and then discarded
301  uint32_t statsFramesInErrorsTotal; ///<Count of all LLDPDUs received with one or more detectable errors
302  uint32_t statsFramesInTotal; ///<Count of all LLDP frames received
303  uint32_t statsTLVsDiscardedTotal; ///<Count of all TLVs received and then discarded for any reason
304  uint32_t statsTLVsUnrecognizedTotal; ///<Count of all TLVs received on the port that are not recognized
305  uint32_t statsAgeoutsTotal; ///<Count of the times that a neighbor's information has been aged out
306 #endif
307 };
308 
309 
310 /**
311  * @brief LLDP agent settings
312  **/
313 
314 typedef struct
315 {
316  NetInterface *interface; ///<Network interface to configure
317  uint_t numPorts; ///<Number of ports
318  LldpPortEntry *ports; ///<Port table
319  uint_t numNeighbors; ///<Maximum number of entries in the neighbor table
320  LldpNeighborEntry *neighbors; ///<Neighbor table
321  LldpSendCallback sendCallback; ///<LLDP frame transmission callback function
322  LldpReceiveCallback receiveCallback; ///<LLDP frame reception callback function
323  LldpTickCallback tickCallback; ///<Tick callback function
325 
326 
327 /**
328  * @brief LLDP agent context
329  **/
330 
332 {
333  NetInterface *interface; ///<Underlying network interface
334  uint_t numPorts; ///<Number of ports
335  LldpPortEntry *ports; ///<Port table
336  uint_t numNeighbors; ///<Maximum number of entries in the neighbor table
337  LldpNeighborEntry *neighbors; ///<Neighbor table
338  LldpSendCallback sendCallback; ///<LLDP frame transmission callback function
339  LldpReceiveCallback receiveCallback; ///<LLDP frame reception callback function
340  LldpTickCallback tickCallback; ///<Tick callback function
341 
342  bool_t running; ///<This flag tells whether the LLDP agent is running or not
343  bool_t stop; ///<Stop request
344  OsMutex mutex; ///<Mutex preventing simultaneous access to LLDP agent context
345  OsEvent event; ///<Event object used to poll the underlying socket
346  OsTaskId taskId; ///<Task identifier
347 #if (OS_STATIC_TASK_SUPPORT == ENABLED)
348  OsTaskTcb taskTcb; ///<Task control block
350 #endif
351  Socket *socket; ///<Underlying socket
352  systime_t timestamp; ///<Timestamp to manage timeout
353  LldpDataUnit lldpdu; ///<Incoming/outgoing LLDP data unit
354 
355 #if (LLDP_TX_MODE_SUPPORT == ENABLED)
356  LldpDataUnit txInfo; ///<Local system information
357  uint_t msgTxInterval; ///<Interval at which LLDP frames are transmitted
358  uint_t msgTxHold; ///<Transmit hold multiplier
359  uint_t reinitDelay; ///<Delay before re-initialization will be attempted
360  uint_t txDelay; ///<Delay between successive LLDP frame transmissions
361  uint32_t mgmtAddrMap; ///<Bit-map indicating the management addresses that are configured
362 #endif
363 
364 #if (LLDP_RX_MODE_SUPPORT == ENABLED)
365  uint32_t index; ///<Monotonically increasing index used to identify entries
366  uint_t notificationInterval; ///<Notification interval
367  uint_t tooManyNeighborsTimer; ///<Too many neighbors timer
368  bool_t badFrame; ///<Incoming failed validation and was discarded
369  bool_t rxChanges; ///<The incoming LLDPDU has been received with different TLV values
370  uint_t rxTTL; ///<The TTL extracted from the received LLDPDU
371  bool_t somethingChangedRemote; ///<Per-MSAP variable set after all the information has been updated
372  bool_t tooManyNeighbors; ///<Insufficient space to store information from all neighbors
378 #endif
379 
380  bool_t busy; ///<Busy flag
381 };
382 
383 
384 //LLDP agent related functions
386 
388  const LldpAgentSettings *settings);
389 
392 
393 error_t lldpSetPortAddr(LldpAgentContext *context, uint_t portIndex,
394  const MacAddr *macAddr);
395 
397  LldpAdminStatus adminStatus);
398 
400  uint8_t mask);
401 
403  uint32_t mask);
404 
405 error_t lldpSetMsgTxInterval(LldpAgentContext *context, uint_t msgTxInterval);
406 error_t lldpSetMsgTxHold(LldpAgentContext *context, uint_t msgTxHold);
407 error_t lldpSetReinitDelay(LldpAgentContext *context, uint_t reinitDelay);
408 error_t lldpSetTxDelay(LldpAgentContext *context, uint_t txDelay);
409 
412  size_t chassisIdLen);
413 
415  LldpPortIdSubtype portIdSubtype, const void *portId, size_t portIdLen);
416 
418  const char_t *portDesc);
419 
420 error_t lldpSetLocalSysName(LldpAgentContext *context, const char_t *sysName);
421 error_t lldpSetLocalSysDesc(LldpAgentContext *context, const char_t *sysDesc);
422 
424  uint16_t enabledCap);
425 
429  const uint8_t *oid, size_t oidLen);
430 
432 
433 void lldpTask(LldpAgentContext *context);
434 
435 void lldpDeinit(LldpAgentContext *context);
436 
437 //C++ guard
438 #ifdef __cplusplus
439 }
440 #endif
441 
442 #endif
LldpRxState rxState
LLDP receive state.
Definition: lldp.h:296
uint8_t portIdSubtype
Definition: lldp_tlv.h:251
Socket * socket
Underlying socket.
Definition: lldp.h:351
uint8_t ifNumSubtype
Definition: lldp_tlv.h:295
uint32_t timeMark
Timestamp used to implement time-filtered rows.
Definition: lldp.h:262
int bool_t
Definition: compiler_port.h:53
uint32_t index
Monotonically increasing index used to identify entries.
Definition: lldp.h:365
error_t lldpSetReinitDelay(LldpAgentContext *context, uint_t reinitDelay)
Set re-initialization delay.
Definition: lldp.c:511
uint8_t portId[]
Definition: lldp_tlv.h:252
uint16_t enabledCap
Definition: lldp_tlv.h:273
bool_t rxChanges
The incoming LLDPDU has been received with different TLV values.
Definition: lldp.h:369
LldpTxState txState
LLDP transmit state.
Definition: lldp.h:285
uint8_t chassisId[]
Definition: lldp_tlv.h:241
uint8_t data[LLDP_MAX_LLDPDU_SIZE]
Definition: lldp.h:236
OsStackType taskStack[LLDP_TASK_STACK_SIZE]
Task stack.
Definition: lldp.h:349
LldpAdminStatus adminStatus
Indicates whether the local LLDP agent is enabled.
Definition: lldp.h:277
Event object.
error_t lldpSetLocalSysDesc(LldpAgentContext *context, const char_t *sysDesc)
Set system description.
Definition: lldp.c:950
@ LLDP_BASIC_TLV_FILTER_ALL
All Basic TLVs.
Definition: lldp.h:205
uint32_t statsRemTablesAgeouts
Definition: lldp.h:377
LldpTxState
LLDP transmit states.
Definition: lldp_tx_fsm.h:49
uint_t notificationInterval
Notification interval.
Definition: lldp.h:366
@ LLDP_BASIC_TLV_FILTER_SYS_DESC
System Description TLV.
Definition: lldp.h:203
systime_t timestamp
Timestamp to manage timeout.
Definition: lldp.h:352
NetInterface * interface
Network interface to configure.
Definition: lldp.h:316
LldpReceiveCallback receiveCallback
LLDP frame reception callback function.
Definition: lldp.h:322
uint8_t basicTlvFilter
Bit-map indicating the basic TLVs enabled for transmission.
Definition: lldp.h:283
LldpNeighborEntry * neighbors
Neighbor table.
Definition: lldp.h:320
error_t lldpSetMsgTxInterval(LldpAgentContext *context, uint_t msgTxInterval)
Set transmit interval.
Definition: lldp.c:446
LldpTlvType
TLV type values.
Definition: lldp_tlv.h:92
LldpPortIdSubtype
Port ID subtypes.
Definition: lldp_tlv.h:128
bool_t running
This flag tells whether the LLDP agent is running or not.
Definition: lldp.h:342
LldpSendCallback sendCallback
LLDP frame transmission callback function.
Definition: lldp.h:321
uint8_t oid[]
Definition: lldp_tlv.h:298
NetInterface * interface
Underlying network interface.
Definition: lldp.h:333
#define LLDP_MAX_LLDPDU_SIZE
Definition: lldp.h:94
bool_t somethingChangedLocal
Status/value of one or more objects in the LLDP local system MIB has changed.
Definition: lldp.h:289
uint_t msgTxHold
Transmit hold multiplier.
Definition: lldp.h:358
uint_t numPorts
Number of ports.
Definition: lldp.h:317
bool_t notificationEnable
Enable or disable notifications.
Definition: lldp.h:297
LldpReceiveCallback receiveCallback
LLDP frame reception callback function.
Definition: lldp.h:339
uint32_t lldpduLengthErrors
The number of LLDPDU length errors recorded for the port.
Definition: lldp.h:292
error_t lldpSetAdminStatus(LldpAgentContext *context, uint_t portIndex, LldpAdminStatus adminStatus)
Set administrative status.
Definition: lldp.c:577
const uint8_t * portId
Port identifier.
Definition: lldp.h:250
uint8_t mgmtAddr[]
Definition: lldp_tlv.h:285
@ LLDP_ADMIN_STATUS_DISABLED
The local LLDP agent can neither transmit or receive LLDP frames.
Definition: lldp.h:188
error_t lldpSetLocalPortDesc(LldpAgentContext *context, uint_t portIndex, const char_t *portDesc)
Set port description.
Definition: lldp.c:834
error_t lldpSetLocalSysName(LldpAgentContext *context, const char_t *sysName)
Set system name.
Definition: lldp.c:896
error_t lldpStop(LldpAgentContext *context)
Stop LLDP agent.
Definition: lldp.c:359
uint32_t statsTLVsUnrecognizedTotal
Count of all TLVs received on the port that are not recognized.
Definition: lldp.h:304
LldpDataUnit txInfo
Local system information.
Definition: lldp.h:356
void(* LldpReceiveCallback)(LldpPortEntry *port, LldpDataUnit *lldpdu)
LLDP frame reception callback function.
Definition: lldp.h:220
uint32_t statsRemTablesDeletes
Definition: lldp.h:375
__start_packed struct @0 MacAddr
MAC address.
LldpDataUnit lldpdu
Incoming/outgoing LLDP data unit.
Definition: lldp.h:353
OsTaskId taskId
Task identifier.
Definition: lldp.h:346
uint32_t mgmtAddrMap
Bit-map indicating the management addresses that are configured.
Definition: lldp.h:361
LldpIfNumSubtype
Interface numbering subtypes.
Definition: lldp_tlv.h:175
size_t portIdLen
Length of the port identifier, in bytes.
Definition: lldp.h:251
LLDP receive state machine.
error_t lldpSetLocalMgmtAddr(LldpAgentContext *context, uint_t index, LldpMgmtAddrSubtype mgmtAddrSubtype, const void *mgmtAddr, size_t mgmtAddrLen, LldpIfNumSubtype ifNumSubtype, uint32_t ifNum, const uint8_t *oid, size_t oidLen)
Set management address.
Definition: lldp.c:1073
uint32_t statsRemTablesLastChangeTime
Definition: lldp.h:373
char_t type
error_t
Error codes.
Definition: error.h:43
size_t length
Definition: lldp.h:237
bool_t rcvFrame
An LLDP frame has been recognized by the LLDP LSAP function.
Definition: lldp.h:298
@ LLDP_BASIC_TLV_FILTER_SYS_NAME
System Name TLV.
Definition: lldp.h:202
const uint8_t * chassisId
Chassis identifier.
Definition: lldp.h:248
LldpRxState
LLDP receive states.
Definition: lldp_rx_fsm.h:49
uint_t numPorts
Number of ports.
Definition: lldp.h:334
uint_t reinitDelay
Delay before re-initialization will be attempted.
Definition: lldp.h:359
uint_t rxInfoTTL
Time remaining until the information is no longer valid.
Definition: lldp.h:264
Task control block.
uint32_t statsRemTablesInserts
Definition: lldp.h:374
uint_t numNeighbors
Maximum number of entries in the neighbor table.
Definition: lldp.h:336
LldpTickCallback tickCallback
Tick callback function.
Definition: lldp.h:323
#define NetInterface
Definition: net.h:36
OsTaskTcb taskTcb
Task control block.
Definition: lldp.h:348
LldpPortEntry * ports
Port table.
Definition: lldp.h:335
@ LLDP_BASIC_TLV_FILTER_PORT_DESC
Port Description TLV.
Definition: lldp.h:201
uint_t txTTL
Time remaining before information in the outgoing LLDPDU will no longer be valid.
Definition: lldp.h:290
error_t lldpSetTxDelay(LldpAgentContext *context, uint_t txDelay)
Set transmit delay.
Definition: lldp.c:543
uint32_t statsRemTablesDrops
Definition: lldp.h:376
#define LldpPortEntry
Definition: lldp.h:44
error_t lldpDeleteLocalTlv(LldpAgentContext *context, LldpTlvType type)
Remove all TLVs with specified type.
Definition: lldp.c:1212
@ LLDP_ADMIN_STATUS_ENABLED_RX_ONLY
The local LLDP agent can only receive LLDP frames.
Definition: lldp.h:190
void(* LldpSendCallback)(LldpPortEntry *port, LldpDataUnit *lldpdu)
LLDP frame transmission callback function.
Definition: lldp.h:213
uint32_t OsStackType
Stack data type.
LldpPortEntry * ports
Port table.
Definition: lldp.h:318
uint_t txDelay
Delay between successive LLDP frame transmissions.
Definition: lldp.h:360
error_t lldpInit(LldpAgentContext *context, const LldpAgentSettings *settings)
LLDP agent initialization.
Definition: lldp.c:82
uint8_t mask
Definition: web_socket.h:317
OsEvent event
Event object used to poll the underlying socket.
Definition: lldp.h:345
LLDP transmit state machine.
TLV parsing and formatting.
error_t lldpSetLocalPortId(LldpAgentContext *context, uint_t portIndex, LldpPortIdSubtype portIdSubtype, const void *portId, size_t portIdLen)
Set port ID.
Definition: lldp.c:762
LldpAgentContext * context
LLDP agent context.
Definition: lldp.h:275
uint8_t chassisIdSubtype
Definition: lldp_tlv.h:240
LLDP agent settings.
Definition: lldp.h:315
bool_t stop
Stop request.
Definition: lldp.h:343
MacAddr macAddr
MAC address of the port.
Definition: lldp.h:281
uint_t msgTxInterval
Interval at which LLDP frames are transmitted.
Definition: lldp.h:357
error_t lldpSetMgmtAddrFilter(LldpAgentContext *context, uint_t portIndex, uint32_t mask)
Set the list of management addresses enabled for transmission.
Definition: lldp.c:646
error_t lldpSetPortAddr(LldpAgentContext *context, uint_t portIndex, const MacAddr *macAddr)
Set port address.
Definition: lldp.c:403
uint32_t mgmtAddrFilter
Bit-map indicating the management addresses enabled for transmission.
Definition: lldp.h:284
Mutex object.
uint32_t systime_t
System time.
uint16_t port
Definition: dns_common.h:251
@ LLDP_ADMIN_STATUS_ENABLED_TX_RX
Definition: lldp.h:191
LLDP neighbor entry.
Definition: lldp.h:260
LldpTickCallback tickCallback
Tick callback function.
Definition: lldp.h:340
bool_t tooManyNeighbors
Insufficient space to store information from all neighbors.
Definition: lldp.h:372
char char_t
Definition: compiler_port.h:48
bool_t portEnabled
Operational state of the MAC service supporting the port.
Definition: lldp.h:278
void lldpGetDefaultSettings(LldpAgentSettings *settings)
Initialize settings with default values.
Definition: lldp.c:51
error_t lldpSetLocalChassisId(LldpAgentContext *context, LldpChassisIdSubtype chassisIdSubtype, const void *chassisId, size_t chassisIdLen)
Set chassis ID.
Definition: lldp.c:694
void lldpTask(LldpAgentContext *context)
LLDP agent task.
Definition: lldp.c:1308
error_t lldpSetMsgTxHold(LldpAgentContext *context, uint_t msgTxHold)
Set transmit hold multiplier.
Definition: lldp.c:479
uint_t portIndex
Port on which the LLDPDU was received.
Definition: lldp.h:263
LLDP port entry.
Definition: lldp.h:274
uint_t numNeighbors
Maximum number of entries in the neighbor table.
Definition: lldp.h:319
void(* LldpTickCallback)(LldpAgentContext *context)
Tick callback function.
Definition: lldp.h:227
error_t lldpSetBasicTlvFilter(LldpAgentContext *context, uint_t portIndex, uint8_t mask)
Set the list of TLVs enabled for transmission.
Definition: lldp.c:611
size_t chassisIdLen
Length of the chassis identifier, in bytes.
Definition: lldp.h:249
uint_t rxTTL
The TTL extracted from the received LLDPDU.
Definition: lldp.h:370
bool_t badFrame
Incoming failed validation and was discarded.
Definition: lldp.h:368
LldpSendCallback sendCallback
LLDP frame transmission callback function.
Definition: lldp.h:338
#define Socket
Definition: socket.h:36
bool_t somethingChangedRemote
Per-MSAP variable set after all the information has been updated.
Definition: lldp.h:371
uint32_t ifNum
Definition: lldp_tlv.h:296
bool_t busy
Busy flag.
Definition: lldp.h:380
uint8_t oidLen
Definition: lldp_tlv.h:297
LldpDataUnit txInfo
Local system information.
Definition: lldp.h:282
LldpChassisIdSubtype
Chassis ID subtypes.
Definition: lldp_tlv.h:111
uint_t txDelayWhile
Minimum delay between transmission of successive LLDP frames.
Definition: lldp.h:287
LldpAdminStatus
Administrative status.
Definition: lldp.h:187
uint8_t portIndex
Port index.
Definition: lldp.h:276
uint8_t mgmtAddrLen
Definition: lldp_tlv.h:283
#define LldpAgentContext
Definition: lldp.h:40
LLDP agent context.
Definition: lldp.h:332
uint32_t index
Arbitrary local integer value used to identify the entry.
Definition: lldp.h:261
uint_t txTTR
Transmit time to refresh timer.
Definition: lldp.h:288
uint_t txShutdownWhile
Number of seconds remaining until LLDP re-initialization can occur.
Definition: lldp.h:286
thread_t * OsTaskId
Task identifier.
void lldpDeinit(LldpAgentContext *context)
Release LLDP agent context.
Definition: lldp.c:1392
uint_t rxInfoAge
The rxInfoTTL timing counter has expired.
Definition: lldp.h:299
LldpNeighborEntry * neighbors
Neighbor table.
Definition: lldp.h:337
uint8_t mgmtAddrSubtype
Definition: lldp_tlv.h:284
uint32_t statsTLVsDiscardedTotal
Count of all TLVs received and then discarded for any reason.
Definition: lldp.h:303
LLDP data unit.
Definition: lldp.h:235
OsMutex mutex
Mutex preventing simultaneous access to LLDP agent context.
Definition: lldp.h:344
LldpMgmtAddrSubtype
Management address subtypes.
Definition: lldp_tlv.h:162
uint32_t statsFramesInErrorsTotal
Count of all LLDPDUs received with one or more detectable errors.
Definition: lldp.h:301
uint32_t statsAgeoutsTotal
Count of the times that a neighbor's information has been aged out.
Definition: lldp.h:305
LldpBasicTlvFilter
Basic TLV filter.
Definition: lldp.h:200
unsigned int uint_t
Definition: compiler_port.h:50
TCP/IP stack core.
size_t pos
Definition: lldp.h:238
uint16_t supportedCap
Definition: lldp_tlv.h:272
MSAP identifier.
Definition: lldp.h:247
#define LLDP_TASK_STACK_SIZE
Definition: lldp.h:75
uint32_t statsFramesInTotal
Count of all LLDP frames received.
Definition: lldp.h:302
@ LLDP_BASIC_TLV_FILTER_SYS_CAP
System Capabilities TLV.
Definition: lldp.h:204
uint_t tooManyNeighborsTimer
Too many neighbors timer.
Definition: lldp.h:367
uint32_t statsFramesDiscardedTotal
Count of all LLDPDUs received and then discarded.
Definition: lldp.h:300
error_t lldpSetLocalSysCap(LldpAgentContext *context, uint16_t supportedCap, uint16_t enabledCap)
Set system capabilities.
Definition: lldp.c:1005
error_t lldpStart(LldpAgentContext *context)
Start LLDP agent.
Definition: lldp.c:259
uint32_t statsFramesOutTotal
Count of all LLDP frames transmitted.
Definition: lldp.h:291
#define LldpDataUnit
Definition: lldp.h:36
@ LLDP_ADMIN_STATUS_ENABLED_TX_ONLY
The local LLDP agent can only transmit LLDP frames.
Definition: lldp.h:189
LldpDataUnit rxInfo
Remote system information.
Definition: lldp.h:265