FD.io VPP  v18.10-32-g1161dda
Vector Packet Processing
igmp_group.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_GROUP_H__
19 #define __IGMP_GROUP_H__
20 
21 #include <igmp/igmp_types.h>
22 #include <igmp/igmp_src.h>
23 
24 /**
25  * Types of timers maintained for each group
26  */
28 {
29  /**
30  * Timer running to reply to a G/SG specific query
31  */
33  /**
34  * wait for response from a sent G/SG specific query.
35  * Sent when a host leaves a group
36  */
38  /**
39  * Timer running to resend report
40  */
42  /**
43  * filter-mode change timer, to check if the group can swap to
44  * INCLUDE mode (section 6.2.2)
45  */
48 
49 #define IGMP_GROUP_N_TIMERS (IGMP_GROUP_TIMER_FILTER_MODE_CHANGE + 1)
50 
51 /**
52  * @brief IGMP group
53  * A multicast group address for which reception has been requested.
54  */
55 typedef struct igmp_group_t_
56 {
57  /** The group's key within the per-interface config */
59 
60  /**
61  * A vector of running timers for the group. this can include:
62  * - group-specific query, sent on reception of a host 'leave'
63  * - filter-mode change timer, to check if the group can swap to
64  * INCLUDE mode (section 6.2.2)
65  */
67 
68  /**
69  * The current filter mode of the group (see 6.2.1)
70  */
72 
73  /**
74  * The pool index of the config object this group is in
75  */
77 
78  /**
79  * The number of times the last report has been sent
80  */
82 
83  /**
84  * Source list per-filter mode
85  */
87 } igmp_group_t;
88 
89 #define FOR_EACH_SRC(_src, _group, _filter, _body) \
90 do { \
91  igmp_key_t *__key__; \
92  u32 __sid__; \
93  hash_foreach_mem(__key__, __sid__, ((igmp_group_t*)_group)->igmp_src_by_key[(_filter)], \
94  ({ \
95  _src = pool_elt_at_index(igmp_main.srcs, __sid__); \
96  do { _body; } while (0); \
97  })); \
98  } while (0);
99 
100 /**
101  * Forward declarations
102  */
103 struct igmp_config_t_;
104 
105 extern void igmp_group_clear (igmp_group_t * group);
106 extern void igmp_group_free_all_srcs (igmp_group_t * group);
107 
109  const igmp_key_t * gkey,
111 
113  const igmp_key_t * skey,
114  igmp_mode_t mode);
115 
116 extern void igmp_group_src_remove (igmp_group_t * group, igmp_src_t * src);
117 
118 extern ip46_address_t *igmp_group_present_minus_new (igmp_group_t * group,
120  const ip46_address_t *
121  saddrs);
122 
123 extern ip46_address_t *igmp_group_new_minus_present (igmp_group_t * group,
125  const ip46_address_t *
126  saddrs);
127 
128 extern ip46_address_t *igmp_group_new_intersect_present (igmp_group_t * group,
130  mode,
131  const ip46_address_t
132  * saddrs);
133 
134 extern u32 igmp_group_n_srcs (const igmp_group_t * group,
136 
137 
138 /** \brief igmp group lookup
139  @param group - igmp group
140  @param key - igmp key
141 */
142 extern igmp_src_t *igmp_src_lookup (igmp_group_t * group,
143  const igmp_key_t * key);
144 
145 extern u32 igmp_group_index (const igmp_group_t * g);
146 extern igmp_group_t *igmp_group_get (u32 index);
147 
148 #endif
149 
150 /*
151  * fd.io coding-style-patch-verification: ON
152  *
153  * Local Variables:
154  * eval: (c-set-style "gnu")
155  * End:
156  */
u32 igmp_group_index(const igmp_group_t *g)
Definition: igmp_group.c:255
vl_api_address_t src
Definition: vxlan_gbp.api:33
filter-mode change timer, to check if the group can swap to INCLUDE mode (section 6...
Definition: igmp_group.h:46
Timer running to resend report.
Definition: igmp_group.h:41
void igmp_group_free_all_srcs(igmp_group_t *group)
Definition: igmp_group.c:22
igmp_group_t * igmp_group_get(u32 index)
Definition: igmp_group.c:261
enum igmp_group_timer_type_t_ igmp_group_timer_type_t
Types of timers maintained for each group.
struct igmp_group_t_ igmp_group_t
IGMP group A multicast group address for which reception has been requested.
#define IGMP_N_FILTER_MODES
Definition: igmp_types.h:67
u32 n_reports_sent
The number of times the last report has been sent.
Definition: igmp_group.h:81
unsigned int u32
Definition: types.h:88
igmp_group_t * igmp_group_alloc(struct igmp_config_t_ *config, const igmp_key_t *gkey, igmp_filter_mode_t mode)
Definition: igmp_group.c:95
void igmp_group_src_remove(igmp_group_t *group, igmp_src_t *src)
Definition: igmp_group.c:38
u32 config
The pool index of the config object this group is in.
Definition: igmp_group.h:76
igmp_src_t * igmp_src_lookup(igmp_group_t *group, const igmp_key_t *key)
igmp group lookup
Definition: igmp_group.c:240
igmp_src_t * igmp_group_src_update(igmp_group_t *group, const igmp_key_t *skey, igmp_mode_t mode)
Definition: igmp_group.c:45
Timer running to reply to a G/SG specific query.
Definition: igmp_group.h:32
u32 timers[IGMP_GROUP_N_TIMERS]
A vector of running timers for the group.
Definition: igmp_group.h:66
wait for response from a sent G/SG specific query.
Definition: igmp_group.h:37
ip46_address_t * igmp_group_new_intersect_present(igmp_group_t *group, igmp_filter_mode_t mode, const ip46_address_t *saddrs)
Definition: igmp_group.c:205
enum igmp_filter_mode_t_ igmp_filter_mode_t
#define IGMP_GROUP_N_TIMERS
Definition: igmp_group.h:49
void igmp_group_clear(igmp_group_t *group)
Definition: igmp_group.c:68
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
igmp_group_timer_type_t_
Types of timers maintained for each group.
Definition: igmp_group.h:27
igmp_filter_mode_t router_filter_mode
The current filter mode of the group (see 6.2.1)
Definition: igmp_group.h:71
IGMP interface configuration.
Definition: igmp_config.h:43
igmp_key_t * key
The group&#39;s key within the per-interface config.
Definition: igmp_group.h:58
IGMP group A multicast group address for which reception has been requested.
Definition: igmp_group.h:55
u64 uword
Definition: types.h:112
enum igmp_mode_t_ igmp_mode_t
ip46_address_t * igmp_group_present_minus_new(igmp_group_t *group, igmp_filter_mode_t mode, const ip46_address_t *saddrs)
the set of present sources minus the new set
Definition: igmp_group.c:126
igmp_mode_t mode
Definition: igmp_config.h:58
uword * igmp_src_by_key[IGMP_N_FILTER_MODES]
Source list per-filter mode.
Definition: igmp_group.h:86
ip46_address_t * igmp_group_new_minus_present(igmp_group_t *group, igmp_filter_mode_t mode, const ip46_address_t *saddrs)
the set of new sources minus the present set
Definition: igmp_group.c:172
IGMP source The representation of a specified source address with in multicast group.
Definition: igmp_src.h:41
u32 igmp_group_n_srcs(const igmp_group_t *group, igmp_filter_mode_t mode)
Definition: igmp_group.c:233