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-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.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 
277  uint8_t portIndex; ///<Port index
278  LldpAdminStatus adminStatus; ///<Indicates whether the local LLDP agent is enabled
279  bool_t portEnabled; ///<Operational state of the MAC service supporting the port
280 
281 #if (LLDP_TX_MODE_SUPPORT == ENABLED)
282  MacAddr macAddr; ///<MAC address of the port
283  LldpDataUnit txInfo; ///<Local system information
284  uint8_t basicTlvFilter; ///<Bit-map indicating the basic TLVs enabled for transmission
285  uint32_t mgmtAddrFilter; ///<Bit-map indicating the management addresses enabled for transmission
286  LldpTxState txState; ///<LLDP transmit state
287  uint_t txShutdownWhile; ///<Number of seconds remaining until LLDP re-initialization can occur
288  uint_t txDelayWhile; ///<Minimum delay between transmission of successive LLDP frames
289  uint_t txTTR; ///<Transmit time to refresh timer
290  bool_t somethingChangedLocal; ///<Status/value of one or more objects in the LLDP local system MIB has changed
291  uint_t txTTL; ///<Time remaining before information in the outgoing LLDPDU will no longer be valid
292  uint32_t statsFramesOutTotal; ///<Count of all LLDP frames transmitted
293  uint32_t lldpduLengthErrors; ///<The number of LLDPDU length errors recorded for the port
294 #endif
295 
296 #if (LLDP_RX_MODE_SUPPORT == ENABLED)
297  LldpRxState rxState; ///<LLDP receive state
298  bool_t notificationEnable; ///<Enable or disable notifications
299  bool_t rcvFrame; ///<An LLDP frame has been recognized by the LLDP LSAP function
300  uint_t rxInfoAge; ///<The rxInfoTTL timing counter has expired
301  uint32_t statsFramesDiscardedTotal; ///<Count of all LLDPDUs received and then discarded
302  uint32_t statsFramesInErrorsTotal; ///<Count of all LLDPDUs received with one or more detectable errors
303  uint32_t statsFramesInTotal; ///<Count of all LLDP frames received
304  uint32_t statsTLVsDiscardedTotal; ///<Count of all TLVs received and then discarded for any reason
305  uint32_t statsTLVsUnrecognizedTotal; ///<Count of all TLVs received on the port that are not recognized
306  uint32_t statsAgeoutsTotal; ///<Count of the times that a neighbor's information has been aged out
307 #endif
308 };
309 
310 
311 /**
312  * @brief LLDP agent settings
313  **/
314 
315 typedef struct
316 {
317  OsTaskParameters task; ///<Task parameters
318  NetInterface *interface; ///<Underlying network interface
319  uint_t numPorts; ///<Number of ports
320  LldpPortEntry *ports; ///<Port table
321  uint_t numNeighbors; ///<Maximum number of entries in the neighbor table
322  LldpNeighborEntry *neighbors; ///<Neighbor table
323  LldpSendCallback sendCallback; ///<LLDP frame transmission callback function
324  LldpReceiveCallback receiveCallback; ///<LLDP frame reception callback function
325  LldpTickCallback tickCallback; ///<Tick callback function
327 
328 
329 /**
330  * @brief LLDP agent context
331  **/
332 
334 {
335  NetInterface *interface; ///<Underlying network interface
336  uint_t numPorts; ///<Number of ports
337  LldpPortEntry *ports; ///<Port table
338  uint_t numNeighbors; ///<Maximum number of entries in the neighbor table
339  LldpNeighborEntry *neighbors; ///<Neighbor table
340  LldpSendCallback sendCallback; ///<LLDP frame transmission callback function
341  LldpReceiveCallback receiveCallback; ///<LLDP frame reception callback function
342  LldpTickCallback tickCallback; ///<Tick callback function
343 
344  bool_t running; ///<This flag tells whether the LLDP agent is running or not
345  bool_t stop; ///<Stop request
346  OsMutex mutex; ///<Mutex preventing simultaneous access to LLDP agent context
347  OsEvent event; ///<Event object used to poll the underlying socket
348  OsTaskParameters taskParams; ///<Task parameters
349  OsTaskId taskId; ///<Task identifier
350  Socket *socket; ///<Underlying socket
351  systime_t timestamp; ///<Timestamp to manage timeout
352  LldpDataUnit lldpdu; ///<Incoming/outgoing LLDP data unit
353 
354 #if (LLDP_TX_MODE_SUPPORT == ENABLED)
355  LldpDataUnit txInfo; ///<Local system information
356  uint_t msgTxInterval; ///<Interval at which LLDP frames are transmitted
357  uint_t msgTxHold; ///<Transmit hold multiplier
358  uint_t reinitDelay; ///<Delay before re-initialization will be attempted
359  uint_t txDelay; ///<Delay between successive LLDP frame transmissions
360  uint32_t mgmtAddrMap; ///<Bit-map indicating the management addresses that are configured
361 #endif
362 
363 #if (LLDP_RX_MODE_SUPPORT == ENABLED)
364  uint32_t index; ///<Monotonically increasing index used to identify entries
365  uint_t notificationInterval; ///<Notification interval
366  uint_t tooManyNeighborsTimer; ///<Too many neighbors timer
367  bool_t badFrame; ///<Incoming failed validation and was discarded
368  bool_t rxChanges; ///<The incoming LLDPDU has been received with different TLV values
369  uint_t rxTTL; ///<The TTL extracted from the received LLDPDU
370  bool_t somethingChangedRemote; ///<Per-MSAP variable set after all the information has been updated
371  bool_t tooManyNeighbors; ///<Insufficient space to store information from all neighbors
377 #endif
378 
379  bool_t busy; ///<Busy flag
380 };
381 
382 
383 //LLDP agent related functions
385 
387  const LldpAgentSettings *settings);
388 
391 
392 error_t lldpSetPortAddr(LldpAgentContext *context, uint_t portIndex,
393  const MacAddr *macAddr);
394 
396  LldpAdminStatus adminStatus);
397 
399  uint8_t mask);
400 
402  uint32_t mask);
403 
404 error_t lldpSetMsgTxInterval(LldpAgentContext *context, uint_t msgTxInterval);
405 error_t lldpSetMsgTxHold(LldpAgentContext *context, uint_t msgTxHold);
406 error_t lldpSetReinitDelay(LldpAgentContext *context, uint_t reinitDelay);
407 error_t lldpSetTxDelay(LldpAgentContext *context, uint_t txDelay);
408 
410  LldpChassisIdSubtype chassisIdSubtype, const void *chassisId,
411  size_t chassisIdLen);
412 
414  LldpPortIdSubtype portIdSubtype, const void *portId, size_t portIdLen);
415 
417  const char_t *portDesc);
418 
419 error_t lldpSetLocalSysName(LldpAgentContext *context, const char_t *sysName);
420 error_t lldpSetLocalSysDesc(LldpAgentContext *context, const char_t *sysDesc);
421 
422 error_t lldpSetLocalSysCap(LldpAgentContext *context, uint16_t supportedCap,
423  uint16_t enabledCap);
424 
427  size_t mgmtAddrLen, LldpIfNumSubtype ifNumSubtype, uint32_t ifNum,
428  const uint8_t *oid, size_t oidLen);
429 
431 
432 void lldpTask(LldpAgentContext *context);
433 
434 void lldpDeinit(LldpAgentContext *context);
435 
436 //C++ guard
437 #ifdef __cplusplus
438 }
439 #endif
440 
441 #endif
LldpRxState rxState
LLDP receive state.
Definition: lldp.h:297
Socket * socket
Underlying socket.
Definition: lldp.h:350
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:364
error_t lldpSetReinitDelay(LldpAgentContext *context, uint_t reinitDelay)
Set re-initialization delay.
Definition: lldp.c:515
uint8_t portId[]
Definition: lldp_tlv.h:254
uint16_t enabledCap
Definition: lldp_tlv.h:275
bool_t rxChanges
The incoming LLDPDU has been received with different TLV values.
Definition: lldp.h:368
LldpTxState txState
LLDP transmit state.
Definition: lldp.h:286
uint8_t chassisId[]
Definition: lldp_tlv.h:243
OsTaskParameters task
Task parameters.
Definition: lldp.h:317
uint8_t data[LLDP_MAX_LLDPDU_SIZE]
Definition: lldp.h:236
LldpAdminStatus adminStatus
Indicates whether the local LLDP agent is enabled.
Definition: lldp.h:278
Event object.
error_t lldpSetLocalSysDesc(LldpAgentContext *context, const char_t *sysDesc)
Set system description.
Definition: lldp.c:954
@ LLDP_BASIC_TLV_FILTER_ALL
All Basic TLVs.
Definition: lldp.h:205
uint32_t statsRemTablesAgeouts
Definition: lldp.h:376
LldpTxState
LLDP transmit states.
Definition: lldp_tx_fsm.h:49
uint_t notificationInterval
Notification interval.
Definition: lldp.h:365
uint8_t type
Definition: coap_common.h:176
@ LLDP_BASIC_TLV_FILTER_SYS_DESC
System Description TLV.
Definition: lldp.h:203
systime_t timestamp
Timestamp to manage timeout.
Definition: lldp.h:351
NetInterface * interface
Underlying network interface.
Definition: lldp.h:318
LldpReceiveCallback receiveCallback
LLDP frame reception callback function.
Definition: lldp.h:324
uint8_t basicTlvFilter
Bit-map indicating the basic TLVs enabled for transmission.
Definition: lldp.h:284
LldpNeighborEntry * neighbors
Neighbor table.
Definition: lldp.h:322
error_t lldpSetMsgTxInterval(LldpAgentContext *context, uint_t msgTxInterval)
Set transmit interval.
Definition: lldp.c:450
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:344
LldpSendCallback sendCallback
LLDP frame transmission callback function.
Definition: lldp.h:323
uint8_t oid[]
Definition: lldp_tlv.h:300
NetInterface * interface
Underlying network interface.
Definition: lldp.h:335
#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:290
uint_t msgTxHold
Transmit hold multiplier.
Definition: lldp.h:357
uint_t numPorts
Number of ports.
Definition: lldp.h:319
bool_t notificationEnable
Enable or disable notifications.
Definition: lldp.h:298
LldpReceiveCallback receiveCallback
LLDP frame reception callback function.
Definition: lldp.h:341
uint32_t lldpduLengthErrors
The number of LLDPDU length errors recorded for the port.
Definition: lldp.h:293
error_t lldpSetAdminStatus(LldpAgentContext *context, uint_t portIndex, LldpAdminStatus adminStatus)
Set administrative status.
Definition: lldp.c:581
const uint8_t * portId
Port identifier.
Definition: lldp.h:250
uint8_t mgmtAddr[]
Definition: lldp_tlv.h:287
@ 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:838
error_t lldpSetLocalSysName(LldpAgentContext *context, const char_t *sysName)
Set system name.
Definition: lldp.c:900
error_t lldpStop(LldpAgentContext *context)
Stop LLDP agent.
Definition: lldp.c:361
uint32_t statsTLVsUnrecognizedTotal
Count of all TLVs received on the port that are not recognized.
Definition: lldp.h:305
LldpDataUnit txInfo
Local system information.
Definition: lldp.h:355
void(* LldpReceiveCallback)(LldpPortEntry *port, LldpDataUnit *lldpdu)
LLDP frame reception callback function.
Definition: lldp.h:220
uint32_t statsRemTablesDeletes
Definition: lldp.h:374
LldpDataUnit lldpdu
Incoming/outgoing LLDP data unit.
Definition: lldp.h:352
OsTaskId taskId
Task identifier.
Definition: lldp.h:349
uint32_t mgmtAddrMap
Bit-map indicating the management addresses that are configured.
Definition: lldp.h:360
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:1077
uint32_t statsRemTablesLastChangeTime
Definition: lldp.h:372
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:299
@ 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:336
uint_t reinitDelay
Delay before re-initialization will be attempted.
Definition: lldp.h:358
uint_t rxInfoTTL
Time remaining until the information is no longer valid.
Definition: lldp.h:264
uint32_t statsRemTablesInserts
Definition: lldp.h:373
uint_t numNeighbors
Maximum number of entries in the neighbor table.
Definition: lldp.h:338
LldpTickCallback tickCallback
Tick callback function.
Definition: lldp.h:325
OsTaskParameters taskParams
Task parameters.
Definition: lldp.h:348
#define NetInterface
Definition: net.h:36
LldpPortEntry * ports
Port table.
Definition: lldp.h:337
@ 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:291
error_t lldpSetTxDelay(LldpAgentContext *context, uint_t txDelay)
Set transmit delay.
Definition: lldp.c:547
uint32_t statsRemTablesDrops
Definition: lldp.h:375
#define LldpPortEntry
Definition: lldp.h:44
error_t lldpDeleteLocalTlv(LldpAgentContext *context, LldpTlvType type)
Remove all TLVs with specified type.
Definition: lldp.c:1216
@ 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
LldpPortEntry * ports
Port table.
Definition: lldp.h:320
uint_t txDelay
Delay between successive LLDP frame transmissions.
Definition: lldp.h:359
error_t lldpInit(LldpAgentContext *context, const LldpAgentSettings *settings)
LLDP agent initialization.
Definition: lldp.c:87
uint8_t mask
Definition: web_socket.h:319
OsEvent event
Event object used to poll the underlying socket.
Definition: lldp.h:347
LLDP transmit state machine.
Task parameters.
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:766
LldpAgentContext * context
LLDP agent context.
Definition: lldp.h:275
LLDP agent settings.
Definition: lldp.h:316
bool_t stop
Stop request.
Definition: lldp.h:345
MacAddr macAddr
MAC address of the port.
Definition: lldp.h:282
uint_t msgTxInterval
Interval at which LLDP frames are transmitted.
Definition: lldp.h:356
error_t lldpSetMgmtAddrFilter(LldpAgentContext *context, uint_t portIndex, uint32_t mask)
Set the list of management addresses enabled for transmission.
Definition: lldp.c:650
error_t lldpSetPortAddr(LldpAgentContext *context, uint_t portIndex, const MacAddr *macAddr)
Set port address.
Definition: lldp.c:407
MacAddr
Definition: ethernet.h:195
uint32_t mgmtAddrFilter
Bit-map indicating the management addresses enabled for transmission.
Definition: lldp.h:285
Mutex object.
uint32_t systime_t
System time.
uint16_t port
Definition: dns_common.h:267
@ 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:342
bool_t tooManyNeighbors
Insufficient space to store information from all neighbors.
Definition: lldp.h:371
char char_t
Definition: compiler_port.h:48
bool_t portEnabled
Operational state of the MAC service supporting the port.
Definition: lldp.h:279
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:698
void lldpTask(LldpAgentContext *context)
LLDP agent task.
Definition: lldp.c:1312
error_t lldpSetMsgTxHold(LldpAgentContext *context, uint_t msgTxHold)
Set transmit hold multiplier.
Definition: lldp.c:483
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:321
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:615
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:369
bool_t badFrame
Incoming failed validation and was discarded.
Definition: lldp.h:367
LldpSendCallback sendCallback
LLDP frame transmission callback function.
Definition: lldp.h:340
#define Socket
Definition: socket.h:36
bool_t somethingChangedRemote
Per-MSAP variable set after all the information has been updated.
Definition: lldp.h:370
uint32_t ifNum
Definition: lldp_tlv.h:298
bool_t busy
Busy flag.
Definition: lldp.h:379
uint8_t oidLen
Definition: lldp_tlv.h:299
LldpDataUnit txInfo
Local system information.
Definition: lldp.h:283
LldpChassisIdSubtype
Chassis ID subtypes.
Definition: lldp_tlv.h:111
uint_t txDelayWhile
Minimum delay between transmission of successive LLDP frames.
Definition: lldp.h:288
LldpAdminStatus
Administrative status.
Definition: lldp.h:187
uint8_t portIndex
Port index.
Definition: lldp.h:277
#define LldpAgentContext
Definition: lldp.h:40
LLDP agent context.
Definition: lldp.h:334
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:289
uint_t txShutdownWhile
Number of seconds remaining until LLDP re-initialization can occur.
Definition: lldp.h:287
thread_t * OsTaskId
Task identifier.
void lldpDeinit(LldpAgentContext *context)
Release LLDP agent context.
Definition: lldp.c:1396
uint_t rxInfoAge
The rxInfoTTL timing counter has expired.
Definition: lldp.h:300
LldpNeighborEntry * neighbors
Neighbor table.
Definition: lldp.h:339
uint8_t mgmtAddrSubtype
Definition: lldp_tlv.h:286
uint32_t statsTLVsDiscardedTotal
Count of all TLVs received and then discarded for any reason.
Definition: lldp.h:304
LLDP data unit.
Definition: lldp.h:235
OsMutex mutex
Mutex preventing simultaneous access to LLDP agent context.
Definition: lldp.h:346
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:302
uint32_t statsAgeoutsTotal
Count of the times that a neighbor's information has been aged out.
Definition: lldp.h:306
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
MSAP identifier.
Definition: lldp.h:247
uint32_t statsFramesInTotal
Count of all LLDP frames received.
Definition: lldp.h:303
@ LLDP_BASIC_TLV_FILTER_SYS_CAP
System Capabilities TLV.
Definition: lldp.h:204
uint_t tooManyNeighborsTimer
Too many neighbors timer.
Definition: lldp.h:366
uint32_t statsFramesDiscardedTotal
Count of all LLDPDUs received and then discarded.
Definition: lldp.h:301
error_t lldpSetLocalSysCap(LldpAgentContext *context, uint16_t supportedCap, uint16_t enabledCap)
Set system capabilities.
Definition: lldp.c:1009
error_t lldpStart(LldpAgentContext *context)
Start LLDP agent.
Definition: lldp.c:268
uint32_t statsFramesOutTotal
Count of all LLDP frames transmitted.
Definition: lldp.h:292
#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