FD.io VPP  v19.01.3-6-g70449b9b9
Vector Packet Processing
igmp.h
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * Copyright (c) 2017 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *------------------------------------------------------------------
16  */
17 
18 #ifndef _IGMP_H_
19 #define _IGMP_H_
20 
21 #include <vlib/vlib.h>
22 #include <vnet/ip/ip.h>
24 #include <vnet/ip/igmp_packet.h>
25 #include <vnet/adj/adj_mcast.h>
26 #include <igmp/igmp_types.h>
27 #include <igmp/igmp_format.h>
28 #include <igmp/igmp_timer.h>
29 #include <igmp/igmp_group.h>
30 #include <igmp/igmp_config.h>
31 #include <igmp/igmp_proxy.h>
32 
33 /**
34  * RFC 3376 Section 8.1
35  */
36 #define IGMP_DEFAULT_ROBUSTNESS_VARIABLE (2)
37 
38 #define IGMP_DBG(...) \
39  vlib_log_debug (igmp_main.logger, __VA_ARGS__);
40 
41 /**
42  * General Query address - 224.0.0.1
43  * Membership Report address - 224.0.0.22
44  * SSM default range 232/8
45  */
46 #if CLIB_ARCH_IS_BIG_ENDIAN
47 #define IGMP_GENERAL_QUERY_ADDRESS (0xE0000001)
48 #define IGMP_MEMBERSHIP_REPORT_ADDRESS (0xE0000016)
49 #define IGMP_SSM_DEFAULT (0xE8000000)
50 #else
51 #define IGMP_GENERAL_QUERY_ADDRESS (0x010000E0)
52 #define IGMP_MEMBERSHIP_REPORT_ADDRESS (0x160000E0)
53 #define IGMP_SSM_DEFAULT (0x000000E8)
54 #endif
55 
56 /** helper macro to get igmp membership group from pointer plus offset */
57 #define group_ptr(p, l) ((igmp_membership_group_v3_t *)((u8*)(p) + (l)))
58 #define group_cptr(p, l) ((const igmp_membership_group_v3_t *)((u8*)(p) + (l)))
59 
60 /**
61  * collection of data related to IGMP
62  */
63 typedef struct igmp_main_t_
64 {
65  /**
66  * API base message ID
67  */
69 
71 
72  /**
73  * API client registered for events
74  */
76 
77  /**
78  * per-interface DB of configs
79  */
81 
82  /**
83  * the number of igmp configs for each mfib_index (VRF)
84  */
86 
87  /**
88  * logger - VLIB log class
89  */
91 
92  /**
93  * pool of configs
94  */
96 
97  /**
98  * pool of groups
99  */
101  /**
102  * pool of sources
103  */
105 
106  /**
107  * per-vrf DB of proxy devices
108  */
110 
111  /**
112  * pool of proxy devices
113  */
115 } igmp_main_t;
116 
117 extern igmp_main_t igmp_main;
118 
119 /**
120  * @brief IGMP interface enable/disable
121  * @param sw_if_index - Interface
122  * @param enable - enable/disable
123  * @param mode - Host or router
124  */
126 
127 /**
128  * @brief igmp listen
129  * Called by a host to request reception of multicast packets
130  * @param vm - vlib main
131  * @param filter - Filter mode
132  * @param sw_if_index - interface sw_if_index
133  * @param saddr - source address
134  * @param gaddr - group address
135  *
136  * Add/del (S,G) on an interface.
137  * send a status change report from the interface.
138  */
139 int igmp_listen (vlib_main_t * vm,
140  igmp_filter_mode_t filter,
142  const ip46_address_t * saddr, const ip46_address_t * gaddr);
143 
144 /**
145  * @brief Send an IGMP event to listening parties
146  * @param filter mode
147  * @param sw_if_index
148  * @param saddr
149  * @param gaddr
150  */
151 void igmp_event (igmp_filter_mode_t filter,
153  const ip46_address_t * saddr, const ip46_address_t * gaddr);
154 
155 #endif /* _IGMP_H_ */
156 
157 /*
158  * fd.io coding-style-patch-verification: ON
159  *
160  * Local Variables:
161  * eval: (c-set-style "gnu")
162  * End:
163  */
u32 vlib_log_class_t
Definition: log.h:21
igmp_config_t * configs
pool of configs
Definition: igmp.h:95
unsigned char u8
Definition: types.h:56
u16 msg_id_base
API base message ID.
Definition: igmp.h:68
u32 sw_if_index
Definition: vxlan_gbp.api:37
u32 * igmp_proxy_device_by_vrf_id
per-vrf DB of proxy devices
Definition: igmp.h:109
unsigned int u32
Definition: types.h:88
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.
Definition: igmp_api.c:421
igmp_main_t igmp_main
Definition: igmp.c:36
vlib_log_class_t logger
logger - VLIB log class
Definition: igmp.h:90
unsigned short u16
Definition: types.h:57
collection of data related to IGMP
Definition: igmp.h:63
int igmp_listen(vlib_main_t *vm, igmp_filter_mode_t filter, u32 sw_if_index, const ip46_address_t *saddr, const ip46_address_t *gaddr)
igmp listen Called by a host to request reception of multicast packets
Definition: igmp.c:133
vlib_main_t * vm
Definition: buffer.c:301
vpe_client_registration_t * api_clients
API client registered for events.
Definition: igmp.h:75
u32 * igmp_config_by_sw_if_index
per-interface DB of configs
Definition: igmp.h:80
enum igmp_filter_mode_t_ igmp_filter_mode_t
u32 * n_configs_per_mfib_index
the number of igmp configs for each mfib_index (VRF)
Definition: igmp.h:85
int igmp_enable_disable(u32 sw_if_index, u8 enable, igmp_mode_t mode)
IGMP interface enable/disable.
Definition: igmp.c:340
IGMP interface configuration.
Definition: igmp_config.h:47
igmp_group_t * groups
pool of groups
Definition: igmp.h:100
IGMP group A multicast group address for which reception has been requested.
Definition: igmp_group.h:56
u64 uword
Definition: types.h:112
enum igmp_mode_t_ igmp_mode_t
vl_api_gbp_vxlan_tunnel_mode_t mode
Definition: gbp.api:349
igmp_proxy_device_t * proxy_devices
pool of proxy devices
Definition: igmp.h:114
struct igmp_main_t_ igmp_main_t
collection of data related to IGMP
uword * igmp_api_client_by_client_index
Definition: igmp.h:70
igmp_src_t * srcs
pool of sources
Definition: igmp.h:104
IGMP source The representation of a specified source address with in multicast group.
Definition: igmp_src.h:41