IGMP improvements
[vpp.git] / src / plugins / igmp / igmp_pkt.h
1 /*
2  *------------------------------------------------------------------
3  * Copyright (c) 2017 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_PKT_H__
19 #define __IGMP_PKT_H__
20
21 #include <igmp/igmp.h>
22
23 typedef struct igmp_pkt_build_t_
24 {
25   u32 *buffers;
26   u32 sw_if_index;
27   u32 n_avail;
28   u32 n_bytes;
29 } igmp_pkt_build_t;
30
31 typedef struct igmp_pkt_build_report_t_
32 {
33   igmp_pkt_build_t base;
34   u32 n_groups;
35   u16 n_srcs;
36 } igmp_pkt_build_report_t;
37
38 extern void igmp_pkt_build_report_init (igmp_pkt_build_report_t * br,
39                                         u32 sw_if_index);
40
41 extern void igmp_pkt_report_v3_add_report (igmp_pkt_build_report_t * br,
42                                            const ip46_address_t * grp,
43                                            const ip46_address_t * srcs,
44                                            igmp_membership_group_v3_type_t
45                                            type);
46
47 extern void igmp_pkt_report_v3_add_group (igmp_pkt_build_report_t * br,
48                                           const igmp_group_t * group,
49                                           igmp_membership_group_v3_type_t
50                                           type);
51
52 extern void igmp_pkt_report_v3_send (igmp_pkt_build_report_t * br);
53
54
55 typedef struct igmp_pkt_build_query_t_
56 {
57   igmp_pkt_build_t base;
58   u32 n_srcs;
59 } igmp_pkt_build_query_t;
60
61 extern void igmp_pkt_build_query_init (igmp_pkt_build_query_t * bq,
62                                        u32 sw_if_index);
63
64 extern void igmp_pkt_query_v3_add_group (igmp_pkt_build_query_t * bq,
65                                          const igmp_group_t * group,
66                                          const ip46_address_t * srcs);
67
68 extern void igmp_pkt_query_v3_send (igmp_pkt_build_query_t * bq);
69
70 #endif
71
72 /*
73  * fd.io coding-style-patch-verification: ON
74  *
75  * Local Variables:
76  * eval: (c-set-style "gnu")
77  * End:
78  */