acl: remove api boilerplate
[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   option vat_help = "<acl-idx> [<ipv4|ipv6> <permit|permit+reflect|deny|action N> [src IP/plen] [dst IP/plen] [sport X-Y] [dport X-Y] [proto P] [tcpflags FL MASK], ... , ...";
113 };
114
115 /** \brief Reply to add/replace ACL
116     @param context - returned sender context, to match reply w/ request
117     @param acl_index - index of the updated or newly created ACL
118     @param retval 0 - no error
119 */
120
121 define acl_add_replace_reply
122 {
123   u32 context;
124   u32 acl_index;
125   i32 retval;
126 };
127
128 /** \brief Delete an ACL
129     @param client_index - opaque cookie to identify the sender
130     @param context - sender context, to match reply w/ request
131     @param acl_index - ACL index to delete
132 */
133
134 autoreply manual_print define acl_del
135 {
136   u32 client_index;
137   u32 context;
138   u32 acl_index;
139   option vat_help = "<acl-idx>";
140 };
141
142 /* acl_interface_add_del(_reply) to be deprecated in lieu of acl_interface_set_acl_list */
143 /** \brief Use acl_interface_set_acl_list instead
144     Append/remove an ACL index to/from the list of ACLs checked for an interface
145     @param client_index - opaque cookie to identify the sender
146     @param context - sender context, to match reply w/ request
147     @param is_add - add or delete the ACL index from the list
148     @param is_input - check the ACL on input (1) or output (0)
149     @param sw_if_index - the interface to alter the list of ACLs on
150     @param acl_index - index of ACL for the operation
151 */
152
153 autoreply manual_print define acl_interface_add_del
154 {
155   u32 client_index;
156   u32 context;
157   u8 is_add;
158 /*
159  * is_input = 0 => ACL applied on interface egress
160  * is_input = 1 => ACL applied on interface ingress
161  */
162   u8 is_input;
163   u32 sw_if_index;
164   u32 acl_index;
165   option vat_help = "<intfc> | sw_if_index <if-idx> [add|del] [input|output] acl <acl-idx>";
166 };
167
168 /** \brief Set the vector of input/output ACLs checked for an interface
169     @param client_index - opaque cookie to identify the sender
170     @param context - sender context, to match reply w/ request
171     @param sw_if_index - the interface to alter the list of ACLs on
172     @param count - total number of ACL indices in the vector
173     @param n_input - this many first elements correspond to input ACLs, the rest - output
174     @param acls - vector of ACL indices
175 */
176
177 autoreply manual_print define acl_interface_set_acl_list
178 {
179   u32 client_index;
180   u32 context;
181   u32 sw_if_index;
182   u8 count;
183   u8 n_input; /* First n_input ACLs are set as a list of input ACLs, the rest are applied as output */
184   u32 acls[count];
185   option vat_help = "<intfc> | sw_if_index <if-idx> input [acl-idx list] output [acl-idx list]";
186 };
187
188 /** \brief Reply to set the ACL list on an interface
189     @param context - returned sender context, to match reply w/ request
190     @param retval 0 - no error
191 */
192
193 /** \brief Dump the specific ACL contents or all of the ACLs' contents
194     @param client_index - opaque cookie to identify the sender
195     @param context - sender context, to match reply w/ request
196     @param acl_index - ACL index to dump, ~0 to dump all ACLs
197 */
198
199 define acl_dump
200 {
201   u32 client_index;
202   u32 context;
203   u32 acl_index; /* ~0 for all ACLs */
204   option vat_help = "[<acl-idx>]";
205 };
206
207 /** \brief Details about a single ACL contents
208     @param context - returned sender context, to match reply w/ request
209     @param acl_index - ACL index whose contents are being sent in this message
210     @param tag - Descriptive tag value which was supplied at ACL creation
211     @param count - Number of rules in this ACL
212     @param r - Array of rules within this ACL
213 */
214
215 manual_endian manual_print define acl_details
216 {
217   u32 context;
218   u32 acl_index;
219   u8 tag[64]; /* Same blob that was supplied to us when creating the ACL, one hopes. */
220   u32 count;
221   vl_api_acl_rule_t r[count];
222 };
223
224 /** \brief Dump the list(s) of ACL applied to specific or all interfaces
225     @param client_index - opaque cookie to identify the sender
226     @param context - sender context, to match reply w/ request
227     @param sw_if_index - interface to dump the ACL list for
228 */
229
230 define acl_interface_list_dump
231 {
232   u32 client_index;
233   u32 context;
234   u32 sw_if_index; /* ~0 for all interfaces */
235   option vat_help = "[<intfc> | sw_if_index <if-idx>]";
236 };
237
238 /** \brief Details about a single ACL contents
239     @param context - returned sender context, to match reply w/ request
240     @param sw_if_index - interface for which the list of ACLs is applied
241     @param count - total length of acl indices vector
242     @param n_input - this many of indices in the beginning are input ACLs, the rest - output
243     @param acls - the vector of ACL indices
244 */
245
246 define acl_interface_list_details
247 {
248   u32 context;
249   u32 sw_if_index;
250   u8 count;
251   u8 n_input;
252   u32 acls[count];
253 };
254
255 /** \brief Add a MACIP ACL
256     @param client_index - opaque cookie to identify the sender
257     @param context - sender context, to match reply w/ request
258     @param tag - descriptive value for this MACIP ACL
259     @param count - number of rules in this MACIP ACL
260     @param r - vector of MACIP ACL rules
261 */
262
263 manual_endian manual_print define macip_acl_add
264 {
265   u32 client_index;
266   u32 context;
267   u8 tag[64];
268   u32 count;
269   vl_api_macip_acl_rule_t r[count];
270   option vat_help = "...";
271 };
272
273 /** \brief Reply to add MACIP ACL
274     @param context - returned sender context, to match reply w/ request
275     @param acl_index - index of the newly created MACIP ACL
276     @param retval 0 - no error
277 */
278
279 define macip_acl_add_reply
280 {
281   u32 context;
282   u32 acl_index;
283   i32 retval;
284 };
285
286 /** \brief Add/Replace a MACIP ACL
287     @param client_index - opaque cookie to identify the sender
288     @param context - sender context, to match reply w/ request
289     @param acl_index - an existing MACIP ACL entry (0..0xfffffffe) to replace, or 0xffffffff to make new MACIP ACL
290     @param tag - descriptive value for this MACIP ACL
291     @param count - number of rules in this MACIP ACL
292     @param r - vector of MACIP ACL rules
293 */
294
295 manual_endian manual_print define macip_acl_add_replace
296 {
297   u32 client_index;
298   u32 context;
299   u32 acl_index; /* ~0 to add, existing MACIP ACL# to replace */
300   u8 tag[64];
301   u32 count;
302   vl_api_macip_acl_rule_t r[count];
303   option vat_help = "<acl-idx> [<ipv4|ipv6> <permit|deny|action N> [count <count>] [src] ip <ipaddress/[plen]> mac <mac> mask <mac_mask>, ... , ...";
304 };
305
306 /** \brief Reply to add/replace MACIP ACL
307     @param context - returned sender context, to match reply w/ request
308     @param acl_index - index of the newly created MACIP ACL
309     @param retval 0 - no error
310 */
311
312 define macip_acl_add_replace_reply
313 {
314   u32 context;
315   u32 acl_index;
316   i32 retval;
317 };
318
319 /** \brief Delete a MACIP ACL
320     @param client_index - opaque cookie to identify the sender
321     @param context - sender context, to match reply w/ request
322     @param acl_index - MACIP ACL index to delete
323 */
324
325 autoreply manual_print define macip_acl_del
326 {
327   u32 client_index;
328   u32 context;
329   u32 acl_index;
330   option vat_help = "<acl-idx>";
331 };
332
333 /** \brief Add or delete a MACIP ACL to/from interface
334     @param client_index - opaque cookie to identify the sender
335     @param context - sender context, to match reply w/ request
336     @param is_add - add (1) or delete (0) MACIP ACL from being used on an interface
337     @param sw_if_index - interface to apply the action to
338     @param acl_index - MACIP ACL index
339 */
340
341 autoreply manual_print define macip_acl_interface_add_del
342 {
343   u32 client_index;
344   u32 context;
345   u8 is_add;
346   /* MACIP ACLs are always input */
347   u32 sw_if_index;
348   u32 acl_index;
349   option vat_help = "<intfc> | sw_if_index <if-idx> [add|del] acl <acl-idx>";
350 };
351
352 /** \brief Dump one or all defined MACIP ACLs
353     @param client_index - opaque cookie to identify the sender
354     @param context - sender context, to match reply w/ request
355     @param acl_index - MACIP ACL index or ~0 to dump all MACIP ACLs
356 */
357
358 define macip_acl_dump
359 {
360   u32 client_index;
361   u32 context;
362   u32 acl_index; /* ~0 for all ACLs */
363   option vat_help = "[<acl-idx>]";
364 };
365
366 /** \brief Details about one MACIP ACL
367     @param context - returned sender context, to match reply w/ request
368     @param acl_index - index of this MACIP ACL
369     @param tag - descriptive tag which was supplied during the creation
370     @param count - length of the vector of MACIP ACL rules
371     @param r - rules comprising this MACIP ACL
372 */
373
374 manual_endian manual_print define macip_acl_details
375 {
376   u32 context;
377   u32 acl_index;
378   u8 tag[64];
379   u32 count;
380   vl_api_macip_acl_rule_t r[count];
381 };
382
383 /** \brief Get the vector of MACIP ACL IDs applied to the interfaces
384     @param client_index - opaque cookie to identify the sender
385     @param context - sender context, to match reply w/ request
386 */
387
388 define macip_acl_interface_get
389 {
390   u32 client_index;
391   u32 context;
392 };
393
394 /** \brief Reply with the vector of MACIP ACLs by sw_if_index
395     @param context - returned sender context, to match reply w/ request
396     @param count - total number of elements in the vector
397     @param acls - the vector of active MACIP ACL indices per sw_if_index
398 */
399
400 define macip_acl_interface_get_reply
401 {
402   u32 context;
403   u32 count;
404   u32 acls[count];
405 };
406
407 /** \brief Dump the list(s) of MACIP ACLs applied to specific or all interfaces
408     @param client_index - opaque cookie to identify the sender
409     @param context - sender context, to match reply w/ request
410     @param sw_if_index - interface to dump the MACIP ACL list for
411 */
412
413 define macip_acl_interface_list_dump
414 {
415   u32 client_index;
416   u32 context;
417   u32 sw_if_index; /* ~0 for all interfaces */
418 };
419
420 /** \brief Details about a single MACIP ACL contents
421     @param context - returned sender context, to match reply w/ request
422     @param sw_if_index - interface for which the list of MACIP ACLs is applied
423     @param count - total length of acl indices vector
424     @param acls - the vector of MACIP ACL indices
425 */
426
427 define macip_acl_interface_list_details
428 {
429   u32 context;
430   u32 sw_if_index;
431   u8 count;
432   u32 acls[count];
433 };
434
435 /** \brief Set the ethertype whitelists on an interface. Takes effect when applying ACLs on the interface, so must be given prior.
436     @param client_index - opaque cookie to identify the sender
437     @param context - sender context, to match reply w/ request
438     @param sw_if_index - the interface to alter the list of ACLs on
439     @param count - total number of whitelisted ethertypes in the vector
440     @param n_input - this many first elements correspond to input whitelisted ethertypes, the rest - output
441     @param whitelist - vector of whitelisted ethertypes
442 */
443
444 autoreply manual_print define acl_interface_set_etype_whitelist
445 {
446   u32 client_index;
447   u32 context;
448   u32 sw_if_index;
449   u8 count; /* Total number of ethertypes in the whitelist */
450   u8 n_input; /* first n_input ethertypes are input, the rest - output */
451   u16 whitelist[count];
452   option vat_help = "<intfc> | sw_if_index <if-idx> input [ethertype list] output [ethertype list]";
453 };
454
455 /** \brief Dump the list(s) of Ethertype whitelists applied to specific or all interfaces
456     @param client_index - opaque cookie to identify the sender
457     @param context - sender context, to match reply w/ request
458     @param sw_if_index - interface to dump the ethertype whitelist for
459 */
460
461 define acl_interface_etype_whitelist_dump
462 {
463   u32 client_index;
464   u32 context;
465   u32 sw_if_index; /* ~0 for all interfaces */
466   option vat_help = "[<intfc> | sw_if_index <if-idx>]";
467 };
468
469 /** \brief Details about ethertype whitelist on a single interface
470     @param context - returned sender context, to match reply w/ request
471     @param sw_if_index - interface for which the list of MACIP ACLs is applied
472     @param count - total number of whitelisted ethertypes in the vector
473     @param n_input - this many first elements correspond to input whitelisted ethertypes, the rest - output
474     @param whitelist - vector of whitelisted ethertypes
475 */
476
477 define acl_interface_etype_whitelist_details
478 {
479   u32 context;
480   u32 sw_if_index;
481   u8 count;
482   u8 n_input; /* first n_input ethertypes are input, the rest - output */
483   u16 whitelist[count];
484 };
485
486 /** \brief Enable or disable incrementing ACL counters in stats segment by interface processing
487     @param client_index - opaque cookie to identify the sender
488     @param context - sender context, to match reply w/ request
489     @param enable - whether to enable or disable incrementing the counters
490 */
491
492 autoreply define acl_stats_intf_counters_enable
493 {
494   u32 client_index;
495   u32 context;
496   bool enable;
497   option vat_help = "[disable]";
498 };