lldp_mgmt.h
Go to the documentation of this file.
1 /**
2  * @file lldp_mgmt.h
3  * @brief Management of the LLDP agent
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_MGMT_H
32 #define _LLDP_MGMT_H
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "lldp/lldp.h"
37 
38 //C++ guard
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 //LLDP related functions
44 void lldpMgmtLock(LldpAgentContext *context);
45 void lldpMgmtUnlock(LldpAgentContext *context);
46 
48  uint_t msgTxInterval, bool_t commit);
49 
51  bool_t commit);
52 
54  bool_t commit);
55 
57  bool_t commit);
58 
60  uint_t notificationInterval, bool_t commit);
61 
63  uint_t portIndex, LldpAdminStatus adminStatus, bool_t commit);
64 
66  uint_t portIndex, bool_t notificationEnable, bool_t commit);
67 
69  uint8_t mask, bool_t commit);
70 
72  uint_t *msgTxInterval);
73 
77 
79  uint_t *notificationInterval);
80 
82  uint_t portIndex, LldpAdminStatus *adminStatus);
83 
85  uint_t portIndex, bool_t *notificationEnable);
86 
88  uint_t portIndex, uint8_t *mibBasicTlvsTxEnable);
89 
91  LldpChassisIdSubtype *chassisIdSubtype, const uint8_t **chassisId,
92  size_t *chassisIdLen);
93 
95  LldpPortIdSubtype *portIdSubtype, const uint8_t **portId,
96  size_t *portIdLen);
97 
99  const char_t **portDesc, size_t *portDescLen);
100 
102  const char_t **sysName, size_t *sysNameLen);
103 
105  const char_t **sysDesc, size_t *sysDescLen);
106 
108  uint16_t *supportedCap, uint16_t *enabledCap);
109 
111  uint8_t mgmtAddrSubtype, const uint8_t *mgmtAddr, size_t mgmtAddrLen);
112 
114  LldpMgmtAddrSubtype *mgmtAddrSubtype, const uint8_t **mgmtAddr,
115  size_t *mgmtAddrLen, LldpIfNumSubtype *ifNumSubtype, uint32_t *ifNum,
116  const uint8_t **oid, size_t *oidLen);
117 
119  uint32_t timeMark, uint_t portIndex, uint32_t index);
120 
122  LldpChassisIdSubtype *chassisIdSubtype, const uint8_t **chassisId,
123  size_t *chassisIdLen);
124 
126  LldpPortIdSubtype *portIdSubtype, const uint8_t **portId,
127  size_t *portIdLen);
128 
130  const char_t **portDesc, size_t *portDescLen);
131 
133  const char_t **sysName, size_t *sysNameLen);
134 
136  const char_t **sysDesc, size_t *sysDescLen);
137 
139  uint16_t *supportedCap, uint16_t *enabledCap);
140 
142  uint8_t mgmtAddrSubtype, const uint8_t *mgmtAddr, size_t mgmtAddrLen);
143 
145  LldpMgmtAddrSubtype *mgmtAddrSubtype, const uint8_t **mgmtAddr,
146  size_t *mgmtAddrLen, LldpIfNumSubtype *ifNumSubtype, uint32_t *ifNum,
147  const uint8_t **oid, size_t *oidLen);
148 
150  uint8_t type, uint_t index, const uint8_t **info, size_t *infoLen);
151 
153  uint32_t oui, uint8_t subtype, uint_t index, const uint8_t **info,
154  size_t *infoLen);
155 
157  uint_t portIndex, uint32_t *statsFramesOutTotal);
158 
160  uint_t portIndex, uint32_t *statsFramesDiscardedTotal);
161 
163  uint_t portIndex, uint32_t *statsFramesInErrorsTotal);
164 
166  uint_t portIndex, uint32_t *statsFramesInTotal);
167 
169  uint_t portIndex, uint32_t *statsTLVsDiscardedTotal);
170 
172  uint_t portIndex, uint32_t *statsTLVsUnrecognizedTotal);
173 
175  uint_t portIndex, uint32_t *statsAgeoutsTotal);
176 
178  uint32_t *statsRemTablesLastChangeTime);
179 
181  uint32_t *statsRemTablesInserts);
182 
184  uint32_t *statsRemTablesDeletes);
185 
187  uint32_t *statsRemTablesDrops);
188 
190  uint32_t *statsRemTablesAgeouts);
191 
192 //C++ guard
193 #ifdef __cplusplus
194 }
195 #endif
196 
197 #endif
error_t lldpMgmtSetNotificationInterval(LldpAgentContext *context, uint_t notificationInterval, bool_t commit)
Set notification interval.
Definition: lldp_mgmt.c:254
int bool_t
Definition: compiler_port.h:53
error_t lldpMgmtGetStatsRemTablesDeletes(LldpAgentContext *context, uint32_t *statsRemTablesDeletes)
Get the value of the statsRemTablesDeletes statistics counter.
Definition: lldp_mgmt.c:2044
error_t lldpMgmtGetTxDelay(LldpAgentContext *context, uint_t *txDelay)
Get transmit delay.
Definition: lldp_mgmt.c:525
uint8_t portId[]
Definition: lldp_tlv.h:254
uint16_t enabledCap
Definition: lldp_tlv.h:275
error_t lldpMgmtSetMsgTxInterval(LldpAgentContext *context, uint_t msgTxInterval, bool_t commit)
Set transmit interval.
Definition: lldp_mgmt.c:81
uint8_t chassisId[]
Definition: lldp_tlv.h:243
signed int int_t
Definition: compiler_port.h:49
void lldpMgmtLock(LldpAgentContext *context)
Acquire exclusive access to the LLDP agent context.
Definition: lldp_mgmt.c:51
error_t lldpMgmtGetRemoteMgmtAddr(LldpNeighborEntry *entry, uint_t index, LldpMgmtAddrSubtype *mgmtAddrSubtype, const uint8_t **mgmtAddr, size_t *mgmtAddrLen, LldpIfNumSubtype *ifNumSubtype, uint32_t *ifNum, const uint8_t **oid, size_t *oidLen)
Extract management address from remote systems MIB.
Definition: lldp_mgmt.c:1608
error_t lldpMgmtGetMibBasicTlvsTxEnable(LldpAgentContext *context, uint_t portIndex, uint8_t *mibBasicTlvsTxEnable)
Get the list of TLVs enabled for transmission.
Definition: lldp_mgmt.c:656
uint8_t type
Definition: coap_common.h:176
error_t lldpMgmtGetNotificationEnable(LldpAgentContext *context, uint_t portIndex, bool_t *notificationEnable)
Check whether notifications are enabled or disabled.
Definition: lldp_mgmt.c:618
error_t lldpMgmtGetStatsTLVsDiscardedTotal(LldpAgentContext *context, uint_t portIndex, uint32_t *statsTLVsDiscardedTotal)
Get the value of the statsTLVsDiscardedTotal statistics counter.
Definition: lldp_mgmt.c:1876
error_t lldpMgmtGetStatsRemTablesInserts(LldpAgentContext *context, uint32_t *statsRemTablesInserts)
Get the value of the statsRemTablesInserts statistics counter.
Definition: lldp_mgmt.c:2016
error_t lldpMgmtGetLocalChassisId(LldpAgentContext *context, LldpChassisIdSubtype *chassisIdSubtype, const uint8_t **chassisId, size_t *chassisIdLen)
Extract chassis ID from local system MIB.
Definition: lldp_mgmt.c:694
LldpPortIdSubtype
Port ID subtypes.
Definition: lldp_tlv.h:128
uint8_t oid[]
Definition: lldp_tlv.h:300
error_t lldpMgmtGetRemoteSysName(LldpNeighborEntry *entry, const char_t **sysName, size_t *sysNameLen)
Extract system name from remote systems MIB.
Definition: lldp_mgmt.c:1403
error_t lldpMgmtSetBasicTlvFilter(LldpAgentContext *context, uint_t portIndex, uint8_t mask, bool_t commit)
Set the list of TLVs enabled for transmission.
Definition: lldp_mgmt.c:399
error_t lldpMgmtGetLocalSysName(LldpAgentContext *context, const char_t **sysName, size_t *sysNameLen)
Extract system name from local system MIB.
Definition: lldp_mgmt.c:871
uint8_t mgmtAddr[]
Definition: lldp_tlv.h:287
LldpIfNumSubtype
Interface numbering subtypes.
Definition: lldp_tlv.h:175
error_t lldpMgmtGetRemoteChassisId(LldpNeighborEntry *entry, LldpChassisIdSubtype *chassisIdSubtype, const uint8_t **chassisId, size_t *chassisIdLen)
Extract chassis ID from remote systems MIB.
Definition: lldp_mgmt.c:1257
error_t lldpMgmtSetMsgTxHold(LldpAgentContext *context, uint_t msgTxHold, bool_t commit)
Set transmit hold multiplier.
Definition: lldp_mgmt.c:127
error_t
Error codes.
Definition: error.h:43
error_t lldpMgmtGetRemoteSysCap(LldpNeighborEntry *entry, uint16_t *supportedCap, uint16_t *enabledCap)
Extract system capabilities from remote systems MIB.
Definition: lldp_mgmt.c:1489
error_t lldpMgmtGetStatsFramesInErrorsTotal(LldpAgentContext *context, uint_t portIndex, uint32_t *statsFramesInErrorsTotal)
Get the value of the statsFramesInErrorsTotal statistics counter.
Definition: lldp_mgmt.c:1800
error_t lldpMgmtGetNotificationInterval(LldpAgentContext *context, uint_t *notificationInterval)
Get notification interval.
Definition: lldp_mgmt.c:551
error_t lldpMgmtGetStatsRemTablesDrops(LldpAgentContext *context, uint32_t *statsRemTablesDrops)
Get the value of the statsRemTablesDrops statistics counter.
Definition: lldp_mgmt.c:2073
error_t lldpMgmtGetReinitDelay(LldpAgentContext *context, uint_t *reinitDelay)
Get re-initialization delay.
Definition: lldp_mgmt.c:499
int_t lldpMgmtFindLocalMgmtAddr(LldpAgentContext *context, uint8_t mgmtAddrSubtype, const uint8_t *mgmtAddr, size_t mgmtAddrLen)
Search the local system MIB for a given management address.
Definition: lldp_mgmt.c:1023
error_t lldpMgmtGetStatsFramesDiscardedTotal(LldpAgentContext *context, uint_t portIndex, uint32_t *statsFramesDiscardedTotal)
Get the value of the statsFramesDiscardedTotal statistics counter.
Definition: lldp_mgmt.c:1762
error_t lldpMgmtGetRemoteOrgDefInfo(LldpNeighborEntry *entry, uint32_t oui, uint8_t subtype, uint_t index, const uint8_t **info, size_t *infoLen)
Extract organizationally defined TLV from remote systems MIB.
Definition: lldp_mgmt.c:1705
error_t lldpMgmtGetLocalMgmtAddr(LldpAgentContext *context, uint_t index, LldpMgmtAddrSubtype *mgmtAddrSubtype, const uint8_t **mgmtAddr, size_t *mgmtAddrLen, LldpIfNumSubtype *ifNumSubtype, uint32_t *ifNum, const uint8_t **oid, size_t *oidLen)
Extract management address from local system MIB.
Definition: lldp_mgmt.c:1116
uint8_t mask
Definition: web_socket.h:319
error_t lldpMgmtGetStatsFramesOutTotal(LldpAgentContext *context, uint_t portIndex, uint32_t *statsFramesOutTotal)
Get the value of the statsFramesOutTotal statistics counter.
Definition: lldp_mgmt.c:1724
error_t lldpMgmtGetRemotePortId(LldpNeighborEntry *entry, LldpPortIdSubtype *portIdSubtype, const uint8_t **portId, size_t *portIdLen)
Extract port ID from remote systems MIB.
Definition: lldp_mgmt.c:1309
error_t lldpMgmtGetStatsFramesInTotal(LldpAgentContext *context, uint_t portIndex, uint32_t *statsFramesInTotal)
Get the value of the statsFramesInTotal statistics counter.
Definition: lldp_mgmt.c:1838
error_t lldpMgmtGetAdminStatus(LldpAgentContext *context, uint_t portIndex, LldpAdminStatus *adminStatus)
Get administrative status.
Definition: lldp_mgmt.c:580
error_t lldpMgmtGetRemotePortDesc(LldpNeighborEntry *entry, const char_t **portDesc, size_t *portDescLen)
Extract port description from remote systems MIB.
Definition: lldp_mgmt.c:1360
error_t lldpMgmtGetStatsAgeoutsTotal(LldpAgentContext *context, uint_t portIndex, uint32_t *statsAgeoutsTotal)
Get the value of the statsAgeoutsTotal statistics counter.
Definition: lldp_mgmt.c:1951
uint8_t subtype
Definition: lldp_tlv.h:311
LLDP neighbor entry.
Definition: lldp.h:260
char char_t
Definition: compiler_port.h:48
error_t lldpMgmtSetReinitDelay(LldpAgentContext *context, uint_t reinitDelay, bool_t commit)
Set re-initialization delay.
Definition: lldp_mgmt.c:172
error_t lldpMgmtGetStatsTLVsUnrecognizedTotal(LldpAgentContext *context, uint_t portIndex, uint32_t *statsTLVsUnrecognizedTotal)
Get the value of the statsTLVsUnrecognizedTotal statistics counter.
Definition: lldp_mgmt.c:1914
error_t lldpMgmtGetLocalSysCap(LldpAgentContext *context, uint16_t *supportedCap, uint16_t *enabledCap)
Extract system capabilities from local system MIB.
Definition: lldp_mgmt.c:968
uint32_t ifNum
Definition: lldp_tlv.h:298
error_t lldpMgmtSetNotificationEnable(LldpAgentContext *context, uint_t portIndex, bool_t notificationEnable, bool_t commit)
Enable or disable notifications.
Definition: lldp_mgmt.c:355
uint8_t oidLen
Definition: lldp_tlv.h:299
LldpChassisIdSubtype
Chassis ID subtypes.
Definition: lldp_tlv.h:111
error_t lldpMgmtGetLocalPortDesc(LldpAgentContext *context, uint_t portIndex, const char_t **portDesc, size_t *portDescLen)
Extract port description from local system MIB.
Definition: lldp_mgmt.c:817
void lldpMgmtUnlock(LldpAgentContext *context)
Release exclusive access to the LLDP agent context.
Definition: lldp_mgmt.c:63
LldpAdminStatus
Administrative status.
Definition: lldp.h:187
#define LldpAgentContext
Definition: lldp.h:40
error_t lldpMgmtGetLocalSysDesc(LldpAgentContext *context, const char_t **sysDesc, size_t *sysDescLen)
Extract system description from local system MIB.
Definition: lldp_mgmt.c:919
error_t lldpMgmtGetStatsRemTablesLastChangeTime(LldpAgentContext *context, uint32_t *statsRemTablesLastChangeTime)
Get the value of the statsRemTablesLastChangeTime statistics counter.
Definition: lldp_mgmt.c:1988
error_t lldpMgmtGetRemoteUnknownTlv(LldpNeighborEntry *entry, uint8_t type, uint_t index, const uint8_t **info, size_t *infoLen)
Extract unknown TLV from remote systems MIB.
Definition: lldp_mgmt.c:1686
error_t lldpMgmtGetRemoteSysDesc(LldpNeighborEntry *entry, const char_t **sysDesc, size_t *sysDescLen)
Extract system description from remote systems MIB.
Definition: lldp_mgmt.c:1446
error_t lldpMgmtSetAdminStatus(LldpAgentContext *context, uint_t portIndex, LldpAdminStatus adminStatus, bool_t commit)
Set administrative status.
Definition: lldp_mgmt.c:297
LldpNeighborEntry * lldpMgmtFindRemoteTableEntry(LldpAgentContext *context, uint32_t timeMark, uint_t portIndex, uint32_t index)
Search the remote systems MIB for a given entry.
Definition: lldp_mgmt.c:1218
uint8_t mgmtAddrSubtype
Definition: lldp_tlv.h:286
LLDP (Link Layer Discovery Protocol)
LldpMgmtAddrSubtype
Management address subtypes.
Definition: lldp_tlv.h:162
error_t lldpMgmtGetStatsRemTablesAgeouts(LldpAgentContext *context, uint32_t *statsRemTablesAgeouts)
Get the value of the statsRemTablesAgeouts statistics counter.
Definition: lldp_mgmt.c:2102
unsigned int uint_t
Definition: compiler_port.h:50
TCP/IP stack core.
error_t lldpMgmtSetTxDelay(LldpAgentContext *context, uint_t txDelay, bool_t commit)
Set transmit delay.
Definition: lldp_mgmt.c:213
error_t lldpMgmtGetLocalPortId(LldpAgentContext *context, uint_t portIndex, LldpPortIdSubtype *portIdSubtype, const uint8_t **portId, size_t *portIdLen)
Extract port ID from local system MIB.
Definition: lldp_mgmt.c:752
error_t lldpMgmtGetMsgTxInterval(LldpAgentContext *context, uint_t *msgTxInterval)
Get transmit interval.
Definition: lldp_mgmt.c:445
error_t lldpMgmtGetMsgTxHold(LldpAgentContext *context, uint_t *msgTxHold)
Get transmit hold multiplier.
Definition: lldp_mgmt.c:473
int_t lldpMgmtFindRemoteMgmtAddr(LldpNeighborEntry *entry, uint8_t mgmtAddrSubtype, const uint8_t *mgmtAddr, size_t mgmtAddrLen)
Search the remote system MIB for a given management address.
Definition: lldp_mgmt.c:1539