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