IGMP: proxy device
[vpp.git] / src / plugins / igmp / igmp_src.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_SOURCE_H__
19 #define __IGMP_SOURCE_H__
20
21 #include <igmp/igmp_types.h>
22
23 /**
24  * IGMP Source timers
25  */
26 typedef enum igmp_src_timer_t_
27 {
28   /**
29    * On expiry the source has not been refreshed by a query
30    * and can now be reaped
31    */
32   IGMP_SRC_TIMER_EXP,
33 } igmp_src_timer_t;
34
35 #define IGMP_SRC_N_TIMERS (IGMP_SRC_TIMER_EXP + 1)
36
37 /**
38  *  @brief IGMP source
39  *  The representation of a specified source address with in multicast group.
40  */
41 typedef struct igmp_src_t_
42 {
43   /**
44    * The source's key
45    */
46   igmp_key_t *key;
47
48   /**
49    * The liveness timer. Reset with each received report. on expiry
50    * the source is removed from the group.
51    */
52   u32 exp_timer;
53
54   /**
55    * The group this source is on
56    */
57   u32 group;
58
59   /**
60    * the mode that provided this source
61    */
62   igmp_mode_t mode;
63
64   /**
65    * Timers
66    */
67   u32 timers[IGMP_SRC_N_TIMERS];
68
69   /**
70    * Tells us which configurations
71    * have this source.
72    */
73   u8 *referance_by_config_index;
74 } igmp_src_t;
75
76 extern void igmp_src_free (igmp_src_t * src);
77
78 extern igmp_src_t *igmp_src_alloc (u32 group_index,
79                                    const igmp_key_t * skey, igmp_mode_t mode);
80
81 extern u32 igmp_src_index (igmp_src_t * src);
82
83 extern void igmp_src_refresh (igmp_src_t * src);
84 extern void igmp_src_blocked (igmp_src_t * src);
85
86 #endif
87
88 /*
89  * fd.io coding-style-patch-verification: ON
90  *
91  * Local Variables:
92  * eval: (c-set-style "gnu")
93  * End:
94  */