FD.io VPP  v18.07-rc0-415-g6c78436
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 = "2.6.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 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
77 */
78 define nat_show_config_reply
79 {
92 };
93 
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
98 */
99 autoreply define nat_set_workers {
103 };
104 
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
108 */
109 define nat_worker_dump {
112 };
113 
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
119 */
120 define nat_worker_details {
124  u8 name[64];
125 };
126 
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
133 */
134 autoreply define nat_ipfix_enable_disable {
140 };
141 
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
150 */
151 autoreply define nat_set_reass {
159 };
160 
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
164 */
165 define nat_get_reass {
168 };
169 
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
181 */
182 define nat_get_reass_reply {
193 };
194 
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
198 */
199 define nat_reass_dump {
202 };
203 
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
212 */
213 define nat_reass_details {
216  u8 src_addr[16];
217  u8 dst_addr[16];
221 };
222 
223 /*
224  * NAT44 APIs
225  */
226 
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 twice_nat - twice NAT address range for extenal hosts
234  @param is_add - 1 if add, 0 if delete
235 */
236 autoreply define nat44_add_del_address_range {
239  u8 first_ip_address[4];
240  u8 last_ip_address[4];
244 };
245 
246 /** \brief Dump NAT44 addresses
247  @param client_index - opaque cookie to identify the sender
248  @param context - sender context, to match reply w/ request
249 */
250 define nat44_address_dump {
253 };
254 
255 /** \brief NAT44 address details response
256  @param context - sender context, to match reply w/ request
257  @param ip_address - IPv4 address
258  @param twice_nat - twice NAT address range for extenal hosts
259  @param vrf_id - VRF id of tenant, ~0 means independent of VRF
260 */
261 define nat44_address_details {
263  u8 ip_address[4];
266 };
267 
268 /** \brief Enable/disable NAT44 feature on the interface
269  @param client_index - opaque cookie to identify the sender
270  @param context - sender context, to match reply w/ request
271  @param is_add - 1 if add, 0 if delete
272  @param is_inside - 1 if inside, 0 if outside
273  @param sw_if_index - software index of the interface
274 */
275 autoreply define nat44_interface_add_del_feature {
281 };
282 
283 /** \brief Dump interfaces with NAT44 feature
284  @param client_index - opaque cookie to identify the sender
285  @param context - sender context, to match reply w/ request
286 */
287 define nat44_interface_dump {
290 };
291 
292 /** \brief NAT44 interface details response
293  @param context - sender context, to match reply w/ request
294  @param is_inside - 1 if inside, 0 if outside, 2 if inside and outside
295  @param sw_if_index - software index of the interface
296 */
297 define nat44_interface_details {
301 };
302 
303 /** \brief Enable/disbale NAT44 as an interface output feature (postrouting
304  in2out translation)
305  @param client_index - opaque cookie to identify the sender
306  @param context - sender context, to match reply w/ request
307  @param is_add - 1 if add, 0 if delete
308  @param is_inside - 1 if inside, 0 if outside
309  @param sw_if_index - software index of the interface
310 */
311 autoreply define nat44_interface_add_del_output_feature {
317 };
318 
319 /** \brief Dump interfaces with NAT44 output feature
320  @param client_index - opaque cookie to identify the sender
321  @param context - sender context, to match reply w/ request
322 */
323 define nat44_interface_output_feature_dump {
326 };
327 
328 /** \brief NAT44 interface with output feature details response
329  @param context - sender context, to match reply w/ request
330  @param is_inside - 1 if inside, 0 if outside
331  @param sw_if_index - software index of the interface
332 */
333 define nat44_interface_output_feature_details {
337 };
338 
339 /** \brief Add/delete NAT44 static mapping
340  @param client_index - opaque cookie to identify the sender
341  @param context - sender context, to match reply w/ request
342  @param is_add - 1 if add, 0 if delete
343  @param addr_only - 1 if address only mapping
344  @param local_ip_address - local IPv4 address
345  @param external_ip_address - external IPv4 address
346  @param protocol - IP protocol, used only if addr_only=0
347  @param local_port - local port number, used only if addr_only=0
348  @param external_port - external port number, used only if addr_only=0
349  @param external_sw_if_index - external interface (if set
350  external_ip_address is ignored, ~0 means not
351  used)
352  @param vfr_id - VRF ID
353  @param twice_nat - if 1 translate external host address and port, only for
354  1:1 NAPT (addr_only must be 0)
355  @param self_twice_nat - if 1 translate external host address and port
356  whenever external host address equals
357  local address of internal host
358  @param out2in_only - if 1 rule match only out2in direction
359  @param tag - opaque string tag
360 */
361 autoreply define nat44_add_del_static_mapping {
366  u8 local_ip_address[4];
367  u8 external_ip_address[4];
376  u8 tag[64];
377 };
378 
379 /** \brief Dump NAT44 static mappings
380  @param client_index - opaque cookie to identify the sender
381  @param context - sender context, to match reply w/ request
382 */
383 define nat44_static_mapping_dump {
386 };
387 
388 /** \brief NAT44 static mapping details response
389  @param context - sender context, to match reply w/ request
390  @param addr_only - 1 if address only mapping
391  @param local_ip_address - local IPv4 address
392  @param external_ip_address - external IPv4 address
393  @param protocol - IP protocol, valid only if addr_only=0
394  @param local_port - local port number, valid only if addr_only=0
395  @param external_port - external port number, valid only if addr_only=0
396  @param external_sw_if_index - external interface
397  @param vfr_id - VRF ID
398  @param twice_nat - if 1 translate external host address and port
399  @param self_twice_nat - if 1 translate external host address and port
400  whenever external host address equals
401  local address of internal host
402  @param out2in_only - if 1 rule match only out2in direction
403  @param tag - opaque string tag
404 */
405 define nat44_static_mapping_details {
408  u8 local_ip_address[4];
409  u8 external_ip_address[4];
418  u8 tag[64];
419 };
420 
421 /** \brief Add/delete NAT44 identity mapping
422  @param client_index - opaque cookie to identify the sender
423  @param context - sender context, to match reply w/ request
424  @param is_add - 1 if add, 0 if delete
425  @param addr_only - 1 if address only mapping
426  @param ip_address - IPv4 address
427  @param protocol - IP protocol
428  @param port - port number
429  @param sw_if_index - interface (if set ip_address is ignored, ~0 means not
430  used)
431  @param vfr_id - VRF ID (if ~0 use default VRF)
432  @param tag - opaque string tag
433 */
434 autoreply define nat44_add_del_identity_mapping {
439  u8 ip_address[4];
444  u8 tag[64];
445 };
446 
447 /** \brief Dump NAT44 identity mappings
448  @param client_index - opaque cookie to identify the sender
449  @param context - sender context, to match reply w/ request
450 */
451 define nat44_identity_mapping_dump {
454 };
455 
456 /** \brief NAT44 identity mapping details response
457  @param context - sender context, to match reply w/ request
458  @param addr_only - 1 if address only mapping
459  @param ip_address - IPv4 address
460  @param protocol - IP protocol
461  @param port - port number
462  @param sw_if_index - interface
463  @param vfr_id - VRF ID
464  @param tag - opaque string tag
465 */
466 define nat44_identity_mapping_details {
469  u8 ip_address[4];
474  u8 tag[64];
475 };
476 
477 /** \brief Add/delete NAT44 pool address from specific interfce
478  @param client_index - opaque cookie to identify the sender
479  @param context - sender context, to match reply w/ request
480  @param is_add - 1 if add, 0 if delete
481  @param twice_nat - twice NAT address for extenal hosts
482  @param sw_if_index - software index of the interface
483 */
484 autoreply define nat44_add_del_interface_addr {
490 };
491 
492 /** \brief Dump NAT44 pool addresses interfaces
493  @param client_index - opaque cookie to identify the sender
494  @param context - sender context, to match reply w/ request
495 */
496 define nat44_interface_addr_dump {
499 };
500 
501 /** \brief NAT44 pool addresses interfaces details response
502  @param context - sender context, to match reply w/ request
503  @param sw_if_index - software index of the interface
504  @param twice_nat - twice NAT address for extenal hosts
505 */
506 define nat44_interface_addr_details {
510 };
511 
512 /** \brief Dump NAT44 users
513  @param client_index - opaque cookie to identify the sender
514  @param context - sender context, to match reply w/ request
515 */
516 define nat44_user_dump {
519 };
520 
521 /** \brief NAT44 users response
522  @param context - sender context, to match reply w/ request
523  @vrf_id - VRF ID
524  @param ip_adress - IPv4 address
525  @param nsessions - number of dynamic sessions
526  @param nstaticsessions - number of static sessions
527 */
528 define nat44_user_details {
531  u8 ip_address[4];
534 };
535 
536 /** \brief NAT44 user's sessions
537  @param client_index - opaque cookie to identify the sender
538  @param context - sender context, to match reply w/ request
539  @param is_ip4 - 1 if address type is IPv4
540  @param user_ip - IP address of the user to dump
541  @param vrf_id - VRF_ID
542 */
543 define nat44_user_session_dump {
546  u8 ip_address[4];
548 };
549 
550 /** \brief NAT44 user's sessions response
551  @param context - sender context, to match reply w/ request
552  @param outside_ip_address - outside IPv4 address
553  @param outside_port - outside port
554  @param inside_ip_address - inside IPv4 address
555  @param inside_port - inside port
556  @param protocol - protocol
557  @param is_static - 1 if session is static
558  @param last_heard - last heard timer
559  @param total_bytes - count of bytes sent through session
560  @param total_pkts - count of pakets sent through session
561  @param is_twicenat - 1 if session is twice-nat
562  @param ext_host_valid - 1 if external host address and port are valid
563  @param ext_host_address - external host IPv4 address
564  @param ext_host_port - external host port
565  @param ext_host_nat_address - post-NAT external host IPv4 address (valid
566  only if twice-nat session)
567  @param ext_host_nat_port - post-NAT external host port (valid only if
568  twice-nat session)
569 */
570 define nat44_user_session_details {
572  u8 outside_ip_address[4];
574  u8 inside_ip_address[4];
583  u8 ext_host_address[4];
585  u8 ext_host_nat_address[4];
587 };
588 
589 /** \brief NAT44 load-balancing address and port pair
590  @param addr - IPv4 address of the internal node
591  @param port - L4 port number of the internal node
592  @param probability - probability of the internal node to be randomly matched
593 */
594 typeonly manual_endian define nat44_lb_addr_port {
595  u8 addr[4];
598 };
599 
600 /** \brief Add/delete NAT44 load-balancing static mapping rule
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 external_addr - external IPv4 address of the service
605  @param external_port - external L4 port number of the service
606  @param protocol - IP protocol number of the service
607  @param vrf_id - internal network VRF ID
608  @param twice_nat - if 1 translate external host address and port
609  @param self_twice_nat - if 1 translate external host address and port
610  whenever external host address equals
611  local address of internal host
612  @param out2in_only - if 1 rule match only out2in direction
613  @param tag - opaque string tag
614  @param local_num - number of local network nodes
615  @param locals - local network nodes
616 */
617 autoreply manual_endian define nat44_add_del_lb_static_mapping {
621  u8 external_addr[4];
628  u8 tag[64];
630  vl_api_nat44_lb_addr_port_t locals[local_num];
631 };
632 
633 /** \brief Dump NAT44 load-balancing static mapping rules
634  @param client_index - opaque cookie to identify the sender
635  @param context - sender context, to match reply w/ request
636 */
637 define nat44_lb_static_mapping_dump {
640 };
641 
642 /** \brief NAT44 load-balancing static mapping rule details response
643  @param context - sender context, to match reply w/ request
644  @param is_add - 1 if add, 0 if delete
645  @param external_addr - external IPv4 address of the service
646  @param external_port - external L4 port number of the service
647  @param protocol - IP protocol number of the service
648  @param vrf_id - internal network VRF ID
649  @param twice_nat - if 1 translate external host address and port
650  @param self_twice_nat - if 1 translate external host address and port
651  whenever external host address equals
652  local address of internal host
653  @param out2in_only - if 1 rule match only out2in direction
654  @param tag - opaque string tag
655  @param local_num - number of local network nodes
656  @param locals - local network nodes
657 */
658 manual_endian define nat44_lb_static_mapping_details {
660  u8 external_addr[4];
667  u8 tag[64];
669  vl_api_nat44_lb_addr_port_t locals[local_num];
670 };
671 
672 /** \brief Delete NAT44 session
673  @param client_index - opaque cookie to identify the sender
674  @param context - sender context, to match reply w/ request
675  @param is_in - 1 if inside network addres and port pari, 0 if outside
676  @param ip_address - IPv4 address
677  @param protocol - IP protocol
678  @param port - port number
679  @param vfr_id - VRF ID
680  @param ext_host_valid - 1 if external host address and port are valid
681  @param ext_host_address - external host IPv4 address
682  @param ext_host_port - external host port
683 */
684 autoreply define nat44_del_session {
693  u8 ext_host_address[4];
695 };
696 
697 /** \brief Enable/disable forwarding for NAT44
698  Forward packets which don't match existing translation
699  or static mapping instead of dropping them.
700  @param client_index - opaque cookie to identify the sender
701  @param context - sender context, to match reply w/ request
702  @param enable - 0 for enable, 1 for disable
703 */
704 autoreply define nat44_forwarding_enable_disable {
708 };
709 
710 /** \brief Check if forwarding is enabled or disabled
711  @param client_index - opaque cookie to identify the sender
712  @param context - sender context, to match reply w/ request
713 */
714 define nat44_forwarding_is_enabled {
717 };
718 
719 /** \brief Response to check if forwarding is enabled or disabled
720  @param context - sender context, to match reply w/ request
721  @param enabled - 1 if enabled, 0 if disabled
722 */
723 define nat44_forwarding_is_enabled_reply {
726 };
727 
728 
729 /*
730  * Deterministic NAT (CGN) APIs
731  */
732 
733 /** \brief Add/delete NAT deterministic mapping
734  @param client_index - opaque cookie to identify the sender
735  @param context - sender context, to match reply w/ request
736  @param is_add - 1 if add, 0 if delete
737  @param is_nat44 - 1 if NAT44
738  @param in_addr - inside IP address
739  @param in_plen - inside IP address prefix length
740  @param out_addr - outside IPv4 address
741  @param out_addr - outside IPv4 address prefix length
742 */
743 autoreply define nat_det_add_del_map {
749  u8 in_addr[16];
751  u8 out_addr[4];
753 };
754 
755 /** \brief Get outside address and port range from inside address
756  @param client_index - opaque cookie to identify the sender
757  @param context - sender context, to match reply w/ request
758  @param is_nat44 - 1 if NAT44
759  @param in_addr - inside IP address
760 */
761 define nat_det_forward {
765  u8 in_addr[16];
766 };
767 
768 /** \brief Get outside address and port range from inside address
769  @param context - sender context, to match reply w/ request
770  @param retval - return code
771  @param out_port_lo - outside port range start
772  @param out_port_hi - outside port range end
773  @param out_addr - outside IPv4 address
774 */
775 define nat_det_forward_reply {
780  u8 out_addr[4];
781 };
782 
783 /** \brief Get inside address from outside address and port
784  @param client_index - opaque cookie to identify the sender
785  @param context - sender context, to match reply w/ request
786  @param out_port - outside port
787  @param out_addr - outside IPv4 address
788 */
789 define nat_det_reverse {
793  u8 out_addr[4];
794 };
795 
796 /** \brief Get inside address from outside address and port reply
797  @param context - sender context, to match reply w/ request
798  @param retval - return code
799  @param is_nat44 - 1 if NAT44
800  @param in_addr - inside IP address
801 */
802 define nat_det_reverse_reply {
806  u8 in_addr[16];
807 };
808 
809 /** \brief Dump NAT deterministic mappings
810  @param client_index - opaque cookie to identify the sender
811  @param context - sender context, to match reply w/ request
812 */
813 define nat_det_map_dump {
816 };
817 
818 /** \brief NAT users response
819  @param context - sender context, to match reply w/ request
820  @param is_nat44 - 1 if NAT44
821  @param in_addr - inside IP address
822  @param in_plen - inside IP address prefix length
823  @param out_addr - outside IPv4 address
824  @param out_plen - outside IPv4 address prefix length
825  @param sharing_ratio - outside to inside address sharing ratio
826  @param ports_per_host - number of ports available to a host
827  @param ses_num - number of sessions belonging to this mapping
828 */
829 define nat_det_map_details {
832  u8 in_addr[16];
834  u8 out_addr[4];
839 };
840 
841 /** \brief Set values of timeouts for deterministic NAT (seconds, 0 = default)
842  @param client_index - opaque cookie to identify the sender
843  @param context - sender context, to match reply w/ request
844  @param udp - UDP timeout (default 300sec)
845  @param tcp_established - TCP established timeout (default 7440sec)
846  @param tcp_transitory - TCP transitory timeout (default 240sec)
847  @param icmp - ICMP timeout (default 60sec)
848 */
849 autoreply define nat_det_set_timeouts {
856 };
857 
858 /** \brief Get values of timeouts for deterministic NAT (seconds)
859  @param client_index - opaque cookie to identify the sender
860  @param context - sender context, to match reply w/ request
861 */
862 define nat_det_get_timeouts {
865 };
866 
867 /** \brief Get values of timeouts for deterministic NAT reply
868  @param context - sender context, to match reply w/ request
869  @param retval - return code
870  @param udp - UDP timeout (default 300sec)
871  @param tcp_established - TCP established timeout (default 7440sec)
872  @param tcp_transitory - TCP transitory timeout (default 240sec)
873  @param icmp - ICMP timeout (default 60sec)
874 */
875 define nat_det_get_timeouts_reply {
882 };
883 
884 /** \brief Close deterministic NAT session by outside address and port
885  @param client_index - opaque cookie to identify the sender
886  @param context - sender context, to match reply w/ request
887  @param out_addr - outside IPv4 address
888  @param out_port - outside port
889  @param ext_addr - external host IPv4 address
890  @param ext_port - external host port
891 */
892 autoreply define nat_det_close_session_out {
895  u8 out_addr[4];
897  u8 ext_addr[4];
899 };
900 
901 /** \brief Close deterministic NAT session by inside address and port
902  @param client_index - opaque cookie to identify the sender
903  @param context - sender context, to match reply w/ request
904  @param is_nat44 - 1 if NAT44
905  @param in_addr - inside IP address
906  @param in_port - inside port
907  @param ext_addr - external host IP address
908  @param ext_port - external host port
909 */
910 autoreply define nat_det_close_session_in {
914  u8 in_addr[16];
916  u8 ext_addr[16];
918 };
919 
920 /** \brief Dump determinstic NAT sessions
921  @param client_index - opaque cookie to identify the sender
922  @param context - sender context, to match reply w/ request
923  @param is_nat44 - 1 if NAT44
924  @param user_addr - address of an inside user whose sessions to dump
925 */
926 define nat_det_session_dump {
930  u8 user_addr[16];
931 };
932 
933 /** \brief Deterministic NAT sessions reply
934  @param context - sender context, to match reply w/ request
935  @param in_port - inside port
936  @param ext_addr - external host address
937  @param ext_port - external host port
938  @param out_port - outside NAT port
939  @param state - session state
940  @param expire - session expiration timestamp
941 */
942 define nat_det_session_details {
946  u8 ext_addr[4];
951 };
952 
953 /*
954  * NAT64 APIs
955  */
956 
957 /** \brief Add/delete address range to NAT64 pool
958  @param client_index - opaque cookie to identify the sender
959  @param context - sender context, to match reply w/ request
960  @param start_addr - start address of the range
961  @param end_addr - end address of the range
962  @param vrf_id - VRF id of tenant, ~0 means independent of VRF
963  @param is_add - 1 if add, 0 if delete
964 */
965 autoreply define nat64_add_del_pool_addr_range {
968  u8 start_addr[4];
969  u8 end_addr[4];
972 };
973 
974 /** \brief Dump NAT64 pool addresses
975  @param client_index - opaque cookie to identify the sender
976  @param context - sender context, to match reply w/ request
977 */
978 define nat64_pool_addr_dump {
981 };
982 
983 /** \brief NAT64 pool address details response
984  @param context - sender context, to match reply w/ request
985  @param address - IPv4 address
986  @param vfr_id - VRF id of tenant, ~0 means independent of VRF
987 */
988 define nat64_pool_addr_details {
992 };
993 
994 /** \brief Enable/disable NAT64 feature on the interface
995  @param client_index - opaque cookie to identify the sender
996  @param context - sender context, to match reply w/ request
997  @param sw_if_index - index of the interface
998  @param is_inside - 1 if inside, 0 if outside
999  @param is_add - 1 if add, 0 if delete
1000 */
1001 autoreply define nat64_add_del_interface {
1007 };
1008 
1009 /** \brief Dump interfaces with NAT64 feature
1010  @param client_index - opaque cookie to identify the sender
1011  @param context - sender context, to match reply w/ request
1012 */
1013 define nat64_interface_dump {
1016 };
1017 
1018 /** \brief NAT64 interface details response
1019  @param context - sender context, to match reply w/ request
1020  @param is_inside - 1 if inside, 0 if outside
1021  @param sw_if_index - index of the interface
1022 */
1023 define nat64_interface_details {
1027 };
1028 
1029 /** \brief Add/delete NAT64 static BIB entry
1030  @param client_index - opaque cookie to identify the sender
1031  @param context - sender context, to match reply w/ request
1032  @param i_addr - inside IPv6 address
1033  @param o_addr - outside IPv4 address
1034  @param i_port - inside port number
1035  @param o_port - outside port number
1036  @param vrf_id - VRF id of tenant
1037  @param proto - protocol number
1038  @param is_add - 1 if add, 0 if delete
1039 */
1040  autoreply define nat64_add_del_static_bib {
1043  u8 i_addr[16];
1044  u8 o_addr[4];
1050 };
1051 
1052 /** \brief Dump NAT64 BIB
1053  @param client_index - opaque cookie to identify the sender
1054  @param context - sender context, to match reply w/ request
1055  @param proto - protocol of the BIB: 255 - all BIBs
1056  6 - TCP BIB
1057  17 - UDP BIB
1058  1/58 - ICMP BIB
1059  otherwise - "unknown" protocol BIB
1060 */
1061 define nat64_bib_dump {
1065 };
1066 
1067 /** \brief NAT64 BIB details response
1068  @param context - sender context, to match reply w/ request
1069  @param i_addr - inside IPv6 address
1070  @param o_addr - outside IPv4 address
1071  @param i_port - inside port number
1072  @param o_port - outside port number
1073  @param vrf_id - VRF id of tenant
1074  @param proto - protocol number
1075  @param is_static - 1 if static BIB entry, 0 if dynamic
1076  @param ses_num - number of sessions associated with the BIB entry
1077 */
1078 define nat64_bib_details {
1080  u8 i_addr[16];
1081  u8 o_addr[4];
1088 };
1089 
1090 /** \brief Set values of timeouts for NAT64 (seconds, 0 = default)
1091  @param client_index - opaque cookie to identify the sender
1092  @param context - sender context, to match reply w/ request
1093  @param udp - UDP timeout (default 300sec)
1094  @param icmp - ICMP timeout (default 60sec)
1095  @param tcp_trans - TCP transitory timeout (default 240sec)
1096  @param tcp_est - TCP established timeout (default 7440sec)
1097  @param tcp_incoming_syn - TCP incoming SYN timeout (default 6sec)
1098 */
1099 autoreply define nat64_set_timeouts {
1107 };
1108 
1109 /** \brief Get values of timeouts for NAT64 (seconds)
1110  @param client_index - opaque cookie to identify the sender
1111  @param context - sender context, to match reply w/ request
1112 */
1113 define nat64_get_timeouts {
1116 };
1117 
1118 /** \brief Get values of timeouts for NAT64 reply
1119  @param context - sender context, to match reply w/ request
1120  @param retval - return code
1121  @param udp - UDP timeout
1122  @param icmp - ICMP timeout
1123  @param tcp_trans - TCP transitory timeout
1124  @param tcp_est - TCP established timeout
1125  @param tcp_incoming_syn - TCP incoming SYN timeout
1126 */
1127 define nat64_get_timeouts_reply {
1135 };
1136 
1137 /** \brief Dump NAT64 session table
1138  @param client_index - opaque cookie to identify the sender
1139  @param context - sender context, to match reply w/ request
1140  @param proto - protocol of the session table: 255 - all STs
1141  6 - TCP ST
1142  17 - UDP ST
1143  1/58 - ICMP ST
1144  otherwise - "unknown" proto ST
1145 */
1146 define nat64_st_dump {
1150 };
1151 
1152 /** \brief NAT64 session table details response
1153  @param context - sender context, to match reply w/ request
1154  @param il_addr - inside IPv6 address of the local host
1155  @param ol_addr - outside IPv4 address of the local host
1156  @param il_port - inside port number id of the local host/inside ICMP id
1157  @param ol_port - outside port number of the local host/outside ICMP id
1158  @param il_addr - inside IPv6 address of the remote host
1159  @param ol_addr - outside IPv4 address of the remote host
1160  @param l_port - port number of the remote host (not used for ICMP)
1161  @param vrf_id - VRF id of tenant
1162  @param proto - protocol number
1163 */
1164 define nat64_st_details {
1166  u8 il_addr[16];
1167  u8 ol_addr[4];
1170  u8 ir_addr[16];
1171  u8 or_addr[4];
1175 };
1176 
1177 /** \brief Add/del NAT64 prefix
1178  @param client_index - opaque cookie to identify the sender
1179  @param context - sender context, to match reply w/ request
1180  @param prefix - NAT64 prefix
1181  @param prefix - NAT64 prefix length
1182  @param vrf_id - VRF id of tenant
1183  @param is_add - 1 if add, 0 if delete
1184 */
1185 autoreply define nat64_add_del_prefix {
1188  u8 prefix[16];
1192 };
1193 
1194 /** \brief Dump NAT64 prefix
1195  @param client_index - opaque cookie to identify the sender
1196  @param context - sender context, to match reply w/ request
1197 */
1198 define nat64_prefix_dump {
1201 };
1202 
1203 /** \brief Dump NAT64 prefix details response
1204  @param context - sender context, to match reply w/ request
1205  @param prefix - NAT64 prefix
1206  @param prefix - NAT64 prefix length
1207  @param vrf_id - VRF id of tenant
1208 */
1209 define nat64_prefix_details {
1211  u8 prefix[16];
1214 };
1215 
1216 /** \brief Add/delete NAT64 pool address from specific interfce
1217  @param client_index - opaque cookie to identify the sender
1218  @param context - sender context, to match reply w/ request
1219  @param is_add - 1 if add, 0 if delete
1220  @param sw_if_index - software index of the interface
1221 */
1222 autoreply define nat64_add_del_interface_addr {
1228 };
1229 
1230 
1231 /*
1232  * DS-Lite APIs
1233  */
1234 
1235 /** \brief Add/delete address range to DS-Lite pool
1236  @param client_index - opaque cookie to identify the sender
1237  @param context - sender context, to match reply w/ request
1238  @param start_addr - start address of the range
1239  @param end_addr - end address of the range
1240  @param is_add - 1 if add, 0 if delete
1241 */
1242 autoreply define dslite_add_del_pool_addr_range {
1245  u8 start_addr[4];
1246  u8 end_addr[4];
1248 };
1249 
1250 /** \brief Dump DS-Lite addresses
1251  @param client_index - opaque cookie to identify the sender
1252  @param context - sender context, to match reply w/ request
1253 */
1254 define dslite_address_dump {
1257 };
1258 
1259 /** \brief DS-Lite address details response
1260  @param context - sender context, to match reply w/ request
1261  @param ip_address - IPv4 address
1262 */
1263 define dslite_address_details {
1265  u8 ip_address[4];
1266 };
1267 
1268 /** \brief Set AFTR IPv6 and IPv4 addresses
1269  @param client_index - opaque cookie to identify the sender
1270  @param context - sender context, to match reply w/ request
1271  @param ip4_addr - IPv4 address
1272  @param ip6_addr - IP64 address
1273 */
1274 autoreply define dslite_set_aftr_addr {
1277  u8 ip4_addr[4];
1278  u8 ip6_addr[16];
1279 };
1280 
1281 /** \brief Get AFTR IPv6 and IPv4 addresses
1282  @param client_index - opaque cookie to identify the sender
1283  @param context - sender context, to match reply w/ request
1284 */
1285 define dslite_get_aftr_addr {
1288 };
1289 
1290 /** \brief Response to get AFTR IPv6 and IPv4 addresses
1291  @param context - sender context, to match reply w/ request
1292  @param retval - return code
1293  @param ip4_addr - IPv4 address
1294  @param ip6_addr - IP64 address
1295 */
1296 define dslite_get_aftr_addr_reply {
1299  u8 ip4_addr[4];
1300  u8 ip6_addr[16];
1301 };
1302 
1303 /** \brief Set B4 IPv6 and IPv4 addresses
1304  @param client_index - opaque cookie to identify the sender
1305  @param context - sender context, to match reply w/ request
1306  @param ip4_addr - IPv4 address
1307  @param ip6_addr - IP64 address
1308 */
1309 autoreply define dslite_set_b4_addr {
1312  u8 ip4_addr[4];
1313  u8 ip6_addr[16];
1314 };
1315 
1316 /** \brief Get B4 IPv6 and IPv4 addresses
1317  @param client_index - opaque cookie to identify the sender
1318  @param context - sender context, to match reply w/ request
1319 */
1320 define dslite_get_b4_addr {
1323 };
1324 
1325 /** \brief Response to get B4 IPv6 and IPv4 addresses
1326  @param context - sender context, to match reply w/ request
1327  @param retval - return code
1328  @param ip4_addr - IPv4 address
1329  @param ip6_addr - IP64 address
1330 */
1331 define dslite_get_b4_addr_reply {
1334  u8 ip4_addr[4];
1335  u8 ip6_addr[16];
1336 };
1337 
1338 /*
1339  * NAT66 APIs
1340  */
1341 /** \brief Enable/disable NAT66 feature on the interface
1342  @param client_index - opaque cookie to identify the sender
1343  @param context - sender context, to match reply w/ request
1344  @param is_add - 1 if add, 0 if delete
1345  @param is_inside - 1 if inside, 0 if outside
1346  @param sw_if_index - software index of the interface
1347 */
1348 autoreply define nat66_add_del_interface {
1354 };
1355 
1356 /** \brief Dump interfaces with NAT66 feature
1357  @param client_index - opaque cookie to identify the sender
1358  @param context - sender context, to match reply w/ request
1359 */
1360 define nat66_interface_dump {
1363 };
1364 
1365 /** \brief NAT66 interface details response
1366  @param context - sender context, to match reply w/ request
1367  @param is_inside - 1 if inside, 0 if outside
1368  @param sw_if_index - software index of the interface
1369 */
1370 define nat66_interface_details {
1374 };
1375 
1376 /** \brief Add/delete 1:1 NAT66
1377  @param client_index - opaque cookie to identify the sender
1378  @param context - sender context, to match reply w/ request
1379  @param is_add - 1 if add, 0 if delete
1380  @param local_ip_address - local IPv6 address
1381  @param external_ip_address - external IPv6 address
1382  @param vrf_id - VRF id of tenant
1383 */
1384 autoreply define nat66_add_del_static_mapping {
1388  u8 local_ip_address[16];
1389  u8 external_ip_address[16];
1391 };
1392 
1393 /** \brief Dump NAT66 static mappings
1394  @param client_index - opaque cookie to identify the sender
1395  @param context - sender context, to match reply w/ request
1396 */
1397 define nat66_static_mapping_dump {
1400 };
1401 
1402 /** \brief NAT66 static mapping details response
1403  @param context - sender context, to match reply w/ request
1404  @param local_ip_address - local IPv6 address
1405  @param external_ip_address - external IPv6 address
1406  @param vrf_id - VRF id of tenant
1407  @param total_bytes - count of bytes sent through static mapping
1408  @param total_pkts - count of pakets sent through static mapping
1409 */
1410 define nat66_static_mapping_details {
1412  u8 local_ip_address[16];
1413  u8 external_ip_address[16];
1417 };
typedef address
Definition: ip_types.api:34
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:404
int nat44_add_del_lb_static_mapping(ip4_address_t e_addr, u16 e_port, snat_protocol_t proto, u32 vrf_id, nat44_lb_addr_port_t *locals, u8 is_add, twice_nat_type_t twice_nat, u8 out2in_only, u8 *tag)
Definition: nat.c:1219
unsigned char u8
Definition: types.h:56
NAT44 load-balancing address and port pair.
Definition: nat.api:594
option version
Definition: nat.api:16
unsigned int u32
Definition: types.h:88
unsigned short u16
Definition: types.h:57
int nat64_add_del_prefix(ip6_address_t *prefix, u8 plen, u32 vrf_id, u8 is_add)
Add/delete NAT64 prefix.
Definition: nat64.c:951
signed int i32
Definition: types.h:81
int nat44_del_session(snat_main_t *sm, ip4_address_t *addr, u16 port, snat_protocol_t proto, u32 vrf_id, int is_in)
Definition: nat.c:3330
vhost_vring_addr_t addr
Definition: vhost-user.h:83