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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 This file defines vpe control-plane API messages which are generally
19 called through a shared memory interface.
25 * Note: API placement cleanup in progress
26 * If you're looking for interface APIs, please
27 * see .../src/vnet/{interface.api,interface_api.c}
28 * IP APIs: see .../src/vnet/ip/{ip.api, ip_api.c}
29 * TAP APIs: see .../src/vnet/unix/{tap.api, tap_api.c}
30 * VXLAN APIs: see .../src/vnet/vxlan/{vxlan.api, vxlan_api.c}
31 * GENEVE APIs: see .../src/vnet/geneve/{geneve.api, geneve_api.c}
32 * LLDP APIs: see .../src/vnet/lldp/{lldp.api, lldp_api.c}
33 * AF-PACKET APIs: see ... /vnet/devices/af_packet/{af_packet.api, af_packet_api.c}
34 * NETMAP APIs: see ... /src/vnet/devices/netmap/{netmap.api, netmap_api.c}
35 * VHOST-USER APIs: see .../vnet/devices/virtio/{vhost_user.api, vhost_user_api.c}
36 * VXLAN GPE APIs: see .../src/vnet/vxlan-gpe/{vxlan_gpe.api, vxlan_gpe_api.c}
37 * GRE APIs: see .../src/vnet/gre/{gre.api, gre_api.c}
38 * L2 APIs: see .../src/vnet/l2/{l2.api, l2_api.c}
39 * L2TP APIs: see .../src/vnet/l2tp/{l2tp.api, l2tp_api.c}
40 * BFD APIs: see .../src/vnet/bfd/{bfd.api, bfd_api.c}
41 * IPSEC APIs: see .../src/vnet/ipsec/{ipsec.api, ipsec_api.c}
42 * IPSEC-GRE APIs: see .../src/vnet/ipsec-gre/{ipsec_gre.api, ipsec_gre_api.c}
43 * LISP APIs: see .../src/vnet/lisp/{lisp.api, lisp_api.c}
44 * LISP-GPE APIs: see .../src/vnet/lisp-gpe/{lisp_gpe.api, lisp_gpe_api.c}
45 * SESSION APIs: .../vnet/session/{session.api session_api.c}
46 * MPLS APIs: see .../src/vnet/mpls/{mpls.api, mpls_api.c}
47 * SR APIs: see .../src/vnet/srv6/{sr.api, sr_api.c}
48 * CLASSIFY APIs: see ... /src/vnet/classify/{classify.api, classify_api.c}
49 * FLOW APIs: see ... /src/vnet/flow/{flow.api, flow_api.c}
50 * DHCP APIs: see ... /src/vnet/dhcp/{dhcpk.api, dhcp_api.c}
51 * COP APIs: see ... /src/vnet/cop/{cop.api, cop_api.c}
52 * POLICER APIs: see ... /src/vnet/policer/{policer.api, policer_api.c}
53 * STATS APIs: see .../src/vpp/stats/{stats.api, stats.c}
56 /** \brief Create a new subinterface with the given vlan id
57 @param client_index - opaque cookie to identify the sender
58 @param context - sender context, to match reply w/ request
59 @param sw_if_index - software index of the new vlan's parent interface
60 @param vlan_id - vlan tag of the new interface
62 define create_vlan_subif
70 /** \brief Reply for the vlan subinterface create request
71 @param context - returned sender context, to match reply w/ request
72 @param retval - return code
73 @param sw_if_index - software index allocated for the new subinterface
75 define create_vlan_subif_reply
82 /** \brief Enable or Disable MPLS on and interface
83 @param client_index - opaque cookie to identify the sender
84 @param context - sender context, to match reply w/ request
85 @param sw_if_index - index of the interface
86 @param enable - if non-zero enable, else disable
88 autoreply define sw_interface_set_mpls_enable
96 /** \brief Proxy ARP add / del request
97 @param client_index - opaque cookie to identify the sender
98 @param context - sender context, to match reply w/ request
99 @param vrf_id - VRF / Fib table ID
100 @param is_add - 1 if adding the Proxy ARP range, 0 if deleting
101 @param low_address[4] - Low address of the Proxy ARP range
102 @param hi_address[4] - High address of the Proxy ARP range
104 autoreply define proxy_arp_add_del
114 /** \brief Proxy ARP add / del request
115 @param client_index - opaque cookie to identify the sender
116 @param context - sender context, to match reply w/ request
117 @param sw_if_index - Which interface to enable / disable Proxy Arp on
118 @param enable_disable - 1 to enable Proxy ARP on interface, 0 to disable
120 autoreply define proxy_arp_intfc_enable_disable
125 /* 1 = on, 0 = off */
129 /** \brief Reset VRF (remove all routes etc) request
130 @param client_index - opaque cookie to identify the sender
131 @param context - sender context, to match reply w/ request
132 @param is_ipv6 - 1 for IPv6 neighbor, 0 for IPv4
133 @param vrf_id - ID of th FIB table / VRF to reset
135 autoreply define reset_vrf
143 /** \brief OAM event structure
144 @param dst_address[] -
153 /** \brief Want OAM events request
154 @param client_index - opaque cookie to identify the sender
155 @param context - sender context, to match reply w/ request
156 @param enable_disable- enable if non-zero, else disable
157 @param pid - pid of the requesting process
159 autoreply define want_oam_events
167 /** \brief OAM add / del target request
168 @param client_index - opaque cookie to identify the sender
169 @param context - sender context, to match reply w/ request
170 @param vrf_id - vrf_id of the target
171 @param src_address[] - source address to use for the updates
172 @param dst_address[] - destination address of the target
173 @param is_add - add target if non-zero, else delete
175 autoreply define oam_add_del
185 /** \brief Reset fib table request
186 @param client_index - opaque cookie to identify the sender
187 @param context - sender context, to match reply w/ request
188 @param vrf_id - vrf/table id of the fib table to reset
189 @param is_ipv6 - an ipv6 fib to reset if non-zero, else ipv4
191 autoreply define reset_fib
199 /** \brief Create loopback interface request
200 @param client_index - opaque cookie to identify the sender
201 @param context - sender context, to match reply w/ request
202 @param mac_address - mac addr to assign to the interface if none-zero
204 define create_loopback
211 /** \brief Create loopback interface response
212 @param context - sender context, to match reply w/ request
213 @param sw_if_index - sw index of the interface that was created
214 @param retval - return code for the request
216 define create_loopback_reply
223 /** \brief Create loopback interface instance request
224 @param client_index - opaque cookie to identify the sender
225 @param context - sender context, to match reply w/ request
226 @param mac_address - mac addr to assign to the interface if none-zero
227 @param is_specified - if non-0, a specific user_instance is being requested
228 @param user_instance - requested instance, ~0 => dynamically allocate
230 define create_loopback_instance
239 /** \brief Create loopback interface instance response
240 @param context - sender context, to match reply w/ request
241 @param sw_if_index - sw index of the interface that was created
242 @param retval - return code for the request
244 define create_loopback_instance_reply
251 /** \brief Delete loopback interface request
252 @param client_index - opaque cookie to identify the sender
253 @param context - sender context, to match reply w/ request
254 @param sw_if_index - sw index of the interface that was created
256 autoreply define delete_loopback
263 /** \brief Control ping from client to api server request
264 @param client_index - opaque cookie to identify the sender
265 @param context - sender context, to match reply w/ request
273 /** \brief Control ping from the client to the server response
274 @param client_index - opaque cookie to identify the sender
275 @param context - sender context, to match reply w/ request
276 @param retval - return code for the request
277 @param vpe_pid - the pid of the vpe, returned by the server
279 define control_ping_reply
287 /** \brief Process a vpe parser cli string request
288 @param client_index - opaque cookie to identify the sender
289 @param context - sender context, to match reply w/ request
290 @param cmd_in_shmem - pointer to cli command string
306 /** \brief vpe parser cli string response
307 @param context - sender context, to match reply w/ request
308 @param retval - return code for request
309 @param reply_in_shmem - Reply string from cli processing if any
317 define cli_inband_reply
325 /** \brief Set max allowed ARP or ip6 neighbor entries request
326 @param client_index - opaque cookie to identify the sender
327 @param context - sender context, to match reply w/ request
328 @param is_ipv6 - neighbor limit if non-zero, else ARP limit
329 @param arp_neighbor_limit - the new limit, defaults are ~ 50k
331 autoreply define set_arp_neighbor_limit
336 u32 arp_neighbor_limit;
339 /** \brief L2 interface patch add / del request
340 @param client_index - opaque cookie to identify the sender
341 @param context - sender context, to match reply w/ request
342 @param rx_sw_if_index - receive side interface
343 @param tx_sw_if_index - transmit side interface
344 @param is_add - if non-zero set up the interface patch, else remove it
346 autoreply define l2_patch_add_del
355 /** \brief Interface set vpath request
356 @param client_index - opaque cookie to identify the sender
357 @param context - sender context, to match reply w/ request
358 @param sw_if_index - interface used to reach neighbor
359 @param enable - if non-zero enable, else disable
361 autoreply define sw_interface_set_vpath
369 /** \brief Set L2 XConnect between two interfaces request
370 @param client_index - opaque cookie to identify the sender
371 @param context - sender context, to match reply w/ request
372 @param rx_sw_if_index - Receive interface index
373 @param tx_sw_if_index - Transmit interface index
374 @param enable - enable xconnect if not 0, else set to L3 mode
376 autoreply define sw_interface_set_l2_xconnect
385 /** \brief Interface bridge mode request
386 @param client_index - opaque cookie to identify the sender
387 @param context - sender context, to match reply w/ request
388 @param rx_sw_if_index - the interface
389 @param bd_id - bridge domain id
390 @param bvi - Setup interface as a bvi, bridge mode only
391 @param shg - Shared horizon group, for bridge mode only
392 @param enable - Enable beige mode if not 0, else set to L3 mode
394 autoreply define sw_interface_set_l2_bridge
405 /** \brief Set bridge domain ip to mac entry request
406 @param client_index - opaque cookie to identify the sender
407 @param context - sender context, to match reply w/ request
408 @param bd_id - the bridge domain to set the flags for
409 @param is_add - if non-zero, add the entry, else clear it
410 @param is_ipv6 - if non-zero, ipv6 address, else ipv4 address
411 @param mac_address - MAC address
414 autoreply define bd_ip_mac_add_del
425 /** \brief Set/unset the classification table for an interface request
426 @param client_index - opaque cookie to identify the sender
427 @param context - sender context, to match reply w/ request
428 @param is_ipv6 - ipv6 if non-zero, else ipv4
429 @param sw_if_index - interface to associate with the table
430 @param table_index - index of the table, if ~0 unset the table
432 autoreply define classify_set_interface_ip_table
438 u32 table_index; /* ~0 => off */
441 /** \brief Set/unset l2 classification tables for an interface request
442 @param client_index - opaque cookie to identify the sender
443 @param context - sender context, to match reply w/ request
444 @param sw_if_index - interface to set/unset tables for
445 @param ip4_table_index - ip4 index, use ~0 for all 3 indexes to unset
446 @param ip6_table_index - ip6 index
447 @param other_table_index - other index
449 autoreply define classify_set_interface_l2_tables
457 u32 other_table_index;
461 /** \brief Get node index using name request
462 @param client_index - opaque cookie to identify the sender
463 @param context - sender context, to match reply w/ request
464 @param node_name[] - name of the node
466 define get_node_index
473 /** \brief Get node index using name request
474 @param context - sender context, to match reply w/ request
475 @param retval - return code for the request
476 @param node_index - index of the desired node if found, else ~0
478 define get_node_index_reply
485 /** \brief Set the next node for a given node request
486 @param client_index - opaque cookie to identify the sender
487 @param context - sender context, to match reply w/ request
488 @param node_name[] - node to add the next node to
489 @param next_name[] - node to add as the next node
499 /** \brief IP Set the next node for a given node response
500 @param context - sender context, to match reply w/ request
501 @param retval - return code for the add next node request
502 @param next_index - the index of the next node if success, else ~0
504 define add_node_next_reply
511 /** \brief L2 interface ethernet flow point filtering enable/disable request
512 @param client_index - opaque cookie to identify the sender
513 @param context - sender context, to match reply w/ request
514 @param sw_if_index - interface to enable/disable filtering on
515 @param enable_disable - if non-zero enable filtering, else disable
517 autoreply define l2_interface_efp_filter
532 /* These fields map directly onto the subif template */
536 u8 dot1ad; // 0 = dot1q, 1=dot1ad
539 u8 outer_vlan_id_any;
540 u8 inner_vlan_id_any;
545 define create_subif_reply
552 /** \brief show version
553 @param client_index - opaque cookie to identify the sender
554 @param context - sender context, to match reply w/ request
562 /** \brief show version response
563 @param context - sender context, to match reply w/ request
564 @param retval - return code for the request
565 @param program - name of the program (vpe)
566 @param version - version of the program
567 @param build_directory - root of the workspace where the program was built
569 define show_version_reply
576 u8 build_directory[256];
579 /* Gross kludge, DGMS */
580 autoreply define interface_name_renumber
585 u32 new_show_dev_instance;
588 /** \brief Register for ip4 arp resolution events
589 @param client_index - opaque cookie to identify the sender
590 @param context - sender context, to match reply w/ request
591 @param enable_disable - 1 => register for events, 0 => cancel registration
592 @param pid - sender's pid
593 @param address - the exact ip4 address of interest
595 autoreply define want_ip4_arp_events
604 /** \brief Tell client about an ip4 arp resolution event
605 @param client_index - opaque cookie to identify the sender
606 @param address - the exact ip4 address of interest
607 @param pid - client pid registered to receive notification
608 @param sw_if_index - interface which received ARP packet
609 @param new_mac - the new mac address
610 @param mac_ip - 0: resolution event, 1: mac/ip binding in bd
622 /** \brief Register for ip6 nd resolution events
623 @param client_index - opaque cookie to identify the sender
624 @param context - sender context, to match reply w/ request
625 @param enable_disable - 1 => register for events, 0 => cancel registration
626 @param pid - sender's pid
627 @param address - the exact ip6 address of interest
629 autoreply define want_ip6_nd_events
638 /** \brief Tell client about an ip6 nd resolution or mac/ip event
639 @param client_index - opaque cookie to identify the sender
640 @param pid - client pid registered to receive notification
641 @param sw_if_index - interface which received ARP packet
642 @param address - the exact ip6 address of interest
643 @param new_mac - the new mac address
644 @param mac_ip - 0: resolution event, 1: mac/ip binding in bd
656 /** \brief Set/unset input ACL interface
657 @param client_index - opaque cookie to identify the sender
658 @param context - sender context, to match reply w/ request
659 @param sw_if_index - interface to set/unset input ACL
660 @param ip4_table_index - ip4 classify table index (~0 for skip)
661 @param ip6_table_index - ip6 classify table index (~0 for skip)
662 @param l2_table_index - l2 classify table index (~0 for skip)
663 @param is_add - Set input ACL if non-zero, else unset
664 Note: User is recommeneded to use just one valid table_index per call.
665 (ip4_table_index, ip6_table_index, or l2_table_index)
667 autoreply define input_acl_set_interface
678 define get_node_graph
684 /** \brief get_node_graph_reply
685 @param context - returned sender context, to match reply w/ request
686 @param retval - return code
687 @param reply_in_shmem - result from vlib_node_serialize, in shared
688 memory. Process with vlib_node_unserialize, remember to switch
689 heaps and free the result.
692 define get_node_graph_reply
699 /** \brief IOAM enable : Enable in-band OAM
700 @param id - profile id
701 @param seqno - To enable Seqno Processing
702 @param analyse - Enabling analysis of iOAM at decap node
703 @param pow_enable - Proof of Work enabled or not flag
704 @param trace_enable - iOAM Trace enabled or not flag
706 autoreply define ioam_enable
718 /** \brief iOAM disable
719 @param client_index - opaque cookie to identify the sender
720 @param context - sender context, to match reply w/ request
721 @param index - MAP Domain index
723 autoreply define ioam_disable
730 /** \brief Query relative index via node names
731 @param client_index - opaque cookie to identify the sender
732 @param context - sender context, to match reply w/ request
733 @param node_name - name of node to find relative index from
734 @param next_name - next node from node_name to find relative index of
736 define get_next_index
744 /** \brief Reply for get next node index
745 @param context - sender context which was passed in the request
746 @param retval - return value
747 @param next_index - index of the next_node
749 define get_next_index_reply
756 /** \brief PacketGenerator create interface request
757 @param client_index - opaque cookie to identify the sender
758 @param context - sender context, to match reply w/ request
759 @param interface_id - interface index
761 define pg_create_interface
768 /** \brief PacketGenerator create interface response
769 @param context - sender context, to match reply w/ request
770 @param retval - return value for request
772 define pg_create_interface_reply
779 /** \brief PacketGenerator capture packets on given interface request
780 @param client_index - opaque cookie to identify the sender
781 @param context - sender context, to match reply w/ request
782 @param interface_id - pg interface index
783 @param is_enabled - 1 if enabling streams, 0 if disabling
784 @param count - number of packets to be captured
785 @param pcap_file - pacp file name to store captured packets
787 autoreply define pg_capture
794 u32 pcap_name_length;
795 u8 pcap_file_name[pcap_name_length];
798 /** \brief Enable / disable packet generator request
799 @param client_index - opaque cookie to identify the sender
800 @param context - sender context, to match reply w/ request
801 @param is_enabled - 1 if enabling streams, 0 if disabling
802 @param stream - stream name to be enable/disabled, if not specified handle all streams
804 autoreply define pg_enable_disable
809 u32 stream_name_length;
810 u8 stream_name[stream_name_length];
813 /** \brief Configure IP source and L4 port-range check
814 @param client_index - opaque cookie to identify the sender
815 @param context - sender context, to match reply w/ request
816 @param is_ip6 - 1 if source address type is IPv6
817 @param is_add - 1 if add, 0 if delete
818 @param mask_length - mask length for address entry
819 @param address - array of address bytes
820 @param number_of_ranges - length of low_port and high_port arrays (must match)
821 @param low_ports[32] - up to 32 low end of port range entries (must have corresponding high_ports entry)
822 @param high_ports[32] - up to 32 high end of port range entries (must have corresponding low_ports entry)
823 @param vrf_id - fib table/vrf id to associate the source and port-range check with
824 @note To specify a single port set low_port and high_port entry the same
826 autoreply define ip_source_and_port_range_check_add_del
840 /** \brief Set interface source and L4 port-range request
841 @param client_index - opaque cookie to identify the sender
842 @param context - sender context, to match reply w/ request
843 @param interface_id - interface index
844 @param tcp_vrf_id - VRF associated with source and TCP port-range check
845 @param udp_vrf_id - VRF associated with source and TCP port-range check
847 autoreply define ip_source_and_port_range_check_interface_add_del
859 /** \brief Delete sub interface request
860 @param client_index - opaque cookie to identify the sender
861 @param context - sender context, to match reply w/ request
862 @param sw_if_index - sw index of the interface that was created by create_subif
864 autoreply define delete_subif {
870 /** \brief Punt traffic to the host
871 @param client_index - opaque cookie to identify the sender
872 @param context - sender context, to match reply w/ request
873 @param is_add - add punt if non-zero, else delete
874 @param ipv - L3 protocol 4 - IPv4, 6 - IPv6, ~0 - All
875 @param l4_protocol - L4 protocol to be punted, only UDP (0x11) is supported
876 @param l4_port - TCP/UDP port to be punted
878 autoreply define punt {
887 /** \brief Punt traffic to the host via socket
888 @param client_index - opaque cookie to identify the sender
889 @param context - sender context, to match reply w/ request
890 @param header_version - expected meta data header version (currently 1)
891 @param is_ip4 - L3 protocol 1 - IPv4, 0 - IPv6
892 @param l4_protocol - L4 protocol to be punted, only UDP (0x11) is supported
893 @param l4_port - TCP/UDP port to be punted
895 define punt_socket_register {
902 u8 pathname[108]; /* Linux sun_path defined to be 108 bytes, see unix(7) */
905 define punt_socket_register_reply
912 autoreply define punt_socket_deregister {
920 /** \brief Feature path enable/disable request
921 @param client_index - opaque cookie to identify the sender
922 @param context - sender context, to match reply w/ request
923 @param sw_if_index - the interface
924 @param enable - 1 = on, 0 = off
926 autoreply define feature_enable_disable {
937 * eval: (c-set-style "gnu")