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 identity mapping
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 addr_only - 1 if address only mapping
401 @param ip_address - IPv4 address
402 @param protocol - IP protocol
403 @param port - port number
404 @param sw_if_index - interface (if set ip_address is ignored, ~0 means not
406 @param vfr_id - VRF ID (if ~0 use default VRF)
408 autoreply define nat44_add_del_identity_mapping {
420 /** \brief Dump NAT44 identity mappings
421 @param client_index - opaque cookie to identify the sender
422 @param context - sender context, to match reply w/ request
424 define nat44_identity_mapping_dump {
429 /** \brief NAT44 identity mapping details response
430 @param context - sender context, to match reply w/ request
431 @param addr_only - 1 if address only mapping
432 @param ip_address - IPv4 address
433 @param protocol - IP protocol
434 @param port - port number
435 @param sw_if_index - interface
436 @param vfr_id - VRF ID
438 define nat44_identity_mapping_details {
448 /** \brief Add/delete NAT44 pool address from specific interfce
449 @param client_index - opaque cookie to identify the sender
450 @param context - sender context, to match reply w/ request
451 @param is_add - 1 if add, 0 if delete
452 @param sw_if_index - software index of the interface
454 autoreply define nat44_add_del_interface_addr {
462 /** \brief Dump NAT44 pool addresses interfaces
463 @param client_index - opaque cookie to identify the sender
464 @param context - sender context, to match reply w/ request
466 define nat44_interface_addr_dump {
471 /** \brief NAT44 pool addresses interfaces details response
472 @param context - sender context, to match reply w/ request
473 @param sw_if_index - software index of the interface
475 define nat44_interface_addr_details {
480 /** \brief Dump NAT44 users
481 @param client_index - opaque cookie to identify the sender
482 @param context - sender context, to match reply w/ request
484 define nat44_user_dump {
489 /** \brief NAT44 users response
490 @param context - sender context, to match reply w/ request
492 @param ip_adress - IPv4 address
493 @param nsessions - number of dynamic sessions
494 @param nstaticsessions - number of static sessions
496 define nat44_user_details {
504 /** \brief NAT44 user's sessions
505 @param client_index - opaque cookie to identify the sender
506 @param context - sender context, to match reply w/ request
507 @param is_ip4 - 1 if address type is IPv4
508 @param user_ip - IP address of the user to dump
509 @param vrf_id - VRF_ID
511 define nat44_user_session_dump {
518 /** \brief NAT44 user's sessions response
519 @param context - sender context, to match reply w/ request
520 @param outside_ip_address - outside IPv4 address
521 @param outside_port - outside port
522 @param inside_ip_address - inside IPv4 address
523 @param inside_port - inside port
524 @param protocol - protocol
525 @param is_static - 1 if session is static
526 @param last_heard - last heard timer
527 @param total_bytes - count of bytes sent through session
528 @param total_pkts - count of pakets sent through session
530 define nat44_user_session_details {
532 u8 outside_ip_address[4];
534 u8 inside_ip_address[4];
543 typeonly manual_endian define nat44_lb_addr_port {
549 autoreply manual_endian define nat44_add_del_lb_static_mapping {
558 vl_api_nat44_lb_addr_port_t locals[local_num];
561 define nat44_lb_static_mapping_dump {
566 manual_endian define nat44_lb_static_mapping_details {
573 vl_api_nat44_lb_addr_port_t locals[local_num];
576 /** \brief Delete NAT44 session
577 @param client_index - opaque cookie to identify the sender
578 @param context - sender context, to match reply w/ request
579 @param is_in - 1 if inside network addres and port pari, 0 if outside
580 @param ip_address - IPv4 address
581 @param protocol - IP protocol
582 @param port - port number
583 @param vfr_id - VRF ID
585 autoreply define nat44_del_session {
597 * Deterministic NAT (CGN) APIs
600 /** \brief Add/delete NAT deterministic mapping
601 @param client_index - opaque cookie to identify the sender
602 @param context - sender context, to match reply w/ request
603 @param is_add - 1 if add, 0 if delete
604 @param is_nat44 - 1 if NAT44
605 @param in_addr - inside IP address
606 @param in_plen - inside IP address prefix length
607 @param out_addr - outside IPv4 address
608 @param out_addr - outside IPv4 address prefix length
610 autoreply define nat_det_add_del_map {
622 /** \brief Get outside address and port range from inside address
623 @param client_index - opaque cookie to identify the sender
624 @param context - sender context, to match reply w/ request
625 @param is_nat44 - 1 if NAT44
626 @param in_addr - inside IP address
628 define nat_det_forward {
635 /** \brief Get outside address and port range from inside address
636 @param context - sender context, to match reply w/ request
637 @param retval - return code
638 @param out_port_lo - outside port range start
639 @param out_port_hi - outside port range end
640 @param out_addr - outside IPv4 address
642 define nat_det_forward_reply {
650 /** \brief Get inside address from outside address and port
651 @param client_index - opaque cookie to identify the sender
652 @param context - sender context, to match reply w/ request
653 @param out_port - outside port
654 @param out_addr - outside IPv4 address
656 define nat_det_reverse {
663 /** \brief Get inside address from outside address and port reply
664 @param context - sender context, to match reply w/ request
665 @param retval - return code
666 @param is_nat44 - 1 if NAT44
667 @param in_addr - inside IP address
669 define nat_det_reverse_reply {
676 /** \brief Dump NAT deterministic mappings
677 @param client_index - opaque cookie to identify the sender
678 @param context - sender context, to match reply w/ request
680 define nat_det_map_dump {
685 /** \brief NAT users response
686 @param context - sender context, to match reply w/ request
687 @param is_nat44 - 1 if NAT44
688 @param in_addr - inside IP address
689 @param in_plen - inside IP address prefix length
690 @param out_addr - outside IPv4 address
691 @param out_plen - outside IPv4 address prefix length
692 @param sharing_ratio - outside to inside address sharing ratio
693 @param ports_per_host - number of ports available to a host
694 @param ses_num - number of sessions belonging to this mapping
696 define nat_det_map_details {
708 /** \brief Set values of timeouts for deterministic NAT (seconds, 0 = default)
709 @param client_index - opaque cookie to identify the sender
710 @param context - sender context, to match reply w/ request
711 @param udp - UDP timeout (default 300sec)
712 @param tcp_established - TCP established timeout (default 7440sec)
713 @param tcp_transitory - TCP transitory timeout (default 240sec)
714 @param icmp - ICMP timeout (default 60sec)
716 autoreply define nat_det_set_timeouts {
725 /** \brief Get values of timeouts for deterministic NAT (seconds)
726 @param client_index - opaque cookie to identify the sender
727 @param context - sender context, to match reply w/ request
729 define nat_det_get_timeouts {
734 /** \brief Get values of timeouts for deterministic NAT reply
735 @param context - sender context, to match reply w/ request
736 @param retval - return code
737 @param udp - UDP timeout (default 300sec)
738 @param tcp_established - TCP established timeout (default 7440sec)
739 @param tcp_transitory - TCP transitory timeout (default 240sec)
740 @param icmp - ICMP timeout (default 60sec)
742 define nat_det_get_timeouts_reply {
751 /** \brief Close deterministic NAT session by outside address and port
752 @param client_index - opaque cookie to identify the sender
753 @param context - sender context, to match reply w/ request
754 @param out_addr - outside IPv4 address
755 @param out_port - outside port
756 @param ext_addr - external host IPv4 address
757 @param ext_port - external host port
759 autoreply define nat_det_close_session_out {
768 /** \brief Close deterministic NAT session by inside address and port
769 @param client_index - opaque cookie to identify the sender
770 @param context - sender context, to match reply w/ request
771 @param is_nat44 - 1 if NAT44
772 @param in_addr - inside IP address
773 @param in_port - inside port
774 @param ext_addr - external host IP address
775 @param ext_port - external host port
777 autoreply define nat_det_close_session_in {
787 /** \brief Dump determinstic NAT sessions
788 @param client_index - opaque cookie to identify the sender
789 @param context - sender context, to match reply w/ request
790 @param is_nat44 - 1 if NAT44
791 @param user_addr - address of an inside user whose sessions to dump
793 define nat_det_session_dump {
800 /** \brief Deterministic NAT sessions reply
801 @param context - sender context, to match reply w/ request
802 @param in_port - inside port
803 @param ext_addr - external host address
804 @param ext_port - external host port
805 @param out_port - outside NAT port
806 @param state - session state
807 @param expire - session expiration timestamp
809 define nat_det_session_details {
824 /** \brief Add/delete address range to NAT64 pool
825 @param client_index - opaque cookie to identify the sender
826 @param context - sender context, to match reply w/ request
827 @param start_addr - start address of the range
828 @param end_addr - end address of the range
829 @param vrf_id - VRF id of tenant, ~0 means independent of VRF
830 @param is_add - 1 if add, 0 if delete
832 autoreply define nat64_add_del_pool_addr_range {
841 /** \brief Dump NAT64 pool addresses
842 @param client_index - opaque cookie to identify the sender
843 @param context - sender context, to match reply w/ request
845 define nat64_pool_addr_dump {
850 /** \brief NAT64 pool address details response
851 @param context - sender context, to match reply w/ request
852 @param address - IPv4 address
853 @param vfr_id - VRF id of tenant, ~0 means independent of VRF
855 define nat64_pool_addr_details {
861 /** \brief Enable/disable NAT64 feature on the interface
862 @param client_index - opaque cookie to identify the sender
863 @param context - sender context, to match reply w/ request
864 @param sw_if_index - index of the interface
865 @param is_inside - 1 if inside, 0 if outside
866 @param is_add - 1 if add, 0 if delete
868 autoreply define nat64_add_del_interface {
876 /** \brief Dump interfaces with NAT64 feature
877 @param client_index - opaque cookie to identify the sender
878 @param context - sender context, to match reply w/ request
880 define nat64_interface_dump {
885 /** \brief NAT64 interface details response
886 @param context - sender context, to match reply w/ request
887 @param is_inside - 1 if inside, 0 if outside
888 @param sw_if_index - index of the interface
890 define nat64_interface_details {
896 /** \brief Add/delete NAT64 static BIB entry
897 @param client_index - opaque cookie to identify the sender
898 @param context - sender context, to match reply w/ request
899 @param i_addr - inside IPv6 address
900 @param o_addr - outside IPv4 address
901 @param i_port - inside port number
902 @param o_port - outside port number
903 @param vrf_id - VRF id of tenant
904 @param proto - protocol number
905 @param is_add - 1 if add, 0 if delete
907 autoreply define nat64_add_del_static_bib {
919 /** \brief Dump NAT64 BIB
920 @param client_index - opaque cookie to identify the sender
921 @param context - sender context, to match reply w/ request
922 @param proto - protocol of the BIB: 255 - all BIBs
926 otherwise - "unknown" protocol BIB
928 define nat64_bib_dump {
934 /** \brief NAT64 BIB details response
935 @param context - sender context, to match reply w/ request
936 @param i_addr - inside IPv6 address
937 @param o_addr - outside IPv4 address
938 @param i_port - inside port number
939 @param o_port - outside port number
940 @param vrf_id - VRF id of tenant
941 @param proto - protocol number
942 @param is_static - 1 if static BIB entry, 0 if dynamic
943 @param ses_num - number of sessions associated with the BIB entry
945 define nat64_bib_details {
957 /** \brief Set values of timeouts for NAT64 (seconds, 0 = default)
958 @param client_index - opaque cookie to identify the sender
959 @param context - sender context, to match reply w/ request
960 @param udp - UDP timeout (default 300sec)
961 @param icmp - ICMP timeout (default 60sec)
962 @param tcp_trans - TCP transitory timeout (default 240sec)
963 @param tcp_est - TCP established timeout (default 7440sec)
964 @param tcp_incoming_syn - TCP incoming SYN timeout (default 6sec)
966 autoreply define nat64_set_timeouts {
973 u32 tcp_incoming_syn;
976 /** \brief Get values of timeouts for NAT64 (seconds)
977 @param client_index - opaque cookie to identify the sender
978 @param context - sender context, to match reply w/ request
980 define nat64_get_timeouts {
985 /** \brief Get values of timeouts for NAT64 reply
986 @param context - sender context, to match reply w/ request
987 @param retval - return code
988 @param udp - UDP timeout
989 @param icmp - ICMP timeout
990 @param tcp_trans - TCP transitory timeout
991 @param tcp_est - TCP established timeout
992 @param tcp_incoming_syn - TCP incoming SYN timeout
994 define nat64_get_timeouts_reply {
1001 u32 tcp_incoming_syn;
1004 /** \brief Dump NAT64 session table
1005 @param client_index - opaque cookie to identify the sender
1006 @param context - sender context, to match reply w/ request
1007 @param proto - protocol of the session table: 255 - all STs
1011 otherwise - "unknown" proto ST
1013 define nat64_st_dump {
1019 /** \brief NAT64 session table details response
1020 @param context - sender context, to match reply w/ request
1021 @param il_addr - inside IPv6 address of the local host
1022 @param ol_addr - outside IPv4 address of the local host
1023 @param il_port - inside port number id of the local host/inside ICMP id
1024 @param ol_port - outside port number of the local host/outside ICMP id
1025 @param il_addr - inside IPv6 address of the remote host
1026 @param ol_addr - outside IPv4 address of the remote host
1027 @param l_port - port number of the remote host (not used for ICMP)
1028 @param vrf_id - VRF id of tenant
1029 @param proto - protocol number
1031 define nat64_st_details {
1044 /** \brief Add/del NAT64 prefix
1045 @param client_index - opaque cookie to identify the sender
1046 @param context - sender context, to match reply w/ request
1047 @param prefix - NAT64 prefix
1048 @param prefix - NAT64 prefix length
1049 @param vrf_id - VRF id of tenant
1050 @param is_add - 1 if add, 0 if delete
1052 autoreply define nat64_add_del_prefix {
1061 /** \brief Dump NAT64 prefix
1062 @param client_index - opaque cookie to identify the sender
1063 @param context - sender context, to match reply w/ request
1065 define nat64_prefix_dump {
1070 /** \brief Dump NAT64 prefix details response
1071 @param context - sender context, to match reply w/ request
1072 @param prefix - NAT64 prefix
1073 @param prefix - NAT64 prefix length
1074 @param vrf_id - VRF id of tenant
1076 define nat64_prefix_details {
1083 /** \brief Add/delete NAT64 pool address from specific interfce
1084 @param client_index - opaque cookie to identify the sender
1085 @param context - sender context, to match reply w/ request
1086 @param is_add - 1 if add, 0 if delete
1087 @param sw_if_index - software index of the interface
1089 autoreply define nat64_add_del_interface_addr {
1102 /** \brief Add/delete address range to DS-Lite pool
1103 @param client_index - opaque cookie to identify the sender
1104 @param context - sender context, to match reply w/ request
1105 @param start_addr - start address of the range
1106 @param end_addr - end address of the range
1107 @param is_add - 1 if add, 0 if delete
1109 autoreply define dslite_add_del_pool_addr_range {
1117 autoreply define dslite_set_aftr_addr {