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 * GENEVE APIs: see .../src/vnet/geneve/{geneve.api, geneve_api.c}
30 * LLDP APIs: see .../src/vnet/lldp/{lldp.api, lldp_api.c}
31 * AF-PACKET APIs: see ... /vnet/devices/af_packet/{af_packet.api, af_packet_api.c}
32 * NETMAP APIs: see ... /src/vnet/devices/netmap/{netmap.api, netmap_api.c}
33 * VHOST-USER APIs: see .../vnet/devices/virtio/{vhost_user.api, vhost_user_api.c}
34 * VXLAN GPE APIs: see .../src/vnet/vxlan-gpe/{vxlan_gpe.api, vxlan_gpe_api.c}
35 * GRE APIs: see .../src/vnet/gre/{gre.api, gre_api.c}
36 * L2 APIs: see .../src/vnet/l2/{l2.api, l2_api.c}
37 * L2TP APIs: see .../src/vnet/l2tp/{l2tp.api, l2tp_api.c}
38 * BFD APIs: see .../src/vnet/bfd/{bfd.api, bfd_api.c}
39 * IPSEC APIs: see .../src/vnet/ipsec/{ipsec.api, ipsec_api.c}
40 * IPSEC-GRE APIs: see .../src/vnet/ipsec-gre/{ipsec_gre.api, ipsec_gre_api.c}
41 * LISP APIs: see .../src/vnet/lisp/{lisp.api, lisp_api.c}
42 * LISP-GPE APIs: see .../src/vnet/lisp-gpe/{lisp_gpe.api, lisp_gpe_api.c}
43 * SESSION APIs: .../vnet/session/{session.api session_api.c}
44 * MPLS APIs: see .../src/vnet/mpls/{mpls.api, mpls_api.c}
45 * SR APIs: see .../src/vnet/srv6/{sr.api, sr_api.c}
46 * CLASSIFY APIs: see ... /src/vnet/classify/{classify.api, classify_api.c}
47 * FLOW APIs: see ... /src/vnet/flow/{flow.api, flow_api.c}
48 * DHCP APIs: see ... /src/vnet/dhcp/{dhcpk.api, dhcp_api.c}
49 * COP APIs: see ... /src/vnet/cop/{cop.api, cop_api.c}
50 * POLICER APIs: see ... /src/vnet/policer/{policer.api, policer_api.c}
51 * STATS APIs: see .../src/vpp/stats/{stats.api, stats.c}
54 /** \brief Create a new subinterface with the given vlan id
55 @param client_index - opaque cookie to identify the sender
56 @param context - sender context, to match reply w/ request
57 @param sw_if_index - software index of the new vlan's parent interface
58 @param vlan_id - vlan tag of the new interface
60 define create_vlan_subif
68 /** \brief Reply for the vlan subinterface create request
69 @param context - returned sender context, to match reply w/ request
70 @param retval - return code
71 @param sw_if_index - software index allocated for the new subinterface
73 define create_vlan_subif_reply
80 /** \brief Enable or Disable MPLS on and interface
81 @param client_index - opaque cookie to identify the sender
82 @param context - sender context, to match reply w/ request
83 @param sw_if_index - index of the interface
84 @param enable - if non-zero enable, else disable
86 autoreply define sw_interface_set_mpls_enable
94 /** \brief Proxy ARP add / del request
95 @param client_index - opaque cookie to identify the sender
96 @param context - sender context, to match reply w/ request
97 @param vrf_id - VRF / Fib table ID
98 @param is_add - 1 if adding the Proxy ARP range, 0 if deleting
99 @param low_address[4] - Low address of the Proxy ARP range
100 @param hi_address[4] - High address of the Proxy ARP range
102 autoreply define proxy_arp_add_del
112 /** \brief Proxy ARP add / del request
113 @param client_index - opaque cookie to identify the sender
114 @param context - sender context, to match reply w/ request
115 @param sw_if_index - Which interface to enable / disable Proxy Arp on
116 @param enable_disable - 1 to enable Proxy ARP on interface, 0 to disable
118 autoreply define proxy_arp_intfc_enable_disable
123 /* 1 = on, 0 = off */
127 /** \brief Reset VRF (remove all routes etc) request
128 @param client_index - opaque cookie to identify the sender
129 @param context - sender context, to match reply w/ request
130 @param is_ipv6 - 1 for IPv6 neighbor, 0 for IPv4
131 @param vrf_id - ID of th FIB table / VRF to reset
133 autoreply define reset_vrf
141 /** \brief OAM event structure
142 @param dst_address[] -
151 /** \brief Want OAM events request
152 @param client_index - opaque cookie to identify the sender
153 @param context - sender context, to match reply w/ request
154 @param enable_disable- enable if non-zero, else disable
155 @param pid - pid of the requesting process
157 autoreply define want_oam_events
165 /** \brief OAM add / del target request
166 @param client_index - opaque cookie to identify the sender
167 @param context - sender context, to match reply w/ request
168 @param vrf_id - vrf_id of the target
169 @param src_address[] - source address to use for the updates
170 @param dst_address[] - destination address of the target
171 @param is_add - add target if non-zero, else delete
173 autoreply define oam_add_del
183 /** \brief Reset fib table request
184 @param client_index - opaque cookie to identify the sender
185 @param context - sender context, to match reply w/ request
186 @param vrf_id - vrf/table id of the fib table to reset
187 @param is_ipv6 - an ipv6 fib to reset if non-zero, else ipv4
189 autoreply define reset_fib
197 /** \brief Create loopback interface request
198 @param client_index - opaque cookie to identify the sender
199 @param context - sender context, to match reply w/ request
200 @param mac_address - mac addr to assign to the interface if none-zero
202 define create_loopback
209 /** \brief Create loopback interface response
210 @param context - sender context, to match reply w/ request
211 @param sw_if_index - sw index of the interface that was created
212 @param retval - return code for the request
214 define create_loopback_reply
221 /** \brief Create loopback interface instance request
222 @param client_index - opaque cookie to identify the sender
223 @param context - sender context, to match reply w/ request
224 @param mac_address - mac addr to assign to the interface if none-zero
225 @param is_specified - if non-0, a specific user_instance is being requested
226 @param user_instance - requested instance, ~0 => dynamically allocate
228 define create_loopback_instance
237 /** \brief Create loopback interface instance response
238 @param context - sender context, to match reply w/ request
239 @param sw_if_index - sw index of the interface that was created
240 @param retval - return code for the request
242 define create_loopback_instance_reply
249 /** \brief Delete loopback interface request
250 @param client_index - opaque cookie to identify the sender
251 @param context - sender context, to match reply w/ request
252 @param sw_if_index - sw index of the interface that was created
254 autoreply define delete_loopback
261 /** \brief Control ping from client to api server request
262 @param client_index - opaque cookie to identify the sender
263 @param context - sender context, to match reply w/ request
271 /** \brief Control ping from the client to the server response
272 @param client_index - opaque cookie to identify the sender
273 @param context - sender context, to match reply w/ request
274 @param retval - return code for the request
275 @param vpe_pid - the pid of the vpe, returned by the server
277 define control_ping_reply
285 /** \brief Process a vpe parser cli string request
286 @param client_index - opaque cookie to identify the sender
287 @param context - sender context, to match reply w/ request
288 @param cmd_in_shmem - pointer to cli command string
304 /** \brief vpe parser cli string response
305 @param context - sender context, to match reply w/ request
306 @param retval - return code for request
307 @param reply_in_shmem - Reply string from cli processing if any
315 define cli_inband_reply
323 /** \brief Set max allowed ARP or ip6 neighbor entries request
324 @param client_index - opaque cookie to identify the sender
325 @param context - sender context, to match reply w/ request
326 @param is_ipv6 - neighbor limit if non-zero, else ARP limit
327 @param arp_neighbor_limit - the new limit, defaults are ~ 50k
329 autoreply define set_arp_neighbor_limit
334 u32 arp_neighbor_limit;
337 /** \brief L2 interface patch add / del request
338 @param client_index - opaque cookie to identify the sender
339 @param context - sender context, to match reply w/ request
340 @param rx_sw_if_index - receive side interface
341 @param tx_sw_if_index - transmit side interface
342 @param is_add - if non-zero set up the interface patch, else remove it
344 autoreply define l2_patch_add_del
353 /** \brief Interface set vpath request
354 @param client_index - opaque cookie to identify the sender
355 @param context - sender context, to match reply w/ request
356 @param sw_if_index - interface used to reach neighbor
357 @param enable - if non-zero enable, else disable
359 autoreply define sw_interface_set_vpath
367 /** \brief Set L2 XConnect between two interfaces request
368 @param client_index - opaque cookie to identify the sender
369 @param context - sender context, to match reply w/ request
370 @param rx_sw_if_index - Receive interface index
371 @param tx_sw_if_index - Transmit interface index
372 @param enable - enable xconnect if not 0, else set to L3 mode
374 autoreply define sw_interface_set_l2_xconnect
383 /** \brief Interface bridge mode request
384 @param client_index - opaque cookie to identify the sender
385 @param context - sender context, to match reply w/ request
386 @param rx_sw_if_index - the interface
387 @param bd_id - bridge domain id
388 @param bvi - Setup interface as a bvi, bridge mode only
389 @param shg - Shared horizon group, for bridge mode only
390 @param enable - Enable beige mode if not 0, else set to L3 mode
392 autoreply define sw_interface_set_l2_bridge
403 /** \brief Set bridge domain ip to mac entry request
404 @param client_index - opaque cookie to identify the sender
405 @param context - sender context, to match reply w/ request
406 @param bd_id - the bridge domain to set the flags for
407 @param is_add - if non-zero, add the entry, else clear it
408 @param is_ipv6 - if non-zero, ipv6 address, else ipv4 address
409 @param mac_address - MAC address
412 autoreply define bd_ip_mac_add_del
423 /** \brief Set/unset the classification table for an interface request
424 @param client_index - opaque cookie to identify the sender
425 @param context - sender context, to match reply w/ request
426 @param is_ipv6 - ipv6 if non-zero, else ipv4
427 @param sw_if_index - interface to associate with the table
428 @param table_index - index of the table, if ~0 unset the table
430 autoreply define classify_set_interface_ip_table
436 u32 table_index; /* ~0 => off */
439 /** \brief Set/unset l2 classification tables for an interface request
440 @param client_index - opaque cookie to identify the sender
441 @param context - sender context, to match reply w/ request
442 @param sw_if_index - interface to set/unset tables for
443 @param ip4_table_index - ip4 index, use ~0 for all 3 indexes to unset
444 @param ip6_table_index - ip6 index
445 @param other_table_index - other index
447 autoreply define classify_set_interface_l2_tables
455 u32 other_table_index;
459 /** \brief Get node index using name request
460 @param client_index - opaque cookie to identify the sender
461 @param context - sender context, to match reply w/ request
462 @param node_name[] - name of the node
464 define get_node_index
471 /** \brief Get node index using name request
472 @param context - sender context, to match reply w/ request
473 @param retval - return code for the request
474 @param node_index - index of the desired node if found, else ~0
476 define get_node_index_reply
483 /** \brief Set the next node for a given node request
484 @param client_index - opaque cookie to identify the sender
485 @param context - sender context, to match reply w/ request
486 @param node_name[] - node to add the next node to
487 @param next_name[] - node to add as the next node
497 /** \brief IP Set the next node for a given node response
498 @param context - sender context, to match reply w/ request
499 @param retval - return code for the add next node request
500 @param next_index - the index of the next node if success, else ~0
502 define add_node_next_reply
509 /** \brief L2 interface ethernet flow point filtering enable/disable request
510 @param client_index - opaque cookie to identify the sender
511 @param context - sender context, to match reply w/ request
512 @param sw_if_index - interface to enable/disable filtering on
513 @param enable_disable - if non-zero enable filtering, else disable
515 autoreply define l2_interface_efp_filter
530 /* These fields map directly onto the subif template */
534 u8 dot1ad; // 0 = dot1q, 1=dot1ad
537 u8 outer_vlan_id_any;
538 u8 inner_vlan_id_any;
543 define create_subif_reply
550 /** \brief show version
551 @param client_index - opaque cookie to identify the sender
552 @param context - sender context, to match reply w/ request
560 /** \brief show version response
561 @param context - sender context, to match reply w/ request
562 @param retval - return code for the request
563 @param program - name of the program (vpe)
564 @param version - version of the program
565 @param build_directory - root of the workspace where the program was built
567 define show_version_reply
574 u8 build_directory[256];
577 /* Gross kludge, DGMS */
578 autoreply define interface_name_renumber
583 u32 new_show_dev_instance;
586 /** \brief Register for ip4 arp resolution events
587 @param client_index - opaque cookie to identify the sender
588 @param context - sender context, to match reply w/ request
589 @param enable_disable - 1 => register for events, 0 => cancel registration
590 @param pid - sender's pid
591 @param address - the exact ip4 address of interest
593 autoreply define want_ip4_arp_events
602 /** \brief Tell client about an ip4 arp resolution event
603 @param client_index - opaque cookie to identify the sender
604 @param address - the exact ip4 address of interest
605 @param pid - client pid registered to receive notification
606 @param sw_if_index - interface which received ARP packet
607 @param new_mac - the new mac address
608 @param mac_ip - 0: resolution event, 1: mac/ip binding in bd
620 /** \brief Register for ip6 nd resolution events
621 @param client_index - opaque cookie to identify the sender
622 @param context - sender context, to match reply w/ request
623 @param enable_disable - 1 => register for events, 0 => cancel registration
624 @param pid - sender's pid
625 @param address - the exact ip6 address of interest
627 autoreply define want_ip6_nd_events
636 /** \brief Tell client about an ip6 nd resolution or mac/ip event
637 @param client_index - opaque cookie to identify the sender
638 @param pid - client pid registered to receive notification
639 @param sw_if_index - interface which received ARP packet
640 @param address - the exact ip6 address of interest
641 @param new_mac - the new mac address
642 @param mac_ip - 0: resolution event, 1: mac/ip binding in bd
654 /** \brief Set/unset input ACL interface
655 @param client_index - opaque cookie to identify the sender
656 @param context - sender context, to match reply w/ request
657 @param sw_if_index - interface to set/unset input ACL
658 @param ip4_table_index - ip4 classify table index (~0 for skip)
659 @param ip6_table_index - ip6 classify table index (~0 for skip)
660 @param l2_table_index - l2 classify table index (~0 for skip)
661 @param is_add - Set input ACL if non-zero, else unset
662 Note: User is recommeneded to use just one valid table_index per call.
663 (ip4_table_index, ip6_table_index, or l2_table_index)
665 autoreply define input_acl_set_interface
676 define get_node_graph
682 /** \brief get_node_graph_reply
683 @param context - returned sender context, to match reply w/ request
684 @param retval - return code
685 @param reply_in_shmem - result from vlib_node_serialize, in shared
686 memory. Process with vlib_node_unserialize, remember to switch
687 heaps and free the result.
690 define get_node_graph_reply
697 /** \brief IOAM enable : Enable in-band OAM
698 @param id - profile id
699 @param seqno - To enable Seqno Processing
700 @param analyse - Enabling analysis of iOAM at decap node
701 @param pow_enable - Proof of Work enabled or not flag
702 @param trace_enable - iOAM Trace enabled or not flag
704 autoreply define ioam_enable
716 /** \brief iOAM disable
717 @param client_index - opaque cookie to identify the sender
718 @param context - sender context, to match reply w/ request
719 @param index - MAP Domain index
721 autoreply define ioam_disable
728 /** \brief Query relative index via node names
729 @param client_index - opaque cookie to identify the sender
730 @param context - sender context, to match reply w/ request
731 @param node_name - name of node to find relative index from
732 @param next_name - next node from node_name to find relative index of
734 define get_next_index
742 /** \brief Reply for get next node index
743 @param context - sender context which was passed in the request
744 @param retval - return value
745 @param next_index - index of the next_node
747 define get_next_index_reply
754 /** \brief PacketGenerator create interface request
755 @param client_index - opaque cookie to identify the sender
756 @param context - sender context, to match reply w/ request
757 @param interface_id - interface index
759 define pg_create_interface
766 /** \brief PacketGenerator create interface response
767 @param context - sender context, to match reply w/ request
768 @param retval - return value for request
770 define pg_create_interface_reply
777 /** \brief PacketGenerator capture packets on given interface request
778 @param client_index - opaque cookie to identify the sender
779 @param context - sender context, to match reply w/ request
780 @param interface_id - pg interface index
781 @param is_enabled - 1 if enabling streams, 0 if disabling
782 @param count - number of packets to be captured
783 @param pcap_file - pacp file name to store captured packets
785 autoreply define pg_capture
792 u32 pcap_name_length;
793 u8 pcap_file_name[pcap_name_length];
796 /** \brief Enable / disable packet generator request
797 @param client_index - opaque cookie to identify the sender
798 @param context - sender context, to match reply w/ request
799 @param is_enabled - 1 if enabling streams, 0 if disabling
800 @param stream - stream name to be enable/disabled, if not specified handle all streams
802 autoreply define pg_enable_disable
807 u32 stream_name_length;
808 u8 stream_name[stream_name_length];
811 /** \brief Configure IP source and L4 port-range check
812 @param client_index - opaque cookie to identify the sender
813 @param context - sender context, to match reply w/ request
814 @param is_ip6 - 1 if source address type is IPv6
815 @param is_add - 1 if add, 0 if delete
816 @param mask_length - mask length for address entry
817 @param address - array of address bytes
818 @param number_of_ranges - length of low_port and high_port arrays (must match)
819 @param low_ports[32] - up to 32 low end of port range entries (must have corresponding high_ports entry)
820 @param high_ports[32] - up to 32 high end of port range entries (must have corresponding low_ports entry)
821 @param vrf_id - fib table/vrf id to associate the source and port-range check with
822 @note To specify a single port set low_port and high_port entry the same
824 autoreply define ip_source_and_port_range_check_add_del
838 /** \brief Set interface source and L4 port-range request
839 @param client_index - opaque cookie to identify the sender
840 @param context - sender context, to match reply w/ request
841 @param interface_id - interface index
842 @param tcp_vrf_id - VRF associated with source and TCP port-range check
843 @param udp_vrf_id - VRF associated with source and TCP port-range check
845 autoreply define ip_source_and_port_range_check_interface_add_del
857 /** \brief Delete sub interface request
858 @param client_index - opaque cookie to identify the sender
859 @param context - sender context, to match reply w/ request
860 @param sw_if_index - sw index of the interface that was created by create_subif
862 autoreply define delete_subif {
868 /** \brief Punt traffic to the host
869 @param client_index - opaque cookie to identify the sender
870 @param context - sender context, to match reply w/ request
871 @param is_add - add punt if non-zero, else delete
872 @param ipv - L3 protocol 4 - IPv4, 6 - IPv6, ~0 - All
873 @param l4_protocol - L4 protocol to be punted, only UDP (0x11) is supported
874 @param l4_port - TCP/UDP port to be punted
876 autoreply define punt {
885 /** \brief Punt traffic to the host via socket
886 @param client_index - opaque cookie to identify the sender
887 @param context - sender context, to match reply w/ request
888 @param header_version - expected meta data header version (currently 1)
889 @param is_ip4 - L3 protocol 1 - IPv4, 0 - IPv6
890 @param l4_protocol - L4 protocol to be punted, only UDP (0x11) is supported
891 @param l4_port - TCP/UDP port to be punted
893 define punt_socket_register {
900 u8 pathname[108]; /* Linux sun_path defined to be 108 bytes, see unix(7) */
903 define punt_socket_register_reply
910 autoreply define punt_socket_deregister {
918 /** \brief Feature path enable/disable request
919 @param client_index - opaque cookie to identify the sender
920 @param context - sender context, to match reply w/ request
921 @param sw_if_index - the interface
922 @param enable - 1 = on, 0 = off
924 autoreply define feature_enable_disable {
935 * eval: (c-set-style "gnu")