FD.io VPP  v18.10-34-gcce845e
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 
26 {
27  /**
28  * On expiry send a general report
29  */
31 
32  /**
33  * On expiry send a general query
34  */
37 
38 #define IGMP_CONFIG_N_TIMERS (IGMP_CONFIG_TIMER_GENERAL_QUERY + 1)
39 
40 /**
41  * @brief IGMP interface configuration
42 */
43 typedef struct igmp_config_t_
44 {
45  /**
46  * @param sw_if_index - interface sw_if_index
47  */
49 
50  /**
51  * @param adj_index - multicast adjacency index on the link
52  */
54 
55  /**
56  * @param moe - host or router
57  */
59 
60  /**
61  * Robustness variable (section 5.1)
62  */
64 
65  /**
66  * Database of groups joined on the link
67  */
69 
70  /**
71  * A vector of scheduled query-response timers
72  */
75 
76 #define FOR_EACH_GROUP(_group, _config, _body) \
77 do { \
78  igmp_key_t *__key__; \
79  u32 __gid__; \
80  hash_foreach_mem(__key__, __gid__, _config->igmp_group_by_key, \
81  ({ \
82  _group = pool_elt_at_index(igmp_main.groups, __gid__); \
83  do { _body; } while (0); \
84  })); \
85  } while (0);
86 
87 /**
88  * @brief igmp clear config
89  * @param config - igmp configuration
90  *
91  * Clear all (S,G)s on specified config and remove this config from pool.
92  */
93 extern void igmp_clear_config (igmp_config_t * config);
94 
95 /**
96  * @brief igmp config lookup
97  * @param im - igmp main
98  * @param sw_if_index - interface sw_if_index
99  */
101 
102 /**
103  * Get the pool index for a config
104  */
105 extern u32 igmp_config_index (const igmp_config_t * c);
106 
107 /**
108  * Get the config from the pool index
109  */
110 extern igmp_config_t *igmp_config_get (u32 index);
111 
112 /**
113  * @brief igmp group lookup
114  * @param config - igmp configuration
115  * @param key - igmp key
116 */
118  const igmp_key_t * key);
119 
120 #endif
121 
122 /*
123  * fd.io coding-style-patch-verification: ON
124  *
125  * Local Variables:
126  * eval: (c-set-style "gnu")
127  * End:
128  */
igmp_timer_id_t timers[IGMP_CONFIG_N_TIMERS]
A vector of scheduled query-response timers.
Definition: igmp_config.h:73
igmp_group_t * igmp_group_lookup(igmp_config_t *config, const igmp_key_t *key)
igmp group lookup
Definition: igmp_config.c:76
struct igmp_config_t_ igmp_config_t
IGMP interface configuration.
adj_index_t adj_index
Definition: igmp_config.h:53
unsigned char u8
Definition: types.h:56
enum igmp_config_timer_type_t_ igmp_config_timer_type_t
unsigned int u32
Definition: types.h:88
uword * igmp_group_by_key
Database of groups joined on the link.
Definition: igmp_config.h:68
#define IGMP_CONFIG_N_TIMERS
Definition: igmp_config.h:38
u32 igmp_timer_id_t
The id of a running timer.
Definition: igmp_timer.h:26
svmdb_client_t * c
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
On expiry send a general report.
Definition: igmp_config.h:30
void igmp_clear_config(igmp_config_t *config)
igmp clear config
Definition: igmp_config.c:22
u32 igmp_config_index(const igmp_config_t *c)
Get the pool index for a config.
Definition: igmp_config.c:64
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
u8 robustness_var
Robustness variable (section 5.1)
Definition: igmp_config.h:63
IGMP interface configuration.
Definition: igmp_config.h:43
igmp_config_t * igmp_config_lookup(u32 sw_if_index)
igmp config lookup
Definition: igmp_config.c:45
IGMP group A multicast group address for which reception has been requested.
Definition: igmp_group.h:55
u64 uword
Definition: types.h:112
igmp_config_timer_type_t_
Definition: igmp_config.h:25
enum igmp_mode_t_ igmp_mode_t
On expiry send a general query.
Definition: igmp_config.h:35
igmp_mode_t mode
Definition: igmp_config.h:58
igmp_config_t * igmp_config_get(u32 index)
Get the config from the pool index.
Definition: igmp_config.c:70