2a2e68030f6810633d0d87147b03eb878501e925
[vpp.git] / src / plugins / igmp / igmp.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  *------------------------------------------------------------------
4  * Copyright (c) 2017 Cisco and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *------------------------------------------------------------------
17  */
18
19 option version = "1.0.0";
20 import "vnet/ip/ip_types.api";
21
22 /**
23  * @brief Filter mode
24  */
25 enum filter_mode {
26   EXCLUDE = 0,
27   INCLUDE = 1,
28 };
29
30
31 /**
32  * @brief
33  *   Used by a 'host' to enable the reception/listening of packets for a specific
34  *   multicast group
35  *
36  *  For each socket on which IPMulticastListen has been invoked, the
37  *  system records the desired multicast reception state for that socket.
38  *  That state conceptually consists of a set of records of the form:
39  *
40  *     (interface, multicast-address, filter-mode, source-list)
41  *
42  *  The socket state evolves in response to each invocation of
43  *  IPMulticastListen on the socket, as follows:
44  *
45  *  o If the requested filter mode is INCLUDE *and* the requested source
46  *    list is empty, then the entry corresponding to the requested
47  *    interface and multicast address is deleted if present.  If no such
48  *    entry is present, the request is ignored.
49  *
50  *  o If the requested filter mode is EXCLUDE *or* the requested source
51  *    list is non-empty, then the entry corresponding to the requested
52  *    interface and multicast address, if present, is changed to contain
53  *    the requested filter mode and source list.  If no such entry is
54  *    present, a new entry is created, using the parameters specified in
55  *    the request.
56  *
57  *   @param client_index - opaque cookie to identify the sender
58  *   @param context - sender context, to match reply w/ request
59  *   @param sw_if_index - interface sw index
60  *   @param filter - filter mode
61  *   @param saddr - source address
62  *   @param gaddr - group address
63  */
64 typeonly define igmp_group
65 {
66   vl_api_filter_mode_t filter;
67   u8 n_srcs;
68   u32 sw_if_index;
69   vl_api_ip4_address_t gaddr;
70   vl_api_ip4_address_t saddrs[n_srcs];
71 };
72 autoreply define igmp_listen
73 {
74   u32 client_index;
75   u32 context;
76
77   vl_api_igmp_group_t group;
78 };
79
80 /**
81  * @brief
82  *   Used by a 'router' and 'host' to enable the reception of IGMP packets.
83  *   For hosts this must be called once before igmp_listen.
84  *
85  *   @param client_index - opaque cookie to identify the sender
86  *   @param context - sender context, to match reply w/ request
87  *   @param enable - if set, enable igmp messages on configuration
88  *   @param mode - Host (1) or router (0) mode
89  *   @param sw_if_index - interface sw index
90  */
91 autoreply define igmp_enable_disable
92 {
93   u32 client_index;
94   u32 context;
95
96   u8 enable;
97   u8 mode;
98   u32 sw_if_index;
99 };
100
101 /**
102  * @brief dump (S,G)s from interface
103  * @param client_index - opaque cookie to identify the sender
104  * @param context - sender context, to match reply w/ request
105  * @param sw_if_index - interface sw index (~0 for all)
106 */
107 define igmp_dump
108 {
109   u32 client_index;
110   u32 context;
111
112   u32 sw_if_index;
113 };
114
115 /**
116  * @brief igmp details
117  * @param context - sender context, to match reply w/ request
118  * @param sw_if_index - interface sw index
119  * @param saddr - source address
120  * @param gaddr - group address
121  */
122 define igmp_details
123 {
124   u32 context;
125
126   u32 sw_if_index;
127   vl_api_ip4_address_t saddr;
128   vl_api_ip4_address_t gaddr;
129 };
130
131 /** \brief remove all (S,G)s from an interface
132     @param client_index - opaque cookie to identify the sender
133     @param context - sender context, to match reply w/ request
134     @param sw_if_index - interface sw index
135 */
136 autoreply define igmp_clear_interface
137 {
138   u32 client_index;
139   u32 context;
140
141   u32 sw_if_index;
142 };
143
144 /**
145  * @brief register for igmp events
146  * @param client_index - opaque cookie to identify the sender
147  * @param context - sender context, to match reply w/ request
148  * @param pid - sender's pid
149  * @param enable - 1 enable, 0 disable igmp events
150  */
151 autoreply define want_igmp_events
152 {
153   u32 client_index;
154   u32 context;
155
156   u32 enable;
157   u32 pid;
158 };
159
160 service {
161   rpc want_igmp_events returns want_igmp_events_reply
162     events igmp_event;
163 };
164
165 /**
166  * @brief igmp event details
167  * @param client_index - opaque cookie to identify the sender
168  * @param context - sender context, to match reply w/ request
169  * @param sw_if_index - interface sw index
170  * @param saddr - source address
171  * @param gaddr - group address
172  *@param filter - filter mode
173  */
174 define igmp_event
175 {
176   u32 context;
177
178   u32 sw_if_index;
179   vl_api_filter_mode_t filter;
180   vl_api_ip4_address_t saddr;
181   vl_api_ip4_address_t gaddr;
182 };
183
184 /**
185  * @brief enum to specify either ASM or SSM semantics
186  */
187 enum group_prefix_type
188 {
189   ASM = 0,
190   SSM = 1,
191 };
192
193 /**
194  * @brief Definition of a Group prefix and its type
195  */
196 typedef group_prefix
197 {
198   vl_api_group_prefix_type_t type;
199   vl_api_prefix_t prefix;
200 };
201
202 /**
203  * @brief Configure a prefix for SSM or ASM semantics
204  * @param address - Prefix address
205  * @param address_length - Prefix length
206  */
207 autoreply define igmp_group_prefix_set
208 {
209   u32 client_index;
210   u32 context;
211
212   vl_api_group_prefix_t gp;
213 };
214
215 define igmp_group_prefix_dump
216 {
217   u32 client_index;
218   u32 context;
219 };
220
221 define igmp_group_prefix_details
222 {
223   u32 context;
224
225   vl_api_group_prefix_t gp;
226 };
227
228
229 /*
230  * Local Variables:
231  * eval: (c-set-style "gnu")
232  * End:
233  */