API refactoring : cop
[vpp.git] / src / vpp / api / vpe.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 /** \file
17
18     This file defines vpe control-plane API messages which are generally
19     called through a shared memory interface. 
20 */
21
22 /* 
23  * Note: API placement cleanup in progress
24  * If you're looking for interface APIs, please
25  * see .../src/vnet/{interface.api,interface_api.c}
26  * IP APIs: see .../src/vnet/ip/{ip.api, ip_api.c}
27  * TAP APIs: see .../src/vnet/unix/{tap.api, tap_api.c}
28  * VXLAN APIs: see .../src/vnet/vxlan/{vxlan.api, vxlan_api.c}
29  * AF-PACKET APIs: see ... /vnet/devices/af_packet/{af_packet.api, af_packet_api.c}
30  * NETMAP APIs: see ... /src/vnet/devices/netmap/{netmap.api, netmap_api.c}
31  * VHOST-USER APIs: see .../vnet/devices/virtio/{vhost_user.api, vhost_user_api.c}
32  * VXLAN GPE APIs: see .../src/vnet/vxlan-gpe/{vxlan_gpe.api, vxlan_gpe_api.c}
33  * GRE APIs: see .../src/vnet/gre/{gre.api, gre_api.c}
34  * L2 APIs: see .../src/vnet/l2/{l2.api, l2_api.c}
35  * L2TP APIs: see .../src/vnet/l2tp/{l2tp.api, l2tp_api.c}
36  * BFD APIs: see .../src/vnet/bfd/{bfd.api, bfd_api.c}
37  * IPSEC APIs: see .../src/vnet/ipsec/{ipsec.api, ipsec_api.c}
38  * IPSEC-GRE APIs: see .../src/vnet/ipsec-gre/{ipsec_gre.api, ipsec_gre_api.c}
39  * LISP APIs: see .../src/vnet/lisp/{lisp.api, lisp_api.c}
40  * LISP-GPE APIs: see .../src/vnet/lisp-gpe/{lisp_gpe.api, lisp_gpe_api.c}
41  * MPLS APIs: see .../src/vnet/mpls/{mpls.api, mpls_api.c}
42  * SR APIs: see .../src/vnet/sr/{sr.api, sr_api.c}
43  * DPDK APIs: see ... /src/vnet/devices/dpdk/{dpdk.api, dpdk_api.c}
44  * CLASSIFY APIs: see ... /src/vnet/classify/{classify.api, classify_api.c}
45  * FLOW APIs: see ... /src/vnet/flow/{flow.api, flow_api.c}
46  * DHCP APIs: see ... /src/vnet/dhcp/{dhcpk.api, dhcp_api.c}
47  * COP APIs: see ... /src/vnet/cop/{cop.api, cop_api.c}
48  */
49
50 /** \brief Create a new subinterface with the given vlan id
51     @param client_index - opaque cookie to identify the sender
52     @param context - sender context, to match reply w/ request
53     @param sw_if_index - software index of the new vlan's parent interface
54     @param vlan_id - vlan tag of the new interface
55 */
56 define create_vlan_subif
57 {
58   u32 client_index;
59   u32 context;
60   u32 sw_if_index;
61   u32 vlan_id;
62 };
63
64 /** \brief Reply for the vlan subinterface create request
65     @param context - returned sender context, to match reply w/ request
66     @param retval - return code
67     @param sw_if_index - software index allocated for the new subinterface
68 */
69 define create_vlan_subif_reply
70 {
71   u32 context;
72   i32 retval;
73   u32 sw_if_index;
74 };
75
76 /** \brief Enable or Disable MPLS on and interface
77     @param client_index - opaque cookie to identify the sender
78     @param context - sender context, to match reply w/ request
79     @param sw_if_index - index of the interface
80     @param enable - if non-zero enable, else disable
81 */
82 define sw_interface_set_mpls_enable
83 {
84   u32 client_index;
85   u32 context;
86   u32 sw_if_index;
87   u8 enable;
88 };
89
90 /** \brief Reply for MPLS state on an interface
91     @param context - returned sender context, to match reply w/ request
92     @param retval - return code
93 */
94 define sw_interface_set_mpls_enable_reply
95 {
96   u32 context;
97   i32 retval;
98 };
99
100 /** \brief Proxy ARP add / del request
101     @param client_index - opaque cookie to identify the sender
102     @param context - sender context, to match reply w/ request
103     @param vrf_id - VRF / Fib table ID
104     @param is_add - 1 if adding the Proxy ARP range, 0 if deleting
105     @param low_address[4] - Low address of the Proxy ARP range
106     @param hi_address[4] - High address of the Proxy ARP range
107 */
108 define proxy_arp_add_del
109 {
110   u32 client_index;
111   u32 context;
112   u32 vrf_id;
113   u8 is_add;
114   u8 low_address[4];
115   u8 hi_address[4];
116 };
117
118 /** \brief Reply for proxy arp add / del request
119     @param context - returned sender context, to match reply w/ request
120     @param retval - return code
121 */
122 define proxy_arp_add_del_reply
123 {
124   u32 context;
125   i32 retval;
126 };
127
128 /** \brief Proxy ARP add / del request
129     @param client_index - opaque cookie to identify the sender
130     @param context - sender context, to match reply w/ request
131     @param sw_if_index - Which interface to enable / disable Proxy Arp on
132     @param enable_disable - 1 to enable Proxy ARP on interface, 0 to disable
133 */
134 define proxy_arp_intfc_enable_disable
135 {
136   u32 client_index;
137   u32 context;
138   u32 sw_if_index;
139   /* 1 = on, 0 = off */
140   u8 enable_disable;
141 };
142
143 /** \brief Reply for Proxy ARP interface enable / disable request
144     @param context - returned sender context, to match reply w/ request
145     @param retval - return code
146 */
147 define proxy_arp_intfc_enable_disable_reply
148 {
149   u32 context;
150   i32 retval;
151 };
152
153 /** \brief Reset VRF (remove all routes etc) request
154     @param client_index - opaque cookie to identify the sender
155     @param context - sender context, to match reply w/ request
156     @param is_ipv6 - 1 for IPv6 neighbor, 0 for IPv4
157     @param vrf_id - ID of th FIB table / VRF to reset
158 */
159 define reset_vrf
160 {
161   u32 client_index;
162   u32 context;
163   u8 is_ipv6;
164   u32 vrf_id;
165 };
166
167 /** \brief Reply for Reset VRF request
168     @param context - returned sender context, to match reply w/ request
169     @param retval - return code
170 */
171 define reset_vrf_reply
172 {
173   u32 context;
174   i32 retval;
175 };
176
177 /** \brief Is Address Reachable request - DISABLED
178     @param client_index - opaque cookie to identify the sender
179     @param context - sender context, to match reply w/ request
180     @param next_hop_sw_if_index - index of interface used to get to next hop
181     @param is_ipv6 - 1 for IPv6, 0 for IPv4
182     @param is_error - address not found or does not match intf
183     @param address[] - Address in question 
184 */
185 define is_address_reachable
186 {
187   u32 client_index;             /* (api_main_t *) am->my_client_index */
188   u32 context;
189   u32 next_hop_sw_if_index;
190   u8 is_known;                  /* on reply, this is the answer */
191   u8 is_ipv6;
192   u8 is_error;                  /* address not found or does not match intf */
193   u8 address[16];
194 };
195
196 /** \brief Want Stats, register for stats updates
197     @param client_index - opaque cookie to identify the sender
198     @param context - sender context, to match reply w/ request
199     @param enable_disable - 1 = enable stats, 0 = disable
200     @param pid - pid of process requesting stats updates
201 */
202 define want_stats
203 {
204   u32 client_index;
205   u32 context;
206   u32 enable_disable;
207   u32 pid;
208 };
209
210 /** \brief Reply for Want Stats request
211     @param context - returned sender context, to match reply w/ request
212     @param retval - return code
213 */
214 define want_stats_reply
215 {
216   u32 context;
217   i32 retval;
218 };
219
220 typeonly manual_print manual_endian define ip4_fib_counter
221 {
222   u32 address;
223   u8 address_length;
224   u64 packets;
225   u64 bytes;
226 };
227
228 manual_print manual_endian define vnet_ip4_fib_counters
229 {
230   u32 vrf_id;
231   u32 count;
232   vl_api_ip4_fib_counter_t c[count];
233 };
234
235 typeonly manual_print manual_endian define ip4_nbr_counter
236 {
237   u32 address;
238   u8  link_type;
239   u64 packets;
240   u64 bytes;
241 };
242
243 /**
244  * @brief Per-neighbour (i.e. per-adjacency) coutners
245  * @param count The size of the array of counters
246  * @param sw_if_index The interface the adjacency is on
247  * @param begin Flag to indicate this is the first set of stats for this
248  *        interface. If this flag is not set the it is a continuation of
249  *        stats for this interface
250  * @param  c counters
251  */
252 manual_print manual_endian define vnet_ip4_nbr_counters
253 {
254   u32 count;
255   u32 sw_if_index;
256   u8 begin;
257   vl_api_ip4_nbr_counter_t c[count];
258 };
259
260 typeonly manual_print manual_endian define ip6_fib_counter
261 {
262   u64 address[2];
263   u8 address_length;
264   u64 packets;
265   u64 bytes;
266 };
267
268 manual_print manual_endian define vnet_ip6_fib_counters
269 {
270   u32 vrf_id;
271   u32 count;
272   vl_api_ip6_fib_counter_t c[count];
273 };
274
275 typeonly manual_print manual_endian define ip6_nbr_counter
276 {
277   u64 address[2];
278   u8  link_type;
279   u64 packets;
280   u64 bytes;
281 };
282
283 manual_print manual_endian define vnet_ip6_nbr_counters
284 {
285   u32 count;
286   u32 sw_if_index;
287   u8 begin;
288   vl_api_ip6_nbr_counter_t c[count];
289 };
290
291 /** \brief Request for a single block of summary stats
292     @param client_index - opaque cookie to identify the sender
293     @param context - sender context, to match reply w/ request
294 */
295 define vnet_get_summary_stats
296 {
297   u32 client_index;
298   u32 context;
299 };
300
301 /** \brief Reply for vnet_get_summary_stats request
302     @param context - sender context, to match reply w/ request
303     @param retval - return code for request
304     @param total_pkts -  
305     @param total_bytes -
306     @param vector_rate - 
307 */
308 define vnet_summary_stats_reply
309 {
310   u32 context;
311   i32 retval;
312   u64 total_pkts[2];
313   u64 total_bytes[2];
314   f64 vector_rate;
315 };
316
317 /** \brief OAM event structure
318     @param dst_address[] - 
319     @param state
320 */
321 define oam_event
322 {
323   u8 dst_address[4];
324   u8 state;
325 };
326
327 /** \brief Want OAM events request
328     @param client_index - opaque cookie to identify the sender
329     @param context - sender context, to match reply w/ request
330     @param enable_disable- enable if non-zero, else disable
331     @param pid - pid of the requesting process
332 */
333 define want_oam_events
334 {
335   u32 client_index;
336   u32 context;
337   u32 enable_disable;
338   u32 pid;
339 };
340
341 /** \brief Want OAM events response
342     @param context - sender context, to match reply w/ request
343     @param retval - return code for the want oam stats request
344 */
345 define want_oam_events_reply
346 {
347   u32 context;
348   i32 retval;
349 };
350
351 /** \brief OAM add / del target request
352     @param client_index - opaque cookie to identify the sender
353     @param context - sender context, to match reply w/ request
354     @param vrf_id - vrf_id of the target
355     @param src_address[] - source address to use for the updates 
356     @param dst_address[] - destination address of the target
357     @param is_add - add target if non-zero, else delete
358 */
359 define oam_add_del
360 {
361   u32 client_index;
362   u32 context;
363   u32 vrf_id;
364   u8 src_address[4];
365   u8 dst_address[4];
366   u8 is_add;
367 };
368
369 /** \brief OAM add / del target response
370     @param context - sender context, to match reply w/ request
371     @param retval - return code of the request
372 */
373 define oam_add_del_reply
374 {
375   u32 context;
376   i32 retval;
377 };
378
379 /** \brief Reset fib table request
380     @param client_index - opaque cookie to identify the sender
381     @param context - sender context, to match reply w/ request
382     @param vrf_id - vrf/table id of the fib table to reset
383     @param is_ipv6 - an ipv6 fib to reset if non-zero, else ipv4
384 */
385 define reset_fib
386 {
387   u32 client_index;
388   u32 context;
389   u32 vrf_id;
390   u8 is_ipv6;
391 };
392
393 /** \brief Reset fib response
394     @param context - sender context, to match reply w/ request
395     @param retval - return code for the reset bfib request
396 */
397 define reset_fib_reply
398 {
399   u32 context;
400   i32 retval;
401 };
402
403 /** \brief Create loopback interface request
404     @param client_index - opaque cookie to identify the sender
405     @param context - sender context, to match reply w/ request
406     @param mac_address - mac addr to assign to the interface if none-zero
407 */
408 define create_loopback
409 {
410   u32 client_index;
411   u32 context;
412   u8 mac_address[6];
413 };
414
415 /** \brief Create loopback interface response
416     @param context - sender context, to match reply w/ request
417     @param sw_if_index - sw index of the interface that was created
418     @param retval - return code for the request
419 */
420 define create_loopback_reply
421 {
422   u32 context;
423   i32 retval;
424   u32 sw_if_index;
425 };
426
427 /** \brief Delete loopback interface request
428     @param client_index - opaque cookie to identify the sender
429     @param context - sender context, to match reply w/ request
430     @param sw_if_index - sw index of the interface that was created
431 */
432 define delete_loopback
433 {
434   u32 client_index;
435   u32 context;
436   u32 sw_if_index;
437 };
438
439 /** \brief Delete loopback interface response
440     @param context - sender context, to match reply w/ request
441     @param retval - return code for the request
442 */
443 define delete_loopback_reply
444 {
445   u32 context;
446   i32 retval;
447 };
448
449 /** \brief Control ping from client to api server request
450     @param client_index - opaque cookie to identify the sender
451     @param context - sender context, to match reply w/ request
452 */
453 define control_ping
454 {
455   u32 client_index;
456   u32 context;
457 };
458
459 /** \brief Control ping from the client to the server response
460     @param client_index - opaque cookie to identify the sender
461     @param context - sender context, to match reply w/ request
462     @param retval - return code for the request
463     @param vpe_pid - the pid of the vpe, returned by the server
464 */
465 define control_ping_reply
466 {
467   u32 context;
468   i32 retval;
469   u32 client_index;
470   u32 vpe_pid;
471 };
472
473 /** \brief Process a vpe parser cli string request
474     @param client_index - opaque cookie to identify the sender
475     @param context - sender context, to match reply w/ request
476     @param cmd_in_shmem - pointer to cli command string
477 */
478 define cli_request
479 {
480   u32 client_index;
481   u32 context;
482   u64 cmd_in_shmem;
483 };
484 define cli_inband
485 {
486   u32 client_index;
487   u32 context;
488   u32 length;
489   u8 cmd[length];
490 };
491
492 /** \brief vpe parser cli string response
493     @param context - sender context, to match reply w/ request
494     @param retval - return code for request
495     @param reply_in_shmem - Reply string from cli processing if any
496 */
497 define cli_reply
498 {
499   u32 context;
500   i32 retval;
501   u64 reply_in_shmem;
502 };
503 define cli_inband_reply
504 {
505   u32 context;
506   i32 retval;
507   u32 length;
508   u8 reply[length];
509 };
510
511 /** \brief Set max allowed ARP or ip6 neighbor entries request
512     @param client_index - opaque cookie to identify the sender
513     @param context - sender context, to match reply w/ request
514     @param is_ipv6 - neighbor limit if non-zero, else ARP limit
515     @param arp_neighbor_limit - the new limit, defaults are ~ 50k
516 */
517 define set_arp_neighbor_limit
518 {
519   u32 client_index;
520   u32 context;
521   u8 is_ipv6;
522   u32 arp_neighbor_limit;
523 };
524
525 /** \brief Set max allowed ARP or ip6 neighbor entries response
526     @param context - sender context, to match reply w/ request
527     @param retval - return code for request
528 */
529 define set_arp_neighbor_limit_reply
530 {
531   u32 context;
532   i32 retval;
533 };
534
535 /** \brief L2 interface patch add / del request
536     @param client_index - opaque cookie to identify the sender
537     @param context - sender context, to match reply w/ request
538     @param rx_sw_if_index - receive side interface 
539     @param tx_sw_if_index - transmit side interface
540     @param is_add - if non-zero set up the interface patch, else remove it
541 */
542 define l2_patch_add_del
543 {
544   u32 client_index;
545   u32 context;
546   u32 rx_sw_if_index;
547   u32 tx_sw_if_index;
548   u8 is_add;
549 };
550
551 /** \brief L2 interface patch add / del response
552     @param context - sender context, to match reply w/ request
553     @param retval - return code for the request
554 */
555 define l2_patch_add_del_reply
556 {
557   u32 context;
558   i32 retval;
559 };
560
561 /** \brief Interface set vpath request
562     @param client_index - opaque cookie to identify the sender
563     @param context - sender context, to match reply w/ request
564     @param sw_if_index - interface used to reach neighbor
565     @param enable - if non-zero enable, else disable
566 */
567 define sw_interface_set_vpath
568 {
569   u32 client_index;
570   u32 context;
571   u32 sw_if_index;
572   u8 enable;
573 };
574
575 /** \brief Interface set vpath response
576     @param context - sender context, to match reply w/ request
577     @param retval - return code for the request
578 */
579 define sw_interface_set_vpath_reply
580 {
581   u32 context;
582   i32 retval;
583 };
584
585 /** \brief Set L2 XConnect between two interfaces request
586     @param client_index - opaque cookie to identify the sender
587     @param context - sender context, to match reply w/ request
588     @param rx_sw_if_index - Receive interface index
589     @param tx_sw_if_index - Transmit interface index
590     @param enable - enable xconnect if not 0, else set to L3 mode
591 */
592 define sw_interface_set_l2_xconnect
593 {
594   u32 client_index;
595   u32 context;
596   u32 rx_sw_if_index;
597   u32 tx_sw_if_index;
598   u8 enable;
599 };
600
601 /** \brief Set L2 XConnect response
602     @param context - sender context, to match reply w/ request
603     @param retval - L2 XConnect request return code
604 */
605 define sw_interface_set_l2_xconnect_reply
606 {
607   u32 context;
608   i32 retval;
609 };
610
611 /** \brief Interface bridge mode request
612     @param client_index - opaque cookie to identify the sender
613     @param context - sender context, to match reply w/ request
614     @param rx_sw_if_index - the interface
615     @param bd_id - bridge domain id
616     @param bvi - Setup interface as a bvi, bridge mode only
617     @param shg - Shared horizon group, for bridge mode only
618     @param enable - Enable beige mode if not 0, else set to L3 mode
619 */
620 define sw_interface_set_l2_bridge
621 {
622   u32 client_index;
623   u32 context;
624   u32 rx_sw_if_index;
625   u32 bd_id;
626   u8 shg;
627   u8 bvi;
628   u8 enable;
629 };
630
631 /** \brief Interface bridge mode response
632     @param context - sender context, to match reply w/ request
633     @param retval - Bridge mode request return code
634 */
635 define sw_interface_set_l2_bridge_reply
636 {
637   u32 context;
638   i32 retval;
639 };
640
641 /** \brief Set bridge domain ip to mac entry request
642     @param client_index - opaque cookie to identify the sender
643     @param context - sender context, to match reply w/ request
644     @param bd_id - the bridge domain to set the flags for
645     @param is_add - if non-zero, add the entry, else clear it
646     @param is_ipv6 - if non-zero, ipv6 address, else ipv4 address
647     @param mac_address - MAC address
648     @param 
649 */
650 define bd_ip_mac_add_del
651 {
652   u32 client_index;
653   u32 context;
654   u32 bd_id;
655   u8 is_add;
656   u8 is_ipv6;
657   u8 ip_address[16];
658   u8 mac_address[6];
659 };
660
661 /** \brief Set bridge domain ip to mac entry response
662     @param context - sender context, to match reply w/ request
663     @param retval - return code for the set bridge flags request
664 */
665 define bd_ip_mac_add_del_reply
666 {
667   u32 context;
668   i32 retval;
669 };
670
671 /** \brief Set/unset the classification table for an interface request 
672     @param client_index - opaque cookie to identify the sender
673     @param context - sender context, to match reply w/ request
674     @param is_ipv6 - ipv6 if non-zero, else ipv4
675     @param sw_if_index - interface to associate with the table
676     @param table_index - index of the table, if ~0 unset the table
677 */
678 define classify_set_interface_ip_table
679 {
680   u32 client_index;
681   u32 context;
682   u8 is_ipv6;
683   u32 sw_if_index;
684   u32 table_index;              /* ~0 => off */
685 };
686
687 /** \brief Set/unset interface classification table response 
688     @param context - sender context, to match reply w/ request
689     @param retval - return code
690 */
691 define classify_set_interface_ip_table_reply
692 {
693   u32 context;
694   i32 retval;
695 };
696
697 /** \brief Set/unset l2 classification tables for an interface request
698     @param client_index - opaque cookie to identify the sender
699     @param context - sender context, to match reply w/ request
700     @param sw_if_index - interface to set/unset tables for
701     @param ip4_table_index - ip4 index, use ~0 for all 3 indexes to unset
702     @param ip6_table_index - ip6 index
703     @param other_table_index - other index
704 */
705 define classify_set_interface_l2_tables
706 {
707   u32 client_index;
708   u32 context;
709   u32 sw_if_index;
710   /* 3 x ~0 => off */
711   u32 ip4_table_index;
712   u32 ip6_table_index;
713   u32 other_table_index;
714   u8 is_input;
715 };
716
717 /** \brief Set/unset l2 classification tables for an interface response
718     @param context - sender context, to match reply w/ request
719     @param retval - return code for the request
720 */
721 define classify_set_interface_l2_tables_reply
722 {
723   u32 context;
724   i32 retval;
725 };
726
727 /** \brief Get node index using name request
728     @param client_index - opaque cookie to identify the sender
729     @param context - sender context, to match reply w/ request
730     @param node_name[] - name of the node
731 */
732 define get_node_index
733 {
734   u32 client_index;
735   u32 context;
736   u8 node_name[64];
737 };
738
739 /** \brief Get node index using name request
740     @param context - sender context, to match reply w/ request
741     @param retval - return code for the request
742     @param node_index - index of the desired node if found, else ~0
743 */
744 define get_node_index_reply
745 {
746   u32 context;
747   i32 retval;
748   u32 node_index;
749 };
750
751 /** \brief Set the next node for a given node request
752     @param client_index - opaque cookie to identify the sender
753     @param context - sender context, to match reply w/ request
754     @param node_name[] - node to add the next node to
755     @param next_name[] - node to add as the next node
756 */
757 define add_node_next
758 {
759   u32 client_index;
760   u32 context;
761   u8 node_name[64];
762   u8 next_name[64];
763 };
764
765 /** \brief IP Set the next node for a given node response
766     @param context - sender context, to match reply w/ request
767     @param retval - return code for the add next node request
768     @param next_index - the index of the next node if success, else ~0
769 */
770 define add_node_next_reply
771 {
772   u32 context;
773   i32 retval;
774   u32 next_index;
775 };
776
777 /** \brief L2 interface ethernet flow point filtering enable/disable request
778     @param client_index - opaque cookie to identify the sender
779     @param context - sender context, to match reply w/ request
780     @param sw_if_index - interface to enable/disable filtering on
781     @param enable_disable - if non-zero enable filtering, else disable
782 */
783 define l2_interface_efp_filter
784 {
785   u32 client_index;
786   u32 context;
787   u32 sw_if_index;
788   u32 enable_disable;
789 };
790
791 /** \brief L2 interface ethernet flow point filtering response
792     @param context - sender context, to match reply w/ request
793     @param retval - return code for the request
794 */
795 define l2_interface_efp_filter_reply
796 {
797   u32 context;
798   i32 retval;
799 };
800
801 define create_subif
802 {
803   u32 client_index;
804   u32 context;
805   u32 sw_if_index;
806   u32 sub_id;
807
808   /* These fields map directly onto the subif template */
809   u8 no_tags;
810   u8 one_tag;
811   u8 two_tags;
812   u8 dot1ad;                    // 0 = dot1q, 1=dot1ad
813   u8 exact_match;
814   u8 default_sub;
815   u8 outer_vlan_id_any;
816   u8 inner_vlan_id_any;
817   u16 outer_vlan_id;
818   u16 inner_vlan_id;
819 };
820
821 define create_subif_reply
822 {
823   u32 context;
824   i32 retval;
825   u32 sw_if_index;
826 };
827
828 /** \brief show version
829     @param client_index - opaque cookie to identify the sender
830     @param context - sender context, to match reply w/ request
831 */
832 define show_version
833 {
834   u32 client_index;
835   u32 context;
836 };
837
838 /** \brief show version response
839     @param context - sender context, to match reply w/ request
840     @param retval - return code for the request
841     @param program - name of the program (vpe)
842     @param version  - version of the program
843     @param build_directory - root of the workspace where the program was built
844 */
845 define show_version_reply
846 {
847   u32 context;
848   i32 retval;
849   u8 program[32];
850   u8 version[32];
851   u8 build_date[32];
852   u8 build_directory[256];
853 };
854
855 /* Gross kludge, DGMS */
856 define interface_name_renumber
857 {
858   u32 client_index;
859   u32 context;
860   u32 sw_if_index;
861   u32 new_show_dev_instance;
862 };
863
864 define interface_name_renumber_reply
865 {
866   u32 context;
867   i32 retval;
868 };
869
870 /** \brief Register for ip4 arp resolution events
871     @param client_index - opaque cookie to identify the sender
872     @param context - sender context, to match reply w/ request
873     @param enable_disable - 1 => register for events, 0 => cancel registration
874     @param pid - sender's pid
875     @param address - the exact ip4 address of interest
876 */
877 define want_ip4_arp_events
878 {
879   u32 client_index;
880   u32 context;
881   u8 enable_disable;
882   u32 pid;
883   u32 address;
884 };
885
886 /** \brief Reply for interface events registration
887     @param context - returned sender context, to match reply w/ request
888     @param retval - return code
889 */
890 define want_ip4_arp_events_reply
891 {
892   u32 context;
893   i32 retval;
894 };
895
896 /** \brief Tell client about an ip4 arp resolution event
897     @param client_index - opaque cookie to identify the sender
898     @param context - sender context, to match reply w/ request
899     @param address - the exact ip4 address of interest
900     @param pid - client pid registered to receive notification
901     @param sw_if_index - interface which received ARP packet
902     @param new_mac - the new mac address 
903     @param mac_ip - 0: resolution event, 1: mac/ip binding in bd
904 */
905 define ip4_arp_event
906 {
907   u32 client_index;
908   u32 context;
909   u32 address;
910   u32 pid;
911   u32 sw_if_index;
912   u8 new_mac[6];
913   u8 mac_ip;
914 };
915
916 /** \brief Register for ip6 nd resolution events
917     @param client_index - opaque cookie to identify the sender
918     @param context - sender context, to match reply w/ request
919     @param enable_disable - 1 => register for events, 0 => cancel registration
920     @param pid - sender's pid
921     @param address - the exact ip6 address of interest
922 */
923 define want_ip6_nd_events
924 {
925   u32 client_index;
926   u32 context;
927   u8 enable_disable;
928   u32 pid;
929   u8 address[16];
930 };
931
932 /** \brief Reply for ip6 nd resolution events registration
933     @param context - returned sender context, to match reply w/ request
934     @param retval - return code
935 */
936 define want_ip6_nd_events_reply
937 {
938   u32 context;
939   i32 retval;
940 };
941
942 /** \brief Tell client about an ip6 nd resolution or mac/ip event
943     @param client_index - opaque cookie to identify the sender
944     @param context - sender context, to match reply w/ request
945     @param pid - client pid registered to receive notification
946     @param sw_if_index - interface which received ARP packet
947     @param address - the exact ip6 address of interest
948     @param new_mac - the new mac address 
949     @param mac_ip - 0: resolution event, 1: mac/ip binding in bd
950 */
951 define ip6_nd_event
952 {
953   u32 client_index;
954   u32 context;
955   u32 pid;
956   u32 sw_if_index;
957   u8 address[16];
958   u8 new_mac[6];
959   u8 mac_ip;
960 };
961     
962 /** \brief Set/unset input ACL interface
963     @param client_index - opaque cookie to identify the sender
964     @param context - sender context, to match reply w/ request
965     @param sw_if_index - interface to set/unset input ACL
966     @param ip4_table_index - ip4 classify table index (~0 for skip)
967     @param ip6_table_index - ip6 classify table index (~0 for skip)
968     @param l2_table_index  -  l2 classify table index (~0 for skip)
969     @param is_add - Set input ACL if non-zero, else unset
970     Note: User is recommeneded to use just one valid table_index per call.
971           (ip4_table_index, ip6_table_index, or l2_table_index)
972 */
973 define input_acl_set_interface
974 {
975   u32 client_index;
976   u32 context;
977   u32 sw_if_index;
978   u32 ip4_table_index;
979   u32 ip6_table_index;
980   u32 l2_table_index;
981   u8 is_add;
982 };
983
984 /** \brief Set/unset input ACL interface response
985     @param context - sender context, to match reply w/ request
986     @param retval - return code for the request
987 */
988 define input_acl_set_interface_reply
989 {
990   u32 context;
991   i32 retval;
992 };
993
994 define get_node_graph
995 {
996   u32 client_index;
997   u32 context;
998 };
999
1000 /** \brief get_node_graph_reply
1001     @param context - returned sender context, to match reply w/ request
1002     @param retval - return code
1003     @param reply_in_shmem - result from vlib_node_serialize, in shared
1004     memory. Process with vlib_node_unserialize, remember to switch
1005     heaps and free the result.
1006 */
1007
1008 define get_node_graph_reply
1009 {
1010   u32 context;
1011   i32 retval;
1012   u64 reply_in_shmem;
1013 };
1014
1015 /** \brief IOAM enable : Enable in-band OAM
1016     @param id - profile id
1017     @param seqno - To enable Seqno Processing
1018     @param analyse - Enabling analysis of iOAM at decap node 
1019     @param pow_enable - Proof of Work enabled or not flag
1020     @param trace_enable - iOAM Trace enabled or not flag
1021 */
1022 define ioam_enable
1023 {
1024   u32 client_index;
1025   u32 context;
1026   u16 id;
1027   u8 seqno;
1028   u8 analyse;
1029   u8 pot_enable;
1030   u8 trace_enable;
1031   u32 node_id;
1032 };
1033
1034 /** \brief iOAM Trace profile add / del response
1035     @param context - sender context, to match reply w/ request
1036     @param retval - return value for request
1037 */
1038 define ioam_enable_reply
1039 {
1040   u32 context;
1041   i32 retval;
1042 };
1043
1044 /** \brief iOAM disable
1045     @param client_index - opaque cookie to identify the sender
1046     @param context - sender context, to match reply w/ request
1047     @param index - MAP Domain index
1048 */
1049 define ioam_disable
1050 {
1051   u32 client_index;
1052   u32 context;
1053   u16 id;
1054 };
1055
1056 /** \brief iOAM disable response
1057     @param context - sender context, to match reply w/ request
1058     @param retval - return value for request
1059 */
1060 define ioam_disable_reply
1061 {
1062   u32 context;
1063   i32 retval;
1064 };
1065
1066 /** \brief Add/del policer
1067     @param client_index - opaque cookie to identify the sender
1068     @param context - sender context, to match reply w/ request
1069     @param is_add - add policer if non-zero, else delete
1070     @param name - policer name
1071     @param cir - CIR
1072     @param eir - EIR
1073     @param cb - Committed Burst
1074     @param eb - Excess or Peak Burst
1075     @param rate_type - rate type
1076     @param round_type - rounding type
1077     @param type - policer algorithm
1078     @param color_aware - 0=color-blind, 1=color-aware
1079     @param conform_action_type - conform action type
1080     @param conform_dscp - DSCP for conform mar-and-transmit action
1081     @param exceed_action_type - exceed action type
1082     @param exceed_dscp - DSCP for exceed mar-and-transmit action
1083     @param violate_action_type - violate action type
1084     @param violate_dscp - DSCP for violate mar-and-transmit action
1085 */
1086 define policer_add_del
1087 {
1088   u32 client_index;
1089   u32 context;
1090
1091   u8 is_add;
1092   u8 name[64];
1093   u32 cir;
1094   u32 eir;
1095   u64 cb;
1096   u64 eb;
1097   u8 rate_type;
1098   u8 round_type;
1099   u8 type;
1100   u8 color_aware;
1101   u8 conform_action_type;
1102   u8 conform_dscp;
1103   u8 exceed_action_type;
1104   u8 exceed_dscp;
1105   u8 violate_action_type;
1106   u8 violate_dscp;
1107 };
1108
1109 /** \brief Add/del policer response
1110     @param context - sender context, to match reply w/ request
1111     @param retval - return value for request
1112     @param policer_index - for add, returned index of the new policer
1113 */
1114 define policer_add_del_reply
1115 {
1116   u32 context;
1117   i32 retval;
1118   u32 policer_index;
1119 };
1120
1121 /** \brief Get list of policers
1122     @param client_index - opaque cookie to identify the sender
1123     @param context - sender context, to match reply w/ request
1124     @param match_name_valid - if 0 request all policers otherwise use match_name
1125     @param match_name - policer name
1126 */
1127 define policer_dump
1128 {
1129   u32 client_index;
1130   u32 context;
1131
1132   u8 match_name_valid;
1133   u8 match_name[64];
1134 };
1135
1136 /** \brief Policer operational state response.
1137     @param context - sender context, to match reply w/ request
1138     @param name - policer name
1139     @param cir - CIR
1140     @param eir - EIR
1141     @param cb - Committed Burst
1142     @param eb - Excess or Peak Burst
1143     @param rate_type - rate type
1144     @param round_type - rounding type
1145     @param type - policer algorithm
1146     @param conform_action_type - conform action type
1147     @param conform_dscp - DSCP for conform mar-and-transmit action
1148     @param exceed_action_type - exceed action type
1149     @param exceed_dscp - DSCP for exceed mar-and-transmit action
1150     @param violate_action_type - violate action type
1151     @param violate_dscp - DSCP for violate mar-and-transmit action
1152     @param single_rate - 1 = single rate policer, 0 = two rate policer
1153     @param color_aware - for hierarchical policing
1154     @param scale - power-of-2 shift amount for lower rates
1155     @param cir_tokens_per_period - number of tokens for each period
1156     @param pir_tokens_per_period - number of tokens for each period for 2-rate policer
1157     @param current_limit - current limit
1158     @param current_bucket - current bucket
1159     @param extended_limit - extended limit
1160     @param extended_bucket - extended bucket
1161     @param last_update_time - last update time
1162 */
1163 define policer_details
1164 {
1165   u32 context;
1166
1167   u8 name[64];
1168   u32 cir;
1169   u32 eir;
1170   u64 cb;
1171   u64 eb;
1172   u8 rate_type;
1173   u8 round_type;
1174   u8 type;
1175   u8 conform_action_type;
1176   u8 conform_dscp;
1177   u8 exceed_action_type;
1178   u8 exceed_dscp;
1179   u8 violate_action_type;
1180   u8 violate_dscp;
1181   u8 single_rate;
1182   u8 color_aware;
1183   u32 scale;
1184   u32 cir_tokens_per_period;
1185   u32 pir_tokens_per_period;
1186   u32 current_limit;
1187   u32 current_bucket;
1188   u32 extended_limit;
1189   u32 extended_bucket;
1190   u64 last_update_time;
1191 };
1192
1193 /** \brief Query relative index via node names
1194     @param client_index - opaque cookie to identify the sender
1195     @param context - sender context, to match reply w/ request
1196     @param node_name - name of node to find relative index from
1197     @param next_name - next node from node_name to find relative index of
1198 */
1199 define get_next_index
1200 {
1201   u32 client_index;
1202   u32 context;
1203   u8 node_name[64];
1204   u8 next_name[64];
1205 };
1206
1207 /** \brief Reply for get next node index
1208     @param context - sender context which was passed in the request
1209     @param retval - return value
1210     @param next_index - index of the next_node
1211 */
1212 define get_next_index_reply
1213 {
1214   u32 context;
1215   i32 retval;
1216   u32 next_index;
1217 };
1218
1219 /** \brief PacketGenerator create interface request
1220     @param client_index - opaque cookie to identify the sender
1221     @param context - sender context, to match reply w/ request
1222     @param interface_id - interface index
1223 */
1224 define pg_create_interface
1225 {
1226   u32 client_index;
1227   u32 context;
1228   u32 interface_id;
1229 };
1230
1231 /** \brief PacketGenerator create interface response
1232     @param context - sender context, to match reply w/ request
1233     @param retval - return value for request
1234 */
1235 define pg_create_interface_reply
1236 {
1237   u32 context;
1238   i32 retval;
1239   u32 sw_if_index;
1240 };
1241
1242 /** \brief PacketGenerator capture packets on given interface request
1243     @param client_index - opaque cookie to identify the sender
1244     @param context - sender context, to match reply w/ request
1245     @param interface_id - pg interface index
1246     @param is_enabled - 1 if enabling streams, 0 if disabling
1247     @param count - number of packets to be captured
1248     @param pcap_file - pacp file name to store captured packets
1249 */
1250 define pg_capture
1251 {
1252   u32 client_index;
1253   u32 context;
1254   u32 interface_id;
1255   u8 is_enabled;
1256   u32 count;
1257   u32 pcap_name_length;
1258   u8 pcap_file_name[pcap_name_length];
1259 };
1260
1261 /** \brief PacketGenerator capture packets response
1262     @param context - sender context, to match reply w/ request
1263     @param retval - return value for request
1264 */
1265 define pg_capture_reply
1266 {
1267   u32 context;
1268   i32 retval;
1269 };
1270
1271 /** \brief Enable / disable packet generator request
1272     @param client_index - opaque cookie to identify the sender
1273     @param context - sender context, to match reply w/ request
1274     @param is_enabled - 1 if enabling streams, 0 if disabling
1275     @param stream - stream name to be enable/disabled, if not specified handle all streams
1276 */
1277 define pg_enable_disable
1278 {
1279   u32 client_index;
1280   u32 context;
1281   u8 is_enabled;
1282   u32 stream_name_length;
1283   u8 stream_name[stream_name_length];
1284 };
1285
1286 /** \brief Reply for enable / disable packet generator
1287     @param context - returned sender context, to match reply w/ request
1288     @param retval - return code
1289 */
1290 define pg_enable_disable_reply
1291 {
1292   u32 context;
1293   i32 retval;
1294 };
1295
1296 /** \brief Configure IP source and L4 port-range check
1297     @param client_index - opaque cookie to identify the sender
1298     @param context - sender context, to match reply w/ request
1299     @param is_ip6 - 1 if source address type is IPv6
1300     @param is_add - 1 if add, 0 if delete
1301     @param mask_length - mask length for address entry
1302     @param address - array of address bytes
1303     @param number_of_ranges - length of low_port and high_port arrays (must match)
1304     @param low_ports[32] - up to 32 low end of port range entries (must have corresponding high_ports entry)
1305     @param high_ports[32] - up to 32 high end of port range entries (must have corresponding low_ports entry)
1306     @param vrf_id - fib table/vrf id to associate the source and port-range check with
1307     @note To specify a single port set low_port and high_port entry the same
1308 */
1309 define ip_source_and_port_range_check_add_del
1310 {
1311   u32 client_index;
1312   u32 context;
1313   u8 is_ipv6;
1314   u8 is_add;
1315   u8 mask_length;
1316   u8 address[16];
1317   u8 number_of_ranges;
1318   u16 low_ports[32];
1319   u16 high_ports[32];
1320   u32 vrf_id;
1321 };
1322
1323 /** \brief Configure IP source and L4 port-range check reply
1324     @param context - returned sender context, to match reply w/ request
1325     @param retval - return code
1326 */
1327 define ip_source_and_port_range_check_add_del_reply
1328 {
1329   u32 context;
1330   i32 retval;
1331 };
1332
1333 /** \brief Set interface source and L4 port-range request
1334     @param client_index - opaque cookie to identify the sender
1335     @param context - sender context, to match reply w/ request
1336     @param interface_id - interface index
1337     @param tcp_vrf_id - VRF associated with source and TCP port-range check
1338     @param udp_vrf_id - VRF associated with source and TCP port-range check
1339 */
1340 define ip_source_and_port_range_check_interface_add_del
1341 {
1342   u32 client_index;
1343   u32 context;
1344   u8 is_add;
1345   u32 sw_if_index;
1346   u32 tcp_in_vrf_id;
1347   u32 tcp_out_vrf_id;
1348   u32 udp_in_vrf_id;
1349   u32 udp_out_vrf_id;
1350 };
1351
1352 /** \brief Set interface source and L4 port-range response
1353     @param context - sender context, to match reply w/ request
1354     @param retval - return value for request
1355 */
1356 define ip_source_and_port_range_check_interface_add_del_reply
1357 {
1358   u32 context;
1359   i32 retval;
1360 };
1361
1362 /** \brief Delete sub interface request
1363     @param client_index - opaque cookie to identify the sender
1364     @param context - sender context, to match reply w/ request
1365     @param sw_if_index - sw index of the interface that was created by create_subif
1366 */
1367 define delete_subif {
1368   u32 client_index;
1369   u32 context;
1370   u32 sw_if_index;
1371 };
1372
1373 /** \brief Delete sub interface response
1374     @param context - sender context, to match reply w/ request
1375     @param retval - return code for the request
1376 */
1377 define delete_subif_reply {
1378   u32 context;
1379   i32 retval;
1380 };
1381
1382 /** \brief Punt traffic to the host
1383     @param client_index - opaque cookie to identify the sender
1384     @param context - sender context, to match reply w/ request
1385     @param is_add - add punt if non-zero, else delete
1386     @param ipv - L3 protocol 4 - IPv4, 6 - IPv6, ~0 - All
1387     @param l4_protocol - L4 protocol to be punted, only UDP (0x11) is supported
1388     @param l4_port - TCP/UDP port to be punted
1389 */
1390 define punt {
1391     u32 client_index;
1392     u32 context;
1393     u8 is_add;
1394     u8 ipv;
1395     u8 l4_protocol;
1396     u16 l4_port;
1397 };
1398
1399 /** \brief Reply to the punt request
1400     @param context - sender context which was passed in the request
1401     @param retval - return code of punt request
1402 */
1403 define punt_reply
1404 {
1405     u32 context;
1406     i32 retval;
1407 };
1408
1409 /** \brief Feature path enable/disable request
1410     @param client_index - opaque cookie to identify the sender
1411     @param context - sender context, to match reply w/ request
1412     @param sw_if_index - the interface
1413     @param enable - 1 = on, 0 = off
1414 */
1415 define feature_enable_disable {
1416     u32 client_index;
1417     u32 context;
1418     u32 sw_if_index;
1419     u8 enable;
1420     u8 arc_name[64];
1421     u8 feature_name[64];
1422 };
1423
1424 /** \brief Reply to the eature path enable/disable request
1425     @param context - sender context which was passed in the request
1426     @param retval - return code for the request
1427 */
1428 define feature_enable_disable_reply
1429 {
1430     u32 context;
1431     i32 retval;
1432 };
1433
1434 /*
1435  * Local Variables:
1436  * eval: (c-set-style "gnu")
1437  * End:
1438  */