26 #include <igmp/igmp.api_enum.h> 27 #include <igmp/igmp.api_types.h> 32 #define IGMP_MSG_ID(_id) (_id + igmp_main.msg_id_base) 39 vl_api_igmp_listen_reply_t *rmp;
49 rv = VNET_API_ERROR_UNEXPECTED_INTF_STATE;
66 IGMP_FILTER_MODE_INCLUDE :
67 IGMP_FILTER_MODE_EXCLUDE),
68 ntohl (mp->
group.sw_if_index), saddrs, &gaddr);
80 vl_api_igmp_enable_disable_reply_t *rmp;
87 (mp->
mode ? IGMP_MODE_HOST : IGMP_MODE_ROUTER));
98 vl_api_igmp_proxy_device_add_del_reply_t *rmp;
116 vl_api_igmp_proxy_device_add_del_interface_reply_t *rmp;
128 (VL_API_IGMP_PROXY_DEVICE_ADD_DEL_INTERFACE_REPLY));
141 mp->_vl_msg_id = htons (
IGMP_MSG_ID (VL_API_IGMP_DETAILS));
182 if (~0 == sw_if_index)
187 igmp_config_dump(im, rp, mp->context, config);
204 vl_api_igmp_clear_interface_reply_t *rmp;
215 static vl_api_group_prefix_type_t
220 case IGMP_GROUP_PREFIX_TYPE_ASM:
221 return (htonl (
ASM));
222 case IGMP_GROUP_PREFIX_TYPE_SSM:
223 return (htonl (
SSM));
235 return (IGMP_GROUP_PREFIX_TYPE_ASM);
237 return (IGMP_GROUP_PREFIX_TYPE_SSM);
240 return (IGMP_GROUP_PREFIX_TYPE_SSM);
246 vl_api_igmp_group_prefix_set_reply_t *rmp;
272 mp->_vl_msg_id = htons (
IGMP_MSG_ID (VL_API_IGMP_DETAILS));
317 vl_api_want_igmp_events_reply_t *rmp;
325 rv = VNET_API_ERROR_INVALID_REGISTRATION;
343 rv = VNET_API_ERROR_INVALID_REGISTRATION;
373 const ip46_address_t * saddr,
const ip46_address_t *
gaddr)
380 mp->
filter = htonl (filter);
390 const ip46_address_t * saddr,
const ip46_address_t *
gaddr)
408 rp = vl_api_client_index_to_registration (api_client->client_index);
410 send_igmp_event (rp, filter, sw_if_index, saddr, gaddr);
416 #include <igmp/igmp.api.c> int igmp_listen(vlib_main_t *vm, igmp_filter_mode_t mode, u32 sw_if_index, const ip46_address_t *saddrs, const ip46_address_t *gaddr)
igmp listen Called by a host to request reception of multicast packets
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static clib_error_t * igmp_plugin_api_hookup(vlib_main_t *vm)
Used by a 'router' and 'host' to enable the reception of IGMP packets.
#define vec_foreach_index(var, v)
Iterate over vector indices.
static void vl_api_igmp_proxy_device_add_del_t_handler(vl_api_igmp_proxy_device_add_del_t *mp)
#define hash_set(h, key, value)
#define hash_unset(h, key)
void ip_prefix_decode(const vl_api_prefix_t *in, fib_prefix_t *out)
remove all (S,G)s from an interface
int igmp_proxy_device_add_del_interface(u32 vrf_id, u32 sw_if_index, u8 add)
IGMP proxy device add/del interface.
vnet_main_t * vnet_get_main(void)
void igmp_ssm_range_walk(igmp_ssm_range_walk_t fn, void *ctx)
vl_api_filter_mode_t filter
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
igmp_config_t * configs
pool of configs
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
vl_api_interface_index_t sw_if_index
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)
vl_api_ip4_address_t gaddr
format_function_t format_vnet_sw_if_index_name
u16 msg_id_base
API base message ID.
#define clib_memcpy(d, s, n)
void igmp_clear_config(igmp_config_t *config)
igmp clear config
enum walk_rc_t_ walk_rc_t
Walk return code.
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
static igmp_group_prefix_type_t igmp_group_type_api_to_int(vl_api_group_prefix_type_t t)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Aggregate type for a prefix.
#define FOR_EACH_GROUP(_group, _config, _body)
struct igmp_ssm_range_walk_ctx_t_ igmp_ssm_range_walk_ctx_t
vl_api_fib_path_type_t type
igmp_config_t * igmp_config_lookup(u32 sw_if_index)
igmp config lookup
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.
static walk_rc_t igmp_ssm_range_walk_dump(const fib_prefix_t *pfx, igmp_group_prefix_type_t type, void *args)
int igmp_enable_disable(u32 sw_if_index, u8 enable, igmp_mode_t mode)
IGMP interface enable/disable.
vl_api_ip4_address_t saddrs[n_srcs]
vl_api_ip4_address_t saddr
vl_api_interface_index_t sw_if_index
Configure a prefix for SSM or ASM semantics.
#define pool_put(P, E)
Free an object E in pool P.
vl_api_interface_index_t sw_if_index
static void igmp_config_dump(igmp_main_t *im, vl_api_registration_t *rp, u32 context, igmp_config_t *config)
vl_api_interface_index_t sw_if_index
VLIB_API_INIT_FUNCTION(igmp_plugin_api_hookup)
static void vl_api_igmp_group_prefix_dump_t_handler(vl_api_igmp_dump_t *mp)
collection of data related to IGMP
vl_api_interface_index_t sw_if_index
format_function_t format_ip46_address
An API client registration, only in vpp/vlib.
#define BAD_SW_IF_INDEX_LABEL
static void vl_api_igmp_group_prefix_set_t_handler(vl_api_igmp_group_prefix_set_t *mp)
vl_api_igmp_group_t group
vl_api_ip4_address_t gaddr
#define vec_free(V)
Free vector's memory (no header).
vpe_client_registration_t * api_clients
API client registered for events.
enum igmp_filter_mode_t_ igmp_filter_mode_t
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
vl_api_ip4_address_t gaddr
void igmp_group_prefix_set(const fib_prefix_t *pfx, igmp_group_prefix_type_t type)
vl_api_interface_index_t sw_if_index
static void send_igmp_details(vl_api_registration_t *rp, igmp_main_t *im, igmp_config_t *config, igmp_group_t *group, igmp_src_t *src, u32 context)
vl_api_registration_t * rp
Add/del downstream interface to/from proxy device.
static void vl_api_igmp_proxy_device_add_del_interface_t_handler(vl_api_igmp_proxy_device_add_del_interface_t *mp)
Add/del proxy device on specified VRF.
void send_igmp_event(vl_api_registration_t *rp, igmp_filter_mode_t filter, u32 sw_if_index, const ip46_address_t *saddr, const ip46_address_t *gaddr)
static vlib_main_t * vlib_get_main(void)
IGMP interface configuration.
static vl_api_group_prefix_type_t igmp_group_type_int_to_api(igmp_group_prefix_type_t t)
void ip_prefix_encode(const fib_prefix_t *in, vl_api_prefix_t *out)
VL_MSG_API_REAPER_FUNCTION(want_igmp_events_reaper)
void igmp_event(igmp_filter_mode_t filter, u32 sw_if_index, const ip46_address_t *saddr, const ip46_address_t *gaddr)
Send an IGMP event to listening parties.
#define FOR_EACH_SRC(_src, _group, _filter, _body)
igmp_key_t * key
The group's key within the per-interface config.
static void vl_api_want_igmp_events_t_handler(vl_api_want_igmp_events_t *mp)
vl_api_ip4_address_t saddr
IGMP group A multicast group address for which reception has been requested.
static void vl_api_igmp_listen_t_handler(vl_api_igmp_listen_t *mp)
igmp_key_t * key
The source's key.
static void vl_api_igmp_enable_disable_t_handler(vl_api_igmp_enable_disable_t *mp)
static vnet_sw_interface_flags_t vnet_sw_interface_get_flags(vnet_main_t *vnm, u32 sw_if_index)
enum igmp_group_prefix_type_t_ igmp_group_prefix_type_t
static void vl_api_igmp_dump_t_handler(vl_api_igmp_dump_t *mp)
static void setup_message_id_table(snat_main_t *sm, api_main_t *am)
static vpe_client_registration_t * igmp_api_client_lookup(igmp_main_t *im, u32 client_index)
uword * igmp_api_client_by_client_index
int igmp_proxy_device_add_del(u32 vrf_id, u32 sw_if_index, u8 add)
IGMP proxy device add/del.
static void vl_api_igmp_clear_interface_t_handler(vl_api_igmp_clear_interface_t *mp)
vl_api_interface_index_t sw_if_index
IGMP source The representation of a specified source address with in multicast group.
vl_api_interface_index_t sw_if_index
#define VALIDATE_SW_IF_INDEX(mp)