FD.io VPP  v18.10-34-gcce845e
Vector Packet Processing
nat.api
Go to the documentation of this file.
1 /*
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:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
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.
14  */
15 
16 option version = "4.0.0";
17 
18 /**
19  * @file nat.api
20  * @brief VPP control-plane API messages.
21  *
22  * This file defines VPP control-plane API messages which are generally
23  * called through a shared memory interface.
24  */
25 
26 /*
27  * Common NAT plugin APIs
28  */
29 
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
33 */
34 define nat_control_ping
35 {
38 };
39 
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
45 */
46 define nat_control_ping_reply
47 {
52 };
53 
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
57 */
58 define nat_show_config
59 {
62 };
63 
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 endpoint_dependent - if 1 endpoint-dependent mode
71  @param out2in_dpo - if 1 out2in dpo mode
72  @param translation_buckets - number of translation hash buckets
73  @param translation_memory_size - translation hash memory size
74  @param user_buckets - number of user hash buckets
75  @param user_memory_size - user hash memory size
76  @param max_translations_per_user - maximum number of translations per user
77  @param outside_vrf_id - outside VRF id
78  @param inside_vrf_id - default inside VRF id
79  @param dslite_ce - if DS-Lite is CE/B4 element, if 0 AFTR elemet
80  @param nat64_bib_buckets - number of NAT64 BIB hash buckets
81  @param nat64_bib_memory_size - memory size of NAT64 BIB hash
82  @param nat64_st_buckets - number of NAT64 session table hash buckets
83  @param nat64_st_memory_size - memory size of NAT64 session table hash
84 */
85 define nat_show_config_reply
86 {
106 };
107 
108 /** \brief Set NAT workers
109  @param client_index - opaque cookie to identify the sender
110  @param context - sender context, to match reply w/ request
111  @param worker_mask - NAT workers mask
112 */
113 autoreply define nat_set_workers {
117 };
118 
119 /** \brief Dump NAT workers
120  @param client_index - opaque cookie to identify the sender
121  @param context - sender context, to match reply w/ request
122 */
123 define nat_worker_dump {
126 };
127 
128 /** \brief NAT workers details response
129  @param context - sender context, to match reply w/ request
130  @param worker_index - worker index
131  @param lcore_id - lcore ID
132  @param name - worker name
133 */
134 define nat_worker_details {
138  u8 name[64];
139 };
140 
141 /** \brief Enable/disable NAT IPFIX logging
142  @param client_index - opaque cookie to identify the sender
143  @param context - sender context, to match reply w/ request
144  @param domain_id - observation domain ID
145  @param src_port - source port number
146  @param enable - 1 if enable, 0 if disable
147 */
148 autoreply define nat_ipfix_enable_disable {
154 };
155 
156 /** \brief Set NAT virtual fragmentation reassembly
157  @param client_index - opaque cookie to identify the sender
158  @param context - sender context, to match reply w/ request
159  @param timeout - reassembly timeout
160  @param max_reass - maximum number of concurrent reassemblies
161  @param max_frag - maximum number of fragmets per reassembly
162  @param drop_frag - if 0 translate fragments, otherwise drop fragments
163  @param is_ip6 - 1 if IPv6, 0 if IPv4
164 */
165 autoreply define nat_set_reass {
173 };
174 
175 /** \brief Get NAT virtual fragmentation reassembly configuration
176  @param client_index - opaque cookie to identify the sender
177  @param context - sender context, to match reply w/ request
178 */
179 define nat_get_reass {
182 };
183 
184 /** \brief Get NAT virtual fragmentation reassembly configuration reply
185  @param context - sender context, to match reply w/ request
186  @param retval - return code
187  @param ip4_timeout - reassembly timeout
188  @param ip4_max_reass - maximum number of concurrent reassemblies
189  @param ip4_max_frag - maximum number of fragmets per reassembly
190  @param ip4_drop_frag - if 0 translate fragments, otherwise drop fragments
191  @param ip6_timeout - reassembly timeout
192  @param ip6_max_reass - maximum number of concurrent reassemblies
193  @param ip6_max_frag - maximum number of fragmets per reassembly
194  @param ip6_drop_frag - if 0 translate fragments, otherwise drop fragments
195 */
196 define nat_get_reass_reply {
207 };
208 
209 /** \brief Dump NAT virtual fragmentation reassemblies
210  @param client_index - opaque cookie to identify the sender
211  @param context - sender context, to match reply w/ request
212 */
213 define nat_reass_dump {
216 };
217 
218 /** \brief NAT virtual fragmentation reassemblies response
219  @param context - sender context, to match reply w/ request
220  @param is_ip4 - 1 if address type is IPv4
221  @param src_addr - source IP address
222  @param dst_addr - destination IP address
223  @param frag_id - fragment ID
224  @param proto - protocol
225  @param frag_n - number of cached fragments
226 */
227 define nat_reass_details {
230  u8 src_addr[16];
231  u8 dst_addr[16];
235 };
236 
237 /** \brief Set values of timeouts for NAT sessions (seconds)
238  @param client_index - opaque cookie to identify the sender
239  @param context - sender context, to match reply w/ request
240  @param udp - UDP timeout (default 300sec)
241  @param tcp_established - TCP established timeout (default 7440sec)
242  @param tcp_transitory - TCP transitory timeout (default 240sec)
243  @param icmp - ICMP timeout (default 60sec)
244 */
245 autoreply define nat_set_timeouts {
252 };
253 
254 /** \brief Get values of timeouts for NAT sessions (seconds)
255  @param client_index - opaque cookie to identify the sender
256  @param context - sender context, to match reply w/ request
257 */
258 define nat_get_timeouts {
261 };
262 
263 /** \brief Get values of timeouts for NAT sessions reply
264  @param context - sender context, to match reply w/ request
265  @param retval - return code
266  @param udp - UDP timeout
267  @param tcp_established - TCP established timeout
268  @param tcp_transitory - TCP transitory timeout
269  @param icmp - ICMP timeout
270 */
271 define nat_get_timeouts_reply {
278 };
279 
280 /** \brief Set address and port assignment algorithm
281  @param client_index - opaque cookie to identify the sender
282  @param context - sender context, to match reply w/ request
283  @param alg - address and port assignment algorithm:
284  0 - default, 1 - MAP-E, 2 - port range
285  (see nat_addr_and_port_alloc_alg_t in nat.h)
286  @param psid_offset - number of offset bits (valid only for MAP-E alg)
287  @param psid_length - length of PSID (valid only for MAP-E alg)
288  @param psid - Port Set Identifier (PSID) value (valid only for MAP-E alg)
289  @param start_port - beginning of the port range
290  @param end_port - end of the port range
291 */
292 autoreply define nat_set_addr_and_port_alloc_alg {
301 };
302 
303 /** \brief Get address and port assignment algorithm
304  @param client_index - opaque cookie to identify the sender
305  @param context - sender context, to match reply w/ request
306 */
307 define nat_get_addr_and_port_alloc_alg {
310 };
311 
312 /** \brief Get address and port assignment algorithm reply
313  @param context - sender context, to match reply w/ request
314  @param retval - return code
315  @param alg - address and port assignment algorithm:
316  0 - default, 1 - MAP-E, 2 - port range
317  (see nat_addr_and_port_alloc_alg_t in nat.h)
318  @param psid_offset - number of offset bits (valid only for MAP-E alg)
319  @param psid_length - length of PSID (valid only for MAP-E alg)
320  @param psid - Port Set Identifier (PSID) value (valid only for MAP-E alg)
321  @param start_port - beginning of the port range
322  @param end_port - end of the port range
323 */
324 define nat_get_addr_and_port_alloc_alg_reply {
333 };
334 
335 /** \brief Set TCP MSS rewriting configuration
336  @param client_index - opaque cookie to identify the sender
337  @param context - sender context, to match reply w/ request
338  @param mss_value - MSS value to be used for MSS rewriting
339  @param enable - disable(0)/enable(1) MSS rewriting feature
340 */
341 autoreply define nat_set_mss_clamping {
346 };
347 
348 /** \brief Get TCP MSS rewriting configuration
349  @param client_index - opaque cookie to identify the sender
350  @param context - sender context, to match reply w/ request
351 */
352 define nat_get_mss_clamping {
355 };
356 
357 /** \brief Get TCP MSS rewriting configuration reply
358  @param context - sender context, to match reply w/ request
359  @param retval - return code
360  @param mss_value - MSS value to be used for MSS rewriting
361  @param enable - disable(0)/enable(1) MSS rewriting feature
362 */
363 define nat_get_mss_clamping_reply {
368 };
369 
370 /*
371  * NAT44 APIs
372  */
373 
374 /** \brief Add/del NAT44 address range
375  @param client_index - opaque cookie to identify the sender
376  @param context - sender context, to match reply w/ request
377  @param first_ip_address - first IPv4 address
378  @param last_ip_address - last IPv4 address
379  @param vrf_id - VRF id of tenant, ~0 means independent of VRF
380  @param twice_nat - twice NAT address range for extenal hosts
381  @param is_add - 1 if add, 0 if delete
382 */
383 autoreply define nat44_add_del_address_range {
386  u8 first_ip_address[4];
387  u8 last_ip_address[4];
391 };
392 
393 /** \brief Dump NAT44 addresses
394  @param client_index - opaque cookie to identify the sender
395  @param context - sender context, to match reply w/ request
396 */
397 define nat44_address_dump {
400 };
401 
402 /** \brief NAT44 address details response
403  @param context - sender context, to match reply w/ request
404  @param ip_address - IPv4 address
405  @param twice_nat - twice NAT address range for extenal hosts
406  @param vrf_id - VRF id of tenant, ~0 means independent of VRF
407 */
408 define nat44_address_details {
410  u8 ip_address[4];
413 };
414 
415 /** \brief Enable/disable NAT44 feature on the interface
416  @param client_index - opaque cookie to identify the sender
417  @param context - sender context, to match reply w/ request
418  @param is_add - 1 if add, 0 if delete
419  @param is_inside - 1 if inside, 0 if outside
420  @param sw_if_index - software index of the interface
421 */
422 autoreply define nat44_interface_add_del_feature {
428 };
429 
430 /** \brief Dump interfaces with NAT44 feature
431  @param client_index - opaque cookie to identify the sender
432  @param context - sender context, to match reply w/ request
433 */
434 define nat44_interface_dump {
437 };
438 
439 /** \brief NAT44 interface details response
440  @param context - sender context, to match reply w/ request
441  @param is_inside - 1 if inside, 0 if outside, 2 if inside and outside
442  @param sw_if_index - software index of the interface
443 */
444 define nat44_interface_details {
448 };
449 
450 /** \brief Enable/disbale NAT44 as an interface output feature (postrouting
451  in2out translation)
452  @param client_index - opaque cookie to identify the sender
453  @param context - sender context, to match reply w/ request
454  @param is_add - 1 if add, 0 if delete
455  @param is_inside - 1 if inside, 0 if outside
456  @param sw_if_index - software index of the interface
457 */
458 autoreply define nat44_interface_add_del_output_feature {
464 };
465 
466 /** \brief Dump interfaces with NAT44 output feature
467  @param client_index - opaque cookie to identify the sender
468  @param context - sender context, to match reply w/ request
469 */
470 define nat44_interface_output_feature_dump {
473 };
474 
475 /** \brief NAT44 interface with output feature details response
476  @param context - sender context, to match reply w/ request
477  @param is_inside - 1 if inside, 0 if outside
478  @param sw_if_index - software index of the interface
479 */
480 define nat44_interface_output_feature_details {
484 };
485 
486 /** \brief Add/delete NAT44 static mapping
487  @param client_index - opaque cookie to identify the sender
488  @param context - sender context, to match reply w/ request
489  @param is_add - 1 if add, 0 if delete
490  @param addr_only - 1 if address only mapping
491  @param local_ip_address - local IPv4 address
492  @param external_ip_address - external IPv4 address
493  @param protocol - IP protocol, used only if addr_only=0
494  @param local_port - local port number, used only if addr_only=0
495  @param external_port - external port number, used only if addr_only=0
496  @param external_sw_if_index - external interface (if set
497  external_ip_address is ignored, ~0 means not
498  used)
499  @param vfr_id - VRF ID
500  @param twice_nat - if 1 translate external host address and port, only for
501  1:1 NAPT (addr_only must be 0)
502  @param self_twice_nat - if 1 translate external host address and port
503  whenever external host address equals
504  local address of internal host
505  @param out2in_only - if 1 rule match only out2in direction
506  @param tag - opaque string tag
507 */
508 autoreply define nat44_add_del_static_mapping {
513  u8 local_ip_address[4];
514  u8 external_ip_address[4];
523  u8 tag[64];
524 };
525 
526 /** \brief Dump NAT44 static mappings
527  @param client_index - opaque cookie to identify the sender
528  @param context - sender context, to match reply w/ request
529 */
530 define nat44_static_mapping_dump {
533 };
534 
535 /** \brief NAT44 static mapping details response
536  @param context - sender context, to match reply w/ request
537  @param addr_only - 1 if address only mapping
538  @param local_ip_address - local IPv4 address
539  @param external_ip_address - external IPv4 address
540  @param protocol - IP protocol, valid only if addr_only=0
541  @param local_port - local port number, valid only if addr_only=0
542  @param external_port - external port number, valid only if addr_only=0
543  @param external_sw_if_index - external interface
544  @param vfr_id - VRF ID
545  @param twice_nat - if 1 translate external host address and port
546  @param self_twice_nat - if 1 translate external host address and port
547  whenever external host address equals
548  local address of internal host
549  @param out2in_only - if 1 rule match only out2in direction
550  @param tag - opaque string tag
551 */
552 define nat44_static_mapping_details {
555  u8 local_ip_address[4];
556  u8 external_ip_address[4];
565  u8 tag[64];
566 };
567 
568 /** \brief Add/delete NAT44 identity mapping
569  @param client_index - opaque cookie to identify the sender
570  @param context - sender context, to match reply w/ request
571  @param is_add - 1 if add, 0 if delete
572  @param addr_only - 1 if address only mapping
573  @param ip_address - IPv4 address
574  @param protocol - IP protocol
575  @param port - port number
576  @param sw_if_index - interface (if set ip_address is ignored, ~0 means not
577  used)
578  @param vfr_id - VRF ID (if ~0 use default VRF)
579  @param tag - opaque string tag
580 */
581 autoreply define nat44_add_del_identity_mapping {
586  u8 ip_address[4];
591  u8 tag[64];
592 };
593 
594 /** \brief Dump NAT44 identity mappings
595  @param client_index - opaque cookie to identify the sender
596  @param context - sender context, to match reply w/ request
597 */
598 define nat44_identity_mapping_dump {
601 };
602 
603 /** \brief NAT44 identity mapping details response
604  @param context - sender context, to match reply w/ request
605  @param addr_only - 1 if address only mapping
606  @param ip_address - IPv4 address
607  @param protocol - IP protocol
608  @param port - port number
609  @param sw_if_index - interface
610  @param vfr_id - VRF ID
611  @param tag - opaque string tag
612 */
613 define nat44_identity_mapping_details {
616  u8 ip_address[4];
621  u8 tag[64];
622 };
623 
624 /** \brief Add/delete NAT44 pool address from specific interfce
625  @param client_index - opaque cookie to identify the sender
626  @param context - sender context, to match reply w/ request
627  @param is_add - 1 if add, 0 if delete
628  @param twice_nat - twice NAT address for extenal hosts
629  @param sw_if_index - software index of the interface
630 */
631 autoreply define nat44_add_del_interface_addr {
637 };
638 
639 /** \brief Dump NAT44 pool addresses interfaces
640  @param client_index - opaque cookie to identify the sender
641  @param context - sender context, to match reply w/ request
642 */
643 define nat44_interface_addr_dump {
646 };
647 
648 /** \brief NAT44 pool addresses interfaces details response
649  @param context - sender context, to match reply w/ request
650  @param sw_if_index - software index of the interface
651  @param twice_nat - twice NAT address for extenal hosts
652 */
653 define nat44_interface_addr_details {
657 };
658 
659 /** \brief Dump NAT44 users
660  @param client_index - opaque cookie to identify the sender
661  @param context - sender context, to match reply w/ request
662 */
663 define nat44_user_dump {
666 };
667 
668 /** \brief NAT44 users response
669  @param context - sender context, to match reply w/ request
670  @vrf_id - VRF ID
671  @param ip_adress - IPv4 address
672  @param nsessions - number of dynamic sessions
673  @param nstaticsessions - number of static sessions
674 */
675 define nat44_user_details {
678  u8 ip_address[4];
681 };
682 
683 /** \brief NAT44 user's sessions
684  @param client_index - opaque cookie to identify the sender
685  @param context - sender context, to match reply w/ request
686  @param is_ip4 - 1 if address type is IPv4
687  @param user_ip - IP address of the user to dump
688  @param vrf_id - VRF_ID
689 */
690 define nat44_user_session_dump {
693  u8 ip_address[4];
695 };
696 
697 /** \brief NAT44 user's sessions response
698  @param context - sender context, to match reply w/ request
699  @param outside_ip_address - outside IPv4 address
700  @param outside_port - outside port
701  @param inside_ip_address - inside IPv4 address
702  @param inside_port - inside port
703  @param protocol - protocol
704  @param is_static - 1 if session is static
705  @param last_heard - last heard timer
706  @param total_bytes - count of bytes sent through session
707  @param total_pkts - count of pakets sent through session
708  @param is_twicenat - 1 if session is twice-nat
709  @param ext_host_valid - 1 if external host address and port are valid
710  @param ext_host_address - external host IPv4 address
711  @param ext_host_port - external host port
712  @param ext_host_nat_address - post-NAT external host IPv4 address (valid
713  only if twice-nat session)
714  @param ext_host_nat_port - post-NAT external host port (valid only if
715  twice-nat session)
716 */
717 define nat44_user_session_details {
719  u8 outside_ip_address[4];
721  u8 inside_ip_address[4];
730  u8 ext_host_address[4];
732  u8 ext_host_nat_address[4];
734 };
735 
736 /** \brief NAT44 load-balancing address and port pair
737  @param addr - IPv4 address of the internal node
738  @param port - L4 port number of the internal node
739  @param probability - probability of the internal node to be randomly matched
740 */
741 typeonly manual_endian define nat44_lb_addr_port {
742  u8 addr[4];
746 };
747 
748 /** \brief Add/delete NAT44 load-balancing static mapping rule
749  @param client_index - opaque cookie to identify the sender
750  @param context - sender context, to match reply w/ request
751  @param is_add - 1 if add, 0 if delete
752  @param external_addr - external IPv4 address of the service
753  @param external_port - external L4 port number of the service
754  @param protocol - IP protocol number of the service
755  @param twice_nat - if 1 translate external host address and port
756  @param self_twice_nat - if 1 translate external host address and port
757  whenever external host address equals
758  local address of internal host
759  @param out2in_only - if 1 rule match only out2in direction
760  @param tag - opaque string tag
761  @param affinity - if 0 disabled, otherwise client IP affinity sticky time
762  in seconds
763  @param local_num - number of local network nodes
764  @param locals - local network nodes
765 */
766 autoreply manual_endian define nat44_add_del_lb_static_mapping {
770  u8 external_addr[4];
776  u8 tag[64];
779  vl_api_nat44_lb_addr_port_t locals[local_num];
780 };
781 
782 /** \brief Dump NAT44 load-balancing static mapping rules
783  @param client_index - opaque cookie to identify the sender
784  @param context - sender context, to match reply w/ request
785 */
786 define nat44_lb_static_mapping_dump {
789 };
790 
791 /** \brief NAT44 load-balancing static mapping rule details response
792  @param context - sender context, to match reply w/ request
793  @param is_add - 1 if add, 0 if delete
794  @param external_addr - external IPv4 address of the service
795  @param external_port - external L4 port number of the service
796  @param protocol - IP protocol number of the service
797  @param twice_nat - if 1 translate external host address and port
798  @param self_twice_nat - if 1 translate external host address and port
799  whenever external host address equals
800  local address of internal host
801  @param out2in_only - if 1 rule match only out2in direction
802  @param tag - opaque string tag
803  @param affinity - if 0 disabled, otherwise client IP affinity sticky time
804  in seconds
805  @param local_num - number of local network nodes
806  @param locals - local network nodes
807 */
808 manual_endian define nat44_lb_static_mapping_details {
810  u8 external_addr[4];
816  u8 tag[64];
819  vl_api_nat44_lb_addr_port_t locals[local_num];
820 };
821 
822 /** \brief Delete NAT44 session
823  @param client_index - opaque cookie to identify the sender
824  @param context - sender context, to match reply w/ request
825  @param is_in - 1 if inside network addres and port pari, 0 if outside
826  @param ip_address - IPv4 address
827  @param protocol - IP protocol
828  @param port - port number
829  @param vfr_id - VRF ID
830  @param ext_host_valid - 1 if external host address and port are valid
831  @param ext_host_address - external host IPv4 address
832  @param ext_host_port - external host port
833 */
834 autoreply define nat44_del_session {
843  u8 ext_host_address[4];
845 };
846 
847 /** \brief Enable/disable forwarding for NAT44
848  Forward packets which don't match existing translation
849  or static mapping instead of dropping them.
850  @param client_index - opaque cookie to identify the sender
851  @param context - sender context, to match reply w/ request
852  @param enable - 0 for enable, 1 for disable
853 */
854 autoreply define nat44_forwarding_enable_disable {
858 };
859 
860 /** \brief Check if forwarding is enabled or disabled
861  @param client_index - opaque cookie to identify the sender
862  @param context - sender context, to match reply w/ request
863 */
864 define nat44_forwarding_is_enabled {
867 };
868 
869 /** \brief Response to check if forwarding is enabled or disabled
870  @param context - sender context, to match reply w/ request
871  @param enabled - 1 if enabled, 0 if disabled
872 */
873 define nat44_forwarding_is_enabled_reply {
876 };
877 
878 
879 /*
880  * Deterministic NAT (CGN) APIs
881  */
882 
883 /** \brief Add/delete NAT deterministic mapping
884  @param client_index - opaque cookie to identify the sender
885  @param context - sender context, to match reply w/ request
886  @param is_add - 1 if add, 0 if delete
887  @param is_nat44 - 1 if NAT44
888  @param in_addr - inside IP address
889  @param in_plen - inside IP address prefix length
890  @param out_addr - outside IPv4 address
891  @param out_addr - outside IPv4 address prefix length
892 */
893 autoreply define nat_det_add_del_map {
899  u8 in_addr[16];
901  u8 out_addr[4];
903 };
904 
905 /** \brief Get outside address and port range from inside address
906  @param client_index - opaque cookie to identify the sender
907  @param context - sender context, to match reply w/ request
908  @param is_nat44 - 1 if NAT44
909  @param in_addr - inside IP address
910 */
911 define nat_det_forward {
915  u8 in_addr[16];
916 };
917 
918 /** \brief Get outside address and port range from inside address
919  @param context - sender context, to match reply w/ request
920  @param retval - return code
921  @param out_port_lo - outside port range start
922  @param out_port_hi - outside port range end
923  @param out_addr - outside IPv4 address
924 */
925 define nat_det_forward_reply {
930  u8 out_addr[4];
931 };
932 
933 /** \brief Get inside address from outside address and port
934  @param client_index - opaque cookie to identify the sender
935  @param context - sender context, to match reply w/ request
936  @param out_port - outside port
937  @param out_addr - outside IPv4 address
938 */
939 define nat_det_reverse {
943  u8 out_addr[4];
944 };
945 
946 /** \brief Get inside address from outside address and port reply
947  @param context - sender context, to match reply w/ request
948  @param retval - return code
949  @param is_nat44 - 1 if NAT44
950  @param in_addr - inside IP address
951 */
952 define nat_det_reverse_reply {
956  u8 in_addr[16];
957 };
958 
959 /** \brief Dump NAT deterministic mappings
960  @param client_index - opaque cookie to identify the sender
961  @param context - sender context, to match reply w/ request
962 */
963 define nat_det_map_dump {
966 };
967 
968 /** \brief NAT users response
969  @param context - sender context, to match reply w/ request
970  @param is_nat44 - 1 if NAT44
971  @param in_addr - inside IP address
972  @param in_plen - inside IP address prefix length
973  @param out_addr - outside IPv4 address
974  @param out_plen - outside IPv4 address prefix length
975  @param sharing_ratio - outside to inside address sharing ratio
976  @param ports_per_host - number of ports available to a host
977  @param ses_num - number of sessions belonging to this mapping
978 */
979 define nat_det_map_details {
982  u8 in_addr[16];
984  u8 out_addr[4];
989 };
990 
991 /** \brief Close deterministic NAT session by outside address and port
992  @param client_index - opaque cookie to identify the sender
993  @param context - sender context, to match reply w/ request
994  @param out_addr - outside IPv4 address
995  @param out_port - outside port
996  @param ext_addr - external host IPv4 address
997  @param ext_port - external host port
998 */
999 autoreply define nat_det_close_session_out {
1002  u8 out_addr[4];
1004  u8 ext_addr[4];
1006 };
1007 
1008 /** \brief Close deterministic NAT session by inside address and port
1009  @param client_index - opaque cookie to identify the sender
1010  @param context - sender context, to match reply w/ request
1011  @param is_nat44 - 1 if NAT44
1012  @param in_addr - inside IP address
1013  @param in_port - inside port
1014  @param ext_addr - external host IP address
1015  @param ext_port - external host port
1016 */
1017 autoreply define nat_det_close_session_in {
1021  u8 in_addr[16];
1023  u8 ext_addr[16];
1025 };
1026 
1027 /** \brief Dump determinstic NAT sessions
1028  @param client_index - opaque cookie to identify the sender
1029  @param context - sender context, to match reply w/ request
1030  @param is_nat44 - 1 if NAT44
1031  @param user_addr - address of an inside user whose sessions to dump
1032 */
1033 define nat_det_session_dump {
1037  u8 user_addr[16];
1038 };
1039 
1040 /** \brief Deterministic NAT sessions reply
1041  @param context - sender context, to match reply w/ request
1042  @param in_port - inside port
1043  @param ext_addr - external host address
1044  @param ext_port - external host port
1045  @param out_port - outside NAT port
1046  @param state - session state
1047  @param expire - session expiration timestamp
1048 */
1049 define nat_det_session_details {
1052  u8 ext_addr[4];
1057 };
1058 
1059 /*
1060  * NAT64 APIs
1061  */
1062 
1063 /** \brief Add/delete address range to NAT64 pool
1064  @param client_index - opaque cookie to identify the sender
1065  @param context - sender context, to match reply w/ request
1066  @param start_addr - start address of the range
1067  @param end_addr - end address of the range
1068  @param vrf_id - VRF id of tenant, ~0 means independent of VRF
1069  @param is_add - 1 if add, 0 if delete
1070 */
1071 autoreply define nat64_add_del_pool_addr_range {
1074  u8 start_addr[4];
1075  u8 end_addr[4];
1078 };
1079 
1080 /** \brief Dump NAT64 pool addresses
1081  @param client_index - opaque cookie to identify the sender
1082  @param context - sender context, to match reply w/ request
1083 */
1084 define nat64_pool_addr_dump {
1087 };
1088 
1089 /** \brief NAT64 pool address details response
1090  @param context - sender context, to match reply w/ request
1091  @param address - IPv4 address
1092  @param vfr_id - VRF id of tenant, ~0 means independent of VRF
1093 */
1094 define nat64_pool_addr_details {
1098 };
1099 
1100 /** \brief Enable/disable NAT64 feature on the interface
1101  @param client_index - opaque cookie to identify the sender
1102  @param context - sender context, to match reply w/ request
1103  @param sw_if_index - index of the interface
1104  @param is_inside - 1 if inside, 0 if outside
1105  @param is_add - 1 if add, 0 if delete
1106 */
1107 autoreply define nat64_add_del_interface {
1113 };
1114 
1115 /** \brief Dump interfaces with NAT64 feature
1116  @param client_index - opaque cookie to identify the sender
1117  @param context - sender context, to match reply w/ request
1118 */
1119 define nat64_interface_dump {
1122 };
1123 
1124 /** \brief NAT64 interface details response
1125  @param context - sender context, to match reply w/ request
1126  @param is_inside - 1 if inside, 0 if outside
1127  @param sw_if_index - index of the interface
1128 */
1129 define nat64_interface_details {
1133 };
1134 
1135 /** \brief Add/delete NAT64 static BIB entry
1136  @param client_index - opaque cookie to identify the sender
1137  @param context - sender context, to match reply w/ request
1138  @param i_addr - inside IPv6 address
1139  @param o_addr - outside IPv4 address
1140  @param i_port - inside port number
1141  @param o_port - outside port number
1142  @param vrf_id - VRF id of tenant
1143  @param proto - protocol number
1144  @param is_add - 1 if add, 0 if delete
1145 */
1146  autoreply define nat64_add_del_static_bib {
1149  u8 i_addr[16];
1150  u8 o_addr[4];
1156 };
1157 
1158 /** \brief Dump NAT64 BIB
1159  @param client_index - opaque cookie to identify the sender
1160  @param context - sender context, to match reply w/ request
1161  @param proto - protocol of the BIB: 255 - all BIBs
1162  6 - TCP BIB
1163  17 - UDP BIB
1164  1/58 - ICMP BIB
1165  otherwise - "unknown" protocol BIB
1166 */
1167 define nat64_bib_dump {
1171 };
1172 
1173 /** \brief NAT64 BIB details response
1174  @param context - sender context, to match reply w/ request
1175  @param i_addr - inside IPv6 address
1176  @param o_addr - outside IPv4 address
1177  @param i_port - inside port number
1178  @param o_port - outside port number
1179  @param vrf_id - VRF id of tenant
1180  @param proto - protocol number
1181  @param is_static - 1 if static BIB entry, 0 if dynamic
1182  @param ses_num - number of sessions associated with the BIB entry
1183 */
1184 define nat64_bib_details {
1186  u8 i_addr[16];
1187  u8 o_addr[4];
1194 };
1195 
1196 /** \brief Dump NAT64 session table
1197  @param client_index - opaque cookie to identify the sender
1198  @param context - sender context, to match reply w/ request
1199  @param proto - protocol of the session table: 255 - all STs
1200  6 - TCP ST
1201  17 - UDP ST
1202  1/58 - ICMP ST
1203  otherwise - "unknown" proto ST
1204 */
1205 define nat64_st_dump {
1209 };
1210 
1211 /** \brief NAT64 session table details response
1212  @param context - sender context, to match reply w/ request
1213  @param il_addr - inside IPv6 address of the local host
1214  @param ol_addr - outside IPv4 address of the local host
1215  @param il_port - inside port number id of the local host/inside ICMP id
1216  @param ol_port - outside port number of the local host/outside ICMP id
1217  @param il_addr - inside IPv6 address of the remote host
1218  @param ol_addr - outside IPv4 address of the remote host
1219  @param l_port - port number of the remote host (not used for ICMP)
1220  @param vrf_id - VRF id of tenant
1221  @param proto - protocol number
1222 */
1223 define nat64_st_details {
1225  u8 il_addr[16];
1226  u8 ol_addr[4];
1229  u8 ir_addr[16];
1230  u8 or_addr[4];
1234 };
1235 
1236 /** \brief Add/del NAT64 prefix
1237  @param client_index - opaque cookie to identify the sender
1238  @param context - sender context, to match reply w/ request
1239  @param prefix - NAT64 prefix
1240  @param prefix - NAT64 prefix length
1241  @param vrf_id - VRF id of tenant
1242  @param is_add - 1 if add, 0 if delete
1243 */
1244 autoreply define nat64_add_del_prefix {
1247  u8 prefix[16];
1251 };
1252 
1253 /** \brief Dump NAT64 prefix
1254  @param client_index - opaque cookie to identify the sender
1255  @param context - sender context, to match reply w/ request
1256 */
1257 define nat64_prefix_dump {
1260 };
1261 
1262 /** \brief Dump NAT64 prefix details response
1263  @param context - sender context, to match reply w/ request
1264  @param prefix - NAT64 prefix
1265  @param prefix - NAT64 prefix length
1266  @param vrf_id - VRF id of tenant
1267 */
1268 define nat64_prefix_details {
1270  u8 prefix[16];
1273 };
1274 
1275 /** \brief Add/delete NAT64 pool address from specific interfce
1276  @param client_index - opaque cookie to identify the sender
1277  @param context - sender context, to match reply w/ request
1278  @param is_add - 1 if add, 0 if delete
1279  @param sw_if_index - software index of the interface
1280 */
1281 autoreply define nat64_add_del_interface_addr {
1287 };
1288 
1289 
1290 /*
1291  * DS-Lite APIs
1292  */
1293 
1294 /** \brief Add/delete address range to DS-Lite pool
1295  @param client_index - opaque cookie to identify the sender
1296  @param context - sender context, to match reply w/ request
1297  @param start_addr - start address of the range
1298  @param end_addr - end address of the range
1299  @param is_add - 1 if add, 0 if delete
1300 */
1301 autoreply define dslite_add_del_pool_addr_range {
1304  u8 start_addr[4];
1305  u8 end_addr[4];
1307 };
1308 
1309 /** \brief Dump DS-Lite addresses
1310  @param client_index - opaque cookie to identify the sender
1311  @param context - sender context, to match reply w/ request
1312 */
1313 define dslite_address_dump {
1316 };
1317 
1318 /** \brief DS-Lite address details response
1319  @param context - sender context, to match reply w/ request
1320  @param ip_address - IPv4 address
1321 */
1322 define dslite_address_details {
1324  u8 ip_address[4];
1325 };
1326 
1327 /** \brief Set AFTR IPv6 and IPv4 addresses
1328  @param client_index - opaque cookie to identify the sender
1329  @param context - sender context, to match reply w/ request
1330  @param ip4_addr - IPv4 address
1331  @param ip6_addr - IP64 address
1332 */
1333 autoreply define dslite_set_aftr_addr {
1336  u8 ip4_addr[4];
1337  u8 ip6_addr[16];
1338 };
1339 
1340 /** \brief Get AFTR IPv6 and IPv4 addresses
1341  @param client_index - opaque cookie to identify the sender
1342  @param context - sender context, to match reply w/ request
1343 */
1344 define dslite_get_aftr_addr {
1347 };
1348 
1349 /** \brief Response to get AFTR IPv6 and IPv4 addresses
1350  @param context - sender context, to match reply w/ request
1351  @param retval - return code
1352  @param ip4_addr - IPv4 address
1353  @param ip6_addr - IP64 address
1354 */
1355 define dslite_get_aftr_addr_reply {
1358  u8 ip4_addr[4];
1359  u8 ip6_addr[16];
1360 };
1361 
1362 /** \brief Set B4 IPv6 and IPv4 addresses
1363  @param client_index - opaque cookie to identify the sender
1364  @param context - sender context, to match reply w/ request
1365  @param ip4_addr - IPv4 address
1366  @param ip6_addr - IP64 address
1367 */
1368 autoreply define dslite_set_b4_addr {
1371  u8 ip4_addr[4];
1372  u8 ip6_addr[16];
1373 };
1374 
1375 /** \brief Get B4 IPv6 and IPv4 addresses
1376  @param client_index - opaque cookie to identify the sender
1377  @param context - sender context, to match reply w/ request
1378 */
1379 define dslite_get_b4_addr {
1382 };
1383 
1384 /** \brief Response to get B4 IPv6 and IPv4 addresses
1385  @param context - sender context, to match reply w/ request
1386  @param retval - return code
1387  @param ip4_addr - IPv4 address
1388  @param ip6_addr - IP64 address
1389 */
1390 define dslite_get_b4_addr_reply {
1393  u8 ip4_addr[4];
1394  u8 ip6_addr[16];
1395 };
1396 
1397 /*
1398  * NAT66 APIs
1399  */
1400 /** \brief Enable/disable NAT66 feature on the interface
1401  @param client_index - opaque cookie to identify the sender
1402  @param context - sender context, to match reply w/ request
1403  @param is_add - 1 if add, 0 if delete
1404  @param is_inside - 1 if inside, 0 if outside
1405  @param sw_if_index - software index of the interface
1406 */
1407 autoreply define nat66_add_del_interface {
1413 };
1414 
1415 /** \brief Dump interfaces with NAT66 feature
1416  @param client_index - opaque cookie to identify the sender
1417  @param context - sender context, to match reply w/ request
1418 */
1419 define nat66_interface_dump {
1422 };
1423 
1424 /** \brief NAT66 interface details response
1425  @param context - sender context, to match reply w/ request
1426  @param is_inside - 1 if inside, 0 if outside
1427  @param sw_if_index - software index of the interface
1428 */
1429 define nat66_interface_details {
1433 };
1434 
1435 /** \brief Add/delete 1:1 NAT66
1436  @param client_index - opaque cookie to identify the sender
1437  @param context - sender context, to match reply w/ request
1438  @param is_add - 1 if add, 0 if delete
1439  @param local_ip_address - local IPv6 address
1440  @param external_ip_address - external IPv6 address
1441  @param vrf_id - VRF id of tenant
1442 */
1443 autoreply define nat66_add_del_static_mapping {
1447  u8 local_ip_address[16];
1448  u8 external_ip_address[16];
1450 };
1451 
1452 /** \brief Dump NAT66 static mappings
1453  @param client_index - opaque cookie to identify the sender
1454  @param context - sender context, to match reply w/ request
1455 */
1456 define nat66_static_mapping_dump {
1459 };
1460 
1461 /** \brief NAT66 static mapping details response
1462  @param context - sender context, to match reply w/ request
1463  @param local_ip_address - local IPv6 address
1464  @param external_ip_address - external IPv6 address
1465  @param vrf_id - VRF id of tenant
1466  @param total_bytes - count of bytes sent through static mapping
1467  @param total_pkts - count of pakets sent through static mapping
1468 */
1469 define nat66_static_mapping_details {
1471  u8 local_ip_address[16];
1472  u8 external_ip_address[16];
1476 };
typedef address
Definition: ip_types.api:35
unsigned long u64
Definition: types.h:89
int nat64_add_del_interface(u32 sw_if_index, u8 is_inside, u8 is_add)
Enable/disable NAT64 feature on the interface.
Definition: nat64.c:403
vhost_vring_addr_t addr
Definition: vhost_user.h:121
unsigned char u8
Definition: types.h:56
int nat44_add_del_lb_static_mapping(ip4_address_t e_addr, u16 e_port, snat_protocol_t proto, nat44_lb_addr_port_t *locals, u8 is_add, twice_nat_type_t twice_nat, u8 out2in_only, u8 *tag, u32 affinity)
Add/delete static mapping with load-balancing (multiple backends)
Definition: nat.c:1119
NAT44 load-balancing address and port pair.
Definition: nat.api:741
option version
Definition: nat.api:16
unsigned int u32
Definition: types.h:88
unsigned short u16
Definition: types.h:57
u8 name[64]
Definition: memclnt.api:151
int nat64_add_del_prefix(ip6_address_t *prefix, u8 plen, u32 vrf_id, u8 is_add)
Add/delete NAT64 prefix.
Definition: nat64.c:934
signed int i32
Definition: types.h:77
int nat44_del_session(snat_main_t *sm, ip4_address_t *addr, u16 port, snat_protocol_t proto, u32 vrf_id, int is_in)
Delete NAT44 session.
Definition: nat.c:3138
typedef prefix
Definition: ip_types.api:40