classify_add_del_session API: Use more descriptive docstring (VPP-1385)
[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                    needs to include bytes in front
106                    with length of skip_n_vectors of target table times sizeof (u32x4)
107                    (values of those bytes will be ignored)
108 */
109 autoreply define classify_add_del_session
110 {
111   u32 client_index;
112   u32 context;
113   u8 is_add;
114   u32 table_index;
115   u32 hit_next_index;
116   u32 opaque_index;
117   i32 advance;
118   u8 action;
119   u32 metadata;
120   u32 match_len;
121   u8 match[match_len];
122 };
123
124 /** \brief Set/unset policer classify interface
125     @param client_index - opaque cookie to identify the sender
126     @param context - sender context, to match reply w/ request
127     @param sw_if_index - interface to set/unset policer classify
128     @param ip4_table_index - ip4 classify table index (~0 for skip)
129     @param ip6_table_index - ip6 classify table index (~0 for skip)
130     @param l2_table_index  -  l2 classify table index (~0 for skip)
131     @param is_add - Set if non-zero, else unset
132     Note: User is recommeneded to use just one valid table_index per call.
133           (ip4_table_index, ip6_table_index, or l2_table_index)
134 */
135 autoreply define policer_classify_set_interface
136 {
137   u32 client_index;
138   u32 context;
139   u32 sw_if_index;
140   u32 ip4_table_index;
141   u32 ip6_table_index;
142   u32 l2_table_index;
143   u8 is_add;
144 };
145
146 /** \brief Get list of policer classify interfaces and tables
147     @param client_index - opaque cookie to identify the sender
148     @param context - sender context, to match reply w/ request
149     @param type - classify table type
150 */
151 define policer_classify_dump
152 {
153   u32 client_index;
154   u32 context;
155   u8 type;
156 };
157
158 /** \brief Policer iclassify operational state response.
159     @param context - sender context, to match reply w/ request
160     @param sw_if_index - software interface index
161     @param table_index - classify table index
162 */
163 define policer_classify_details
164 {
165   u32 context;
166   u32 sw_if_index;
167   u32 table_index;
168 };
169
170 /** \brief Classify get table IDs request
171     @param client_index - opaque cookie to identify the sender
172     @param context - sender context, to match reply w/ request
173 */
174 define classify_table_ids
175 {
176   u32 client_index;
177   u32 context;
178 };
179
180 /** \brief Reply for classify get table IDs request
181     @param context - sender context which was passed in the request
182     @param count - number of ids returned in response
183     @param ids - array of classify table ids
184 */
185 define classify_table_ids_reply
186 {
187   u32 context;
188   i32 retval;
189   u32 count;
190   u32 ids[count];
191 };
192
193 /** \brief Classify table ids by interface index request
194     @param client_index - opaque cookie to identify the sender
195     @param context - sender context, to match reply w/ request
196     @param sw_if_index - index of the interface
197 */
198 define classify_table_by_interface
199 {
200   u32 client_index;
201   u32 context;
202   u32 sw_if_index;
203 };
204
205 /** \brief Reply for classify table id by interface index request
206     @param context - sender context which was passed in the request
207     @param count - number of ids returned in response
208     @param sw_if_index - index of the interface
209     @param l2_table_id - l2 classify table index
210     @param ip4_table_id - ip4 classify table index
211     @param ip6_table_id - ip6 classify table index
212 */
213 define classify_table_by_interface_reply
214 {
215   u32 context;
216   i32 retval;
217   u32 sw_if_index;
218   u32 l2_table_id;
219   u32 ip4_table_id;
220   u32 ip6_table_id;
221 };
222
223 /** \brief Classify table info
224     @param client_index - opaque cookie to identify the sender
225     @param context - sender context, to match reply w/ request
226     @param table_id - classify table index
227 */
228 define classify_table_info
229 {
230   u32 client_index;
231   u32 context;
232   u32 table_id;
233 };
234
235 /** \brief Reply for classify table info request
236     @param context - sender context which was passed in the request
237     @param count - number of ids returned in response
238     @param table_id - classify table index
239     @param nbuckets - number of buckets when adding a table
240     @param match_n_vectors - number of match vectors
241     @param skip_n_vectors - number of skip_n_vectors
242     @param active_sessions - number of sessions (active entries)
243     @param next_table_index - index of next table
244     @param miss_next_index - index of miss table
245     @param mask[] - match mask
246 */
247 define classify_table_info_reply
248 {
249   u32 context;
250   i32 retval;
251   u32 table_id;
252   u32 nbuckets;
253   u32 match_n_vectors;
254   u32 skip_n_vectors;
255   u32 active_sessions;
256   u32 next_table_index;
257   u32 miss_next_index;
258   u32 mask_length;
259   u8 mask[mask_length];
260 };
261
262 /** \brief Classify sessions dump request
263     @param client_index - opaque cookie to identify the sender
264     @param context - sender context, to match reply w/ request
265     @param table_id - classify table index
266 */
267 define classify_session_dump
268 {
269   u32 client_index;
270   u32 context;
271   u32 table_id;
272 };
273
274 /** \brief Reply for classify table session dump request
275     @param context - sender context which was passed in the request
276     @param count - number of ids returned in response
277     @param table_id - classify table index
278     @param hit_next_index - hit_next_index of session
279     @param opaque_index - for add, opaque_index of session
280     @param advance - advance value of session
281     @param match[] - match value for session
282 */
283 define classify_session_details
284 {
285   u32 context;
286   i32 retval;
287   u32 table_id;
288   u32 hit_next_index;
289   i32 advance;
290   u32 opaque_index;
291   u32 match_length;
292   u8 match[match_length];
293 };
294
295 /** \brief Set/unset flow classify interface
296     @param client_index - opaque cookie to identify the sender
297     @param context - sender context, to match reply w/ request
298     @param sw_if_index - interface to set/unset flow classify
299     @param ip4_table_index - ip4 classify table index (~0 for skip)
300     @param ip6_table_index - ip6 classify table index (~0 for skip)
301     @param l2_table_index  -  l2 classify table index (~0 for skip)
302     @param is_add - Set if non-zero, else unset
303     Note: User is recommeneded to use just one valid table_index per call.
304           (ip4_table_index, ip6_table_index, or l2_table_index)
305 */
306 autoreply define flow_classify_set_interface {
307     u32 client_index;
308     u32 context;
309     u32 sw_if_index;
310     u32 ip4_table_index;
311     u32 ip6_table_index;
312     u8  is_add;
313 };
314
315 /** \brief Get list of flow classify interfaces and tables
316     @param client_index - opaque cookie to identify the sender
317     @param context - sender context, to match reply w/ request
318     @param type - classify table type
319 */
320 define flow_classify_dump {
321     u32 client_index;
322     u32 context;
323     u8 type;
324 };
325
326 /** \brief Flow classify operational state response.
327     @param context - sender context, to match reply w/ request
328     @param sw_if_index - software interface index
329     @param table_index - classify table index
330 */
331 define flow_classify_details {
332     u32 context;
333     u32 sw_if_index;
334     u32 table_index;
335 };
336
337 /** \brief Set/unset the classification table for an interface request 
338     @param client_index - opaque cookie to identify the sender
339     @param context - sender context, to match reply w/ request
340     @param is_ipv6 - ipv6 if non-zero, else ipv4
341     @param sw_if_index - interface to associate with the table
342     @param table_index - index of the table, if ~0 unset the table
343 */
344 autoreply define classify_set_interface_ip_table
345 {
346   u32 client_index;
347   u32 context;
348   u8 is_ipv6;
349   u32 sw_if_index;
350   u32 table_index;              /* ~0 => off */
351 };
352
353 /** \brief Set/unset l2 classification tables for an interface request
354     @param client_index - opaque cookie to identify the sender
355     @param context - sender context, to match reply w/ request
356     @param sw_if_index - interface to set/unset tables for
357     @param ip4_table_index - ip4 index, use ~0 for all 3 indexes to unset
358     @param ip6_table_index - ip6 index
359     @param other_table_index - other index
360 */
361 autoreply define classify_set_interface_l2_tables
362 {
363   u32 client_index;
364   u32 context;
365   u32 sw_if_index;
366   /* 3 x ~0 => off */
367   u32 ip4_table_index;
368   u32 ip6_table_index;
369   u32 other_table_index;
370   u8 is_input;
371 };
372
373 /** \brief Set/unset input ACL interface
374     @param client_index - opaque cookie to identify the sender
375     @param context - sender context, to match reply w/ request
376     @param sw_if_index - interface to set/unset input ACL
377     @param ip4_table_index - ip4 classify table index (~0 for skip)
378     @param ip6_table_index - ip6 classify table index (~0 for skip)
379     @param l2_table_index  -  l2 classify table index (~0 for skip)
380     @param is_add - Set input ACL if non-zero, else unset
381     Note: User is recommeneded to use just one valid table_index per call.
382           (ip4_table_index, ip6_table_index, or l2_table_index)
383 */
384 autoreply define input_acl_set_interface
385 {
386   u32 client_index;
387   u32 context;
388   u32 sw_if_index;
389   u32 ip4_table_index;
390   u32 ip6_table_index;
391   u32 l2_table_index;
392   u8 is_add;
393 };
394
395 /** \brief Set/unset output ACL interface
396     @param client_index - opaque cookie to identify the sender
397     @param context - sender context, to match reply w/ request
398     @param sw_if_index - interface to set/unset output ACL
399     @param ip4_table_index - ip4 classify table index (~0 for skip)
400     @param ip6_table_index - ip6 classify table index (~0 for skip)
401     @param l2_table_index  -  l2 classify table index (~0 for skip)
402     @param is_add - Set output ACL if non-zero, else unset
403     Note: User is recommeneded to use just one valid table_index per call.
404           (ip4_table_index, ip6_table_index, or l2_table_index)
405 */
406 autoreply define output_acl_set_interface
407 {
408   u32 client_index;
409   u32 context;
410   u32 sw_if_index;
411   u32 ip4_table_index;
412   u32 ip6_table_index;
413   u32 l2_table_index;
414   u8 is_add;
415 };
416
417 /*
418  * Local Variables:
419  * eval: (c-set-style "gnu")
420  * End:
421  */
422