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.
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 * LLDP APIs: see .../src/vnet/lldp/{lldp.api, lldp_api.c}
30 * AF-PACKET APIs: see ... /vnet/devices/af_packet/{af_packet.api, af_packet_api.c}
31 * NETMAP APIs: see ... /src/vnet/devices/netmap/{netmap.api, netmap_api.c}
32 * VHOST-USER APIs: see .../vnet/devices/virtio/{vhost_user.api, vhost_user_api.c}
33 * VXLAN GPE APIs: see .../src/vnet/vxlan-gpe/{vxlan_gpe.api, vxlan_gpe_api.c}
34 * GRE APIs: see .../src/vnet/gre/{gre.api, gre_api.c}
35 * L2 APIs: see .../src/vnet/l2/{l2.api, l2_api.c}
36 * L2TP APIs: see .../src/vnet/l2tp/{l2tp.api, l2tp_api.c}
37 * BFD APIs: see .../src/vnet/bfd/{bfd.api, bfd_api.c}
38 * IPSEC APIs: see .../src/vnet/ipsec/{ipsec.api, ipsec_api.c}
39 * IPSEC-GRE APIs: see .../src/vnet/ipsec-gre/{ipsec_gre.api, ipsec_gre_api.c}
40 * LISP APIs: see .../src/vnet/lisp/{lisp.api, lisp_api.c}
41 * LISP-GPE APIs: see .../src/vnet/lisp-gpe/{lisp_gpe.api, lisp_gpe_api.c}
42 * SESSION APIs: .../vnet/session/{session.api session_api.c}
43 * MPLS APIs: see .../src/vnet/mpls/{mpls.api, mpls_api.c}
44 * SR APIs: see .../src/vnet/srv6/{sr.api, sr_api.c}
45 * CLASSIFY APIs: see ... /src/vnet/classify/{classify.api, classify_api.c}
46 * FLOW APIs: see ... /src/vnet/flow/{flow.api, flow_api.c}
47 * DHCP APIs: see ... /src/vnet/dhcp/{dhcpk.api, dhcp_api.c}
48 * COP APIs: see ... /src/vnet/cop/{cop.api, cop_api.c}
49 * POLICER APIs: see ... /src/vnet/policer/{policer.api, policer_api.c}
50 * STATS APIs: see .../src/vpp/stats/{stats.api, stats.c}
53 /** \brief Create a new subinterface with the given vlan id
54 @param client_index - opaque cookie to identify the sender
55 @param context - sender context, to match reply w/ request
56 @param sw_if_index - software index of the new vlan's parent interface
57 @param vlan_id - vlan tag of the new interface
59 define create_vlan_subif
67 /** \brief Reply for the vlan subinterface create request
68 @param context - returned sender context, to match reply w/ request
69 @param retval - return code
70 @param sw_if_index - software index allocated for the new subinterface
72 define create_vlan_subif_reply
79 /** \brief Enable or Disable MPLS on and interface
80 @param client_index - opaque cookie to identify the sender
81 @param context - sender context, to match reply w/ request
82 @param sw_if_index - index of the interface
83 @param enable - if non-zero enable, else disable
85 autoreply define sw_interface_set_mpls_enable
93 /** \brief Proxy ARP add / del request
94 @param client_index - opaque cookie to identify the sender
95 @param context - sender context, to match reply w/ request
96 @param vrf_id - VRF / Fib table ID
97 @param is_add - 1 if adding the Proxy ARP range, 0 if deleting
98 @param low_address[4] - Low address of the Proxy ARP range
99 @param hi_address[4] - High address of the Proxy ARP range
101 autoreply define proxy_arp_add_del
111 /** \brief Proxy ARP add / del request
112 @param client_index - opaque cookie to identify the sender
113 @param context - sender context, to match reply w/ request
114 @param sw_if_index - Which interface to enable / disable Proxy Arp on
115 @param enable_disable - 1 to enable Proxy ARP on interface, 0 to disable
117 autoreply define proxy_arp_intfc_enable_disable
122 /* 1 = on, 0 = off */
126 /** \brief Reset VRF (remove all routes etc) request
127 @param client_index - opaque cookie to identify the sender
128 @param context - sender context, to match reply w/ request
129 @param is_ipv6 - 1 for IPv6 neighbor, 0 for IPv4
130 @param vrf_id - ID of th FIB table / VRF to reset
132 autoreply define reset_vrf
140 /** \brief OAM event structure
141 @param dst_address[] -
150 /** \brief Want OAM events request
151 @param client_index - opaque cookie to identify the sender
152 @param context - sender context, to match reply w/ request
153 @param enable_disable- enable if non-zero, else disable
154 @param pid - pid of the requesting process
156 autoreply define want_oam_events
164 /** \brief OAM add / del target request
165 @param client_index - opaque cookie to identify the sender
166 @param context - sender context, to match reply w/ request
167 @param vrf_id - vrf_id of the target
168 @param src_address[] - source address to use for the updates
169 @param dst_address[] - destination address of the target
170 @param is_add - add target if non-zero, else delete
172 autoreply define oam_add_del
182 /** \brief Reset fib table request
183 @param client_index - opaque cookie to identify the sender
184 @param context - sender context, to match reply w/ request
185 @param vrf_id - vrf/table id of the fib table to reset
186 @param is_ipv6 - an ipv6 fib to reset if non-zero, else ipv4
188 autoreply define reset_fib
196 /** \brief Create loopback interface request
197 @param client_index - opaque cookie to identify the sender
198 @param context - sender context, to match reply w/ request
199 @param mac_address - mac addr to assign to the interface if none-zero
201 define create_loopback
208 /** \brief Create loopback interface response
209 @param context - sender context, to match reply w/ request
210 @param sw_if_index - sw index of the interface that was created
211 @param retval - return code for the request
213 define create_loopback_reply
220 /** \brief Create loopback interface instance request
221 @param client_index - opaque cookie to identify the sender
222 @param context - sender context, to match reply w/ request
223 @param mac_address - mac addr to assign to the interface if none-zero
224 @param is_specified - if non-0, a specific user_instance is being requested
225 @param user_instance - requested instance, ~0 => dynamically allocate
227 define create_loopback_instance
236 /** \brief Create loopback interface instance response
237 @param context - sender context, to match reply w/ request
238 @param sw_if_index - sw index of the interface that was created
239 @param retval - return code for the request
241 define create_loopback_instance_reply
248 /** \brief Delete loopback interface request
249 @param client_index - opaque cookie to identify the sender
250 @param context - sender context, to match reply w/ request
251 @param sw_if_index - sw index of the interface that was created
253 autoreply define delete_loopback
260 /** \brief Control ping from client to api server request
261 @param client_index - opaque cookie to identify the sender
262 @param context - sender context, to match reply w/ request
270 /** \brief Control ping from the client to the server response
271 @param client_index - opaque cookie to identify the sender
272 @param context - sender context, to match reply w/ request
273 @param retval - return code for the request
274 @param vpe_pid - the pid of the vpe, returned by the server
276 define control_ping_reply
284 /** \brief Process a vpe parser cli string request
285 @param client_index - opaque cookie to identify the sender
286 @param context - sender context, to match reply w/ request
287 @param cmd_in_shmem - pointer to cli command string
303 /** \brief vpe parser cli string response
304 @param context - sender context, to match reply w/ request
305 @param retval - return code for request
306 @param reply_in_shmem - Reply string from cli processing if any
314 define cli_inband_reply
322 /** \brief Set max allowed ARP or ip6 neighbor entries request
323 @param client_index - opaque cookie to identify the sender
324 @param context - sender context, to match reply w/ request
325 @param is_ipv6 - neighbor limit if non-zero, else ARP limit
326 @param arp_neighbor_limit - the new limit, defaults are ~ 50k
328 autoreply define set_arp_neighbor_limit
333 u32 arp_neighbor_limit;
336 /** \brief L2 interface patch add / del request
337 @param client_index - opaque cookie to identify the sender
338 @param context - sender context, to match reply w/ request
339 @param rx_sw_if_index - receive side interface
340 @param tx_sw_if_index - transmit side interface
341 @param is_add - if non-zero set up the interface patch, else remove it
343 autoreply define l2_patch_add_del
352 /** \brief Interface set vpath request
353 @param client_index - opaque cookie to identify the sender
354 @param context - sender context, to match reply w/ request
355 @param sw_if_index - interface used to reach neighbor
356 @param enable - if non-zero enable, else disable
358 autoreply define sw_interface_set_vpath
366 /** \brief Set L2 XConnect between two interfaces request
367 @param client_index - opaque cookie to identify the sender
368 @param context - sender context, to match reply w/ request
369 @param rx_sw_if_index - Receive interface index
370 @param tx_sw_if_index - Transmit interface index
371 @param enable - enable xconnect if not 0, else set to L3 mode
373 autoreply define sw_interface_set_l2_xconnect
382 /** \brief Interface bridge mode request
383 @param client_index - opaque cookie to identify the sender
384 @param context - sender context, to match reply w/ request
385 @param rx_sw_if_index - the interface
386 @param bd_id - bridge domain id
387 @param bvi - Setup interface as a bvi, bridge mode only
388 @param shg - Shared horizon group, for bridge mode only
389 @param enable - Enable beige mode if not 0, else set to L3 mode
391 autoreply define sw_interface_set_l2_bridge
402 /** \brief Set bridge domain ip to mac entry request
403 @param client_index - opaque cookie to identify the sender
404 @param context - sender context, to match reply w/ request
405 @param bd_id - the bridge domain to set the flags for
406 @param is_add - if non-zero, add the entry, else clear it
407 @param is_ipv6 - if non-zero, ipv6 address, else ipv4 address
408 @param mac_address - MAC address
411 autoreply define bd_ip_mac_add_del
422 /** \brief Set/unset the classification table for an interface request
423 @param client_index - opaque cookie to identify the sender
424 @param context - sender context, to match reply w/ request
425 @param is_ipv6 - ipv6 if non-zero, else ipv4
426 @param sw_if_index - interface to associate with the table
427 @param table_index - index of the table, if ~0 unset the table
429 autoreply define classify_set_interface_ip_table
435 u32 table_index; /* ~0 => off */
438 /** \brief Set/unset l2 classification tables for an interface request
439 @param client_index - opaque cookie to identify the sender
440 @param context - sender context, to match reply w/ request
441 @param sw_if_index - interface to set/unset tables for
442 @param ip4_table_index - ip4 index, use ~0 for all 3 indexes to unset
443 @param ip6_table_index - ip6 index
444 @param other_table_index - other index
446 autoreply define classify_set_interface_l2_tables
454 u32 other_table_index;
458 /** \brief Get node index using name request
459 @param client_index - opaque cookie to identify the sender
460 @param context - sender context, to match reply w/ request
461 @param node_name[] - name of the node
463 define get_node_index
470 /** \brief Get node index using name request
471 @param context - sender context, to match reply w/ request
472 @param retval - return code for the request
473 @param node_index - index of the desired node if found, else ~0
475 define get_node_index_reply
482 /** \brief Set the next node for a given node request
483 @param client_index - opaque cookie to identify the sender
484 @param context - sender context, to match reply w/ request
485 @param node_name[] - node to add the next node to
486 @param next_name[] - node to add as the next node
496 /** \brief IP Set the next node for a given node response
497 @param context - sender context, to match reply w/ request
498 @param retval - return code for the add next node request
499 @param next_index - the index of the next node if success, else ~0
501 define add_node_next_reply
508 /** \brief L2 interface ethernet flow point filtering enable/disable request
509 @param client_index - opaque cookie to identify the sender
510 @param context - sender context, to match reply w/ request
511 @param sw_if_index - interface to enable/disable filtering on
512 @param enable_disable - if non-zero enable filtering, else disable
514 autoreply define l2_interface_efp_filter
529 /* These fields map directly onto the subif template */
533 u8 dot1ad; // 0 = dot1q, 1=dot1ad
536 u8 outer_vlan_id_any;
537 u8 inner_vlan_id_any;
542 define create_subif_reply
549 /** \brief show version
550 @param client_index - opaque cookie to identify the sender
551 @param context - sender context, to match reply w/ request
559 /** \brief show version response
560 @param context - sender context, to match reply w/ request
561 @param retval - return code for the request
562 @param program - name of the program (vpe)
563 @param version - version of the program
564 @param build_directory - root of the workspace where the program was built
566 define show_version_reply
573 u8 build_directory[256];
576 /* Gross kludge, DGMS */
577 autoreply define interface_name_renumber
582 u32 new_show_dev_instance;
585 /** \brief Register for ip4 arp resolution events
586 @param client_index - opaque cookie to identify the sender
587 @param context - sender context, to match reply w/ request
588 @param enable_disable - 1 => register for events, 0 => cancel registration
589 @param pid - sender's pid
590 @param address - the exact ip4 address of interest
592 autoreply define want_ip4_arp_events
601 /** \brief Tell client about an ip4 arp resolution event
602 @param client_index - opaque cookie to identify the sender
603 @param address - the exact ip4 address of interest
604 @param pid - client pid registered to receive notification
605 @param sw_if_index - interface which received ARP packet
606 @param new_mac - the new mac address
607 @param mac_ip - 0: resolution event, 1: mac/ip binding in bd
619 /** \brief Register for ip6 nd resolution events
620 @param client_index - opaque cookie to identify the sender
621 @param context - sender context, to match reply w/ request
622 @param enable_disable - 1 => register for events, 0 => cancel registration
623 @param pid - sender's pid
624 @param address - the exact ip6 address of interest
626 autoreply define want_ip6_nd_events
635 /** \brief Tell client about an ip6 nd resolution or mac/ip event
636 @param client_index - opaque cookie to identify the sender
637 @param pid - client pid registered to receive notification
638 @param sw_if_index - interface which received ARP packet
639 @param address - the exact ip6 address of interest
640 @param new_mac - the new mac address
641 @param mac_ip - 0: resolution event, 1: mac/ip binding in bd
653 /** \brief Set/unset input ACL interface
654 @param client_index - opaque cookie to identify the sender
655 @param context - sender context, to match reply w/ request
656 @param sw_if_index - interface to set/unset input ACL
657 @param ip4_table_index - ip4 classify table index (~0 for skip)
658 @param ip6_table_index - ip6 classify table index (~0 for skip)
659 @param l2_table_index - l2 classify table index (~0 for skip)
660 @param is_add - Set input ACL if non-zero, else unset
661 Note: User is recommeneded to use just one valid table_index per call.
662 (ip4_table_index, ip6_table_index, or l2_table_index)
664 autoreply define input_acl_set_interface
675 define get_node_graph
681 /** \brief get_node_graph_reply
682 @param context - returned sender context, to match reply w/ request
683 @param retval - return code
684 @param reply_in_shmem - result from vlib_node_serialize, in shared
685 memory. Process with vlib_node_unserialize, remember to switch
686 heaps and free the result.
689 define get_node_graph_reply
696 /** \brief IOAM enable : Enable in-band OAM
697 @param id - profile id
698 @param seqno - To enable Seqno Processing
699 @param analyse - Enabling analysis of iOAM at decap node
700 @param pow_enable - Proof of Work enabled or not flag
701 @param trace_enable - iOAM Trace enabled or not flag
703 autoreply define ioam_enable
715 /** \brief iOAM disable
716 @param client_index - opaque cookie to identify the sender
717 @param context - sender context, to match reply w/ request
718 @param index - MAP Domain index
720 autoreply define ioam_disable
727 /** \brief Query relative index via node names
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 node to find relative index from
731 @param next_name - next node from node_name to find relative index of
733 define get_next_index
741 /** \brief Reply for get next node index
742 @param context - sender context which was passed in the request
743 @param retval - return value
744 @param next_index - index of the next_node
746 define get_next_index_reply
753 /** \brief PacketGenerator create interface request
754 @param client_index - opaque cookie to identify the sender
755 @param context - sender context, to match reply w/ request
756 @param interface_id - interface index
758 define pg_create_interface
765 /** \brief PacketGenerator create interface response
766 @param context - sender context, to match reply w/ request
767 @param retval - return value for request
769 define pg_create_interface_reply
776 /** \brief PacketGenerator capture packets on given interface request
777 @param client_index - opaque cookie to identify the sender
778 @param context - sender context, to match reply w/ request
779 @param interface_id - pg interface index
780 @param is_enabled - 1 if enabling streams, 0 if disabling
781 @param count - number of packets to be captured
782 @param pcap_file - pacp file name to store captured packets
784 autoreply define pg_capture
791 u32 pcap_name_length;
792 u8 pcap_file_name[pcap_name_length];
795 /** \brief Enable / disable packet generator request
796 @param client_index - opaque cookie to identify the sender
797 @param context - sender context, to match reply w/ request
798 @param is_enabled - 1 if enabling streams, 0 if disabling
799 @param stream - stream name to be enable/disabled, if not specified handle all streams
801 autoreply define pg_enable_disable
806 u32 stream_name_length;
807 u8 stream_name[stream_name_length];
810 /** \brief Configure IP source and L4 port-range check
811 @param client_index - opaque cookie to identify the sender
812 @param context - sender context, to match reply w/ request
813 @param is_ip6 - 1 if source address type is IPv6
814 @param is_add - 1 if add, 0 if delete
815 @param mask_length - mask length for address entry
816 @param address - array of address bytes
817 @param number_of_ranges - length of low_port and high_port arrays (must match)
818 @param low_ports[32] - up to 32 low end of port range entries (must have corresponding high_ports entry)
819 @param high_ports[32] - up to 32 high end of port range entries (must have corresponding low_ports entry)
820 @param vrf_id - fib table/vrf id to associate the source and port-range check with
821 @note To specify a single port set low_port and high_port entry the same
823 autoreply define ip_source_and_port_range_check_add_del
837 /** \brief Set interface source and L4 port-range request
838 @param client_index - opaque cookie to identify the sender
839 @param context - sender context, to match reply w/ request
840 @param interface_id - interface index
841 @param tcp_vrf_id - VRF associated with source and TCP port-range check
842 @param udp_vrf_id - VRF associated with source and TCP port-range check
844 autoreply define ip_source_and_port_range_check_interface_add_del
856 /** \brief Delete sub interface request
857 @param client_index - opaque cookie to identify the sender
858 @param context - sender context, to match reply w/ request
859 @param sw_if_index - sw index of the interface that was created by create_subif
861 autoreply define delete_subif {
867 /** \brief Punt traffic to the host
868 @param client_index - opaque cookie to identify the sender
869 @param context - sender context, to match reply w/ request
870 @param is_add - add punt if non-zero, else delete
871 @param ipv - L3 protocol 4 - IPv4, 6 - IPv6, ~0 - All
872 @param l4_protocol - L4 protocol to be punted, only UDP (0x11) is supported
873 @param l4_port - TCP/UDP port to be punted
875 autoreply define punt {
884 /** \brief Punt traffic to the host via socket
885 @param client_index - opaque cookie to identify the sender
886 @param context - sender context, to match reply w/ request
887 @param header_version - expected meta data header version (currently 1)
888 @param is_ip4 - L3 protocol 1 - IPv4, 0 - IPv6
889 @param l4_protocol - L4 protocol to be punted, only UDP (0x11) is supported
890 @param l4_port - TCP/UDP port to be punted
892 define punt_socket_register {
899 u8 pathname[108]; /* Linux sun_path defined to be 108 bytes, see unix(7) */
902 define punt_socket_register_reply
909 autoreply define punt_socket_deregister {
917 /** \brief Feature path enable/disable request
918 @param client_index - opaque cookie to identify the sender
919 @param context - sender context, to match reply w/ request
920 @param sw_if_index - the interface
921 @param enable - 1 = on, 0 = off
923 autoreply define feature_enable_disable {
934 * eval: (c-set-style "gnu")