Fix "Old Style VLA" build warnings
[vpp.git] / src / vnet / classify / classify.api
1 /*
2  * Copyright (c) 2015-2016 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 option version = "2.0.0";
17
18 /** \brief Add/Delete classification table request
19     @param client_index - opaque cookie to identify the sender
20     @param context - sender context, to match reply w/ request
21     @param is_add- if non-zero add the table, else delete it
22     @param del_chain - if non-zero delete the whole chain of tables
23     @param table_index - if add, reuturns index of the created table, else specifies the table to delete  
24     @param nbuckets - number of buckets when adding a table
25     @param memory_size - memory size when adding a table
26     @param match_n_vectors - number of match vectors
27     @param next_table_index - index of next table
28     @param miss_next_index - index of miss table
29     @param current_data_flag - option to use current node's packet payload
30             as the starting point from where packets are classified,
31             This option is only valid for L2/L3 input ACL for now.
32             0: by default, classify data from the buffer's start location
33             1: classify packets from VPP node’s current data pointer
34     @param current_data_offset - a signed value to shift the start location of
35             the packet to be classified
36             For example, if input IP ACL node is used, L2 header’s first byte
37             can be accessible by configuring current_data_offset to -14
38             if there is no vlan tag.
39             This is valid only if current_data_flag is set to 1.
40     @param mask_len - length of match mask, should be equal to match_n_vectors * sizeof (u32x4)
41     @param mask - match mask
42 */
43 define classify_add_del_table
44 {
45   u32 client_index;
46   u32 context;
47   u8 is_add;
48   u8 del_chain;
49   u32 table_index;
50   u32 nbuckets;
51   u32 memory_size;
52   u32 skip_n_vectors;
53   u32 match_n_vectors;
54   u32 next_table_index;
55   u32 miss_next_index;
56   u32 current_data_flag;
57   i32 current_data_offset;
58   u32 mask_len;
59   u8 mask[mask_len];
60 };
61
62 /** \brief Add/Delete classification table response
63     @param context - sender context, to match reply w/ request
64     @param retval - return code for the table add/del requst
65     @param new_table_index - for add, returned index of the new table
66     @param skip_n_vectors - for add, returned value of skip_n_vectors in table
67     @param match_n_vectors -for add, returned value of match_n_vectors in table
68 */
69 define classify_add_del_table_reply
70 {
71   u32 context;
72   i32 retval;
73   u32 new_table_index;
74   u32 skip_n_vectors;
75   u32 match_n_vectors;
76 };
77
78 /** \brief Classify add / del session request
79     @param client_index - opaque cookie to identify the sender
80     @param context - sender context, to match reply w/ request
81     @param is_add - add session if non-zero, else delete
82     @param table_index - index of the table to add/del the session, required
83     @param hit_next_index - for add, hit_next_index of new session, required
84     @param opaque_index - for add, opaque_index of new session
85     @param advance -for add, advance value for session
86     @param action -
87            0: no action (by default)
88               metadata is not used.
89            1: Classified IP packets will be looked up from the
90               specified ipv4 fib table (configured by metadata as VRF id).
91               Only valid for L3 input ACL node
92            2: Classified IP packets will be looked up from the
93               specified ipv6 fib table (configured by metadata as VRF id).
94               Only valid for L3 input ACL node
95            3: Classified packet will be steered to source routig policy
96               of given index (in metadata).
97               This is only valid for IPv6 packets redirected to a source
98               routing node.
99     @param metadata - valid only if action != 0
100            VRF id if action is 1 or 2.
101            sr policy index if action is 3.
102     @param match_len - length of match, should be equal to skip_n_vectors plus match_n_vectors
103                        of target table times sizeof (u32x4)
104     @param match - for add, match value for session, required
105 */
106 autoreply define classify_add_del_session
107 {
108   u32 client_index;
109   u32 context;
110   u8 is_add;
111   u32 table_index;
112   u32 hit_next_index;
113   u32 opaque_index;
114   i32 advance;
115   u8 action;
116   u32 metadata;
117   u32 match_len;
118   u8 match[match_len];
119 };
120
121 /** \brief Set/unset policer classify interface
122     @param client_index - opaque cookie to identify the sender
123     @param context - sender context, to match reply w/ request
124     @param sw_if_index - interface to set/unset policer classify
125     @param ip4_table_index - ip4 classify table index (~0 for skip)
126     @param ip6_table_index - ip6 classify table index (~0 for skip)
127     @param l2_table_index  -  l2 classify table index (~0 for skip)
128     @param is_add - Set if non-zero, else unset
129     Note: User is recommeneded to use just one valid table_index per call.
130           (ip4_table_index, ip6_table_index, or l2_table_index)
131 */
132 autoreply define policer_classify_set_interface
133 {
134   u32 client_index;
135   u32 context;
136   u32 sw_if_index;
137   u32 ip4_table_index;
138   u32 ip6_table_index;
139   u32 l2_table_index;
140   u8 is_add;
141 };
142
143 /** \brief Get list of policer classify interfaces and tables
144     @param client_index - opaque cookie to identify the sender
145     @param context - sender context, to match reply w/ request
146     @param type - classify table type
147 */
148 define policer_classify_dump
149 {
150   u32 client_index;
151   u32 context;
152   u8 type;
153 };
154
155 /** \brief Policer iclassify operational state response.
156     @param context - sender context, to match reply w/ request
157     @param sw_if_index - software interface index
158     @param table_index - classify table index
159 */
160 define policer_classify_details
161 {
162   u32 context;
163   u32 sw_if_index;
164   u32 table_index;
165 };
166
167 /** \brief Classify get table IDs request
168     @param client_index - opaque cookie to identify the sender
169     @param context - sender context, to match reply w/ request
170 */
171 define classify_table_ids
172 {
173   u32 client_index;
174   u32 context;
175 };
176
177 /** \brief Reply for classify get table IDs request
178     @param context - sender context which was passed in the request
179     @param count - number of ids returned in response
180     @param ids - array of classify table ids
181 */
182 define classify_table_ids_reply
183 {
184   u32 context;
185   i32 retval;
186   u32 count;
187   u32 ids[count];
188 };
189
190 /** \brief Classify table ids by interface index request
191     @param client_index - opaque cookie to identify the sender
192     @param context - sender context, to match reply w/ request
193     @param sw_if_index - index of the interface
194 */
195 define classify_table_by_interface
196 {
197   u32 client_index;
198   u32 context;
199   u32 sw_if_index;
200 };
201
202 /** \brief Reply for classify table id by interface index request
203     @param context - sender context which was passed in the request
204     @param count - number of ids returned in response
205     @param sw_if_index - index of the interface
206     @param l2_table_id - l2 classify table index
207     @param ip4_table_id - ip4 classify table index
208     @param ip6_table_id - ip6 classify table index
209 */
210 define classify_table_by_interface_reply
211 {
212   u32 context;
213   i32 retval;
214   u32 sw_if_index;
215   u32 l2_table_id;
216   u32 ip4_table_id;
217   u32 ip6_table_id;
218 };
219
220 /** \brief Classify table info
221     @param client_index - opaque cookie to identify the sender
222     @param context - sender context, to match reply w/ request
223     @param table_id - classify table index
224 */
225 define classify_table_info
226 {
227   u32 client_index;
228   u32 context;
229   u32 table_id;
230 };
231
232 /** \brief Reply for classify table info request
233     @param context - sender context which was passed in the request
234     @param count - number of ids returned in response
235     @param table_id - classify table index
236     @param nbuckets - number of buckets when adding a table
237     @param match_n_vectors - number of match vectors
238     @param skip_n_vectors - number of skip_n_vectors
239     @param active_sessions - number of sessions (active entries)
240     @param next_table_index - index of next table
241     @param miss_next_index - index of miss table
242     @param mask[] - match mask
243 */
244 define classify_table_info_reply
245 {
246   u32 context;
247   i32 retval;
248   u32 table_id;
249   u32 nbuckets;
250   u32 match_n_vectors;
251   u32 skip_n_vectors;
252   u32 active_sessions;
253   u32 next_table_index;
254   u32 miss_next_index;
255   u32 mask_length;
256   u8 mask[mask_length];
257 };
258
259 /** \brief Classify sessions dump request
260     @param client_index - opaque cookie to identify the sender
261     @param context - sender context, to match reply w/ request
262     @param table_id - classify table index
263 */
264 define classify_session_dump
265 {
266   u32 client_index;
267   u32 context;
268   u32 table_id;
269 };
270
271 /** \brief Reply for classify table session dump request
272     @param context - sender context which was passed in the request
273     @param count - number of ids returned in response
274     @param table_id - classify table index
275     @param hit_next_index - hit_next_index of session
276     @param opaque_index - for add, opaque_index of session
277     @param advance - advance value of session
278     @param match[] - match value for session
279 */
280 define classify_session_details
281 {
282   u32 context;
283   i32 retval;
284   u32 table_id;
285   u32 hit_next_index;
286   i32 advance;
287   u32 opaque_index;
288   u32 match_length;
289   u8 match[match_length];
290 };
291
292 /** \brief Set/unset flow classify interface
293     @param client_index - opaque cookie to identify the sender
294     @param context - sender context, to match reply w/ request
295     @param sw_if_index - interface to set/unset flow classify
296     @param ip4_table_index - ip4 classify table index (~0 for skip)
297     @param ip6_table_index - ip6 classify table index (~0 for skip)
298     @param l2_table_index  -  l2 classify table index (~0 for skip)
299     @param is_add - Set if non-zero, else unset
300     Note: User is recommeneded to use just one valid table_index per call.
301           (ip4_table_index, ip6_table_index, or l2_table_index)
302 */
303 autoreply define flow_classify_set_interface {
304     u32 client_index;
305     u32 context;
306     u32 sw_if_index;
307     u32 ip4_table_index;
308     u32 ip6_table_index;
309     u8  is_add;
310 };
311
312 /** \brief Get list of flow classify interfaces and tables
313     @param client_index - opaque cookie to identify the sender
314     @param context - sender context, to match reply w/ request
315     @param type - classify table type
316 */
317 define flow_classify_dump {
318     u32 client_index;
319     u32 context;
320     u8 type;
321 };
322
323 /** \brief Flow classify operational state response.
324     @param context - sender context, to match reply w/ request
325     @param sw_if_index - software interface index
326     @param table_index - classify table index
327 */
328 define flow_classify_details {
329     u32 context;
330     u32 sw_if_index;
331     u32 table_index;
332 };
333
334 /** \brief Set/unset the classification table for an interface request 
335     @param client_index - opaque cookie to identify the sender
336     @param context - sender context, to match reply w/ request
337     @param is_ipv6 - ipv6 if non-zero, else ipv4
338     @param sw_if_index - interface to associate with the table
339     @param table_index - index of the table, if ~0 unset the table
340 */
341 autoreply define classify_set_interface_ip_table
342 {
343   u32 client_index;
344   u32 context;
345   u8 is_ipv6;
346   u32 sw_if_index;
347   u32 table_index;              /* ~0 => off */
348 };
349
350 /** \brief Set/unset l2 classification tables for an interface request
351     @param client_index - opaque cookie to identify the sender
352     @param context - sender context, to match reply w/ request
353     @param sw_if_index - interface to set/unset tables for
354     @param ip4_table_index - ip4 index, use ~0 for all 3 indexes to unset
355     @param ip6_table_index - ip6 index
356     @param other_table_index - other index
357 */
358 autoreply define classify_set_interface_l2_tables
359 {
360   u32 client_index;
361   u32 context;
362   u32 sw_if_index;
363   /* 3 x ~0 => off */
364   u32 ip4_table_index;
365   u32 ip6_table_index;
366   u32 other_table_index;
367   u8 is_input;
368 };
369
370 /** \brief Set/unset input ACL interface
371     @param client_index - opaque cookie to identify the sender
372     @param context - sender context, to match reply w/ request
373     @param sw_if_index - interface to set/unset input ACL
374     @param ip4_table_index - ip4 classify table index (~0 for skip)
375     @param ip6_table_index - ip6 classify table index (~0 for skip)
376     @param l2_table_index  -  l2 classify table index (~0 for skip)
377     @param is_add - Set input ACL if non-zero, else unset
378     Note: User is recommeneded to use just one valid table_index per call.
379           (ip4_table_index, ip6_table_index, or l2_table_index)
380 */
381 autoreply define input_acl_set_interface
382 {
383   u32 client_index;
384   u32 context;
385   u32 sw_if_index;
386   u32 ip4_table_index;
387   u32 ip6_table_index;
388   u32 l2_table_index;
389   u8 is_add;
390 };
391
392 /** \brief Set/unset output ACL interface
393     @param client_index - opaque cookie to identify the sender
394     @param context - sender context, to match reply w/ request
395     @param sw_if_index - interface to set/unset output ACL
396     @param ip4_table_index - ip4 classify table index (~0 for skip)
397     @param ip6_table_index - ip6 classify table index (~0 for skip)
398     @param l2_table_index  -  l2 classify table index (~0 for skip)
399     @param is_add - Set output ACL if non-zero, else unset
400     Note: User is recommeneded to use just one valid table_index per call.
401           (ip4_table_index, ip6_table_index, or l2_table_index)
402 */
403 autoreply define output_acl_set_interface
404 {
405   u32 client_index;
406   u32 context;
407   u32 sw_if_index;
408   u32 ip4_table_index;
409   u32 ip6_table_index;
410   u32 l2_table_index;
411   u8 is_add;
412 };
413
414 /*
415  * Local Variables:
416  * eval: (c-set-style "gnu")
417  * End:
418  */
419