FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
igmp_config.h
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * Copyright (c) 2018 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_CONFIG_H__
19 #define __IGMP_CONFIG_H__
20 
21 #include <igmp/igmp_types.h>
22 #include <igmp/igmp_timer.h>
23 #include <igmp/igmp_group.h>
24 
25 /**
26  * GENERAL_REPORT = On expiry send a general report
27  * GENERAL_QUERY = On expiry send a general query
28  */
29 #define foreach_igmp_config_timer_type \
30  _(GENERAL_REPORT, "general-report") \
31  _(GENERAL_QUERY, "general-query")
32 
34 {
35 #define _(v,s) IGMP_CONFIG_TIMER_##v,
37 #undef _
39 
40 #define IGMP_CONFIG_N_TIMERS (IGMP_CONFIG_TIMER_GENERAL_QUERY + 1)
41 
42 extern u8 *format_igmp_config_timer_type (u8 * s, va_list * args);
43 
44 /**
45  * @brief IGMP interface configuration
46 */
47 typedef struct igmp_config_t_
48 {
49  /**
50  * @param sw_if_index - interface sw_if_index
51  */
53 
54  /**
55  * @param adj_index - multicast adjacency index on the link
56  */
58 
59  /**
60  * @param mode - host or router
61  */
63 
64  /**
65  * Robustness variable (section 5.1)
66  */
68 
69  /**
70  * Database of groups joined on the link
71  */
73 
74  /**
75  * A vector of scheduled query-response timers
76  */
78 
79  /**
80  * ID of a proxy device this configuration is on
81  */
84 
85 #define FOR_EACH_GROUP(_group, _config, _body) \
86 do { \
87  igmp_key_t *__key__; \
88  u32 __gid__; \
89  hash_foreach_mem(__key__, __gid__, _config->igmp_group_by_key, \
90  ({ \
91  _group = pool_elt_at_index(igmp_main.groups, __gid__); \
92  do { _body; } while (0); \
93  })); \
94  } while (0);
95 
96 /**
97  * @brief igmp clear config
98  * @param config - igmp configuration
99  *
100  * Clear all (S,G)s on specified config and remove this config from pool.
101  */
102 extern void igmp_clear_config (igmp_config_t * config);
103 
104 /**
105  * @brief igmp config lookup
106  * @param sw_if_index - interface sw_if_index
107  */
109 
110 /**
111  * Get the pool index for a config
112  */
113 extern u32 igmp_config_index (const igmp_config_t * c);
114 
115 /**
116  * Get the config from the pool index
117  */
119 
120 /**
121  * @brief igmp group lookup
122  * @param config - igmp configuration
123  * @param key - igmp key
124 */
126  const igmp_key_t * key);
127 
128 extern u8 *format_igmp_config (u8 * s, va_list * args);
129 
130 #endif
131 
132 /*
133  * fd.io coding-style-patch-verification: ON
134  *
135  * Local Variables:
136  * eval: (c-set-style "gnu")
137  * End:
138  */
igmp_mode_t
enum igmp_mode_t_ igmp_mode_t
igmp_group.h
format_igmp_config_timer_type
u8 * format_igmp_config_timer_type(u8 *s, va_list *args)
Definition: igmp_config.c:91
igmp_timer.h
igmp_config_t_
IGMP interface configuration.
Definition: igmp_config.h:47
igmp_config_t_::sw_if_index
u32 sw_if_index
Definition: igmp_config.h:52
igmp_group_t_
IGMP group A multicast group address for which reception has been requested.
Definition: igmp_group.h:56
igmp_types.h
key
typedef key
Definition: ipsec_types.api:88
igmp_clear_config
void igmp_clear_config(igmp_config_t *config)
igmp clear config
Definition: igmp_config.c:22
IGMP_CONFIG_N_TIMERS
#define IGMP_CONFIG_N_TIMERS
Definition: igmp_config.h:40
igmp_group_lookup
igmp_group_t * igmp_group_lookup(igmp_config_t *config, const igmp_key_t *key)
igmp group lookup
Definition: igmp_config.c:76
igmp_config_t_::timers
igmp_timer_id_t timers[IGMP_CONFIG_N_TIMERS]
A vector of scheduled query-response timers.
Definition: igmp_config.h:77
igmp_config_t_::adj_index
adj_index_t adj_index
Definition: igmp_config.h:57
foreach_igmp_config_timer_type
#define foreach_igmp_config_timer_type
GENERAL_REPORT = On expiry send a general report GENERAL_QUERY = On expiry send a general query.
Definition: igmp_config.h:29
igmp_config_t_::robustness_var
u8 robustness_var
Robustness variable (section 5.1)
Definition: igmp_config.h:67
c
svmdb_client_t * c
Definition: vpp_get_metrics.c:48
igmp_config_t_::proxy_device_id
u32 proxy_device_id
ID of a proxy device this configuration is on.
Definition: igmp_config.h:82
uword
u64 uword
Definition: types.h:112
index
u32 index
Definition: flow_types.api:221
igmp_config_lookup
igmp_config_t * igmp_config_lookup(u32 sw_if_index)
igmp config lookup
Definition: igmp_config.c:45
igmp_config_get
igmp_config_t * igmp_config_get(u32 index)
Get the config from the pool index.
Definition: igmp_config.c:70
igmp_config_t_::mode
igmp_mode_t mode
Definition: igmp_config.h:62
u32
unsigned int u32
Definition: types.h:88
igmp_config_t_::igmp_group_by_key
uword * igmp_group_by_key
Database of groups joined on the link.
Definition: igmp_config.h:72
igmp_timer_id_t
u32 igmp_timer_id_t
The id of a running timer.
Definition: igmp_timer.h:26
adj_index_t
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
u8
unsigned char u8
Definition: types.h:56
igmp_config_index
u32 igmp_config_index(const igmp_config_t *c)
Get the pool index for a config.
Definition: igmp_config.c:64
igmp_config_timer_type_t
enum igmp_config_timer_type_t_ igmp_config_timer_type_t
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
format_igmp_config
u8 * format_igmp_config(u8 *s, va_list *args)
Definition: igmp_config.c:106
igmp_config_t
struct igmp_config_t_ igmp_config_t
IGMP interface configuration.
igmp_config_timer_type_t_
igmp_config_timer_type_t_
Definition: igmp_config.h:33
igmp_key_t
ip46_address_t igmp_key_t
IGMP Key Used to index groups within an interface config and sources within a list.
Definition: igmp_types.h:49