FD.io VPP  v18.04-17-g3a0d853
Vector Packet Processing
igmp_packet.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 /*
16  * igmp_packet.h: igmp packet format
17  *
18  * Copyright (c) 2011 Eliot Dresselhaus
19  *
20  * Permission is hereby granted, free of charge, to any person obtaining
21  * a copy of this software and associated documentation files (the
22  * "Software"), to deal in the Software without restriction, including
23  * without limitation the rights to use, copy, modify, merge, publish,
24  * distribute, sublicense, and/or sell copies of the Software, and to
25  * permit persons to whom the Software is furnished to do so, subject to
26  * the following conditions:
27  *
28  * The above copyright notice and this permission notice shall be
29  * included in all copies or substantial portions of the Software.
30  *
31  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
35  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
36  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
37  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38  */
39 
40 #ifndef included_vnet_igmp_packet_h
41 #define included_vnet_igmp_packet_h
42 
43 #include <vnet/ip/ip4_packet.h>
44 #include <vnet/ip/ip6_packet.h>
45 
46 #define foreach_igmp_type \
47  _ (0x11, membership_query) \
48  _ (0x12, membership_report_v1) \
49  _ (0x13, dvmrp) \
50  _ (0x14, pim_v1) \
51  _ (0x15, cisco_trace) \
52  _ (0x16, membership_report_v2) \
53  _ (0x17, leave_group_v2) \
54  _ (0x1e, traceroute_response) \
55  _ (0x1f, traceroute_request) \
56  _ (0x22, membership_report_v3) \
57  _ (0x30, router_advertisement) \
58  _ (0x31, router_solicitation) \
59  _ (0x32, router_termination)
60 
61 typedef enum
62 {
63 #define _(n,f) IGMP_TYPE_##f = n,
65 #undef _
66 } igmp_type_t;
67 
68 typedef struct
69 {
70  igmp_type_t type:8;
71 
73 
76 
77 typedef struct
78 {
79  /* membership_query, version <= 2 reports. */
81 
82  /* Multicast destination address. */
85 
86 typedef struct
87 {
88  /* type 0x11 (IGMPv3) */
90 
92 
93  /* Reserved, Suppress Router-Side Processing flag and
94  Querier's Robustness Variable RRRRSQQQ. */
96 
97  /* Querier's Query Interval Code */
99 
101  ip4_address_t src_addresses[0];
103 
104 #define foreach_igmp_membership_group_v3_type \
105  _ (1, mode_is_filter_include) \
106  _ (2, mode_is_filter_exclude) \
107  _ (3, change_to_filter_include) \
108  _ (4, change_to_filter_exclude) \
109  _ (5, allow_new_sources) \
110  _ (6, block_old_sources)
111 
112 typedef enum
113 {
114 #define _(n,f) IGMP_MEMBERSHIP_GROUP_##f = n,
116 #undef _
118 
119 typedef struct
120 {
122 
123  /* Number of 32 bit words of aux data after source addresses. */
125 
126  /* Number of source addresses that follow. */
128 
129  /* Destination multicast address. */
131 
132  ip4_address_t src_addresses[0];
134 
137 {
138  return ((void *) g
139  + g->n_src_addresses * sizeof (g->src_addresses[0])
140  + g->n_aux_u32s * sizeof (u32));
141 }
142 
143 typedef struct
144 {
145  /* Type 0x22. */
147 
149 
150  /* Number of groups which follow. */
152 
155 
156 /* IP6 flavor of IGMP is called MLD which is embedded in ICMP6. */
157 typedef struct
158 {
159  /* Preceeded by ICMP v6 header. */
163 } mld_header_t;
164 
165 #endif /* included_vnet_igmp_packet_h */
166 
167 /*
168  * fd.io coding-style-patch-verification: ON
169  *
170  * Local Variables:
171  * eval: (c-set-style "gnu")
172  * End:
173  */
static igmp_membership_group_v3_t * igmp_membership_group_v3_next(igmp_membership_group_v3_t *g)
Definition: igmp_packet.h:136
igmp_membership_group_v3_type_t
Definition: igmp_packet.h:112
#define foreach_igmp_membership_group_v3_type
Definition: igmp_packet.h:104
#define always_inline
Definition: clib.h:92
ip6_address_t dst
Definition: igmp_packet.h:162
igmp_header_t header
Definition: igmp_packet.h:80
#define foreach_igmp_type
Definition: igmp_packet.h:46
unsigned int u32
Definition: types.h:88
unsigned short u16
Definition: types.h:57
unsigned char u8
Definition: types.h:56
u16 max_response_delay_in_milliseconds
Definition: igmp_packet.h:160
ip4_address_t src_addresses[0]
Definition: igmp_packet.h:132
igmp_type_t
Definition: igmp_packet.h:61
ip4_address_t dst
Definition: igmp_packet.h:83