23 u32 if_index,
u8 oid_len,
u8 * oid)
25 lldp_tlv_t *t = (lldp_tlv_t *) * t0p;
28 t->v[0] = addr_len + 1;
31 t->v[addr_len + 2] = 2;
32 t->v[addr_len + 3] = (if_index >> 24) & 0xFF;
33 t->v[addr_len + 4] = (if_index >> 16) & 0xFF;
34 t->v[addr_len + 5] = (if_index >> 8) & 0xFF;
35 t->v[addr_len + 6] = (if_index >> 0) & 0xFF;
36 t->v[addr_len + 7] = oid_len;
42 *t0p +=
STRUCT_SIZE_OF (lldp_tlv_t, head) + addr_len + oid_len + 8;
48 lldp_chassis_id_tlv_t *t = (lldp_chassis_id_tlv_t *) * t0p;
53 const size_t addr_len = 6;
64 lldp_port_id_tlv_t *t = (lldp_port_id_tlv_t *) * t0p;
79 lldp_ttl_tlv_t *t = (lldp_ttl_tlv_t *) * t0p;
89 t->ttl = htons ((1 << 16) - 1);
107 lldp_tlv_t *t = (lldp_tlv_t *) * t0p;
121 lldp_tlv_t *t = (lldp_tlv_t *) * t0p;
136 if (!(len_ip4 | len_ip6))
176 lldp_tlv_t *t = (lldp_tlv_t *) * t0p;
226 u8 *
data = ((
u8 *) h0) +
sizeof (*h0);
290 h.
type = htons (ETHERNET_TYPE_802_1_LLDP);
#define LLDP_CHASS_ID_SUBTYPE_NAME(t)
#define hash_unset(h, key)
#define clib_memcpy_fast(a, b, c)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static f64 vlib_time_now(vlib_main_t *vm)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
u16 current_length
Nbytes between current data and the end of this buffer.
static void lldp_add_mgmt_addr(const lldp_intf_t *n, const vnet_hw_interface_t *hw, u8 **t0p)
void * vlib_packet_template_get_packet(vlib_main_t *vm, vlib_packet_template_t *t, u32 *bi_result)
#define VLIB_INIT_FUNCTION(x)
static void lldp_add_ttl(const lldp_main_t *lm, u8 **t0p, int shutdown)
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
void lldp_send_ethernet(lldp_main_t *lm, lldp_intf_t *n, int shutdown)
static void lldp_add_sys_name(const lldp_main_t *lm, u8 **t0p)
void vlib_packet_template_init(vlib_main_t *vm, vlib_packet_template_t *t, void *packet_data, uword n_packet_data_bytes, uword min_n_buffers_each_alloc, char *fmt,...)
uword * intf_by_hw_if_index
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
#define pool_put(P, E)
Free an object E in pool P.
static void lldp_add_chassis_id(const vnet_hw_interface_t *hw, u8 **t0p)
#define LLDP_PORT_ID_SUBTYPE_NAME(t)
void lldp_delete_intf(lldp_main_t *lm, lldp_intf_t *n)
static void lldp_add_tlvs(lldp_main_t *lm, vnet_hw_interface_t *hw, u8 **t0p, int shutdown, lldp_intf_t *n)
#define vec_free(V)
Free vector's memory (no header).
static void lldp_build_mgmt_addr_tlv(u8 **t0p, u8 subtype, u8 addr_len, u8 *addr, u32 if_index, u8 oid_len, u8 *oid)
static void lldp_add_port_desc(const lldp_main_t *lm, lldp_intf_t *n, u8 **t0p)
static void lldp_add_pdu_end(u8 **t0p)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vl_api_mac_address_t mac_addr
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
void lldp_unschedule_intf(lldp_main_t *lm, lldp_intf_t *n)
LLDP global declarations.
#define STRUCT_SIZE_OF(t, f)
vlib_packet_template_t packet_template
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static clib_error_t * lldp_template_init(vlib_main_t *vm)
static void lldp_add_port_id(const vnet_hw_interface_t *hw, u8 **t0p)