75 u32 n_left_from, next_index, *from, *to_next;
89 while (n_left_from > 0)
95 while (n_left_from >= 4 && n_left_to_next >= 2)
101 u8 next0, next1, is_ethernet0, is_ethernet1, len0, len1,
137 is_ethernet0 = oui0 == IEEE_OUI_ethernet;
138 is_ethernet1 = oui1 == IEEE_OUI_ethernet;
140 len0 =
sizeof (h0[0]) - (is_ethernet0 ?
sizeof (h0->protocol) : 0);
141 len1 =
sizeof (h1[0]) - (is_ethernet1 ?
sizeof (h1->protocol) : 0);
156 b0->
error = node->
errors[SNAP_ERROR_UNKNOWN_PROTOCOL];
157 b1->
error = node->
errors[SNAP_ERROR_UNKNOWN_PROTOCOL];
159 enqueue_code = (next0 != next_index) + 2 * (next1 != next_index);
163 switch (enqueue_code)
198 while (n_left_from > 0 && n_left_to_next > 0)
204 u8 next0, is_ethernet0, len0;
220 is_ethernet0 = oui0 == IEEE_OUI_ethernet;
222 len0 =
sizeof (h0[0]) - (is_ethernet0 ?
sizeof (h0->protocol) : 0);
233 b0->
error = node->
errors[SNAP_ERROR_UNKNOWN_PROTOCOL];
244 to_next, n_left_to_next);
267 .name =
"snap-input",
269 .vector_size =
sizeof (
u32),
321 h.protocol = clib_host_to_net_u16 (protocol);
322 h.oui[0] = (ieee_oui >> 16) & 0xff;
323 h.oui[1] = (ieee_oui >> 8) & 0xff;
324 h.oui[2] = (ieee_oui >> 0) & 0xff;
336 key.
protocol = clib_host_to_net_u16 (protocol);
static void snap_setup_node(vlib_main_t *vm, u32 node_index)
static void vlib_set_next_frame_buffer(vlib_main_t *vm, vlib_node_runtime_t *node, u32 next_index, u32 buffer_index)
vl_api_ip_proto_t protocol
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define foreach_snap_error
#define hash_set_mem(h, key, value)
vlib_error_t * errors
Vector of errors for this node.
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
format_function_t format_snap_header
#define VLIB_INIT_FUNCTION(x)
description fragment has unexpected format
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define vlib_call_init_function(vm, x)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
format_function_t format_snap_header_with_length
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vlib_node_registration_t snap_input_node
(constructor) VLIB_REGISTER_NODE (snap_input_node)
static uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
void llc_register_input_protocol(vlib_main_t *vm, llc_protocol_t protocol, u32 node_index)
static clib_error_t * snap_input_init(vlib_main_t *vm)
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
static snap_protocol_info_t * snap_get_protocol_info(snap_main_t *sm, snap_header_t *h)
uword * protocol_info_by_name
static uword snap_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
static u32 snap_header_get_oui(snap_header_t *h)
vlib_main_t vlib_node_runtime_t * node
static char * snap_error_strings[]
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
#define clib_error_report(e)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
unformat_function_t unformat_snap_header
static u8 * format_snap_input_trace(u8 *s, va_list *va)
void vlib_trace_frame_buffers_only(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, uword n_buffers, uword next_buffer_stride, uword n_buffer_data_bytes_in_trace)
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
void snap_register_input_protocol(vlib_main_t *vm, char *name, u32 ieee_oui, u16 protocol, u32 node_index)
u16 flags
Copy of main node flags.
#define VLIB_NODE_FLAG_TRACE
snap_protocol_info_t * protocols
static clib_error_t * snap_init(vlib_main_t *vm)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.