AM243x MCU+ SDK  09.00.00
ieee802-dot1ab-lldp_access.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 Texas Instruments Incorporated
3  * Copyright (c) 2023 Excelfore Corporation (https://excelfore.com)
4  *
5  * All rights reserved not granted herein.
6  * Limited License.
7  *
8  * Texas Instruments Incorporated grants a world-wide, royalty-free,
9  * non-exclusive license under copyrights and patents it now or hereafter
10  * owns or controls to make, have made, use, import, offer to sell and sell ("Utilize")
11  * this software subject to the terms herein. With respect to the foregoing patent
12  * license, such license is granted solely to the extent that any such patent is necessary
13  * to Utilize the software alone. The patent license shall not apply to any combinations which
14  * include this software, other than combinations with devices manufactured by or for TI ("TI Devices").
15  * No hardware patent is licensed hereunder.
16  *
17  * Redistributions must preserve existing copyright notices and reproduce this license (including the
18  * above copyright notice and the disclaimer and (if applicable) source code license limitations below)
19  * in the documentation and/or other materials provided with the distribution
20  *
21  * Redistribution and use in binary form, without modification, are permitted provided that the following
22  * conditions are met:
23  *
24  * * No reverse engineering, decompilation, or disassembly of this software is permitted with respect to any
25  * software provided in binary form.
26  * * any redistribution and use are licensed by TI for use only with TI Devices.
27  * * Nothing shall obligate TI to provide you with source code for the software licensed and provided to you in object code.
28  *
29  * If software source code is provided to you, modification and redistribution of the source code are permitted
30  * provided that the following conditions are met:
31  *
32  * * any redistribution and use of the source code, including any resulting derivative works, are licensed by
33  * TI for use only with TI Devices.
34  * * any redistribution and use of any object code compiled from the source code and any resulting derivative
35  * works, are licensed by TI for use only with TI Devices.
36  *
37  * Neither the name of Texas Instruments Incorporated nor the names of its suppliers may be used to endorse or
38  * promote products derived from this software without specific prior written permission.
39  *
40  * DISCLAIMER.
41  *
42  * THIS SOFTWARE IS PROVIDED BY TI AND TI"S LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
43  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
44  * IN NO EVENT SHALL TI AND TI"S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
45  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
46  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
47  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
48  * POSSIBILITY OF SUCH DAMAGE.
49 */
50 #ifndef IEEE802_DOT1AB_LLDP_ACCESS_H_
51 #define IEEE802_DOT1AB_LLDP_ACCESS_H_
52 #include "yang_db_access.h"
53 
54 #define LLDP_MAX_LOCAL_INTERFACES (8)
55 #define LLDP_STRING_MAX_LEN (256)
56 
59 typedef enum
60 {
67  C_LOCAL
69 
73 typedef enum
74 {
81  P_LOCAL
83 
87 typedef uint32_t timestamp_t;
88 typedef struct
89 {
91  uint32_t remote_inserts;
92  uint32_t remote_deletes;
93  uint32_t remote_drops;
94  uint32_t remote_ageouts;
96 
100 typedef struct
101 {
103  char chassis_id[LLDP_STRING_MAX_LEN];
104  char system_name[LLDP_STRING_MAX_LEN];
105  char system_description[LLDP_STRING_MAX_LEN];
109 
110 
114 typedef enum
115 {
117  sys_name = 1,
119  sys_cap
121 
125 typedef enum
126 {
127  ipv4 = 1,
129  nsap
131 
135 typedef enum
136 {
137  unknown = 1,
138  port_ref = 2,
141 
145 #define MAX_ADDRESS_LEN (64) // pattern: [0-9A-F]{2}([0-9A-F]{2}){0,30} <= max len = 2 + 31 *2 = 64
146 #define MAX_PORT_MANAGEMENT_ADDRESS (4)
147 typedef struct
148 {
150  char man_address[MAX_ADDRESS_LEN];
151  bool tx_enable;
152  uint32_t addr_len;
154  uint32_t if_id;
156 
157 
161 typedef enum
162 {
163  tx_only = 1,
166  disabled
168 
172 typedef struct
173 {
174  uint32_t total_frames;
177 
181 typedef struct
182 {
183  uint32_t total_ageouts;
185  uint32_t error_frames;
186  uint32_t total_frames;
190 
194 typedef struct
195 {
197  char address[MAX_ADDRESS_LEN];
199  uint32_t if_id;
201 
202 #define MAX_UNKNOW_TLV_LEN (8)
203 #define MAX_TLV_INFO_LEN (512)
204 
207 typedef struct
208 {
209  uint32_t tlv_type;
210  uint8_t tlv_info[MAX_TLV_INFO_LEN];
212 
213 #define MAX_REMOTE_ORG_DEFINE_LEN (8)
214 #define MAX_REMOTE_INFO_LEN (508)
215 
218 typedef struct
219 {
220  uint32_t info_identifier;
221  uint32_t info_subtype;
222  uint32_t info_index;
223  uint8_t remote_info[MAX_REMOTE_INFO_LEN];
225 
226 typedef uint32_t timeticks;
227 #define MAX_REMOTE_SYSTEM_DATA_LEN (8)
228 
231 typedef struct
232 {
234  uint32_t remote_index;
238  char chassis_id[LLDP_STRING_MAX_LEN];
240  char port_id[LLDP_STRING_MAX_LEN];
242  char system_name[LLDP_STRING_MAX_LEN];
243  char system_description[LLDP_STRING_MAX_LEN];
250 
255 #define PORT_MAX_NAME_LEN (16)
256 typedef struct
257 {
258  char name[PORT_MAX_NAME_LEN];
262  uint8_t tlvs_tx_enable;
263  uint32_t message_fast_tx;
266  uint32_t reinit_delay;
267  uint32_t tx_credit_max;
268  uint32_t tx_fast_init;
272  char port_id[LLDP_STRING_MAX_LEN];
277 } lldp_port_t;
278 
283 typedef struct
284 {
285  uint32_t message_fast_tx;
288  uint32_t reinit_delay;
289  uint32_t tx_credit_max;
290  uint32_t tx_fast_init;
295 } yang_lldp_t;
296 
297 int ydbi_get_item_abk1vk0(yang_db_item_access_t *ydbia, void **rval, uint8_t k1, bool status);
298 
299 int ydbi_get_item_abk2vk0(yang_db_item_access_t *ydbia, void **rval, uint8_t k1, uint8_t k2, bool status);
300 
301 int ydbi_load_lldp_db(yang_db_item_access_t *ydbia, yang_lldp_t* lldp);
302 
303 #endif /* IEEE802_DOT1AB_LLDP_ACCESS_H_ */
remote_statistic_t::last_change_time
timestamp_t last_change_time
Definition: ieee802-dot1ab-lldp_access.h:90
local_system_data_t::system_capabilities_enabled
uint16_t system_capabilities_enabled
Definition: ieee802-dot1ab-lldp_access.h:107
lldp_port_t::port_id_subtype
port_id_type_t port_id_subtype
Definition: ieee802-dot1ab-lldp_access.h:271
tx_statistic_t
tx statistic base on 1 port
Definition: ieee802-dot1ab-lldp_access.h:173
chassis_id_type_t
chassis_id_type_t
yang_lldp ieee:chassis_id_subtype_type
Definition: ieee802-dot1ab-lldp_access.h:60
LLDP_STRING_MAX_LEN
#define LLDP_STRING_MAX_LEN
Definition: ieee802-dot1ab-lldp_access.h:55
local_system_data_t
yang_lldp local_system_data
Definition: ieee802-dot1ab-lldp_access.h:101
rx_statistic_t::total_discarded_tlvs
uint32_t total_discarded_tlvs
Definition: ieee802-dot1ab-lldp_access.h:187
P_LOCAL
@ P_LOCAL
Definition: ieee802-dot1ab-lldp_access.h:81
remote_systems_data_t::system_capabilities_enabled
uint16_t system_capabilities_enabled
Definition: ieee802-dot1ab-lldp_access.h:245
lldp_port_t::reinit_delay
uint32_t reinit_delay
Definition: ieee802-dot1ab-lldp_access.h:266
LLDP_MAX_LOCAL_INTERFACES
#define LLDP_MAX_LOCAL_INTERFACES
Definition: ieee802-dot1ab-lldp_access.h:54
address_subtype_t
address_subtype_t
Address subtype.
Definition: ieee802-dot1ab-lldp_access.h:126
sys_cap
@ sys_cap
Definition: ieee802-dot1ab-lldp_access.h:119
MAX_ADDRESS_LEN
#define MAX_ADDRESS_LEN
Local manament address of a port. 1 port can have IPV4, IPV6, ...
Definition: ieee802-dot1ab-lldp_access.h:145
yang_lldp_t::notification_interval
uint32_t notification_interval
Definition: ieee802-dot1ab-lldp_access.h:291
tx_only
@ tx_only
Definition: ieee802-dot1ab-lldp_access.h:163
management_address_tx_port_t::address_subtype
address_subtype_t address_subtype
address_subtype:ipv4, ipv6
Definition: ieee802-dot1ab-lldp_access.h:149
lldp_port_t::tx_credit_max
uint32_t tx_credit_max
Definition: ieee802-dot1ab-lldp_access.h:267
admin_status_t
admin_status_t
We can enable/disable tx/rx of one interface.
Definition: ieee802-dot1ab-lldp_access.h:162
MAX_PORT_MANAGEMENT_ADDRESS
#define MAX_PORT_MANAGEMENT_ADDRESS
Definition: ieee802-dot1ab-lldp_access.h:146
P_INTERFACE_ALIAS
@ P_INTERFACE_ALIAS
Definition: ieee802-dot1ab-lldp_access.h:75
MAX_REMOTE_SYSTEM_DATA_LEN
#define MAX_REMOTE_SYSTEM_DATA_LEN
Definition: ieee802-dot1ab-lldp_access.h:227
rx_statistic_t
rx statistic base on 1 port
Definition: ieee802-dot1ab-lldp_access.h:182
yang_lldp_t::local_system_data
local_system_data_t local_system_data
Definition: ieee802-dot1ab-lldp_access.h:293
lldp_port_t::notification_interval
uint32_t notification_interval
Definition: ieee802-dot1ab-lldp_access.h:269
yang_lldp_t::tx_fast_init
uint32_t tx_fast_init
Definition: ieee802-dot1ab-lldp_access.h:290
rx_statistic_t::error_frames
uint32_t error_frames
Definition: ieee802-dot1ab-lldp_access.h:185
sys_desc
@ sys_desc
Definition: ieee802-dot1ab-lldp_access.h:118
port_id_type_t
port_id_type_t
yang_lldp ieee:port_id_subtype_type
Definition: ieee802-dot1ab-lldp_access.h:74
system_port_number
@ system_port_number
Definition: ieee802-dot1ab-lldp_access.h:139
tx_and_rx
@ tx_and_rx
Definition: ieee802-dot1ab-lldp_access.h:165
management_address_t::address_subtype
address_subtype_t address_subtype
address_subtype:ipv4, ipv6
Definition: ieee802-dot1ab-lldp_access.h:196
yang_lldp_t::tx_credit_max
uint32_t tx_credit_max
Definition: ieee802-dot1ab-lldp_access.h:289
C_INTERFACE_NAME
@ C_INTERFACE_NAME
Definition: ieee802-dot1ab-lldp_access.h:66
rx_statistic_t::total_discarded_frames
uint32_t total_discarded_frames
Definition: ieee802-dot1ab-lldp_access.h:184
remote_statistic_t::remote_ageouts
uint32_t remote_ageouts
Definition: ieee802-dot1ab-lldp_access.h:94
remote_systems_data_t::remote_index
uint32_t remote_index
Definition: ieee802-dot1ab-lldp_access.h:234
ipv4
@ ipv4
Definition: ieee802-dot1ab-lldp_access.h:127
management_address_t
Remote management address info needed.
Definition: ieee802-dot1ab-lldp_access.h:195
tx_statistic_t::total_length_errors
uint32_t total_length_errors
Definition: ieee802-dot1ab-lldp_access.h:175
disabled
@ disabled
Definition: ieee802-dot1ab-lldp_access.h:166
C_PORT_COMPONENT
@ C_PORT_COMPONENT
Definition: ieee802-dot1ab-lldp_access.h:63
lldp_port_t
Definition: ieee802-dot1ab-lldp_access.h:257
rx_statistic_t::total_unrecognized_tlvs
uint32_t total_unrecognized_tlvs
Definition: ieee802-dot1ab-lldp_access.h:188
remote_statistic_t
Definition: ieee802-dot1ab-lldp_access.h:89
remote_org_defined_info_t
Remote organization defined info.
Definition: ieee802-dot1ab-lldp_access.h:219
port_desc
@ port_desc
Definition: ieee802-dot1ab-lldp_access.h:116
yang_lldp_t
yang_lldp_t corresponding to yangdb but in mem At the init time of lldp, lldpd should load db in to t...
Definition: ieee802-dot1ab-lldp_access.h:284
remote_systems_data_t::remote_too_many_neighbors
bool remote_too_many_neighbors
Definition: ieee802-dot1ab-lldp_access.h:235
local_system_data_t::system_capabilities_supported
uint16_t system_capabilities_supported
Definition: ieee802-dot1ab-lldp_access.h:106
C_NETWORK_ADDRESS
@ C_NETWORK_ADDRESS
Definition: ieee802-dot1ab-lldp_access.h:65
ydbi_load_lldp_db
int ydbi_load_lldp_db(yang_db_item_access_t *ydbia, yang_lldp_t *lldp)
management_address_tx_port_t::tx_enable
bool tx_enable
Definition: ieee802-dot1ab-lldp_access.h:151
P_AGENT_CIRCUIT_ID
@ P_AGENT_CIRCUIT_ID
Definition: ieee802-dot1ab-lldp_access.h:80
P_NETWORK_ADDRESS
@ P_NETWORK_ADDRESS
Definition: ieee802-dot1ab-lldp_access.h:78
P_MAC_ADDRESS
@ P_MAC_ADDRESS
Definition: ieee802-dot1ab-lldp_access.h:77
remote_unknown_tlv_t
Unknown tlv info (the tlv type is not listed in spec)
Definition: ieee802-dot1ab-lldp_access.h:208
lldp_port_t::dest_mac_address
ub_macaddr_t dest_mac_address
Definition: ieee802-dot1ab-lldp_access.h:259
tx_statistic_t::total_frames
uint32_t total_frames
Definition: ieee802-dot1ab-lldp_access.h:174
port_ref
@ port_ref
Definition: ieee802-dot1ab-lldp_access.h:138
ipv6
@ ipv6
Definition: ieee802-dot1ab-lldp_access.h:128
rx_statistic_t::total_ageouts
uint32_t total_ageouts
Definition: ieee802-dot1ab-lldp_access.h:183
sys_name
@ sys_name
Definition: ieee802-dot1ab-lldp_access.h:117
remote_org_defined_info_t::info_subtype
uint32_t info_subtype
Definition: ieee802-dot1ab-lldp_access.h:221
remote_statistic_t::remote_drops
uint32_t remote_drops
Definition: ieee802-dot1ab-lldp_access.h:93
remote_org_defined_info_t::info_index
uint32_t info_index
Definition: ieee802-dot1ab-lldp_access.h:222
C_LOCAL
@ C_LOCAL
Definition: ieee802-dot1ab-lldp_access.h:67
ydbi_get_item_abk2vk0
int ydbi_get_item_abk2vk0(yang_db_item_access_t *ydbia, void **rval, uint8_t k1, uint8_t k2, bool status)
remote_systems_data_t::system_capabilities_supported
uint16_t system_capabilities_supported
Definition: ieee802-dot1ab-lldp_access.h:244
yang_lldp_t::message_tx_hold_multiplier
uint32_t message_tx_hold_multiplier
Definition: ieee802-dot1ab-lldp_access.h:286
MAX_UNKNOW_TLV_LEN
#define MAX_UNKNOW_TLV_LEN
Definition: ieee802-dot1ab-lldp_access.h:202
rx_statistic_t::total_frames
uint32_t total_frames
Definition: ieee802-dot1ab-lldp_access.h:186
management_address_tx_port_t::if_id
uint32_t if_id
Definition: ieee802-dot1ab-lldp_access.h:154
MAX_REMOTE_ORG_DEFINE_LEN
#define MAX_REMOTE_ORG_DEFINE_LEN
Definition: ieee802-dot1ab-lldp_access.h:213
remote_systems_data_t::time_mark
timeticks time_mark
Definition: ieee802-dot1ab-lldp_access.h:233
lldp_port_t::tx_statistic
tx_statistic_t tx_statistic
Definition: ieee802-dot1ab-lldp_access.h:274
lldp_port_t::tlvs_tx_enable
uint8_t tlvs_tx_enable
mask with tlvs_tx_enable_bits_t
Definition: ieee802-dot1ab-lldp_access.h:262
lldp_port_t::message_fast_tx
uint32_t message_fast_tx
Definition: ieee802-dot1ab-lldp_access.h:263
ub_macaddr_t
ub_bytearray6_t ub_macaddr_t
6-byte binary array is used for MAC Address
Definition: ub_strutils.h:71
C_CHASSIS_COMPONENT
@ C_CHASSIS_COMPONENT
Definition: ieee802-dot1ab-lldp_access.h:61
lldp_port_t::admin_status
admin_status_t admin_status
Definition: ieee802-dot1ab-lldp_access.h:260
lldp_port_t::tx_fast_init
uint32_t tx_fast_init
Definition: ieee802-dot1ab-lldp_access.h:268
lldp_port_t::rx_statistic
rx_statistic_t rx_statistic
Definition: ieee802-dot1ab-lldp_access.h:275
local_system_data_t::chassis_id_subtype
chassis_id_type_t chassis_id_subtype
Definition: ieee802-dot1ab-lldp_access.h:102
management_address_tx_port_t::addr_len
uint32_t addr_len
Definition: ieee802-dot1ab-lldp_access.h:152
remote_systems_data_t::chassis_id_subtype
chassis_id_type_t chassis_id_subtype
Definition: ieee802-dot1ab-lldp_access.h:237
P_INTERFACE_NAME
@ P_INTERFACE_NAME
Definition: ieee802-dot1ab-lldp_access.h:79
nsap
@ nsap
Definition: ieee802-dot1ab-lldp_access.h:129
remote_org_defined_info_t::info_identifier
uint32_t info_identifier
Definition: ieee802-dot1ab-lldp_access.h:220
rx_only
@ rx_only
Definition: ieee802-dot1ab-lldp_access.h:164
remote_systems_data_t::remote_changes
bool remote_changes
Definition: ieee802-dot1ab-lldp_access.h:236
remote_statistic_t::remote_deletes
uint32_t remote_deletes
Definition: ieee802-dot1ab-lldp_access.h:92
remote_unknown_tlv_t::tlv_type
uint32_t tlv_type
Definition: ieee802-dot1ab-lldp_access.h:209
man_addr_if_subtype_t
man_addr_if_subtype_t
If subtype.
Definition: ieee802-dot1ab-lldp_access.h:136
tlvs_tx_enable_bits_t
tlvs_tx_enable_bits_t
TX enable bit position. Once the position is set to 1, lldpd will send the corresponding tlv info.
Definition: ieee802-dot1ab-lldp_access.h:115
yang_lldp_t::remote_statistic
remote_statistic_t remote_statistic
Definition: ieee802-dot1ab-lldp_access.h:292
management_address_t::if_id
uint32_t if_id
Definition: ieee802-dot1ab-lldp_access.h:199
lldp_port_t::message_tx_hold_multiplier
uint32_t message_tx_hold_multiplier
Definition: ieee802-dot1ab-lldp_access.h:264
MAX_TLV_INFO_LEN
#define MAX_TLV_INFO_LEN
Definition: ieee802-dot1ab-lldp_access.h:203
ydbi_get_item_abk1vk0
int ydbi_get_item_abk1vk0(yang_db_item_access_t *ydbia, void **rval, uint8_t k1, bool status)
unknown
@ unknown
Definition: ieee802-dot1ab-lldp_access.h:137
timeticks
uint32_t timeticks
Definition: ieee802-dot1ab-lldp_access.h:226
management_address_t::if_subtype
man_addr_if_subtype_t if_subtype
Definition: ieee802-dot1ab-lldp_access.h:198
C_INTERFACE_ALIAS
@ C_INTERFACE_ALIAS
Definition: ieee802-dot1ab-lldp_access.h:62
MAX_REMOTE_INFO_LEN
#define MAX_REMOTE_INFO_LEN
Definition: ieee802-dot1ab-lldp_access.h:214
P_PORT_COMPONENT
@ P_PORT_COMPONENT
Definition: ieee802-dot1ab-lldp_access.h:76
lldp_port_t::message_tx_interval
uint32_t message_tx_interval
Definition: ieee802-dot1ab-lldp_access.h:265
yang_lldp_t::message_fast_tx
uint32_t message_fast_tx
Definition: ieee802-dot1ab-lldp_access.h:285
lldp_port_t::notification_enable
bool notification_enable
Definition: ieee802-dot1ab-lldp_access.h:261
remote_statistic_t::remote_inserts
uint32_t remote_inserts
Definition: ieee802-dot1ab-lldp_access.h:91
timestamp_t
uint32_t timestamp_t
yang_lldp remote_statistics
Definition: ieee802-dot1ab-lldp_access.h:87
yang_lldp_t::reinit_delay
uint32_t reinit_delay
Definition: ieee802-dot1ab-lldp_access.h:288
PORT_MAX_NAME_LEN
#define PORT_MAX_NAME_LEN
Represent an interface with interface name and MAC address as keys 1 lldpd system consists of multipl...
Definition: ieee802-dot1ab-lldp_access.h:255
yang_lldp_t::message_tx_interval
uint32_t message_tx_interval
Definition: ieee802-dot1ab-lldp_access.h:287
remote_systems_data_t::port_id_subtype
port_id_type_t port_id_subtype
Definition: ieee802-dot1ab-lldp_access.h:239
management_address_tx_port_t::if_subtype
man_addr_if_subtype_t if_subtype
Definition: ieee802-dot1ab-lldp_access.h:153
remote_systems_data_t
Remote system data per port.
Definition: ieee802-dot1ab-lldp_access.h:232
C_MAC_ADDRESS
@ C_MAC_ADDRESS
Definition: ieee802-dot1ab-lldp_access.h:64
management_address_tx_port_t
Definition: ieee802-dot1ab-lldp_access.h:148