FD.io VPP  v17.04.2-2-ga8f93f8
Vector Packet Processing
flowperpkt.c File Reference

Per-packet IPFIX flow record generator plugin. More...

+ Include dependency graph for flowperpkt.c:

Go to the source code of this file.

Macros

#define vl_typedefs
 
#define vl_endianfun
 
#define vl_print(handle, ...)   vlib_cli_output (handle, __VA_ARGS__)
 
#define vl_printfun
 
#define vl_api_version(n, v)   static u32 api_version=(v);
 
#define REPLY_MSG_ID_BASE   fm->msg_id_base
 
#define FINISH
 
#define foreach_flowperpkt_plugin_api_msg   _(FLOWPERPKT_TX_INTERFACE_ADD_DEL, flowperpkt_tx_interface_add_del)
 
#define vl_msg_name_crc_list
 

Functions

 VNET_FEATURE_INIT (flow_perpacket_ipv4, static)
 
 VNET_FEATURE_INIT (flow_perpacket_l2, static)
 
static u8flowperpkt_template_rewrite_inline (flow_report_main_t *frm, flow_report_t *fr, ip4_address_t *collector_address, ip4_address_t *src_address, u16 collector_port, int variant)
 Create an IPFIX template packet rewrite string. More...
 
u8flowperpkt_template_rewrite_ipv4 (flow_report_main_t *frm, flow_report_t *fr, ip4_address_t *collector_address, ip4_address_t *src_address, u16 collector_port)
 
u8flowperpkt_template_rewrite_l2 (flow_report_main_t *frm, flow_report_t *fr, ip4_address_t *collector_address, ip4_address_t *src_address, u16 collector_port)
 
vlib_frame_tflowperpkt_data_callback_ipv4 (flow_report_main_t *frm, flow_report_t *fr, vlib_frame_t *f, u32 *to_next, u32 node_index)
 Flush accumulated data. More...
 
vlib_frame_tflowperpkt_data_callback_l2 (flow_report_main_t *frm, flow_report_t *fr, vlib_frame_t *f, u32 *to_next, u32 node_index)
 
static int flowperpkt_tx_interface_add_del_feature (flowperpkt_main_t *fm, u32 sw_if_index, int which, int is_add)
 configure / deconfigure the IPFIX flow-per-packet More...
 
void vl_api_flowperpkt_tx_interface_add_del_t_handler (vl_api_flowperpkt_tx_interface_add_del_t *mp)
 API message handler. More...
 
static void * vl_api_flowperpkt_tx_interface_add_del_t_print (vl_api_flowperpkt_tx_interface_add_del_t *mp, void *handle)
 API message custom-dump function. More...
 
 VLIB_PLUGIN_REGISTER ()
 
static clib_error_tflowperpkt_tx_interface_add_del_feature_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tflowperpkt_plugin_api_hookup (vlib_main_t *vm)
 Set up the API message handling tables. More...
 
static void setup_message_id_table (flowperpkt_main_t *fm, api_main_t *am)
 
static clib_error_tflowperpkt_init (vlib_main_t *vm)
 Set up the API message handling tables. More...
 

Variables

flowperpkt_main_t flowperpkt_main
 
static vlib_cli_command_t flowperpkt_enable_disable_command
 (constructor) VLIB_CLI_COMMAND (flowperpkt_enable_disable_command) More...
 

Detailed Description

Per-packet IPFIX flow record generator plugin.

This file implements vpp plugin registration mechanics, debug CLI, and binary API handling.

Definition in file flowperpkt.c.

Macro Definition Documentation

#define FINISH
Value:
vec_add1 (s, 0); \
vl_print (handle, (char *)s); \
vec_free (s); \
return handle;
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:522
#define vl_print(handle,...)
Definition: flowperpkt.c:49
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:340

Definition at line 82 of file flowperpkt.c.

#define foreach_flowperpkt_plugin_api_msg   _(FLOWPERPKT_TX_INTERFACE_ADD_DEL, flowperpkt_tx_interface_add_del)

Definition at line 445 of file flowperpkt.c.

#define REPLY_MSG_ID_BASE   fm->msg_id_base

Definition at line 61 of file flowperpkt.c.

#define vl_api_version (   n,
  v 
)    static u32 api_version=(v);

Definition at line 57 of file flowperpkt.c.

#define vl_endianfun

Definition at line 44 of file flowperpkt.c.

#define vl_msg_name_crc_list

Definition at line 551 of file flowperpkt.c.

#define vl_print (   handle,
  ... 
)    vlib_cli_output (handle, __VA_ARGS__)

Definition at line 49 of file flowperpkt.c.

#define vl_printfun

Definition at line 50 of file flowperpkt.c.

