api acl: breakout acl_types.api for reuse by others
[vpp.git] / src / plugins / acl / acl.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2016 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 /** \file
18     This file defines the vpp control-plane API messages
19     used to control the ACL plugin
20 */
21
22 option version = "1.0.1";
23
24 import "plugins/acl/acl_types.api";
25
26 /** \brief Get the plugin version
27     @param client_index - opaque cookie to identify the sender
28     @param context - sender context, to match reply w/ request
29 */
30
31 define acl_plugin_get_version
32 {
33   u32 client_index;
34   u32 context;
35 };
36
37 /** \brief Reply to get the plugin version
38     @param context - returned sender context, to match reply w/ request
39     @param major - Incremented every time a known breaking behavior change is introduced
40     @param minor - Incremented with small changes, may be used to avoid buggy versions
41 */
42
43 define acl_plugin_get_version_reply
44 {
45   u32 context;
46   u32 major;
47   u32 minor;
48 };
49
50 /** \brief Control ping from client to api server request
51     @param client_index - opaque cookie to identify the sender
52     @param context - sender context, to match reply w/ request
53 */
54 define acl_plugin_control_ping
55 {
56   u32 client_index;
57   u32 context;
58 };
59
60 /** \brief Control ping from the client to the server response
61     @param client_index - opaque cookie to identify the sender
62     @param context - sender context, to match reply w/ request
63     @param retval - return code for the request
64     @param vpe_pid - the pid of the vpe, returned by the server
65 */
66 define acl_plugin_control_ping_reply
67 {
68   u32 context;
69   i32 retval;
70   u32 client_index;
71   u32 vpe_pid;
72 };
73
74 /** \brief Get Connection table max entries
75     @param client_index - opaque cookie to identify the sender
76     @param context - sender context, to match reply w/ request
77 */
78
79 define acl_plugin_get_conn_table_max_entries
80 {
81   u32 client_index;
82   u32 context;
83 };
84
85 /** \brief Reply to get connection table max entries
86     @param context - sender context, to match reply w/ request
87     @param conn_table_max_entries - the value of maximum entries of connection table
88 */
89 define acl_plugin_get_conn_table_max_entries_reply
90 {
91   u32 context;
92   u64 conn_table_max_entries;
93 };
94
95 /** \brief Replace an existing ACL in-place or create a new ACL
96     @param client_index - opaque cookie to identify the sender
97     @param context - sender context, to match reply w/ request
98     @param acl_index - an existing ACL entry (0..0xfffffffe) to replace, or 0xffffffff to make new ACL
99     @param tag - a string value stored along with the ACL, for descriptive purposes
100     @param count - number of ACL rules
101     @r - Rules for this access-list
102 */
103
104 manual_print manual_endian define acl_add_replace
105 {
106   u32 client_index;
107   u32 context;
108   u32 acl_index; /* ~0 to add, existing ACL# to replace */
109   u8 tag[64]; /* What gets in here gets out in the corresponding tag field when dumping the ACLs. */
110   u32 count;
111   vl_api_acl_rule_t r[count];
112 };
113
114 /** \brief Reply to add/replace ACL
115     @param context - returned sender context, to match reply w/ request
116     @param acl_index - index of the updated or newly created ACL
117     @param retval 0 - no error
118 */
119
120 define acl_add_replace_reply
121 {
122   u32 context;
123   u32 acl_index;
124   i32 retval;
125 };
126
127 /** \brief Delete an ACL
128     @param client_index - opaque cookie to identify the sender
129     @param context - sender context, to match reply w/ request
130     @param acl_index - ACL index to delete
131 */
132
133 autoreply manual_print define acl_del
134 {
135   u32 client_index;
136   u32 context;
137   u32 acl_index;
138 };
139
140 /* acl_interface_add_del(_reply) to be deprecated in lieu of acl_interface_set_acl_list */
141 /** \brief Use acl_interface_set_acl_list instead
142     Append/remove an ACL index to/from the list of ACLs checked for an interface
143     @param client_index - opaque cookie to identify the sender
144     @param context - sender context, to match reply w/ request
145     @param is_add - add or delete the ACL index from the list
146     @param is_input - check the ACL on input (1) or output (0)
147     @param sw_if_index - the interface to alter the list of ACLs on
148     @param acl_index - index of ACL for the operation
149 */
150
151 autoreply manual_print define acl_interface_add_del
152 {
153   u32 client_index;
154   u32 context;
155   u8 is_add;
156 /*
157  * is_input = 0 => ACL applied on interface egress
158  * is_input = 1 => ACL applied on interface ingress
159  */
160   u8 is_input;
161   u32 sw_if_index;
162   u32 acl_index;
163 };
164
165 /** \brief Set the vector of input/output ACLs checked for an interface
166     @param client_index - opaque cookie to identify the sender
167     @param context - sender context, to match reply w/ request
168     @param sw_if_index - the interface to alter the list of ACLs on
169     @param count - total number of ACL indices in the vector
170     @param n_input - this many first elements correspond to input ACLs, the rest - output
171     @param acls - vector of ACL indices
172 */
173
174 autoreply manual_print define acl_interface_set_acl_list
175 {
176   u32 client_index;
177   u32 context;
178   u32 sw_if_index;
179   u8 count;
180   u8 n_input; /* First n_input ACLs are set as a list of input ACLs, the rest are applied as output */
181   u32 acls[count];
182 };
183
184 /** \brief Reply to set the ACL list on an interface
185     @param context - returned sender context, to match reply w/ request
186     @param retval 0 - no error
187 */
188
189 /** \brief Dump the specific ACL contents or all of the ACLs' contents
190     @param client_index - opaque cookie to identify the sender
191     @param context - sender context, to match reply w/ request
192     @param acl_index - ACL index to dump, ~0 to dump all ACLs
193 */
194
195 define acl_dump
196 {
197   u32 client_index;
198   u32 context;
199   u32 acl_index; /* ~0 for all ACLs */
200 };
201
202 /** \brief Details about a single ACL contents
203     @param context - returned sender context, to match reply w/ request
204     @param acl_index - ACL index whose contents are being sent in this message
205     @param tag - Descriptive tag value which was supplied at ACL creation
206     @param count - Number of rules in this ACL
207     @param r - Array of rules within this ACL
208 */
209
210 manual_endian manual_print define acl_details
211 {
212   u32 context;
213   u32 acl_index;
214   u8 tag[64]; /* Same blob that was supplied to us when creating the ACL, one hopes. */
215   u32 count;
216   vl_api_acl_rule_t r[count];
217 };
218
219 /** \brief Dump the list(s) of ACL applied to specific or all interfaces
220     @param client_index - opaque cookie to identify the sender
221     @param context - sender context, to match reply w/ request
222     @param sw_if_index - interface to dump the ACL list for
223 */
224
225 define acl_interface_list_dump
226 {
227   u32 client_index;
228   u32 context;
229   u32 sw_if_index; /* ~0 for all interfaces */
230 };
231
232 /** \brief Details about a single ACL contents
233     @param context - returned sender context, to match reply w/ request
234     @param sw_if_index - interface for which the list of ACLs is applied
235     @param count - total length of acl indices vector
236     @param n_input - this many of indices in the beginning are input ACLs, the rest - output
237     @param acls - the vector of ACL indices
238 */
239
240 define acl_interface_list_details
241 {
242   u32 context;
243   u32 sw_if_index;
244   u8 count;
245   u8 n_input;
246   u32 acls[count];
247 };
248
249 /** \brief Add a MACIP ACL
250     @param client_index - opaque cookie to identify the sender
251     @param context - sender context, to match reply w/ request
252     @param tag - descriptive value for this MACIP ACL
253     @param count - number of rules in this MACIP ACL
254     @param r - vector of MACIP ACL rules
255 */
256
257 manual_endian manual_print define macip_acl_add
258 {
259   u32 client_index;
260   u32 context;
261   u8 tag[64];
262   u32 count;
263   vl_api_macip_acl_rule_t r[count];
264 };
265
266 /** \brief Reply to add MACIP ACL
267     @param context - returned sender context, to match reply w/ request
268     @param acl_index - index of the newly created MACIP ACL
269     @param retval 0 - no error
270 */
271
272 define macip_acl_add_reply
273 {
274   u32 context;
275   u32 acl_index;
276   i32 retval;
277 };
278
279 /** \brief Add/Replace a MACIP ACL
280     @param client_index - opaque cookie to identify the sender
281     @param context - sender context, to match reply w/ request
282     @param acl_index - an existing MACIP ACL entry (0..0xfffffffe) to replace, or 0xffffffff to make new MACIP ACL
283     @param tag - descriptive value for this MACIP ACL
284     @param count - number of rules in this MACIP ACL
285     @param r - vector of MACIP ACL rules
286 */
287
288 manual_endian manual_print define macip_acl_add_replace
289 {
290   u32 client_index;
291   u32 context;
292   u32 acl_index; /* ~0 to add, existing MACIP ACL# to replace */
293   u8 tag[64];
294   u32 count;
295   vl_api_macip_acl_rule_t r[count];
296 };
297
298 /** \brief Reply to add/replace MACIP ACL
299     @param context - returned sender context, to match reply w/ request
300     @param acl_index - index of the newly created MACIP ACL
301     @param retval 0 - no error
302 */
303
304 define macip_acl_add_replace_reply
305 {
306   u32 context;
307   u32 acl_index;
308   i32 retval;
309 };
310
311 /** \brief Delete a MACIP ACL
312     @param client_index - opaque cookie to identify the sender
313     @param context - sender context, to match reply w/ request
314     @param acl_index - MACIP ACL index to delete
315 */
316
317 autoreply manual_print define macip_acl_del
318 {
319   u32 client_index;
320   u32 context;
321   u32 acl_index;
322 };
323
324 /** \brief Add or delete a MACIP ACL to/from interface
325     @param client_index - opaque cookie to identify the sender
326     @param context - sender context, to match reply w/ request
327     @param is_add - add (1) or delete (0) MACIP ACL from being used on an interface
328     @param sw_if_index - interface to apply the action to
329     @param acl_index - MACIP ACL index
330 */
331
332 autoreply manual_print define macip_acl_interface_add_del
333 {
334   u32 client_index;
335   u32 context;
336   u8 is_add;
337   /* MACIP ACLs are always input */
338   u32 sw_if_index;
339   u32 acl_index;
340 };
341
342 /** \brief Dump one or all defined MACIP ACLs
343     @param client_index - opaque cookie to identify the sender
344     @param context - sender context, to match reply w/ request
345     @param acl_index - MACIP ACL index or ~0 to dump all MACIP ACLs
346 */
347
348 define macip_acl_dump
349 {
350   u32 client_index;
351   u32 context;
352   u32 acl_index; /* ~0 for all ACLs */
353 };
354
355 /** \brief Details about one MACIP ACL
356     @param context - returned sender context, to match reply w/ request
357     @param acl_index - index of this MACIP ACL
358     @param tag - descriptive tag which was supplied during the creation
359     @param count - length of the vector of MACIP ACL rules
360     @param r - rules comprising this MACIP ACL
361 */
362
363 manual_endian manual_print define macip_acl_details
364 {
365   u32 context;
366   u32 acl_index;
367   u8 tag[64];
368   u32 count;
369   vl_api_macip_acl_rule_t r[count];
370 };
371
372 /** \brief Get the vector of MACIP ACL IDs applied to the interfaces
373     @param client_index - opaque cookie to identify the sender
374     @param context - sender context, to match reply w/ request
375 */
376
377 define macip_acl_interface_get
378 {
379   u32 client_index;
380   u32 context;
381 };
382
383 /** \brief Reply with the vector of MACIP ACLs by sw_if_index
384     @param context - returned sender context, to match reply w/ request
385     @param count - total number of elements in the vector
386     @param acls - the vector of active MACIP ACL indices per sw_if_index
387 */
388
389 define macip_acl_interface_get_reply
390 {
391   u32 context;
392   u32 count;
393   u32 acls[count];
394 };
395
396 /** \brief Dump the list(s) of MACIP ACLs applied to specific or all interfaces
397     @param client_index - opaque cookie to identify the sender
398     @param context - sender context, to match reply w/ request
399     @param sw_if_index - interface to dump the MACIP ACL list for
400 */
401
402 define macip_acl_interface_list_dump
403 {
404   u32 client_index;
405   u32 context;
406   u32 sw_if_index; /* ~0 for all interfaces */
407 };
408
409 /** \brief Details about a single MACIP ACL contents
410     @param context - returned sender context, to match reply w/ request
411     @param sw_if_index - interface for which the list of MACIP ACLs is applied
412     @param count - total length of acl indices vector
413     @param acls - the vector of MACIP ACL indices
414 */
415
416 define macip_acl_interface_list_details
417 {
418   u32 context;
419   u32 sw_if_index;
420   u8 count;
421   u32 acls[count];
422 };
423
424 /** \brief Set the ethertype whitelists on an interface. Takes effect when applying ACLs on the interface, so must be given prior.
425     @param client_index - opaque cookie to identify the sender
426     @param context - sender context, to match reply w/ request
427     @param sw_if_index - the interface to alter the list of ACLs on
428     @param count - total number of whitelisted ethertypes in the vector
429     @param n_input - this many first elements correspond to input whitelisted ethertypes, the rest - output
430     @param whitelist - vector of whitelisted ethertypes
431 */
432
433 autoreply manual_print define acl_interface_set_etype_whitelist
434 {
435   u32 client_index;
436   u32 context;
437   u32 sw_if_index;
438   u8 count; /* Total number of ethertypes in the whitelist */
439   u8 n_input; /* first n_input ethertypes are input, the rest - output */
440   u16 whitelist[count];
441 };
442
443 /** \brief Dump the list(s) of Ethertype whitelists applied to specific or all interfaces
444     @param client_index - opaque cookie to identify the sender
445     @param context - sender context, to match reply w/ request
446     @param sw_if_index - interface to dump the ethertype whitelist for
447 */
448
449 define acl_interface_etype_whitelist_dump
450 {
451   u32 client_index;
452   u32 context;
453   u32 sw_if_index; /* ~0 for all interfaces */
454 };
455
456 /** \brief Details about ethertype whitelist on a single interface
457     @param context - returned sender context, to match reply w/ request
458     @param sw_if_index - interface for which the list of MACIP ACLs is applied
459     @param count - total number of whitelisted ethertypes in the vector
460     @param n_input - this many first elements correspond to input whitelisted ethertypes, the rest - output
461     @param whitelist - vector of whitelisted ethertypes
462 */
463
464 define acl_interface_etype_whitelist_details
465 {
466   u32 context;
467   u32 sw_if_index;
468   u8 count;
469   u8 n_input; /* first n_input ethertypes are input, the rest - output */
470   u16 whitelist[count];
471 };
472
473 /** \brief Enable or disable incrementing ACL counters in stats segment by interface processing
474     @param client_index - opaque cookie to identify the sender
475     @param context - sender context, to match reply w/ request
476     @param enable - whether to enable or disable incrementing the counters
477 */
478
479 autoreply define acl_stats_intf_counters_enable
480 {
481   u32 client_index;
482   u32 context;
483   bool enable;
484 };