FD.io VPP  v19.08.3-2-gbabecb413
Vector Packet Processing
sample.c File Reference

Sample Plugin, plugin API / trace / CLI handling. More...

+ Include dependency graph for sample.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   sm->msg_id_base
 
#define foreach_sample_plugin_api_msg   _(SAMPLE_MACSWAP_ENABLE_DISABLE, sample_macswap_enable_disable)
 
#define vl_msg_name_crc_list
 

Functions

 VLIB_PLUGIN_REGISTER ()
 
int sample_macswap_enable_disable (sample_main_t *sm, u32 sw_if_index, int enable_disable)
 Enable/disable the macswap plugin. More...
 
static clib_error_tmacswap_enable_disable_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static void vl_api_sample_macswap_enable_disable_t_handler (vl_api_sample_macswap_enable_disable_t *mp)
 Plugin API message handler. More...
 
static clib_error_tsample_plugin_api_hookup (vlib_main_t *vm)
 Set up the API message handling tables. More...
 
static void setup_message_id_table (sample_main_t *sm, api_main_t *am)
 
static clib_error_tsample_init (vlib_main_t *vm)
 Initialize the sample plugin. More...
 
 VNET_FEATURE_INIT (sample, static)
 Hook the sample plugin into the VPP graph hierarchy. More...
 

Variables

sample_main_t sample_main
 
static vlib_cli_command_t sr_content_command
 CLI command to enable/disable the sample macswap plugin. More...
 

Detailed Description

Sample Plugin, plugin API / trace / CLI handling.

Definition in file sample.c.

Macro Definition Documentation

◆ foreach_sample_plugin_api_msg

#define foreach_sample_plugin_api_msg   _(SAMPLE_MACSWAP_ENABLE_DISABLE, sample_macswap_enable_disable)

Definition at line 56 of file sample.c.

◆ REPLY_MSG_ID_BASE

#define REPLY_MSG_ID_BASE   sm->msg_id_base

Definition at line 51 of file sample.c.

◆ vl_api_version

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

Definition at line 47 of file sample.c.

◆ vl_endianfun

#define vl_endianfun

Definition at line 36 of file sample.c.

◆ vl_msg_name_crc_list

#define vl_msg_name_crc_list

Definition at line 189 of file sample.c.

◆ vl_print

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

Definition at line 41 of file sample.c.

◆ vl_printfun

#define vl_printfun

Definition at line 42 of file sample.c.

◆ vl_typedefs

#define vl_typedefs

Definition at line 31 of file sample.c.

Function Documentation

◆ macswap_enable_disable_command_fn()

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

Definition at line 97 of file sample.c.

+ Here is the call graph for this function:

◆ sample_init()

static clib_error_t* sample_init ( vlib_main_t vm)
static

Initialize the sample plugin.

Definition at line 205 of file sample.c.

+ Here is the call graph for this function:

◆ sample_macswap_enable_disable()

int sample_macswap_enable_disable ( sample_main_t sm,
u32  sw_if_index,
int  enable_disable 
)

Enable/disable the macswap plugin.

Action function shared between message handler and debug CLI.

Definition at line 74 of file sample.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sample_plugin_api_hookup()

static clib_error_t* sample_plugin_api_hookup ( vlib_main_t vm)
static

Set up the API message handling tables.

Definition at line 172 of file sample.c.

+ Here is the caller graph for this function:

◆ setup_message_id_table()

static void setup_message_id_table ( sample_main_t sm,
api_main_t am 
)
static

Definition at line 194 of file sample.c.

+ Here is the caller graph for this function:

◆ vl_api_sample_macswap_enable_disable_t_handler()

static void vl_api_sample_macswap_enable_disable_t_handler ( vl_api_sample_macswap_enable_disable_t mp)
static

Plugin API message handler.

Definition at line 156 of file sample.c.

+ Here is the call graph for this function:

◆ VLIB_PLUGIN_REGISTER()

VLIB_PLUGIN_REGISTER ( )

◆ VNET_FEATURE_INIT()

VNET_FEATURE_INIT ( sample  ,
static   
)

Hook the sample plugin into the VPP graph hierarchy.

Variable Documentation

◆ sample_main

sample_main_t sample_main

Definition at line 66 of file sample.c.

◆ sr_content_command

vlib_cli_command_t sr_content_command
static
Initial value:
= {
.path = "sample macswap",
.short_help =
"sample macswap <interface-name> [disable]",
}
static clib_error_t * macswap_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: sample.c:97

CLI command to enable/disable the sample macswap plugin.

(constructor) VLIB_CLI_COMMAND (sr_content_command)

Definition at line 145 of file sample.c.