55 s =
format (s,
"0x%04x", p);
64 u32 max_header_bytes = va_arg (*args,
u32);
66 uword indent, header_bytes;
68 header_bytes =
sizeof (h[0]);
69 if (max_header_bytes != 0 && header_bytes > max_header_bytes)
70 return format (s,
"hdlc header truncated");
81 if (max_header_bytes != 0 && header_bytes > max_header_bytes)
89 max_header_bytes - header_bytes);
106 u16 * result = va_arg (*args,
u16 *);
136 u16 * result = va_arg (*args,
u16 *);
139 *result = clib_host_to_net_u16 ((
u16) *result);
146 u8 ** result = va_arg (*args,
u8 **);
156 h->
protocol = clib_host_to_net_u16 (p);
161 u32 n_bytes =
sizeof (h[0]);
175 uword max_rewrite_bytes)
180 if (max_rewrite_bytes <
sizeof (h[0]))
184 #define _(a,b) case VNET_L3_PACKET_TYPE_##a: protocol = HDLC_PROTOCOL_##b; break 187 _ (MPLS_UNICAST, mpls_unicast);
188 _ (MPLS_MULTICAST, mpls_multicast);
196 h->
protocol = clib_host_to_net_u16 (protocol);
198 return sizeof (h[0]);
210 char * protocol_name)
218 pi->
name = protocol_name;
230 memset (pm, 0,
sizeof (pm[0]));
236 #define _(n,s) add_protocol (pm, HDLC_PROTOCOL_##s, #s); vnet_hw_interface_class_t hdlc_hw_interface_class
#define hash_set(h, key, value)
sll srl srl sll sra u16x4 i
u8 * format_hdlc_protocol(u8 *s, va_list *args)
always_inline vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define hash_set_mem(h, key, value)
u8 * format_hdlc_header(u8 *s, va_list *args)
uword unformat_hdlc_protocol_net_byte_order(unformat_input_t *input, va_list *args)
#define VLIB_INIT_FUNCTION(x)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static clib_error_t * hdlc_init(vlib_main_t *vm)
#define vlib_call_init_function(vm, x)
#define hash_create_string(elts, value_bytes)
uword unformat_hdlc_header(unformat_input_t *input, va_list *args)
format_function_t * format_buffer
uword * protocol_info_by_protocol
u8 * format_hdlc_header_with_length(u8 *s, va_list *args)
#define clib_memcpy(a, b, c)
#define hash_create(elts, value_bytes)
hdlc_main_t * hdlc_get_main(vlib_main_t *vm)
uword * protocol_info_by_name
VNET_HW_INTERFACE_CLASS(hdlc_hw_interface_class)
static clib_error_t * hdlc_input_init(vlib_main_t *vm)
static void add_protocol(hdlc_main_t *pm, hdlc_protocol_t protocol, char *protocol_name)
static uword hdlc_set_rewrite(vnet_main_t *vnm, u32 sw_if_index, u32 l3_type, void *dst_address, void *rewrite, uword max_rewrite_bytes)
hdlc_protocol_info_t * protocol_infos
always_inline hdlc_protocol_info_t * hdlc_get_protocol_info(hdlc_main_t *em, hdlc_protocol_t protocol)
uword unformat_hdlc_protocol_host_byte_order(unformat_input_t *input, va_list *args)