#define vl_typedefs

Definition at line 39 of file flowperpkt.c.

Function Documentation

vlib_frame_t* flowperpkt_data_callback_ipv4 ( flow_report_main_t frm,
flow_report_t fr,
vlib_frame_t f,
u32 to_next,
u32  node_index 
)

Flush accumulated data.

Parameters
frmflow_report_main_t *
frflow_report_t *
fvlib_frame_t *

Notes: This function must simply return the incoming frame, or no template packets will be sent.

Definition at line 320 of file flowperpkt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vlib_frame_t* flowperpkt_data_callback_l2 ( flow_report_main_t frm,
flow_report_t fr,
vlib_frame_t f,
u32 to_next,
u32  node_index 
)

Definition at line 330 of file flowperpkt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* flowperpkt_init ( vlib_main_t vm)
static

Set up the API message handling tables.

Parameters
vmvlib_main_t * vlib main data structure pointer
Returns
0 to indicate all is well, or a clib_error_t

Definition at line 570 of file flowperpkt.c.

+ Here is the call graph for this function:

static clib_error_t* flowperpkt_plugin_api_hookup ( vlib_main_t vm)
static

Set up the API message handling tables.

Parameters
vmvlib_main_t * vlib main data structure pointer
Returns
0 to indicate all is well

Definition at line 534 of file flowperpkt.c.

+ Here is the caller graph for this function:

static u8* flowperpkt_template_rewrite_inline ( flow_report_main_t frm,
flow_report_t fr,
ip4_address_t collector_address,
ip4_address_t src_address,
u16  collector_port,
int  variant 
)
inlinestatic

Create an IPFIX template packet rewrite string.

Parameters
frmflow_report_main_t *
frflow_report_t *
collector_addressip4_address_t * the IPFIX collector address
src_addressip4_address_t * the source address we should use
collector_portu16 the collector port we should use, host byte order
Returns
u8 * vector containing the indicated IPFIX template packet

Definition at line 98 of file flowperpkt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* flowperpkt_template_rewrite_ipv4 ( flow_report_main_t frm,
flow_report_t fr,
ip4_address_t collector_address,
ip4_address_t src_address,
u16  collector_port 
)

Definition at line 285 of file flowperpkt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* flowperpkt_template_rewrite_l2 ( flow_report_main_t frm,
flow_report_t fr,
ip4_address_t collector_address,
ip4_address_t src_address,
u16  collector_port 
)

Definition at line 297 of file flowperpkt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int flowperpkt_tx_interface_add_del_feature ( flowperpkt_main_t fm,
u32  sw_if_index,
int  which,
int  is_add 
)
static

configure / deconfigure the IPFIX flow-per-packet

Parameters
fmflowperpkt_main_t * fm
sw_if_indexu32 the desired interface
is_addint 1 to enable the feature, 0 to disable it
Returns
0 if successful, non-zero otherwise

Definition at line 347 of file flowperpkt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* flowperpkt_tx_interface_add_del_feature_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 456 of file flowperpkt.c.

+ Here is the call graph for this function:

static void setup_message_id_table ( flowperpkt_main_t fm,
api_main_t am 
)
static

Definition at line 556 of file flowperpkt.c.

+ Here is the caller graph for this function:

void vl_api_flowperpkt_tx_interface_add_del_t_handler ( vl_api_flowperpkt_tx_interface_add_del_t mp)

API message handler.

Parameters
mpvl_api_flowperpkt_tx_interface_add_del_t * mp the api message

Definition at line 403 of file flowperpkt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_flowperpkt_tx_interface_add_del_t_print ( vl_api_flowperpkt_tx_interface_add_del_t mp,
void *  handle 
)
static

API message custom-dump function.

Parameters
mpvl_api_flowperpkt_tx_interface_add_del_t * mp the api message
handlevoid * print function handle
Returns
u8 * output string

Definition at line 433 of file flowperpkt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VLIB_PLUGIN_REGISTER ( )
VNET_FEATURE_INIT ( flow_perpacket_ipv4  ,
static   
)
VNET_FEATURE_INIT ( flow_perpacket_l2  ,
static   
)

Variable Documentation

vlib_cli_command_t flowperpkt_enable_disable_command
static
Initial value:
= {
.path = "flowperpkt feature add-del",
.short_help =
"flowperpkt feature add-del <interface-name> [disable]",
}
static clib_error_t * flowperpkt_tx_interface_add_del_feature_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: flowperpkt.c:456

(constructor) VLIB_CLI_COMMAND (flowperpkt_enable_disable_command)

Definition at line 520 of file flowperpkt.c.

flowperpkt_main_t flowperpkt_main

Definition at line 54 of file flowperpkt.c.