IGMP improvements
[vpp.git] / src / plugins / igmp / igmp_types.h
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_TYPES_H__
19 #define __IGMP_TYPES_H__
20
21 #include <vnet/ip/ip.h>
22
23 /** \brief IGMP source - where to the request for state arrive from
24  *  host - from an API/CLI command to add the state
25  *  network - from a received report
26  * Each source could be mode from both modes, so these are flags.
27  */
28 #define foreach_igmp_mode       \
29   _ (1, HOST)                   \
30   _ (2, ROUTER)                 \
31
32 typedef enum igmp_mode_t_
33 {
34 #define _(n,f) IGMP_MODE_##f = n,
35   foreach_igmp_mode
36 #undef _
37 } igmp_mode_t;
38
39 typedef enum igmp_msg_type_t_
40 {
41   IGMP_MSG_REPORT,
42   IGMP_MSG_QUERY,
43 } igmp_msg_type_t;
44
45 /**
46  * @brief IGMP Key
47  *  Used to index groups within an interface config and sources within a list
48  */
49 typedef ip46_address_t igmp_key_t;
50
51 /**
52  * @brief IGMP filter mode
53  * Exclude all source address except this one
54  * Include only this source address
55  */
56 #define foreach_igmp_filter_mode        \
57   _ (1, INCLUDE)                        \
58   _ (0, EXCLUDE)                        \
59
60 typedef enum igmp_filter_mode_t_
61 {
62 #define _(n,f) IGMP_FILTER_MODE_##f = n,
63   foreach_igmp_filter_mode
64 #undef _
65 } igmp_filter_mode_t;
66
67 #define IGMP_N_FILTER_MODES 2
68
69 /*
70  * fd.io coding-style-patch-verification: ON
71  *
72  * Local Variables:
73  * eval: (c-set-style "gnu")
74  * End:
75  */
76
77 #endif