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}
54 * BIER APIs: see ... /src/vnet/policer/{bier.api, bier_api.c}
57 /** \brief Create a new subinterface with the given vlan id
58 @param client_index - opaque cookie to identify the sender
59 @param context - sender context, to match reply w/ request
60 @param sw_if_index - software index of the new vlan's parent interface
61 @param vlan_id - vlan tag of the new interface
63 define create_vlan_subif
71 /** \brief Reply for the vlan subinterface create request
72 @param context - returned sender context, to match reply w/ request
73 @param retval - return code
74 @param sw_if_index - software index allocated for the new subinterface
76 define create_vlan_subif_reply
83 /** \brief Enable or Disable MPLS on and interface
84 @param client_index - opaque cookie to identify the sender
85 @param context - sender context, to match reply w/ request
86 @param sw_if_index - index of the interface
87 @param enable - if non-zero enable, else disable
89 autoreply define sw_interface_set_mpls_enable
97 /** \brief Proxy ARP add / del request
98 @param client_index - opaque cookie to identify the sender
99 @param context - sender context, to match reply w/ request
100 @param vrf_id - VRF / Fib table ID
101 @param is_add - 1 if adding the Proxy ARP range, 0 if deleting
102 @param low_address[4] - Low address of the Proxy ARP range
103 @param hi_address[4] - High address of the Proxy ARP range
105 autoreply define proxy_arp_add_del
115 /** \brief Proxy ARP add / del request
116 @param client_index - opaque cookie to identify the sender
117 @param context - sender context, to match reply w/ request
118 @param sw_if_index - Which interface to enable / disable Proxy Arp on
119 @param enable_disable - 1 to enable Proxy ARP on interface, 0 to disable
121 autoreply define proxy_arp_intfc_enable_disable
126 /* 1 = on, 0 = off */
130 /** \brief Reset VRF (remove all routes etc) request
131 @param client_index - opaque cookie to identify the sender
132 @param context - sender context, to match reply w/ request
133 @param is_ipv6 - 1 for IPv6 neighbor, 0 for IPv4
134 @param vrf_id - ID of th FIB table / VRF to reset
136 autoreply define reset_vrf
144 /** \brief OAM event structure
145 @param dst_address[] -
154 /** \brief Want OAM events request
155 @param client_index - opaque cookie to identify the sender
156 @param context - sender context, to match reply w/ request
157 @param enable_disable- enable if non-zero, else disable
158 @param pid - pid of the requesting process
160 autoreply define want_oam_events
168 /** \brief OAM add / del target request
169 @param client_index - opaque cookie to identify the sender
170 @param context - sender context, to match reply w/ request
171 @param vrf_id - vrf_id of the target
172 @param src_address[] - source address to use for the updates
173 @param dst_address[] - destination address of the target
174 @param is_add - add target if non-zero, else delete
176 autoreply define oam_add_del
186 /** \brief Reset fib table request
187 @param client_index - opaque cookie to identify the sender
188 @param context - sender context, to match reply w/ request
189 @param vrf_id - vrf/table id of the fib table to reset
190 @param is_ipv6 - an ipv6 fib to reset if non-zero, else ipv4
192 autoreply define reset_fib
200 /** \brief Create loopback interface request
201 @param client_index - opaque cookie to identify the sender
202 @param context - sender context, to match reply w/ request
203 @param mac_address - mac addr to assign to the interface if none-zero
205 define create_loopback
212 /** \brief Create loopback interface response
213 @param context - sender context, to match reply w/ request
214 @param sw_if_index - sw index of the interface that was created
215 @param retval - return code for the request
217 define create_loopback_reply
224 /** \brief Create loopback interface instance request
225 @param client_index - opaque cookie to identify the sender
226 @param context - sender context, to match reply w/ request
227 @param mac_address - mac addr to assign to the interface if none-zero
228 @param is_specified - if non-0, a specific user_instance is being requested
229 @param user_instance - requested instance, ~0 => dynamically allocate
231 define create_loopback_instance
240 /** \brief Create loopback interface instance response
241 @param context - sender context, to match reply w/ request
242 @param sw_if_index - sw index of the interface that was created
243 @param retval - return code for the request
245 define create_loopback_instance_reply
252 /** \brief Delete loopback interface request
253 @param client_index - opaque cookie to identify the sender
254 @param context - sender context, to match reply w/ request
255 @param sw_if_index - sw index of the interface that was created
257 autoreply define delete_loopback
264 /** \brief Control ping from client to api server request
265 @param client_index - opaque cookie to identify the sender
266 @param context - sender context, to match reply w/ request
274 /** \brief Control ping from the client to the server response
275 @param client_index - opaque cookie to identify the sender
276 @param context - sender context, to match reply w/ request
277 @param retval - return code for the request
278 @param vpe_pid - the pid of the vpe, returned by the server
280 define control_ping_reply
288 /** \brief Process a vpe parser cli string request
289 @param client_index - opaque cookie to identify the sender
290 @param context - sender context, to match reply w/ request
291 @param cmd_in_shmem - pointer to cli command string
307 /** \brief vpe parser cli string response
308 @param context - sender context, to match reply w/ request
309 @param retval - return code for request
310 @param reply_in_shmem - Reply string from cli processing if any
318 define cli_inband_reply
326 /** \brief Set max allowed ARP or ip6 neighbor entries request
327 @param client_index - opaque cookie to identify the sender
328 @param context - sender context, to match reply w/ request
329 @param is_ipv6 - neighbor limit if non-zero, else ARP limit
330 @param arp_neighbor_limit - the new limit, defaults are ~ 50k
332 autoreply define set_arp_neighbor_limit
337 u32 arp_neighbor_limit;
340 /** \brief L2 interface patch add / del request
341 @param client_index - opaque cookie to identify the sender
342 @param context - sender context, to match reply w/ request
343 @param rx_sw_if_index - receive side interface
344 @param tx_sw_if_index - transmit side interface
345 @param is_add - if non-zero set up the interface patch, else remove it
347 autoreply define l2_patch_add_del
356 /** \brief Interface set vpath request
357 @param client_index - opaque cookie to identify the sender
358 @param context - sender context, to match reply w/ request
359 @param sw_if_index - interface used to reach neighbor
360 @param enable - if non-zero enable, else disable
362 autoreply define sw_interface_set_vpath
370 /** \brief Set L2 XConnect between two interfaces request
371 @param client_index - opaque cookie to identify the sender
372 @param context - sender context, to match reply w/ request
373 @param rx_sw_if_index - Receive interface index
374 @param tx_sw_if_index - Transmit interface index
375 @param enable - enable xconnect if not 0, else set to L3 mode
377 autoreply define sw_interface_set_l2_xconnect
386 /** \brief Interface bridge mode request
387 @param client_index - opaque cookie to identify the sender
388 @param context - sender context, to match reply w/ request
389 @param rx_sw_if_index - the interface
390 @param bd_id - bridge domain id
391 @param bvi - Setup interface as a bvi, bridge mode only
392 @param shg - Shared horizon group, for bridge mode only
393 @param enable - Enable beige mode if not 0, else set to L3 mode
395 autoreply define sw_interface_set_l2_bridge
406 /** \brief Set bridge domain ip to mac entry request
407 @param client_index - opaque cookie to identify the sender
408 @param context - sender context, to match reply w/ request
409 @param bd_id - the bridge domain to set the flags for
410 @param is_add - if non-zero, add the entry, else clear it
411 @param is_ipv6 - if non-zero, ipv6 address, else ipv4 address
412 @param mac_address - MAC address
415 autoreply define bd_ip_mac_add_del
426 /** \brief Set/unset the classification table for an interface request
427 @param client_index - opaque cookie to identify the sender
428 @param context - sender context, to match reply w/ request
429 @param is_ipv6 - ipv6 if non-zero, else ipv4
430 @param sw_if_index - interface to associate with the table
431 @param table_index - index of the table, if ~0 unset the table
433 autoreply define classify_set_interface_ip_table
439 u32 table_index; /* ~0 => off */
442 /** \brief Set/unset l2 classification tables for an interface request
443 @param client_index - opaque cookie to identify the sender
444 @param context - sender context, to match reply w/ request
445 @param sw_if_index - interface to set/unset tables for
446 @param ip4_table_index - ip4 index, use ~0 for all 3 indexes to unset
447 @param ip6_table_index - ip6 index
448 @param other_table_index - other index
450 autoreply define classify_set_interface_l2_tables
458 u32 other_table_index;
462 /** \brief Get node index using name request
463 @param client_index - opaque cookie to identify the sender
464 @param context - sender context, to match reply w/ request
465 @param node_name[] - name of the node
467 define get_node_index
474 /** \brief Get node index using name request
475 @param context - sender context, to match reply w/ request
476 @param retval - return code for the request
477 @param node_index - index of the desired node if found, else ~0
479 define get_node_index_reply
486 /** \brief Set the next node for a given node request
487 @param client_index - opaque cookie to identify the sender
488 @param context - sender context, to match reply w/ request
489 @param node_name[] - node to add the next node to
490 @param next_name[] - node to add as the next node
500 /** \brief IP Set the next node for a given node response
501 @param context - sender context, to match reply w/ request
502 @param retval - return code for the add next node request
503 @param next_index - the index of the next node if success, else ~0
505 define add_node_next_reply
512 /** \brief L2 interface ethernet flow point filtering enable/disable request
513 @param client_index - opaque cookie to identify the sender
514 @param context - sender context, to match reply w/ request
515 @param sw_if_index - interface to enable/disable filtering on
516 @param enable_disable - if non-zero enable filtering, else disable
518 autoreply define l2_interface_efp_filter
533 /* These fields map directly onto the subif template */
537 u8 dot1ad; // 0 = dot1q, 1=dot1ad
540 u8 outer_vlan_id_any;
541 u8 inner_vlan_id_any;
546 define create_subif_reply
553 /** \brief show version
554 @param client_index - opaque cookie to identify the sender
555 @param context - sender context, to match reply w/ request
563 /** \brief show version response
564 @param context - sender context, to match reply w/ request
565 @param retval - return code for the request
566 @param program - name of the program (vpe)
567 @param version - version of the program
568 @param build_directory - root of the workspace where the program was built
570 define show_version_reply
577 u8 build_directory[256];
580 /* Gross kludge, DGMS */
581 autoreply define interface_name_renumber
586 u32 new_show_dev_instance;
589 /** \brief Register for ip4 arp resolution events
590 @param client_index - opaque cookie to identify the sender
591 @param context - sender context, to match reply w/ request
592 @param enable_disable - 1 => register for events, 0 => cancel registration
593 @param pid - sender's pid
594 @param address - the exact ip4 address of interest
596 autoreply define want_ip4_arp_events
605 /** \brief Tell client about an ip4 arp resolution event
606 @param client_index - opaque cookie to identify the sender
607 @param address - the exact ip4 address of interest
608 @param pid - client pid registered to receive notification
609 @param sw_if_index - interface which received ARP packet
610 @param new_mac - the new mac address
611 @param mac_ip - 0: resolution event, 1: mac/ip binding in bd
623 /** \brief Register for ip6 nd resolution events
624 @param client_index - opaque cookie to identify the sender
625 @param context - sender context, to match reply w/ request
626 @param enable_disable - 1 => register for events, 0 => cancel registration
627 @param pid - sender's pid
628 @param address - the exact ip6 address of interest
630 autoreply define want_ip6_nd_events
639 /** \brief Tell client about an ip6 nd resolution or mac/ip event
640 @param client_index - opaque cookie to identify the sender
641 @param pid - client pid registered to receive notification
642 @param sw_if_index - interface which received ARP packet
643 @param address - the exact ip6 address of interest
644 @param new_mac - the new mac address
645 @param mac_ip - 0: resolution event, 1: mac/ip binding in bd
657 /** \brief Set/unset input ACL interface
658 @param client_index - opaque cookie to identify the sender
659 @param context - sender context, to match reply w/ request
660 @param sw_if_index - interface to set/unset input ACL
661 @param ip4_table_index - ip4 classify table index (~0 for skip)
662 @param ip6_table_index - ip6 classify table index (~0 for skip)
663 @param l2_table_index - l2 classify table index (~0 for skip)
664 @param is_add - Set input ACL if non-zero, else unset
665 Note: User is recommeneded to use just one valid table_index per call.
666 (ip4_table_index, ip6_table_index, or l2_table_index)
668 autoreply define input_acl_set_interface
679 define get_node_graph
685 /** \brief get_node_graph_reply
686 @param context - returned sender context, to match reply w/ request
687 @param retval - return code
688 @param reply_in_shmem - result from vlib_node_serialize, in shared
689 memory. Process with vlib_node_unserialize, remember to switch
690 heaps and free the result.
693 define get_node_graph_reply
700 /** \brief IOAM enable : Enable in-band OAM
701 @param id - profile id
702 @param seqno - To enable Seqno Processing
703 @param analyse - Enabling analysis of iOAM at decap node
704 @param pow_enable - Proof of Work enabled or not flag
705 @param trace_enable - iOAM Trace enabled or not flag
707 autoreply define ioam_enable
719 /** \brief iOAM disable
720 @param client_index - opaque cookie to identify the sender
721 @param context - sender context, to match reply w/ request
722 @param index - MAP Domain index
724 autoreply define ioam_disable
731 /** \brief Query relative index via node names
732 @param client_index - opaque cookie to identify the sender
733 @param context - sender context, to match reply w/ request
734 @param node_name - name of node to find relative index from
735 @param next_name - next node from node_name to find relative index of
737 define get_next_index
745 /** \brief Reply for get next node index
746 @param context - sender context which was passed in the request
747 @param retval - return value
748 @param next_index - index of the next_node
750 define get_next_index_reply
757 /** \brief PacketGenerator create interface request
758 @param client_index - opaque cookie to identify the sender
759 @param context - sender context, to match reply w/ request
760 @param interface_id - interface index
762 define pg_create_interface
769 /** \brief PacketGenerator create interface response
770 @param context - sender context, to match reply w/ request
771 @param retval - return value for request
773 define pg_create_interface_reply
780 /** \brief PacketGenerator capture packets on given interface request
781 @param client_index - opaque cookie to identify the sender
782 @param context - sender context, to match reply w/ request
783 @param interface_id - pg interface index
784 @param is_enabled - 1 if enabling streams, 0 if disabling
785 @param count - number of packets to be captured
786 @param pcap_file - pacp file name to store captured packets
788 autoreply define pg_capture
795 u32 pcap_name_length;
796 u8 pcap_file_name[pcap_name_length];
799 /** \brief Enable / disable packet generator request
800 @param client_index - opaque cookie to identify the sender
801 @param context - sender context, to match reply w/ request
802 @param is_enabled - 1 if enabling streams, 0 if disabling
803 @param stream - stream name to be enable/disabled, if not specified handle all streams
805 autoreply define pg_enable_disable
810 u32 stream_name_length;
811 u8 stream_name[stream_name_length];
814 /** \brief Configure IP source and L4 port-range check
815 @param client_index - opaque cookie to identify the sender
816 @param context - sender context, to match reply w/ request
817 @param is_ip6 - 1 if source address type is IPv6
818 @param is_add - 1 if add, 0 if delete
819 @param mask_length - mask length for address entry
820 @param address - array of address bytes
821 @param number_of_ranges - length of low_port and high_port arrays (must match)
822 @param low_ports[32] - up to 32 low end of port range entries (must have corresponding high_ports entry)
823 @param high_ports[32] - up to 32 high end of port range entries (must have corresponding low_ports entry)
824 @param vrf_id - fib table/vrf id to associate the source and port-range check with
825 @note To specify a single port set low_port and high_port entry the same
827 autoreply define ip_source_and_port_range_check_add_del
841 /** \brief Set interface source and L4 port-range request
842 @param client_index - opaque cookie to identify the sender
843 @param context - sender context, to match reply w/ request
844 @param interface_id - interface index
845 @param tcp_vrf_id - VRF associated with source and TCP port-range check
846 @param udp_vrf_id - VRF associated with source and TCP port-range check
848 autoreply define ip_source_and_port_range_check_interface_add_del
860 /** \brief Delete sub interface request
861 @param client_index - opaque cookie to identify the sender
862 @param context - sender context, to match reply w/ request
863 @param sw_if_index - sw index of the interface that was created by create_subif
865 autoreply define delete_subif {
871 /** \brief Punt traffic to the host
872 @param client_index - opaque cookie to identify the sender
873 @param context - sender context, to match reply w/ request
874 @param is_add - add punt if non-zero, else delete
875 @param ipv - L3 protocol 4 - IPv4, 6 - IPv6, ~0 - All
876 @param l4_protocol - L4 protocol to be punted, only UDP (0x11) is supported
877 @param l4_port - TCP/UDP port to be punted
879 autoreply define punt {
888 /** \brief Punt traffic to the host via socket
889 @param client_index - opaque cookie to identify the sender
890 @param context - sender context, to match reply w/ request
891 @param header_version - expected meta data header version (currently 1)
892 @param is_ip4 - L3 protocol 1 - IPv4, 0 - IPv6
893 @param l4_protocol - L4 protocol to be punted, only UDP (0x11) is supported
894 @param l4_port - TCP/UDP port to be punted
896 define punt_socket_register {
903 u8 pathname[108]; /* Linux sun_path defined to be 108 bytes, see unix(7) */
906 define punt_socket_register_reply
913 autoreply define punt_socket_deregister {
921 /** \brief Feature path enable/disable request
922 @param client_index - opaque cookie to identify the sender
923 @param context - sender context, to match reply w/ request
924 @param sw_if_index - the interface
925 @param enable - 1 = on, 0 = off
927 autoreply define feature_enable_disable {
938 * eval: (c-set-style "gnu")