37 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 43 #define vl_api_version(n,v) static u32 api_version=(v); 49 #define foreach_igmp_plugin_api_msg \ 50 _(IGMP_LISTEN, igmp_listen) \ 51 _(IGMP_ENABLE_DISABLE, igmp_enable_disable) \ 52 _(IGMP_DUMP, igmp_dump) \ 53 _(IGMP_CLEAR_INTERFACE, igmp_clear_interface) \ 54 _(WANT_IGMP_EVENTS, want_igmp_events) \ 62 vl_api_igmp_listen_reply_t *rmp;
64 ip46_address_t saddr, gaddr;
68 rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
75 rv = VNET_API_ERROR_UNEXPECTED_INTF_STATE;
91 rmp->_vl_msg_id = htons ((VL_API_IGMP_LISTEN_REPLY) + im->
msg_id_base);
93 rmp->retval = htonl (rv);
101 vl_api_igmp_enable_disable_reply_t *rmp;
116 memset (mp, 0,
sizeof (*mp));
118 mp->_vl_msg_id = htons (VL_API_IGMP_DETAILS + im->
msg_id_base);
145 pool_foreach (group, config->groups, (
147 pool_foreach (src, group->srcs, (
149 send_igmp_details (q, im, config, group, src, mp->context);
162 pool_foreach (src, group->srcs, (
164 send_igmp_details (q, im, config, group, src, mp->context);
176 vl_api_igmp_clear_interface_reply_t *rmp;
190 htons ((VL_API_IGMP_CLEAR_INTERFACE_REPLY) + im->
msg_id_base);
192 rmp->retval = htonl (rv);
219 vl_api_want_igmp_events_reply_t *rmp;
227 rv = VNET_API_ERROR_INVALID_REGISTRATION;
245 rv = VNET_API_ERROR_INVALID_REGISTRATION;
254 rmp->_vl_msg_id = htons ((VL_API_WANT_IGMP_EVENTS_REPLY) + im->
msg_id_base);
256 rmp->retval = htonl (rv);
287 memset (mp, 0,
sizeof (*mp));
289 mp->_vl_msg_id = ntohs ((VL_API_IGMP_EVENT) + im->
msg_id_base);
295 (group->
type == IGMP_MEMBERSHIP_GROUP_mode_is_filter_include) ? 1 : 0;
309 q = vl_api_client_index_to_input_queue (api_client->client_index);
311 send_igmp_event (q, 0, im, config, group, src);
314 if (group->
type == IGMP_MEMBERSHIP_GROUP_block_old_sources)
325 #define vl_msg_name_crc_list 327 #undef vl_msg_name_crc_list 332 #define _(id,n,crc) \ 333 vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + im->msg_id_base); 334 foreach_vl_msg_name_crc_igmp;
347 name =
format (0,
"igmp_%08x%c", api_version, 0);
354 vl_msg_api_set_handlers((VL_API_##N + im->msg_id_base), \ 356 vl_api_##n##_t_handler, \ 358 vl_api_##n##_t_endian, \ 359 vl_api_##n##_t_print, \ 360 sizeof(vl_api_##n##_t), 1);
#define foreach_igmp_plugin_api_msg
igmp_membership_group_v3_type_t type
static clib_error_t * igmp_plugin_api_hookup(vlib_main_t *vm)
Used by a 'router' to enable the recption of IGMP packets and the construction of group state for hos...
#define hash_set(h, key, value)
#define hash_unset(h, key)
void igmp_event(igmp_main_t *im, igmp_config_t *config, igmp_group_t *group, igmp_src_t *src)
igmp event
remove all (S,G)s from an interface
void igmp_clear_group(igmp_config_t *config, igmp_group_t *group)
igmp clear group
vnet_main_t * vnet_get_main(void)
dump (S,G)s from interface
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
void * vl_msg_api_alloc(int nbytes)
void igmp_clear_config(igmp_config_t *config)
igmp clear config
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
svm_queue_t unix_shared_memory_queue_t
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static clib_error_t * want_igmp_events_reaper(u32 client_index)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
uword * igmp_config_by_sw_if_index
#define pool_put(P, E)
Free an object E in pool P.
Used by a 'host' to enable the recption/listening of packets for a specific multicast group...
VLIB_API_INIT_FUNCTION(igmp_plugin_api_hookup)
void send_igmp_event(unix_shared_memory_queue_t *q, u32 context, igmp_main_t *im, igmp_config_t *config, igmp_group_t *group, igmp_src_t *src)
API main structure, used by both vpp and binary API clients.
static void setup_message_id_table(igmp_main_t *im, api_main_t *am)
void vl_msg_api_send_shmem(svm_queue_t *q, u8 *elem)
svm_queue_t * vl_api_client_index_to_input_queue(u32 index)
#define vec_free(V)
Free vector's memory (no header).
vpe_client_registration_t * api_clients
#define clib_memcpy(a, b, c)
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
static vlib_main_t * vlib_get_main(void)
int igmp_listen(vlib_main_t *vm, u8 enable, u32 sw_if_index, ip46_address_t saddr, ip46_address_t gaddr, u8 cli_api_configured)
igmp listen
static uword vnet_sw_interface_is_api_valid(vnet_main_t *vnm, u32 sw_if_index)
VL_MSG_API_REAPER_FUNCTION(want_igmp_events_reaper)
static igmp_config_t * igmp_config_lookup(igmp_main_t *im, u32 sw_if_index)
igmp config lookup
static void vl_api_want_igmp_events_t_handler(vl_api_want_igmp_events_t *mp)
static void vl_api_igmp_listen_t_handler(vl_api_igmp_listen_t *mp)
static void vl_api_igmp_enable_disable_t_handler(vl_api_igmp_enable_disable_t *mp)
static void send_igmp_details(unix_shared_memory_queue_t *q, igmp_main_t *im, igmp_config_t *config, igmp_group_t *group, igmp_src_t *src, u32 context)
static void vl_api_igmp_dump_t_handler(vl_api_igmp_dump_t *mp)
static vpe_client_registration_t * igmp_api_client_lookup(igmp_main_t *im, u32 client_index)
igmp group lookup
uword * igmp_api_client_by_client_index
static uword vnet_sw_interface_get_flags(vnet_main_t *vnm, u32 sw_if_index)
static void vl_api_igmp_clear_interface_t_handler(vl_api_igmp_clear_interface_t *mp)
u16 vl_msg_api_get_msg_ids(const char *name, int n)
static uword pool_elts(void *v)
Number of active elements in a pool.