27 #include <sample/sample.api_enum.h> 28 #include <sample/sample.api_types.h> 30 #define REPLY_MSG_ID_BASE sm->msg_id_base 36 .description =
"Sample of VPP Plugin",
57 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
62 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
65 sw_if_index, enable_disable, 0, 0);
77 int enable_disable = 1;
91 if (sw_if_index == ~0)
100 case VNET_API_ERROR_INVALID_SW_IF_INDEX:
102 (0,
"Invalid interface, only works on physical ports");
105 case VNET_API_ERROR_UNIMPLEMENTED:
120 .path =
"sample macswap",
122 "sample macswap <interface-name> [disable]",
132 vl_api_sample_macswap_enable_disable_reply_t * rmp;
139 REPLY_MACRO(VL_API_SAMPLE_MACSWAP_ENABLE_DISABLE_REPLY);
143 #include <sample/sample.api.c> 167 .arc_name =
"device-input",
168 .node_name =
"sample",
sample_main_t sample_main
vnet_main_t * vnet_get_main(void)
vnet_interface_main_t interface_main
vl_api_interface_index_t sw_if_index
static void vl_api_sample_macswap_enable_disable_t_handler(vl_api_sample_macswap_enable_disable_t *mp)
Plugin API message handler.
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
unformat_function_t unformat_vnet_sw_interface
#define SAMPLE_PLUGIN_BUILD_VER
#define VLIB_INIT_FUNCTION(x)
#define clib_error_return(e, args...)
int sample_macswap_enable_disable(sample_main_t *sm, u32 sw_if_index, int enable_disable)
Enable/disable the macswap plugin.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
#define VLIB_CLI_COMMAND(x,...)
static clib_error_t * sample_init(vlib_main_t *vm)
Initialize the sample plugin.
#define VNET_FEATURES(...)
vnet_sw_interface_t * sw_interfaces
VNET_FEATURE_INIT(sample, static)
Hook the sample plugin into the VPP graph hierarchy.
vnet_sw_interface_type_t type
static void setup_message_id_table(snat_main_t *sm, api_main_t *am)
static clib_error_t * macswap_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vl_api_interface_index_t sw_if_index
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)