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