13#ifndef ZEPHYR_INCLUDE_NET_LLDP_H_
14#define ZEPHYR_INCLUDE_NET_LLDP_H_
29#define LLDP_TLV_GET_LENGTH(type_length) (type_length & BIT_MASK(9))
30#define LLDP_TLV_GET_TYPE(type_length) ((uint8_t)(type_length >> 9))
35#define NET_LLDP_END_LLDPDU_VALUE 0x0000
44#if defined(CONFIG_NET_LLDP_CHASSIS_ID_SUBTYPE)
45#if (CONFIG_NET_LLDP_CHASSIS_ID_SUBTYPE == 4)
46#define NET_LLDP_CHASSIS_ID_VALUE \
48 CONFIG_NET_LLDP_CHASSIS_ID_MAC0, \
49 CONFIG_NET_LLDP_CHASSIS_ID_MAC1, \
50 CONFIG_NET_LLDP_CHASSIS_ID_MAC2, \
51 CONFIG_NET_LLDP_CHASSIS_ID_MAC3, \
52 CONFIG_NET_LLDP_CHASSIS_ID_MAC4, \
53 CONFIG_NET_LLDP_CHASSIS_ID_MAC5 \
56#define NET_LLDP_CHASSIS_ID_VALUE_LEN (6)
58#define NET_LLDP_CHASSIS_ID_VALUE CONFIG_NET_LLDP_CHASSIS_ID
59#define NET_LLDP_CHASSIS_ID_VALUE_LEN (sizeof(CONFIG_NET_LLDP_CHASSIS_ID) - 1)
62#define NET_LLDP_CHASSIS_ID_VALUE 0
63#define NET_LLDP_CHASSIS_ID_VALUE_LEN 0
73#if defined(CONFIG_NET_LLDP_PORT_ID_SUBTYPE)
74#if (CONFIG_NET_LLDP_PORT_ID_SUBTYPE == 3)
75#define NET_LLDP_PORT_ID_VALUE \
77 CONFIG_NET_LLDP_PORT_ID_MAC0, \
78 CONFIG_NET_LLDP_PORT_ID_MAC1, \
79 CONFIG_NET_LLDP_PORT_ID_MAC2, \
80 CONFIG_NET_LLDP_PORT_ID_MAC3, \
81 CONFIG_NET_LLDP_PORT_ID_MAC4, \
82 CONFIG_NET_LLDP_PORT_ID_MAC5 \
85#define NET_LLDP_PORT_ID_VALUE_LEN (6)
87#define NET_LLDP_PORT_ID_VALUE CONFIG_NET_LLDP_PORT_ID
88#define NET_LLDP_PORT_ID_VALUE_LEN (sizeof(CONFIG_NET_LLDP_PORT_ID) - 1)
91#define NET_LLDP_PORT_ID_VALUE 0
92#define NET_LLDP_PORT_ID_VALUE_LEN 0
99#define NET_LLDP_CHASSIS_ID_TLV_LEN (NET_LLDP_CHASSIS_ID_VALUE_LEN + 1)
100#define NET_LLDP_PORT_ID_TLV_LEN (NET_LLDP_PORT_ID_VALUE_LEN + 1)
101#define NET_LLDP_TTL_TLV_LEN (2)
110#if defined(CONFIG_NET_LLDP_TX_INTERVAL) && defined(CONFIG_NET_LLDP_TX_HOLD)
111#define NET_LLDP_TTL \
112 MIN((CONFIG_NET_LLDP_TX_INTERVAL * CONFIG_NET_LLDP_TX_HOLD) + 1, 65535)
243#if defined(CONFIG_NET_LLDP)
246#define net_lldp_set_lldpdu(iface)
254#if defined(CONFIG_NET_LLDP)
257#define net_lldp_unset_lldpdu(iface)
int net_lldp_config(struct net_if *iface, const struct net_lldpdu *lldpdu)
Set the LLDP data unit for a network interface.
enum net_verdict(* net_lldp_recv_cb_t)(struct net_if *iface, struct net_pkt *pkt)
LLDP Receive packet callback.
Definition: lldp.h:213
void net_lldp_init(void)
Initialize LLDP engine.
int net_lldp_register_callback(struct net_if *iface, net_lldp_recv_cb_t cb)
Register LLDP Rx callback function.
#define net_lldp_set_lldpdu(iface)
Set LLDP protocol data unit (LLDPDU) for the network interface.
Definition: lldp.h:246
int net_lldp_config_optional(struct net_if *iface, const uint8_t *tlv, size_t len)
Set the Optional LLDP TLVs for a network interface.
net_lldp_tlv_type
TLV Types.
Definition: lldp.h:121
#define net_lldp_unset_lldpdu(iface)
Unset LLDP protocol data unit (LLDPDU) for the network interface.
Definition: lldp.h:257
enum net_verdict net_lldp_recv(struct net_if *iface, struct net_pkt *pkt)
Parse LLDP packet.
@ LLDP_TLV_ORG_SPECIFIC
Org specific TLVs (optional)
Definition: lldp.h:132
@ LLDP_TLV_PORT_ID
Port ID (mandatory)
Definition: lldp.h:124
@ LLDP_TLV_END_LLDPDU
End Of LLDPDU (optional)
Definition: lldp.h:122
@ LLDP_TLV_PORT_DESC
Port Description (optional)
Definition: lldp.h:126
@ LLDP_TLV_SYSTEM_CAPABILITIES
System Capability (optional)
Definition: lldp.h:129
@ LLDP_TLV_MANAGEMENT_ADDR
Management Address (optional)
Definition: lldp.h:130
@ LLDP_TLV_SYSTEM_DESC
System Description (optional)
Definition: lldp.h:128
@ LLDP_TLV_SYSTEM_NAME
System Name (optional)
Definition: lldp.h:127
@ LLDP_TLV_CHASSIS_ID
Chassis ID (mandatory)
Definition: lldp.h:123
@ LLDP_TLV_TTL
Time To Live (mandatory)
Definition: lldp.h:125
net_verdict
Net Verdict.
Definition: net_core.h:100
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Network Interface structure.
Definition: net_if.h:675
Chassis ID TLV, see chapter 8.5.2 in IEEE 802.1AB.
Definition: lldp.h:136
uint8_t value[NET_LLDP_CHASSIS_ID_VALUE_LEN]
Chassis ID value.
Definition: lldp.h:142
uint8_t subtype
ID subtype.
Definition: lldp.h:140
uint16_t type_length
7 bits for type, 9 bits for length
Definition: lldp.h:138
Port ID TLV, see chapter 8.5.3 in IEEE 802.1AB.
Definition: lldp.h:146
uint8_t subtype
ID subtype.
Definition: lldp.h:150
uint16_t type_length
7 bits for type, 9 bits for length
Definition: lldp.h:148
uint8_t value[NET_LLDP_PORT_ID_VALUE_LEN]
Port ID value.
Definition: lldp.h:152
Time To Live TLV, see chapter 8.5.4 in IEEE 802.1AB.
Definition: lldp.h:156
uint16_t type_length
7 bits for type, 9 bits for length
Definition: lldp.h:158
uint16_t ttl
Time To Live (TTL) value.
Definition: lldp.h:160
LLDP Data Unit (LLDPDU) shall contain the following ordered TLVs as stated in "8.2 LLDPDU format" fro...
Definition: lldp.h:167
struct net_lldp_chassis_tlv chassis_id
Mandatory Chassis TLV.
Definition: lldp.h:168
struct net_lldp_port_tlv port_id
Mandatory Port TLV.
Definition: lldp.h:169
struct net_lldp_time_to_live_tlv ttl
Mandatory TTL TLV.
Definition: lldp.h:170
Network packet.
Definition: net_pkt.h:67
struct net_if * iface
Network interface.
Definition: net_pkt.h:90