VPPAPIGEN: vppapigen replacement in Python PLY.
[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 = "1.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[] - match mask
41 */
42 define classify_add_del_table
43 {
44   u32 client_index;
45   u32 context;
46   u8 is_add;
47   u8 del_chain;
48   u32 table_index;
49   u32 nbuckets;
50   u32 memory_size;
51   u32 skip_n_vectors;
52   u32 match_n_vectors;
53   u32 next_table_index;
54   u32 miss_next_index;
55   u32 current_data_flag;
56   i32 current_data_offset;
57   u8 mask[0];
58 };
59
60 /** \brief Add/Delete classification table response
61     @param context - sender context, to match reply w/ request
62     @param retval - return code for the table add/del requst
63     @param new_table_index - for add, returned index of the new table
64     @param skip_n_vectors - for add, returned value of skip_n_vectors in table
65     @param match_n_vectors -for add, returned value of match_n_vectors in table
66 */
67 define classify_add_del_table_reply
68 {
69   u32 context;
70   i32 retval;
71   u32 new_table_index;
72   u32 skip_n_vectors;
73   u32 match_n_vectors;
74 };
75
76 /** \brief Classify add / del session request
77     @param client_index - opaque cookie to identify the sender
78     @param context - sender context, to match reply w/ request
79     @param is_add - add session if non-zero, else delete
80     @param table_index - index of the table to add/del the session, required
81     @param hit_next_index - for add, hit_next_index of new session, required
82     @param opaque_index - for add, opaque_index of new session
83     @param advance -for add, advance value for session
84     @param action -
85            0: no action (by default)
86               metadata is not used.
87            1: Classified IP packets will be looked up from the
88               specified ipv4 fib table (configured by metadata as VRF id).
89               Only valid for L3 input ACL node
90            2: Classified IP packets will be looked up from the
91               specified ipv6 fib table (configured by metadata as VRF id).
92               Only valid for L3 input ACL node
93            3: Classified packet will be steered to source routig policy
94               of given index (in metadata).
95               This is only valid for IPv6 packets redirected to a source
96               routing node.
97     @param metadata - valid only if action != 0
98            VRF id if action is 1 or 2.
99            sr policy index if action is 3.
100     @param match[] - for add, match value for session, required
101 */
102 autoreply define classify_add_del_session
103 {
104   u32 client_index;
105   u32 context;
106   u8 is_add;
107   u32 table_index;
108   u32 hit_next_index;
109   u32 opaque_index;
110   i32 advance;
111   u8 action;
112   u32 metadata;
113   u8 match[0];
114 };
115
116 /** \brief Set/unset policer classify interface
117     @param client_index - opaque cookie to identify the sender
118     @param context - sender context, to match reply w/ request
119     @param sw_if_index - interface to set/unset policer classify
120     @param ip4_table_index - ip4 classify table index (~0 for skip)
121     @param ip6_table_index - ip6 classify table index (~0 for skip)
122     @param l2_table_index  -  l2 classify table index (~0 for skip)
123     @param is_add - Set if non-zero, else unset
124     Note: User is recommeneded to use just one valid table_index per call.
125           (ip4_table_index, ip6_table_index, or l2_table_index)
126 */
127 autoreply define policer_classify_set_interface
128 {
129   u32 client_index;
130   u32 context;
131   u32 sw_if_index;
132   u32 ip4_table_index;
133   u32 ip6_table_index;
134   u32 l2_table_index;
135   u8 is_add;
136 };
137
138 /** \brief Get list of policer classify interfaces and tables
139     @param client_index - opaque cookie to identify the sender
140     @param context - sender context, to match reply w/ request
141     @param type - classify table type
142 */
143 define policer_classify_dump
144 {
145   u32 client_index;
146   u32 context;
147   u8 type;
148 };
149
150 /** \brief Policer iclassify operational state response.
151     @param context - sender context, to match reply w/ request
152     @param sw_if_index - software interface index
153     @param table_index - classify table index
154 */
155 define policer_classify_details
156 {
157   u32 context;
158   u32 sw_if_index;
159   u32 table_index;
160 };
161
162 /** \brief Classify get table IDs request
163     @param client_index - opaque cookie to identify the sender
164     @param context - sender context, to match reply w/ request
165 */
166 define classify_table_ids
167 {
168   u32 client_index;
169   u32 context;
170 };
171
172 /** \brief Reply for classify get table IDs request
173     @param context - sender context which was passed in the request
174     @param count - number of ids returned in response
175     @param ids - array of classify table ids
176 */
177 define classify_table_ids_reply
178 {
179   u32 context;
180   i32 retval;
181   u32 count;
182   u32 ids[count];
183 };
184
185 /** \brief Classify table ids by interface index request
186     @param client_index - opaque cookie to identify the sender
187     @param context - sender context, to match reply w/ request
188     @param sw_if_index - index of the interface
189 */
190 define classify_table_by_interface
191 {
192   u32 client_index;
193   u32 context;
194   u32 sw_if_index;
195 };
196
197 /** \brief Reply for classify table id by interface index request
198     @param context - sender context which was passed in the request
199     @param count - number of ids returned in response
200     @param sw_if_index - index of the interface
201     @param l2_table_id - l2 classify table index
202     @param ip4_table_id - ip4 classify table index
203     @param ip6_table_id - ip6 classify table index
204 */
205 define classify_table_by_interface_reply
206 {
207   u32 context;
208   i32 retval;
209   u32 sw_if_index;
210   u32 l2_table_id;
211   u32 ip4_table_id;
212   u32 ip6_table_id;
213 };
214
215 /** \brief Classify table info
216     @param client_index - opaque cookie to identify the sender
217     @param context - sender context, to match reply w/ request
218     @param table_id - classify table index
219 */
220 define classify_table_info
221 {
222   u32 client_index;
223   u32 context;
224   u32 table_id;
225 };
226
227 /** \brief Reply for classify table info request
228     @param context - sender context which was passed in the request
229     @param count - number of ids returned in response
230     @param table_id - classify table index
231     @param nbuckets - number of buckets when adding a table
232     @param match_n_vectors - number of match vectors
233     @param skip_n_vectors - number of skip_n_vectors
234     @param active_sessions - number of sessions (active entries)
235     @param next_table_index - index of next table
236     @param miss_next_index - index of miss table
237     @param mask[] - match mask
238 */
239 define classify_table_info_reply
240 {
241   u32 context;
242   i32 retval;
243   u32 table_id;
244   u32 nbuckets;
245   u32 match_n_vectors;
246   u32 skip_n_vectors;
247   u32 active_sessions;
248   u32 next_table_index;
249   u32 miss_next_index;
250   u32 mask_length;
251   u8 mask[mask_length];
252 };
253
254 /** \brief Classify sessions dump request
255     @param client_index - opaque cookie to identify the sender
256     @param context - sender context, to match reply w/ request
257     @param table_id - classify table index
258 */
259 define classify_session_dump
260 {
261   u32 client_index;
262   u32 context;
263   u32 table_id;
264 };
265
266 /** \brief Reply for classify table session dump request
267     @param context - sender context which was passed in the request
268     @param count - number of ids returned in response
269     @param table_id - classify table index
270     @param hit_next_index - hit_next_index of session
271     @param opaque_index - for add, opaque_index of session
272     @param advance - advance value of session
273     @param match[] - match value for session
274 */
275 define classify_session_details
276 {
277   u32 context;
278   i32 retval;
279   u32 table_id;
280   u32 hit_next_index;
281   i32 advance;
282   u32 opaque_index;
283   u32 match_length;
284   u8 match[match_length];
285 };
286
287 /** \brief Set/unset flow classify interface
288     @param client_index - opaque cookie to identify the sender
289     @param context - sender context, to match reply w/ request
290     @param sw_if_index - interface to set/unset flow classify
291     @param ip4_table_index - ip4 classify table index (~0 for skip)
292     @param ip6_table_index - ip6 classify table index (~0 for skip)
293     @param l2_table_index  -  l2 classify table index (~0 for skip)
294     @param is_add - Set if non-zero, else unset
295     Note: User is recommeneded to use just one valid table_index per call.
296           (ip4_table_index, ip6_table_index, or l2_table_index)
297 */
298 autoreply define flow_classify_set_interface {
299     u32 client_index;
300     u32 context;
301     u32 sw_if_index;
302     u32 ip4_table_index;
303     u32 ip6_table_index;
304     u8  is_add;
305 };
306
307 /** \brief Get list of flow classify interfaces and tables
308     @param client_index - opaque cookie to identify the sender
309     @param context - sender context, to match reply w/ request
310     @param type - classify table type
311 */
312 define flow_classify_dump {
313     u32 client_index;
314     u32 context;
315     u8 type;
316 };
317
318 /** \brief Flow classify operational state response.
319     @param context - sender context, to match reply w/ request
320     @param sw_if_index - software interface index
321     @param table_index - classify table index
322 */
323 define flow_classify_details {
324     u32 context;
325     u32 sw_if_index;
326     u32 table_index;
327 };
328
329 /** \brief Set/unset the classification table for an interface request 
330     @param client_index - opaque cookie to identify the sender
331     @param context - sender context, to match reply w/ request
332     @param is_ipv6 - ipv6 if non-zero, else ipv4
333     @param sw_if_index - interface to associate with the table
334     @param table_index - index of the table, if ~0 unset the table
335 */
336 autoreply define classify_set_interface_ip_table
337 {
338   u32 client_index;
339   u32 context;
340   u8 is_ipv6;
341   u32 sw_if_index;
342   u32 table_index;              /* ~0 => off */
343 };
344
345 /** \brief Set/unset l2 classification tables for an interface request
346     @param client_index - opaque cookie to identify the sender
347     @param context - sender context, to match reply w/ request
348     @param sw_if_index - interface to set/unset tables for
349     @param ip4_table_index - ip4 index, use ~0 for all 3 indexes to unset
350     @param ip6_table_index - ip6 index
351     @param other_table_index - other index
352 */
353 autoreply define classify_set_interface_l2_tables
354 {
355   u32 client_index;
356   u32 context;
357   u32 sw_if_index;
358   /* 3 x ~0 => off */
359   u32 ip4_table_index;
360   u32 ip6_table_index;
361   u32 other_table_index;
362   u8 is_input;
363 };
364
365 /** \brief Set/unset input ACL interface
366     @param client_index - opaque cookie to identify the sender
367     @param context - sender context, to match reply w/ request
368     @param sw_if_index - interface to set/unset input ACL
369     @param ip4_table_index - ip4 classify table index (~0 for skip)
370     @param ip6_table_index - ip6 classify table index (~0 for skip)
371     @param l2_table_index  -  l2 classify table index (~0 for skip)
372     @param is_add - Set input ACL if non-zero, else unset
373     Note: User is recommeneded to use just one valid table_index per call.
374           (ip4_table_index, ip6_table_index, or l2_table_index)
375 */
376 autoreply define input_acl_set_interface
377 {
378   u32 client_index;
379   u32 context;
380   u32 sw_if_index;
381   u32 ip4_table_index;
382   u32 ip6_table_index;
383   u32 l2_table_index;
384   u8 is_add;
385 };
386
387 /*
388  * Local Variables:
389  * eval: (c-set-style "gnu")
390  * End:
391  */
392