2 * Copyright (c) 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.
20 * @brief VPP control-plane API messages.
22 * This file defines VPP control-plane API messages which are generally
23 * called through a shared memory interface.
27 * Common NAT plugin APIs
30 /** \brief Control ping from client to api server request
31 @param client_index - opaque cookie to identify the sender
32 @param context - sender context, to match reply w/ request
34 define nat_control_ping
40 /** \brief Control ping from the client to the server response
41 @param client_index - opaque cookie to identify the sender
42 @param context - sender context, to match reply w/ request
43 @param retval - return code for the request
44 @param vpe_pid - the pid of the vpe, returned by the server
46 define nat_control_ping_reply
54 /** \brief Show NAT plugin startup config
55 @param client_index - opaque cookie to identify the sender
56 @param context - sender context, to match reply w/ request
58 define nat_show_config
64 /** \brief Show NAT plugin startup config reply
65 @param context - sender context, to match reply w/ request
66 @param retval - return code for the request
67 @param static_mapping_only - if 1 dynamic translations disabled
68 @param static_mapping_connection_tracking - if 1 create session data
69 @param deterministic - if 1 deterministic mapping
70 @param translation_buckets - number of translation hash buckets
71 @param translation_memory_size - translation hash memory size
72 @param user_buckets - number of user hash buckets
73 @param user_memory_size - user hash memory size
74 @param max_translations_per_user - maximum number of translations per user
75 @param outside_vrf_id - outside VRF id
76 @param inside_vrf_id - default inside VRF id
78 define nat_show_config_reply
82 u8 static_mapping_only;
83 u8 static_mapping_connection_tracking;
85 u32 translation_buckets;
86 u32 translation_memory_size;
89 u32 max_translations_per_user;
94 /** \brief Set NAT workers
95 @param client_index - opaque cookie to identify the sender
96 @param context - sender context, to match reply w/ request
97 @param worker_mask - NAT workers mask
99 autoreply define nat_set_workers {
105 /** \brief Dump NAT workers
106 @param client_index - opaque cookie to identify the sender
107 @param context - sender context, to match reply w/ request
109 define nat_worker_dump {
114 /** \brief NAT workers details response
115 @param context - sender context, to match reply w/ request
116 @param worker_index - worker index
117 @param lcore_id - lcore ID
118 @param name - worker name
120 define nat_worker_details {
127 /** \brief Enable/disable NAT IPFIX logging
128 @param client_index - opaque cookie to identify the sender
129 @param context - sender context, to match reply w/ request
130 @param domain_id - observation domain ID
131 @param src_port - source port number
132 @param enable - 1 if enable, 0 if disable
134 autoreply define nat_ipfix_enable_disable {
142 /** \brief Set NAT virtual fragmentation reassembly
143 @param client_index - opaque cookie to identify the sender
144 @param context - sender context, to match reply w/ request
145 @param timeout - reassembly timeout
146 @param max_reass - maximum number of concurrent reassemblies
147 @param max_frag - maximum number of fragmets per reassembly
148 @param drop_frag - if 0 translate fragments, otherwise drop fragments
149 @param is_ip6 - 1 if IPv6, 0 if IPv4
151 autoreply define nat_set_reass {
161 /** \brief Get NAT virtual fragmentation reassembly configuration
162 @param client_index - opaque cookie to identify the sender
163 @param context - sender context, to match reply w/ request
165 define nat_get_reass {
170 /** \brief Get NAT virtual fragmentation reassembly configuration reply
171 @param context - sender context, to match reply w/ request
172 @param retval - return code
173 @param ip4_timeout - reassembly timeout
174 @param ip4_max_reass - maximum number of concurrent reassemblies
175 @param ip4_max_frag - maximum number of fragmets per reassembly
176 @param ip4_drop_frag - if 0 translate fragments, otherwise drop fragments
177 @param ip6_timeout - reassembly timeout
178 @param ip6_max_reass - maximum number of concurrent reassemblies
179 @param ip6_max_frag - maximum number of fragmets per reassembly
180 @param ip6_drop_frag - if 0 translate fragments, otherwise drop fragments
182 define nat_get_reass_reply {
195 /** \brief Dump NAT virtual fragmentation reassemblies
196 @param client_index - opaque cookie to identify the sender
197 @param context - sender context, to match reply w/ request
199 define nat_reass_dump {
204 /** \brief NAT virtual fragmentation reassemblies response
205 @param context - sender context, to match reply w/ request
206 @param is_ip4 - 1 if address type is IPv4
207 @param src_addr - source IP address
208 @param dst_addr - destination IP address
209 @param frag_id - fragment ID
210 @param proto - protocol
211 @param frag_n - number of cached fragments
213 define nat_reass_details {
227 /** \brief Add/del NAT44 address range
228 @param client_index - opaque cookie to identify the sender
229 @param context - sender context, to match reply w/ request
230 @param first_ip_address - first IPv4 address
231 @param last_ip_address - last IPv4 address
232 @param vrf_id - VRF id of tenant, ~0 means independent of VRF
233 @param is_add - 1 if add, 0 if delete
235 autoreply define nat44_add_del_address_range {
238 u8 first_ip_address[4];
239 u8 last_ip_address[4];
244 /** \brief Dump NAT44 addresses
245 @param client_index - opaque cookie to identify the sender
246 @param context - sender context, to match reply w/ request
248 define nat44_address_dump {
253 /** \brief NAT44 address details response
254 @param context - sender context, to match reply w/ request
255 @param ip_address - IPv4 address
256 @param vrf_id - VRF id of tenant, ~0 means independent of VRF
258 define nat44_address_details {
264 /** \brief Enable/disable NAT44 feature on the interface
265 @param client_index - opaque cookie to identify the sender
266 @param context - sender context, to match reply w/ request
267 @param is_add - 1 if add, 0 if delete
268 @param is_inside - 1 if inside, 0 if outside
269 @param sw_if_index - software index of the interface
271 autoreply define nat44_interface_add_del_feature {
279 /** \brief Dump interfaces with NAT44 feature
280 @param client_index - opaque cookie to identify the sender
281 @param context - sender context, to match reply w/ request
283 define nat44_interface_dump {
288 /** \brief NAT44 interface details response
289 @param context - sender context, to match reply w/ request
290 @param is_inside - 1 if inside, 0 if outside, 2 if inside and outside
291 @param sw_if_index - software index of the interface
293 define nat44_interface_details {
299 /** \brief Enable/disbale NAT44 as an interface output feature (postrouting
301 @param client_index - opaque cookie to identify the sender
302 @param context - sender context, to match reply w/ request
303 @param is_add - 1 if add, 0 if delete
304 @param is_inside - 1 if inside, 0 if outside
305 @param sw_if_index - software index of the interface
307 autoreply define nat44_interface_add_del_output_feature {
315 /** \brief Dump interfaces with NAT44 output feature
316 @param client_index - opaque cookie to identify the sender
317 @param context - sender context, to match reply w/ request
319 define nat44_interface_output_feature_dump {
324 /** \brief NAT44 interface with output feature details response
325 @param context - sender context, to match reply w/ request
326 @param is_inside - 1 if inside, 0 if outside
327 @param sw_if_index - software index of the interface
329 define nat44_interface_output_feature_details {
335 /** \brief Add/delete NAT44 static mapping
336 @param client_index - opaque cookie to identify the sender
337 @param context - sender context, to match reply w/ request
338 @param is_add - 1 if add, 0 if delete
339 @param addr_only - 1 if address only mapping
340 @param local_ip_address - local IPv4 address
341 @param external_ip_address - external IPv4 address
342 @param protocol - IP protocol
343 @param local_port - local port number
344 @param external_port - external port number
345 @param external_sw_if_index - external interface (if set
346 external_ip_address is ignored, ~0 means not
348 @param vfr_id - VRF ID
350 autoreply define nat44_add_del_static_mapping {
355 u8 local_ip_address[4];
356 u8 external_ip_address[4];
360 u32 external_sw_if_index;
364 /** \brief Dump NAT44 static mappings
365 @param client_index - opaque cookie to identify the sender
366 @param context - sender context, to match reply w/ request
368 define nat44_static_mapping_dump {
373 /** \brief NAT44 static mapping details response
374 @param context - sender context, to match reply w/ request
375 @param addr_only - 1 if address only mapping
376 @param local_ip_address - local IPv4 address
377 @param external_ip_address - external IPv4 address
378 @param protocol - IP protocol
379 @param local_port - local port number
380 @param external_port - external port number
381 @param external_sw_if_index - external interface
382 @param vfr_id - VRF ID
384 define nat44_static_mapping_details {
387 u8 local_ip_address[4];
388 u8 external_ip_address[4];
392 u32 external_sw_if_index;
396 /** \brief Add/delete NAT44 pool address from specific interfce
397 @param client_index - opaque cookie to identify the sender
398 @param context - sender context, to match reply w/ request
399 @param is_add - 1 if add, 0 if delete
400 @param sw_if_index - software index of the interface
402 autoreply define nat44_add_del_interface_addr {
410 /** \brief Dump NAT44 pool addresses interfaces
411 @param client_index - opaque cookie to identify the sender
412 @param context - sender context, to match reply w/ request
414 define nat44_interface_addr_dump {
419 /** \brief NAT44 pool addresses interfaces details response
420 @param context - sender context, to match reply w/ request
421 @param sw_if_index - software index of the interface
423 define nat44_interface_addr_details {
428 /** \brief Dump NAT44 users
429 @param client_index - opaque cookie to identify the sender
430 @param context - sender context, to match reply w/ request
432 define nat44_user_dump {
437 /** \brief NAT44 users response
438 @param context - sender context, to match reply w/ request
440 @param ip_adress - IPv4 address
441 @param nsessions - number of dynamic sessions
442 @param nstaticsessions - number of static sessions
444 define nat44_user_details {
452 /** \brief NAT44 user's sessions
453 @param client_index - opaque cookie to identify the sender
454 @param context - sender context, to match reply w/ request
455 @param is_ip4 - 1 if address type is IPv4
456 @param user_ip - IP address of the user to dump
457 @param vrf_id - VRF_ID
459 define nat44_user_session_dump {
466 /** \brief NAT44 user's sessions response
467 @param context - sender context, to match reply w/ request
468 @param outside_ip_address - outside IPv4 address
469 @param outside_port - outside port
470 @param inside_ip_address - inside IPv4 address
471 @param inside_port - inside port
472 @param protocol - protocol
473 @param is_static - 1 if session is static
474 @param last_heard - last heard timer
475 @param total_bytes - count of bytes sent through session
476 @param total_pkts - count of pakets sent through session
478 define nat44_user_session_details {
480 u8 outside_ip_address[4];
482 u8 inside_ip_address[4];
491 typeonly manual_endian define nat44_lb_addr_port {
497 autoreply manual_endian define nat44_add_del_lb_static_mapping {
506 vl_api_nat44_lb_addr_port_t locals[local_num];
509 define nat44_lb_static_mapping_dump {
514 manual_endian define nat44_lb_static_mapping_details {
521 vl_api_nat44_lb_addr_port_t locals[local_num];
524 /** \brief Delete NAT44 session
525 @param client_index - opaque cookie to identify the sender
526 @param context - sender context, to match reply w/ request
527 @param is_in - 1 if inside network addres and port pari, 0 if outside
528 @param ip_address - IPv4 address
529 @param protocol - IP protocol
530 @param port - port number
531 @param vfr_id - VRF ID
533 autoreply define nat44_del_session {
545 * Deterministic NAT (CGN) APIs
548 /** \brief Add/delete NAT deterministic mapping
549 @param client_index - opaque cookie to identify the sender
550 @param context - sender context, to match reply w/ request
551 @param is_add - 1 if add, 0 if delete
552 @param is_nat44 - 1 if NAT44
553 @param in_addr - inside IP address
554 @param in_plen - inside IP address prefix length
555 @param out_addr - outside IPv4 address
556 @param out_addr - outside IPv4 address prefix length
558 autoreply define nat_det_add_del_map {
570 /** \brief Get outside address and port range from inside address
571 @param client_index - opaque cookie to identify the sender
572 @param context - sender context, to match reply w/ request
573 @param is_nat44 - 1 if NAT44
574 @param in_addr - inside IP address
576 define nat_det_forward {
583 /** \brief Get outside address and port range from inside address
584 @param context - sender context, to match reply w/ request
585 @param retval - return code
586 @param out_port_lo - outside port range start
587 @param out_port_hi - outside port range end
588 @param out_addr - outside IPv4 address
590 define nat_det_forward_reply {
598 /** \brief Get inside address from outside address and port
599 @param client_index - opaque cookie to identify the sender
600 @param context - sender context, to match reply w/ request
601 @param out_port - outside port
602 @param out_addr - outside IPv4 address
604 define nat_det_reverse {
611 /** \brief Get inside address from outside address and port reply
612 @param context - sender context, to match reply w/ request
613 @param retval - return code
614 @param is_nat44 - 1 if NAT44
615 @param in_addr - inside IP address
617 define nat_det_reverse_reply {
624 /** \brief Dump NAT deterministic mappings
625 @param client_index - opaque cookie to identify the sender
626 @param context - sender context, to match reply w/ request
628 define nat_det_map_dump {
633 /** \brief NAT users response
634 @param context - sender context, to match reply w/ request
635 @param is_nat44 - 1 if NAT44
636 @param in_addr - inside IP address
637 @param in_plen - inside IP address prefix length
638 @param out_addr - outside IPv4 address
639 @param out_plen - outside IPv4 address prefix length
640 @param sharing_ratio - outside to inside address sharing ratio
641 @param ports_per_host - number of ports available to a host
642 @param ses_num - number of sessions belonging to this mapping
644 define nat_det_map_details {
656 /** \brief Set values of timeouts for deterministic NAT (seconds, 0 = default)
657 @param client_index - opaque cookie to identify the sender
658 @param context - sender context, to match reply w/ request
659 @param udp - UDP timeout (default 300sec)
660 @param tcp_established - TCP established timeout (default 7440sec)
661 @param tcp_transitory - TCP transitory timeout (default 240sec)
662 @param icmp - ICMP timeout (default 60sec)
664 autoreply define nat_det_set_timeouts {
673 /** \brief Get values of timeouts for deterministic NAT (seconds)
674 @param client_index - opaque cookie to identify the sender
675 @param context - sender context, to match reply w/ request
677 define nat_det_get_timeouts {
682 /** \brief Get values of timeouts for deterministic NAT reply
683 @param context - sender context, to match reply w/ request
684 @param retval - return code
685 @param udp - UDP timeout (default 300sec)
686 @param tcp_established - TCP established timeout (default 7440sec)
687 @param tcp_transitory - TCP transitory timeout (default 240sec)
688 @param icmp - ICMP timeout (default 60sec)
690 define nat_det_get_timeouts_reply {
699 /** \brief Close deterministic NAT session by outside address and port
700 @param client_index - opaque cookie to identify the sender
701 @param context - sender context, to match reply w/ request
702 @param out_addr - outside IPv4 address
703 @param out_port - outside port
704 @param ext_addr - external host IPv4 address
705 @param ext_port - external host port
707 autoreply define nat_det_close_session_out {
716 /** \brief Close deterministic NAT session by inside address and port
717 @param client_index - opaque cookie to identify the sender
718 @param context - sender context, to match reply w/ request
719 @param is_nat44 - 1 if NAT44
720 @param in_addr - inside IP address
721 @param in_port - inside port
722 @param ext_addr - external host IP address
723 @param ext_port - external host port
725 autoreply define nat_det_close_session_in {
735 /** \brief Dump determinstic NAT sessions
736 @param client_index - opaque cookie to identify the sender
737 @param context - sender context, to match reply w/ request
738 @param is_nat44 - 1 if NAT44
739 @param user_addr - address of an inside user whose sessions to dump
741 define nat_det_session_dump {
748 /** \brief Deterministic NAT sessions reply
749 @param context - sender context, to match reply w/ request
750 @param in_port - inside port
751 @param ext_addr - external host address
752 @param ext_port - external host port
753 @param out_port - outside NAT port
754 @param state - session state
755 @param expire - session expiration timestamp
757 define nat_det_session_details {
772 /** \brief Add/delete address range to NAT64 pool
773 @param client_index - opaque cookie to identify the sender
774 @param context - sender context, to match reply w/ request
775 @param start_addr - start address of the range
776 @param end_addr - end address of the range
777 @param vrf_id - VRF id of tenant, ~0 means independent of VRF
778 @param is_add - 1 if add, 0 if delete
780 autoreply define nat64_add_del_pool_addr_range {
789 /** \brief Dump NAT64 pool addresses
790 @param client_index - opaque cookie to identify the sender
791 @param context - sender context, to match reply w/ request
793 define nat64_pool_addr_dump {
798 /** \brief NAT64 pool address details response
799 @param context - sender context, to match reply w/ request
800 @param address - IPv4 address
801 @param vfr_id - VRF id of tenant, ~0 means independent of VRF
803 define nat64_pool_addr_details {
809 /** \brief Enable/disable NAT64 feature on the interface
810 @param client_index - opaque cookie to identify the sender
811 @param context - sender context, to match reply w/ request
812 @param sw_if_index - index of the interface
813 @param is_inside - 1 if inside, 0 if outside
814 @param is_add - 1 if add, 0 if delete
816 autoreply define nat64_add_del_interface {
824 /** \brief Dump interfaces with NAT64 feature
825 @param client_index - opaque cookie to identify the sender
826 @param context - sender context, to match reply w/ request
828 define nat64_interface_dump {
833 /** \brief NAT64 interface details response
834 @param context - sender context, to match reply w/ request
835 @param is_inside - 1 if inside, 0 if outside
836 @param sw_if_index - index of the interface
838 define nat64_interface_details {
844 /** \brief Add/delete NAT64 static BIB entry
845 @param client_index - opaque cookie to identify the sender
846 @param context - sender context, to match reply w/ request
847 @param i_addr - inside IPv6 address
848 @param o_addr - outside IPv4 address
849 @param i_port - inside port number
850 @param o_port - outside port number
851 @param vrf_id - VRF id of tenant
852 @param proto - protocol number
853 @param is_add - 1 if add, 0 if delete
855 autoreply define nat64_add_del_static_bib {
867 /** \brief Dump NAT64 BIB
868 @param client_index - opaque cookie to identify the sender
869 @param context - sender context, to match reply w/ request
870 @param proto - protocol of the BIB: 255 - all BIBs
874 otherwise - "unknown" protocol BIB
876 define nat64_bib_dump {
882 /** \brief NAT64 BIB details response
883 @param context - sender context, to match reply w/ request
884 @param i_addr - inside IPv6 address
885 @param o_addr - outside IPv4 address
886 @param i_port - inside port number
887 @param o_port - outside port number
888 @param vrf_id - VRF id of tenant
889 @param proto - protocol number
890 @param is_static - 1 if static BIB entry, 0 if dynamic
891 @param ses_num - number of sessions associated with the BIB entry
893 define nat64_bib_details {
905 /** \brief Set values of timeouts for NAT64 (seconds, 0 = default)
906 @param client_index - opaque cookie to identify the sender
907 @param context - sender context, to match reply w/ request
908 @param udp - UDP timeout (default 300sec)
909 @param icmp - ICMP timeout (default 60sec)
910 @param tcp_trans - TCP transitory timeout (default 240sec)
911 @param tcp_est - TCP established timeout (default 7440sec)
912 @param tcp_incoming_syn - TCP incoming SYN timeout (default 6sec)
914 autoreply define nat64_set_timeouts {
921 u32 tcp_incoming_syn;
924 /** \brief Get values of timeouts for NAT64 (seconds)
925 @param client_index - opaque cookie to identify the sender
926 @param context - sender context, to match reply w/ request
928 define nat64_get_timeouts {
933 /** \brief Get values of timeouts for NAT64 reply
934 @param context - sender context, to match reply w/ request
935 @param retval - return code
936 @param udp - UDP timeout
937 @param icmp - ICMP timeout
938 @param tcp_trans - TCP transitory timeout
939 @param tcp_est - TCP established timeout
940 @param tcp_incoming_syn - TCP incoming SYN timeout
942 define nat64_get_timeouts_reply {
949 u32 tcp_incoming_syn;
952 /** \brief Dump NAT64 session table
953 @param client_index - opaque cookie to identify the sender
954 @param context - sender context, to match reply w/ request
955 @param proto - protocol of the session table: 255 - all STs
959 otherwise - "unknown" proto ST
961 define nat64_st_dump {
967 /** \brief NAT64 session table details response
968 @param context - sender context, to match reply w/ request
969 @param il_addr - inside IPv6 address of the local host
970 @param ol_addr - outside IPv4 address of the local host
971 @param il_port - inside port number id of the local host/inside ICMP id
972 @param ol_port - outside port number of the local host/outside ICMP id
973 @param il_addr - inside IPv6 address of the remote host
974 @param ol_addr - outside IPv4 address of the remote host
975 @param l_port - port number of the remote host (not used for ICMP)
976 @param vrf_id - VRF id of tenant
977 @param proto - protocol number
979 define nat64_st_details {
992 /** \brief Add/del NAT64 prefix
993 @param client_index - opaque cookie to identify the sender
994 @param context - sender context, to match reply w/ request
995 @param prefix - NAT64 prefix
996 @param prefix - NAT64 prefix length
997 @param vrf_id - VRF id of tenant
998 @param is_add - 1 if add, 0 if delete
1000 autoreply define nat64_add_del_prefix {
1009 /** \brief Dump NAT64 prefix
1010 @param client_index - opaque cookie to identify the sender
1011 @param context - sender context, to match reply w/ request
1013 define nat64_prefix_dump {
1018 /** \brief Dump NAT64 prefix details response
1019 @param context - sender context, to match reply w/ request
1020 @param prefix - NAT64 prefix
1021 @param prefix - NAT64 prefix length
1022 @param vrf_id - VRF id of tenant
1024 define nat64_prefix_details {
1031 /** \brief Add/delete NAT64 pool address from specific interfce
1032 @param client_index - opaque cookie to identify the sender
1033 @param context - sender context, to match reply w/ request
1034 @param is_add - 1 if add, 0 if delete
1035 @param sw_if_index - software index of the interface
1037 autoreply define nat64_add_del_interface_addr {
1050 /** \brief Add/delete address range to DS-Lite pool
1051 @param client_index - opaque cookie to identify the sender
1052 @param context - sender context, to match reply w/ request
1053 @param start_addr - start address of the range
1054 @param end_addr - end address of the range
1055 @param is_add - 1 if add, 0 if delete
1057 autoreply define dslite_add_del_pool_addr_range {
1065 autoreply define dslite_set_aftr_addr {