-/** \brief igmp timer function
- @param vm - vlib main
- @param rt - vlib runtime node
- @param im - igmp main
- @param timer - igmp timer
-*/
-typedef void (igmp_timer_function_t) (vlib_main_t * vm,
- vlib_node_runtime_t * rt,
- igmp_main_t * im, igmp_timer_t * timer);
-
-/** \brief igmp timer
- @param exp_time - expiration time
- @param func - function to call on timer expiration
- @param sw_if_index - interface sw_if_index
- @param data - custom data
-*/
-typedef struct igmp_timer_t_
-{
- f64 exp_time;
- igmp_timer_function_t *func;
-
- u32 sw_if_index;
- void *data;
-} igmp_timer_t;
-
-extern vlib_node_registration_t igmp_timer_process_node;
-extern vlib_node_registration_t igmp_input_node;
-extern vlib_node_registration_t igmp_parse_query_node;
-extern vlib_node_registration_t igmp_parse_report_node;
-
-/** \brief igmp listen
- @param vm - vlib main
- @param enable - 0 == remove (S,G), else add (S,G)
- @param sw_if_index - interface sw_if_index
- @param saddr - source address
- @param gaddr - group address
- @param cli_api_configured - if zero, an igmp report has been received on interface
-
- Add/del (S,G) on an interface. If user configured,
- send a status change report from the interface.
- If a report was received on interface notify registered api clients.
-*/
-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);
-
-/** \brief igmp clear config
- @param config - igmp configuration
-
- Clear all (S,G)s on specified config and remove this config from pool.
-*/
-void igmp_clear_config (igmp_config_t * config);
-
-/** \brief igmp clear group
- @param config - igmp configuration
- @param group - the group to be removed
-
- Remove this group from interface (specified by configuration).
-*/
-void igmp_clear_group (igmp_config_t * config, igmp_group_t * group);
-
-/** \brief igmp sort timers
- @param timers - pool of igmp timers
-
- Sort igmp timers, so that the first to expire is at end.
-*/
-void igmp_sort_timers (igmp_timer_t * timers);
-
-/** \brief igmp create int timer
- @param time - expiration time (at this time the timer will expire)
- @param sw_if_index - interface sw_if_index
- @param func - function to all after timer expiration
-
-
- Creates new interface timer. Delayed reports, query msg, query resp.
-*/
-void igmp_create_int_timer (f64 time, u32 sw_if_index,
- igmp_timer_function_t * func);
-
-/** \brief igmp create group timer
- @param time - expiration time (at this time the timer will expire)
- @param sw_if_index - interface sw_if_index
- @param gkey - key to find the group by
- @param func - function to all after timer expiration
-
- Creates new group timer.
-*/
-void igmp_create_group_timer (f64 time, u32 sw_if_index, igmp_key_t * gkey,
- igmp_timer_function_t * func);
-
-/** \brief igmp create group timer
- @param time - expiration time (at this time the timer will expire)
- @param sw_if_index - interface sw_if_index
- @param gkey - key to find the group by
- @param skey - key to find the source by
- @param func - function to all after timer expiration
-
- Creates new source timer.
-*/
-void igmp_create_src_timer (f64 time, u32 sw_if_index, igmp_key_t * gkey,
- igmp_key_t * skey, igmp_timer_function_t * func);
-
-/** \brief igmp send query (igmp_timer_function_t)
-
- Send an igmp query.
- If the timer holds group key, send Group-Specific query,
- else send General query.
-*/
-void igmp_send_query (vlib_main_t * vm, vlib_node_runtime_t * rt,
- igmp_main_t * im, igmp_timer_t * timer);
-
-/** \brief igmp query response expiration (igmp_timer_function_t)
-
- If a response to a query didn't come in time, remove (S,G)s.
-*/
-void igmp_query_resp_exp (vlib_main_t * vm, vlib_node_runtime_t * rt,
- igmp_main_t * im, igmp_timer_t * timer);
-
-/** \brief igmp send report (igmp_timer_function_t)
-
- Send igmp membership report.
-*/
-void igmp_send_report (vlib_main_t * vm, vlib_node_runtime_t * rt,
- igmp_main_t * im, igmp_timer_t * timer);
-
-/** \brief igmp send state changed (igmp_timer_function_t)
-
- Send report if an (S,G) filter has changed.
-*/
-void igmp_send_state_changed (vlib_main_t * vm, vlib_node_runtime_t * rt,
- igmp_main_t * im, igmp_timer_t * timer);
-
-/** \brief igmp source expiration (igmp_timer_function_t)
-
- Remove expired (S,G) from group.
-*/
-void igmp_src_exp (vlib_main_t * vm, vlib_node_runtime_t * rt,
- igmp_main_t * im, igmp_timer_t * timer);
-
-static inline igmp_type_info_t *
-igmp_get_type_info (igmp_main_t * im, u32 type)
-{
- uword *p;
-
- p = hash_get (im->type_info_by_type, type);
- return p ? vec_elt_at_index (im->type_infos, p[0]) : 0;
-}
-
-static inline igmp_report_type_info_t *
-igmp_get_report_type_info (igmp_main_t * im, u8 report_type)
-{
- uword *p;
-
- p = hash_get (im->report_type_info_by_report_type, report_type);
- return p ? vec_elt_at_index (im->report_type_infos, p[0]) : 0;
-}
-
-/** \brief igmp event
- @param im - igmp main
- @param config - igmp configuration
- @param group - igmp group
- @param src - source
-
- Notify registered api clients of (S,G) filter update.
-*/
-void igmp_event (igmp_main_t * im, igmp_config_t * config,
- igmp_group_t * group, igmp_src_t * src);
-
-typedef enum
-{
- IGMP_NEXT_IP4_REWRITE_MCAST_NODE,
- IGMP_NEXT_IP6_REWRITE_MCAST_NODE,
- IGMP_N_NEXT,
-} igmp_next_t;
-
-/** \brief igmp config lookup
- @param im - igmp main
- @param sw_if_index - interface sw_if_index
-*/
-always_inline igmp_config_t *
-igmp_config_lookup (igmp_main_t * im, u32 sw_if_index)
-{
- uword *p;
- igmp_config_t *config = NULL;
-
- p = hash_get (im->igmp_config_by_sw_if_index, sw_if_index);
- if (p)
- config = vec_elt_at_index (im->configs, p[0]);
-
- return config;
-}
-
-/** \brief igmp group lookup
- @param config - igmp configuration
- @param key - igmp key
-*/
-always_inline igmp_group_t *
-igmp_group_lookup (igmp_config_t * config, igmp_key_t * key)
-{
- uword *p;
- igmp_group_t *group = NULL;
- if (!config)
- return NULL;
-
- p = hash_get_mem (config->igmp_group_by_key, key);
- if (p)
- group = vec_elt_at_index (config->groups, p[0]);
-
- return group;
-}
-
-/** \brief igmp group lookup
- @param group - igmp group
- @param key - igmp key
-*/
-always_inline igmp_src_t *
-igmp_src_lookup (igmp_group_t * group, igmp_key_t * key)
-{
- uword *p;
- igmp_src_t *src = NULL;
- if (!group)
- return NULL;
-
- p = hash_get_mem (group->igmp_src_by_key, key);
- if (p)
- src = vec_elt_at_index (group->srcs, p[0]);
-
- return src;
-}