43 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 49 #define vl_api_version(n,v) static u32 api_version=(v); 61 #define REPLY_MACRO(t) \ 63 unix_shared_memory_queue_t * q = \ 64 vl_api_client_index_to_input_queue (mp->client_index); \ 68 rmp = vl_msg_api_alloc (sizeof (*rmp)); \ 69 rmp->_vl_msg_id = ntohs((t)+sm->msg_id_base); \ 70 rmp->context = mp->context; \ 71 rmp->retval = ntohl(rv); \ 73 vl_msg_api_send_shmem (q, (u8 *)&rmp); \ 79 #define foreach_sample_plugin_api_msg \ 80 _(SAMPLE_MACSWAP_ENABLE_DISABLE, sample_macswap_enable_disable) 115 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
120 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
140 u32 sw_if_index = ~0;
141 int enable_disable = 1;
155 if (sw_if_index == ~0)
164 case VNET_API_ERROR_INVALID_SW_IF_INDEX:
166 (0,
"Invalid interface, only works on physical ports");
169 case VNET_API_ERROR_UNIMPLEMENTED:
181 .path =
"sample macswap",
183 "sample macswap <interface-name> [disable]",
198 REPLY_MACRO(VL_API_SAMPLE_MACSWAP_ENABLE_DISABLE_REPLY);
207 vl_msg_api_set_handlers((VL_API_##N + sm->msg_id_base), \ 209 vl_api_##n##_t_handler, \ 211 vl_api_##n##_t_endian, \ 212 vl_api_##n##_t_print, \ 213 sizeof(vl_api_##n##_t), 1); 226 name =
format (0,
"sample_%08x%c", api_version, 0);
vnet_interface_main_t interface_main
int vnet_hw_interface_rx_redirect_to_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
static void vl_api_sample_macswap_enable_disable_t_handler(vl_api_sample_macswap_enable_disable_t *mp)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
unformat_function_t unformat_vnet_sw_interface
ethernet_main_t * ethernet_main
#define VLIB_INIT_FUNCTION(x)
ethernet_main_t * ethernet_main
vlib_node_registration_t sample_node
(constructor) VLIB_REGISTER_NODE (sample_node)
sample_main_t sample_main
int sample_macswap_enable_disable(sample_main_t *sm, u32 sw_if_index, int enable_disable)
#define vec_free(V)
Free vector's memory (no header).
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static clib_error_t * sample_init(vlib_main_t *vm)
VLIB_CLI_COMMAND(set_interface_ip_source_and_port_range_check_command, static)
static clib_error_t * sample_plugin_api_hookup(vlib_main_t *vm)
vnet_sw_interface_t * sw_interfaces
vnet_sw_interface_type_t type
u16 vl_msg_api_get_msg_ids(char *name, int n)
#define clib_error_return(e, args...)
static clib_error_t * macswap_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
clib_error_t * vlib_plugin_register(vlib_main_t *vm, vnet_plugin_handoff_t *h, int from_early_init)
#define foreach_sample_plugin_api_msg