FIB table add/delete API only
[vpp.git] / src / vnet / ip / ip.api
1 /*
2  * Copyright (c) 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 /** \file
17
18     This file defines vpp IP control-plane API messages which are generally
19     called through a shared memory interface. 
20 */
21
22 /** \brief Add / del table request
23            A table can be added multiple times, but need be deleted only once.
24     @param client_index - opaque cookie to identify the sender
25     @param context - sender context, to match reply w/ request
26     @param is_ipv6 - V4 or V6 table
27     @param table_id - table ID associated with the route
28                       This table ID will apply to both the unicats
29                       and mlticast FIBs
30 */
31 autoreply define ip_table_add_del
32 {
33   u32 client_index;
34   u32 context;
35   u32 table_id;
36   u8 is_ipv6;
37   u8 is_add;
38 };
39
40 /** \brief Dump IP fib table
41     @param client_index - opaque cookie to identify the sender
42 */
43 define ip_fib_dump
44 {
45   u32 client_index;
46   u32 context;
47 };
48
49 /** \brief FIB path
50     @param sw_if_index - index of the interface
51     @param weight - The weight, for UCMP
52     @param preference - The preference of the path. lowest preference is prefered
53     @param is_local - local if non-zero, else remote
54     @param is_drop - Drop the packet
55     @param is_unreach - Drop the packet and rate limit send ICMP unreachable
56     @param is_prohibit - Drop the packet and rate limit send ICMP prohibited
57     @param afi - the afi of the next hop, IP46_TYPE_IP4=1, IP46_TYPE_IP6=2
58     @param next_hop[16] - the next hop address
59
60     WARNING: this type is replicated, pending cleanup completion
61 */
62 typeonly manual_print manual_endian define fib_path
63 {
64   u32 sw_if_index;
65   u8 weight;
66   u8 preference;
67   u8 is_local;
68   u8 is_drop;
69   u8 is_unreach;
70   u8 is_prohibit;
71   u8 afi;
72   u8 next_hop[16];
73 };
74
75 /** \brief IP FIB table response
76     @param table_id - IP fib table id
77     @address_length - mask length
78     @address - ip4 prefix
79     @param count - the number of fib_path in path
80     @param path  - array of of fib_path structures
81 */
82 manual_endian manual_print define ip_fib_details
83 {
84   u32 context;
85   u32 table_id;
86   u8  address_length;
87   u8  address[4];
88   u32 count;
89   vl_api_fib_path_t path[count];
90 };
91
92 /** \brief Dump IP6 fib table
93     @param client_index - opaque cookie to identify the sender
94 */
95 define ip6_fib_dump
96 {
97   u32 client_index;
98   u32 context;
99 };
100
101 /** \brief IP6 FIB table response
102     @param table_id - IP6 fib table id
103     @address_length - mask length
104     @address - ip6 prefix
105     @param count - the number of fib_path in path
106     @param path  - array of of fib_path structures
107 */
108 manual_endian manual_print define ip6_fib_details
109 {
110   u32 context;
111   u32 table_id;
112   u8  address_length;
113   u8  address[16];
114   u32 count;
115   vl_api_fib_path_t path[count];
116 };
117
118 /** \brief Dump IP neighboors
119     @param client_index - opaque cookie to identify the sender
120     @param context - sender context, to match reply w/ request
121     @param sw_if_index - the interface to dump neighboors
122     @param is_ipv6 - [1|0] to indicate if address family is ipv[6|4]
123 */
124 define ip_neighbor_dump
125 {
126     u32 client_index;
127     u32 context;
128     u32 sw_if_index;
129     u8  is_ipv6;
130 };
131
132 /** \brief IP neighboors dump response
133     @param context - sender context which was passed in the request
134     @param is_static - [1|0] to indicate if neighbor is statically configured
135     @param is_ipv6 - [1|0] to indicate if address family is ipv[6|4]
136 */
137 define ip_neighbor_details {
138     u32 context;
139     u8  is_static;
140     u8  is_ipv6;
141     u8  mac_address[6];
142     u8  ip_address[16];
143 };
144
145 /** \brief IP neighbor add / del request
146     @param client_index - opaque cookie to identify the sender
147     @param context - sender context, to match reply w/ request
148     @param sw_if_index - interface used to reach neighbor
149     @param is_add - 1 to add neighbor, 0 to delete
150     @param is_ipv6 - 1 for IPv6 neighbor, 0 for IPv4
151     @param is_ipv6 - 1 for IPv6 neighbor, 0 for IPv4
152     @param is_static - A static neighbor Entry - there are not flushed
153                        If the interface goes down.
154     @param is_no_adj_fib - Do not create a corresponding entry in the FIB
155                            table for the neighbor.
156     @param mac_address - l2 address of the neighbor
157     @param dst_address - ip4 or ip6 address of the neighbor
158 */
159 autoreply define ip_neighbor_add_del
160 {
161   u32 client_index;
162   u32 context;
163   u32 sw_if_index;
164   /* 1 = add, 0 = delete */
165   u8 is_add;
166   u8 is_ipv6;
167   u8 is_static;
168   u8 is_no_adj_fib;
169   u8 mac_address[6];
170   u8 dst_address[16];
171 };
172
173 /** \brief Set the ip flow hash config for a fib request
174     @param client_index - opaque cookie to identify the sender
175     @param context - sender context, to match reply w/ request
176     @param vrf_id - vrf/fib id
177     @param is_ipv6 - if non-zero the fib is ip6, else ip4
178     @param src - if non-zero include src in flow hash
179     @param dst - if non-zero include dst in flow hash
180     @param sport - if non-zero include sport in flow hash
181     @param dport - if non-zero include dport in flow hash
182     @param proto -if non-zero include proto in flow hash
183     @param reverse - if non-zero include reverse in flow hash
184 */
185 autoreply define set_ip_flow_hash
186 {
187   u32 client_index;
188   u32 context;
189   u32 vrf_id;
190   u8 is_ipv6;
191   u8 src;
192   u8 dst;
193   u8 sport;
194   u8 dport;
195   u8 proto;
196   u8 reverse;
197 };
198
199 /** \brief IPv6 router advertisement config request
200     @param client_index - opaque cookie to identify the sender
201     @param context - sender context, to match reply w/ request
202     @param suppress -
203     @param managed -
204     @param other -
205     @param ll_option -
206     @param send_unicast -
207     @param cease -
208     @param is_no -
209     @param default_router -
210     @param max_interval -
211     @param min_interval -
212     @param lifetime -
213     @param initial_count -
214     @param initial_interval -
215 */
216 autoreply define sw_interface_ip6nd_ra_config
217 {
218   u32 client_index;
219   u32 context;
220   u32 sw_if_index;
221   u8 suppress;
222   u8 managed;
223   u8 other;
224   u8 ll_option;
225   u8 send_unicast;
226   u8 cease;
227   u8 is_no;
228   u8 default_router;
229   u32 max_interval;
230   u32 min_interval;
231   u32 lifetime;
232   u32 initial_count;
233   u32 initial_interval;
234 };
235
236 /** \brief IPv6 router advertisement prefix config request
237     @param client_index - opaque cookie to identify the sender
238     @param context - sender context, to match reply w/ request
239     @param sw_if_index - The interface the RA prefix information is for
240     @param address[] - The prefix to advertise
241     @param address_length - the prefix length
242     @param use_default - Revert to default settings
243     @param no_advertise - Do not advertise this prefix
244     @param off_link - The prefix is off link (it is not configured on the interface)
245                       Configures the L-flag, When set, indicates that this
246                       prefix can be used for on-link determination.
247     @param no_autoconfig - Setting for the A-flag. When
248                            set indicates that this prefix can be used for
249                           stateless address configuration.
250     @param no_onlink - The prefix is not on link. Make sure this is consistent
251                        with the off_link parameter else YMMV
252     @param is_no - add/delete
253     @param val_lifetime - The length of time in
254                      seconds (relative to the time the packet is sent)
255                      that the prefix is valid for the purpose of on-link
256                      determination.  A value of all one bits
257                      (0xffffffff) represents infinity
258     @param pref_lifetime - The length of time in
259                      seconds (relative to the time the packet is sent)
260                      that addresses generated from the prefix via
261                      stateless address autoconfiguration remain
262                      preferred [ADDRCONF].  A value of all one bits
263                      (0xffffffff) represents infinity.
264 */
265 autoreply define sw_interface_ip6nd_ra_prefix
266 {
267   u32 client_index;
268   u32 context;
269   u32 sw_if_index;
270   u8 address[16];
271   u8 address_length;
272   u8 use_default;
273   u8 no_advertise;
274   u8 off_link;
275   u8 no_autoconfig;
276   u8 no_onlink;
277   u8 is_no;
278   u32 val_lifetime;
279   u32 pref_lifetime;
280 };
281
282 /** \brief IPv6 ND proxy config
283     @param client_index - opaque cookie to identify the sender
284     @param context - sender context, to match reply w/ request
285     @param sw_if_index - The interface the host is on
286     @param address - The address of the host for which to proxy for
287     @param is_add - Adding or deleting
288 */
289 autoreply define ip6nd_proxy_add_del
290 {
291   u32 client_index;
292   u32 context;
293   u32 sw_if_index;
294   u8 is_del;
295   u8 address[16];
296 };
297
298 /** \brief IPv6 ND proxy details returned after request
299     @param context - sender context, to match reply w/ request
300     @param retval - return code for the request
301 */
302 define ip6nd_proxy_details
303 {
304   u32 client_index;
305   u32 context;
306   u32 sw_if_index;
307   u8 address[16];
308 };
309
310 /** \brief IPv6 ND proxy dump request
311     @param context - sender context, to match reply w/ request
312     @param retval - return code for the request
313     @param sw_if_index - The interface the host is on
314     @param address - The address of the host for which to proxy for
315 */
316 define ip6nd_proxy_dump
317 {
318   u32 client_index;
319   u32 context;
320 };
321
322 /** \brief IPv6 interface enable / disable request
323     @param client_index - opaque cookie to identify the sender
324     @param context - sender context, to match reply w/ request
325     @param sw_if_index - interface used to reach neighbor
326     @param enable - if non-zero enable ip6 on interface, else disable
327 */
328 autoreply define sw_interface_ip6_enable_disable
329 {
330   u32 client_index;
331   u32 context;
332   u32 sw_if_index;
333   u8 enable;                    /* set to true if enable */
334 };
335
336 /** \brief IPv6 set link local address on interface request
337     @param client_index - opaque cookie to identify the sender
338     @param context - sender context, to match reply w/ request
339     @param sw_if_index - interface to set link local on
340     @param address[] - the new link local address
341 */
342 autoreply define sw_interface_ip6_set_link_local_address
343 {
344   u32 client_index;
345   u32 context;
346   u32 sw_if_index;
347   u8 address[16];
348 };
349
350 /** \brief Add / del route 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 - software index of the new vlan's parent interface
354     @param vrf_id - fib table /vrf associated with the route
355     @param lookup_in_vrf - 
356     @param classify_table_index - 
357     @param create_vrf_if_needed - 
358     @param is_add - 1 if adding the route, 0 if deleting
359     @param is_drop - Drop the packet
360     @param is_unreach - Drop the packet and rate limit send ICMP unreachable
361     @param is_prohibit - Drop the packet and rate limit send ICMP prohibited
362     @param is_ipv6 - 0 if an ip4 route, else ip6
363     @param is_local - 
364     @param is_classify - 
365     @param is_multipath - Set to 1 if this is a multipath route, else 0
366     @param not_last - Is last or not last msg in group of multiple add/del msgs
367     @param next_hop_weight - 
368     @param dst_address_length - 
369     @param dst_address[16] - 
370     @param next_hop_address[16] - 
371     @param next_hop_n_out_labels - the number of labels in the label stack
372     @param next_hop_out_label_stack - the next-hop output label stack, outer most first
373     @param next_hop_via_label - The next-hop is a resolved via a local label
374 */
375 autoreply define ip_add_del_route
376 {
377   u32 client_index;
378   u32 context;
379   u32 next_hop_sw_if_index;
380   u32 table_id;
381   u32 classify_table_index;
382   u32 next_hop_table_id;
383   u8 create_vrf_if_needed;
384   u8 is_add;
385   u8 is_drop;
386   u8 is_unreach;
387   u8 is_prohibit;
388   u8 is_ipv6;
389   u8 is_local;
390   u8 is_classify;
391   u8 is_multipath;
392   u8 is_resolve_host;
393   u8 is_resolve_attached;
394   /* Is last/not-last message in group of multiple add/del messages. */
395   u8 not_last;
396   u8 next_hop_weight;
397   u8 next_hop_preference;
398   u8 dst_address_length;
399   u8 dst_address[16];
400   u8 next_hop_address[16];
401   u8 next_hop_n_out_labels;
402   u32 next_hop_via_label;
403   u32 next_hop_out_label_stack[next_hop_n_out_labels];
404 };
405
406 /** \brief Add / del route request
407     @param client_index - opaque cookie to identify the sender
408     @param context - sender context, to match reply w/ request
409     @param sw_if_index - software index of the new vlan's parent interface
410     @param vrf_id - fib table /vrf associated with the route
411
412     FIXME
413 */
414 autoreply define ip_mroute_add_del
415 {
416   u32 client_index;
417   u32 context;
418   u32 next_hop_sw_if_index;
419   u32 table_id;
420   u32 entry_flags;
421   u32 itf_flags;
422   u32 rpf_id;
423   u16 grp_address_length;
424   u8 create_vrf_if_needed;
425   u8 is_add;
426   u8 is_ipv6;
427   u8 is_local;
428   u8 grp_address[16];
429   u8 src_address[16];
430 };
431
432 /** \brief Dump IP multicast fib table
433     @param client_index - opaque cookie to identify the sender
434 */
435 define ip_mfib_dump
436 {
437   u32 client_index;
438   u32 context;
439 };
440
441 /** \brief IP Multicast FIB table response
442     @param table_id - IP fib table id
443     @address_length - mask length
444     @grp_address - Group address/prefix
445     @src_address - Source address
446     @param count - the number of fib_path in path
447     @param path  - array of of fib_path structures
448 */
449 manual_endian manual_print define ip_mfib_details
450 {
451   u32 context;
452   u32 table_id;
453   u32 entry_flags;
454   u32 rpf_id;
455   u8  address_length;
456   u8  grp_address[4];
457   u8  src_address[4];
458   u32 count;
459   vl_api_fib_path_t path[count];
460 };
461
462 /** \brief Dump IP6 multicast fib table
463     @param client_index - opaque cookie to identify the sender
464 */
465 define ip6_mfib_dump
466 {
467   u32 client_index;
468   u32 context;
469 };
470
471 /** \brief IP6 Multicast FIB table response
472     @param table_id - IP fib table id
473     @address_length - mask length
474     @grp_address - Group address/prefix
475     @src_address - Source address
476     @param count - the number of fib_path in path
477     @param path  - array of of fib_path structures
478 */
479 manual_endian manual_print define ip6_mfib_details
480 {
481   u32 context;
482   u32 table_id;
483   u8  address_length;
484   u8  grp_address[16];
485   u8  src_address[16];
486   u32 count;
487   vl_api_fib_path_t path[count];
488 };
489
490 define ip_address_details
491 {
492   u32 client_index;
493   u32 context;
494   u8 ip[16];
495   u8 prefix_length;
496   u32 sw_if_index;
497   u8 is_ipv6;
498 };
499
500 define ip_address_dump
501 {
502   u32 client_index;
503   u32 context;
504   u32 sw_if_index;
505   u8 is_ipv6;
506 };
507
508 define ip_details
509 {
510   u32 sw_if_index;
511   u32 context;
512   u8 is_ipv6;
513 };
514
515 define ip_dump
516 {
517   u32 client_index;
518   u32 context;
519   u8 is_ipv6;
520 };
521
522 define mfib_signal_dump
523 {
524   u32 client_index;
525   u32 context;
526 };
527
528 define mfib_signal_details
529 {
530   u32 client_index;
531   u32 context;
532   u32 sw_if_index;
533   u32 table_id;
534   u16 grp_address_len;
535   u8 grp_address[16];
536   u8 src_address[16];
537   u16 ip_packet_len;
538   u8 ip_packet_data[256];
539 };
540
541 /*
542  * Local Variables:
543  * eval: (c-set-style "gnu")
544  * End:
545  */