41 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 48 #define foreach_tap_api_msg \ 49 _(TAP_CONNECT, tap_connect) \ 50 _(TAP_MODIFY, tap_modify) \ 51 _(TAP_DELETE, tap_delete) \ 52 _(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump) 54 #define vl_msg_name_crc_list 55 #include <vnet/unix/tap.api.h> 56 #undef vl_msg_name_crc_list 69 memset (mp, 0,
sizeof (*mp));
70 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_FLAGS);
87 u32 sw_if_index = (
u32) ~ 0;
96 if (rv == 0 && mp->
tag[0])
108 rmp->_vl_msg_id = ntohs (VL_API_TAP_CONNECT_REPLY);
122 u32 sw_if_index = (
u32) ~ 0;
135 rmp->_vl_msg_id = ntohs (VL_API_TAP_MODIFY_REPLY);
165 rmp->_vl_msg_id = ntohs (VL_API_TAP_DELETE_REPLY);
183 memset (mp, 0,
sizeof (*mp));
184 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_TAP_DETAILS);
221 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 222 foreach_vl_msg_name_crc_tap;
232 vl_msg_api_set_handlers(VL_API_##N, #n, \ 233 vl_api_##n##_t_handler, \ 235 vl_api_##n##_t_endian, \ 236 vl_api_##n##_t_print, \ 237 sizeof(vl_api_##n##_t), 1);
static void send_sw_interface_tap_details(vpe_api_main_t *am, unix_shared_memory_queue_t *q, tapcli_interface_details_t *tap_if, u32 context)
int vnet_tap_modify(vlib_main_t *vm, u32 orig_sw_if_index, u8 *intfc_name, u8 *hwaddr_arg, u32 *sw_if_indexp, u8 renumber, u32 custom_dev_instance)
Modifies tap interface - can result in new interface being created.
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
static vlib_main_t * vlib_get_main(void)
Set flags on the interface.
static void vnet_clear_sw_interface_tag(vnet_main_t *vnm, u32 sw_if_index)
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
Dump tap interfaces request.
static void setup_message_id_table(api_main_t *am)
Reply for tap delete request.
static void send_sw_interface_flags_deleted(vpe_api_main_t *am, unix_shared_memory_queue_t *q, u32 sw_if_index)
TAP CLI interface details struct.
static clib_error_t * tap_api_hookup(vlib_main_t *vm)
vnet_main_t * vnet_get_main(void)
#define foreach_tap_api_msg
Initialize a new tap interface with the given paramters.
Reply for tap connect request.
Call from VLIB_INIT_FUNCTION to set the Linux kernel inject node name.
void * vl_msg_api_alloc(int nbytes)
#define vec_free(V)
Free vector's memory (no header).
Reply for tap dump request.
Reply for tap modify request.
static void vnet_set_sw_interface_tag(vnet_main_t *vnm, u8 *tag, u32 sw_if_index)
int vnet_tap_delete(vlib_main_t *vm, u32 sw_if_index)
Delete TAP interface.
VLIB_API_INIT_FUNCTION(tap_api_hookup)
Modify a tap interface with the given paramters.
int vnet_tap_connect_renumber(vlib_main_t *vm, u8 *intfc_name, u8 *hwaddr_arg, u32 *sw_if_indexp, u8 renumber, u32 custom_dev_instance)
Renumber a TAP interface.
static void vl_api_sw_interface_tap_dump_t_handler(vl_api_sw_interface_tap_dump_t *mp)
#define vec_foreach(var, vec)
Vector iterator.
static void vl_api_tap_connect_t_handler(vl_api_tap_connect_t *mp)
vpe_api_main_t vpe_api_main
int vnet_tap_dump_ifs(tapcli_interface_details_t **out_tapids)
Dump TAP interfaces.
static void vl_api_tap_delete_t_handler(vl_api_tap_delete_t *mp)
static void vl_api_tap_modify_t_handler(vl_api_tap_modify_t *mp)
struct _unix_shared_memory_queue unix_shared_memory_queue_t