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