FD.io VPP  v19.04.4-rc0-5-ge88582fac
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.1.0";
17 import "vnet/ip/ip_types.api";
18 
19 /**
20  * @file nat.api
21  * @brief VPP control-plane API messages.
22  *
23  * This file defines VPP control-plane API messages which are generally
24  * called through a shared memory interface.
25  */
26 
27 /*
28  * Common NAT plugin APIs
29  */
30 
31 /** \brief Control ping from client to api server request
32  @param client_index - opaque cookie to identify the sender
33  @param context - sender context, to match reply w/ request
34 */
35 define nat_control_ping
36 {
39 };
40 
41 /** \brief Control ping from the client to the server response
42  @param client_index - opaque cookie to identify the sender
43  @param context - sender context, to match reply w/ request
44  @param retval - return code for the request
45  @param vpe_pid - the pid of the vpe, returned by the server
46 */
47 define nat_control_ping_reply
48 {
53 };
54 
55 /** \brief Show NAT plugin startup config
56  @param client_index - opaque cookie to identify the sender
57  @param context - sender context, to match reply w/ request
58 */
59 define nat_show_config
60 {
63 };
64 
65 /** \brief Show NAT plugin startup config reply
66  @param context - sender context, to match reply w/ request
67  @param retval - return code for the request
68  @param static_mapping_only - if 1 dynamic translations disabled
69  @param static_mapping_connection_tracking - if 1 create session data
70  @param deterministic - if 1 deterministic mapping
71  @param endpoint_dependent - if 1 endpoint-dependent mode
72  @param out2in_dpo - if 1 out2in dpo mode
73  @param translation_buckets - number of translation hash buckets
74  @param translation_memory_size - translation hash memory size
75  @param user_buckets - number of user hash buckets
76  @param user_memory_size - user hash memory size
77  @param max_translations_per_user - maximum number of translations per user
78  @param outside_vrf_id - outside VRF id
79  @param inside_vrf_id - default inside VRF id
80  @param dslite_ce - if DS-Lite is CE/B4 element, if 0 AFTR elemet
81  @param nat64_bib_buckets - number of NAT64 BIB hash buckets
82  @param nat64_bib_memory_size - memory size of NAT64 BIB hash
83  @param nat64_st_buckets - number of NAT64 session table hash buckets
84  @param nat64_st_memory_size - memory size of NAT64 session table hash
85 */
86 define nat_show_config_reply
87 {
107 };
108 
109 /** \brief Set NAT workers
110  @param client_index - opaque cookie to identify the sender
111  @param context - sender context, to match reply w/ request
112  @param worker_mask - NAT workers mask
113 */
114 autoreply define nat_set_workers {
118 };
119 
120 /** \brief Dump NAT workers
121  @param client_index - opaque cookie to identify the sender
122  @param context - sender context, to match reply w/ request
123 */
124 define nat_worker_dump {
127 };
128 
129 /** \brief NAT workers details response
130  @param context - sender context, to match reply w/ request
131  @param worker_index - worker index
132  @param lcore_id - lcore ID
133  @param name - worker name
134 */
135 define nat_worker_details {
139  u8 name[64];
140 };
141 
142 /** \brief Enable/disable NAT IPFIX logging
143  @param client_index - opaque cookie to identify the sender
144  @param context - sender context, to match reply w/ request
145  @param domain_id - observation domain ID
146  @param src_port - source port number
147  @param enable - 1 if enable, 0 if disable
148 */
149 autoreply define nat_ipfix_enable_disable {
155 };
156 
157 /** \brief Set NAT virtual fragmentation reassembly
158  @param client_index - opaque cookie to identify the sender
159  @param context - sender context, to match reply w/ request
160  @param timeout - reassembly timeout
161  @param max_reass - maximum number of concurrent reassemblies
162  @param max_frag - maximum number of fragmets per reassembly
163  @param drop_frag - if 0 translate fragments, otherwise drop fragments
164  @param is_ip6 - 1 if IPv6, 0 if IPv4
165 */
166 autoreply define nat_set_reass {
174 };
175 
176 /** \brief Get NAT virtual fragmentation reassembly configuration
177  @param client_index - opaque cookie to identify the sender
178  @param context - sender context, to match reply w/ request
179 */
180 define nat_get_reass {
183 };
184 
185 /** \brief Get NAT virtual fragmentation reassembly configuration reply
186  @param context - sender context, to match reply w/ request
187  @param retval - return code
188  @param ip4_timeout - reassembly timeout
189  @param ip4_max_reass - maximum number of concurrent reassemblies
190  @param ip4_max_frag - maximum number of fragmets per reassembly
191  @param ip4_drop_frag - if 0 translate fragments, otherwise drop fragments
192  @param ip6_timeout - reassembly timeout
193  @param ip6_max_reass - maximum number of concurrent reassemblies
194  @param ip6_max_frag - maximum number of fragmets per reassembly
195  @param ip6_drop_frag - if 0 translate fragments, otherwise drop fragments
196 */
197 define nat_get_reass_reply {
208 };
209 
210 /** \brief Dump NAT virtual fragmentation reassemblies
211  @param client_index - opaque cookie to identify the sender
212  @param context - sender context, to match reply w/ request
213 */
214 define nat_reass_dump {
217 };
218 
219 /** \brief NAT virtual fragmentation reassemblies response
220  @param context - sender context, to match reply w/ request
221  @param is_ip4 - 1 if address type is IPv4
222  @param src_addr - source IP address
223  @param dst_addr - destination IP address
224  @param frag_id - fragment ID
225  @param proto - protocol
226  @param frag_n - number of cached fragments
227 */
228 define nat_reass_details {
231  u8 src_addr[16];
232  u8 dst_addr[16];
236 };
237 
238 /** \brief Set values of timeouts for NAT sessions (seconds)
239  @param client_index - opaque cookie to identify the sender
240  @param context - sender context, to match reply w/ request
241  @param udp - UDP timeout (default 300sec)
242  @param tcp_established - TCP established timeout (default 7440sec)
243  @param tcp_transitory - TCP transitory timeout (default 240sec)
244  @param icmp - ICMP timeout (default 60sec)
245 */
246 autoreply define nat_set_timeouts {
253 };
254 
255 /** \brief Get values of timeouts for NAT sessions (seconds)
256  @param client_index - opaque cookie to identify the sender
257  @param context - sender context, to match reply w/ request
258 */
259 define nat_get_timeouts {
262 };
263 
264 /** \brief Get values of timeouts for NAT sessions reply
265  @param context - sender context, to match reply w/ request
266  @param retval - return code
267  @param udp - UDP timeout
268  @param tcp_established - TCP established timeout
269  @param tcp_transitory - TCP transitory timeout
270  @param icmp - ICMP timeout
271 */
272 define nat_get_timeouts_reply {
279 };
280 
281 /** \brief Set address and port assignment algorithm
282  @param client_index - opaque cookie to identify the sender
283  @param context - sender context, to match reply w/ request
284  @param alg - address and port assignment algorithm:
285  0 - default, 1 - MAP-E, 2 - port range
286  (see nat_addr_and_port_alloc_alg_t in nat.h)
287  @param psid_offset - number of offset bits (valid only for MAP-E alg)
288  @param psid_length - length of PSID (valid only for MAP-E alg)
289  @param psid - Port Set Identifier (PSID) value (valid only for MAP-E alg)
290  @param start_port - beginning of the port range
291  @param end_port - end of the port range
292 */
293 autoreply define nat_set_addr_and_port_alloc_alg {
302 };
303 
304 /** \brief Get address and port assignment algorithm
305  @param client_index - opaque cookie to identify the sender
306  @param context - sender context, to match reply w/ request
307 */
308 define nat_get_addr_and_port_alloc_alg {
311 };
312 
313 /** \brief Get address and port assignment algorithm reply
314  @param context - sender context, to match reply w/ request
315  @param retval - return code
316  @param alg - address and port assignment algorithm:
317  0 - default, 1 - MAP-E, 2 - port range
318  (see nat_addr_and_port_alloc_alg_t in nat.h)
319  @param psid_offset - number of offset bits (valid only for MAP-E alg)
320  @param psid_length - length of PSID (valid only for MAP-E alg)
321  @param psid - Port Set Identifier (PSID) value (valid only for MAP-E alg)
322  @param start_port - beginning of the port range
323  @param end_port - end of the port range
324 */
325 define nat_get_addr_and_port_alloc_alg_reply {
334 };
335 
336 /** \brief Set TCP MSS rewriting configuration
337  @param client_index - opaque cookie to identify the sender
338  @param context - sender context, to match reply w/ request
339  @param mss_value - MSS value to be used for MSS rewriting
340  @param enable - disable(0)/enable(1) MSS rewriting feature
341 */
342 autoreply define nat_set_mss_clamping {
347 };
348 
349 /** \brief Get TCP MSS rewriting configuration
350  @param client_index - opaque cookie to identify the sender
351  @param context - sender context, to match reply w/ request
352 */
353 define nat_get_mss_clamping {
356 };
357 
358 /** \brief Get TCP MSS rewriting configuration reply
359  @param context - sender context, to match reply w/ request
360  @param retval - return code
361  @param mss_value - MSS value to be used for MSS rewriting
362  @param enable - disable(0)/enable(1) MSS rewriting feature
363 */
364 define nat_get_mss_clamping_reply {
369 };
370 
371 /** \brief Set HA listener (local settings)
372  @param client_index - opaque cookie to identify the sender
373  @param context - sender context, to match reply w/ request
374  @param ip_address - local IP4 address
375  @param port - local UDP port number
376  @param path_mtu - path MTU between local and failover
377 */
378 autoreply define nat_ha_set_listener {
384 };
385 
386 /** \brief Set HA failover (remote settings)
387  @param client_index - opaque cookie to identify the sender
388  @param context - sender context, to match reply w/ request
389  @param ip_address - failover IP4 address
390  @param port - failvoer UDP port number
391  @param session_refresh_interval - number of seconds after which to send
392  session counters refresh
393 */
394 autoreply define nat_ha_set_failover {
400 };
401 
402 /** \brief Get HA listener/local configuration
403  @param client_index - opaque cookie to identify the sender
404  @param context - sender context, to match reply w/ request
405 */
409 };
410 
411 /** \brief Get HA listener/local configuration reply
412  @param context - sender context, to match reply w/ request
413  @param retval - return code
414  @param ip_address - local IP4 address
415  @param port - local UDP port number
416  @param path_mtu - Path MTU between local and failover
417 */
418 define nat_ha_get_listener_reply {
424 };
425 
426 /** \brief Get HA failover/remote settings
427  @param client_index - opaque cookie to identify the sender
428  @param context - sender context, to match reply w/ request
429 */
433 };
434 
435 /** \brief Get HA failover/remote settings reply
436  @param context - sender context, to match reply w/ request
437  @param retval - return code
438  @param ip_address - failover IP4 address
439  @param port - failvoer UDP port number
440  @param session_refresh_interval - number of seconds after which to send
441  session counters refresh
442 */
443 define nat_ha_get_failover_reply {
449 };
450 
451 /** \brief Flush the current HA data (for testing)
452  @param client_index - opaque cookie to identify the sender
453  @param context - sender context, to match reply w/ request
454 */
455 autoreply define nat_ha_flush {
458 };
459 
460 /** \brief Resync HA (resend existing sessions to new failover)
461  @param context - sender context, to match reply w/ request
462  @param retval - return code
463  @param want_resync_event - resync completed event sent to the sender via
464  nat_ha_resync_completed_event API message if
465  non-zero
466  @param pid - sender's pid
467 */
468 autoreply define nat_ha_resync
469 {
474 };
475 
476 /** \brief Tell client about a HA resync completion event
477  @param client_index - opaque cookie to identify the sender
478  @param pid - client pid registered to receive notification
479  @param missed_count - number of missed (not ACKed) messages
480 */
481 define nat_ha_resync_completed_event
482 {
486 };
487 
489  rpc nat_ha_resync returns nat_ha_resync_reply events nat_ha_resync_completed_event;
490 };
491 
492 /*
493  * NAT44 APIs
494  */
495 
496 /** \brief Add/del NAT44 address range
497  @param client_index - opaque cookie to identify the sender
498  @param context - sender context, to match reply w/ request
499  @param first_ip_address - first IPv4 address
500  @param last_ip_address - last IPv4 address
501  @param vrf_id - VRF id of tenant, ~0 means independent of VRF
502  @param twice_nat - twice NAT address range for extenal hosts
503  @param is_add - 1 if add, 0 if delete
504 */
505 autoreply define nat44_add_del_address_range {
508  u8 first_ip_address[4];
509  u8 last_ip_address[4];
513 };
514 
515 /** \brief Dump NAT44 addresses
516  @param client_index - opaque cookie to identify the sender
517  @param context - sender context, to match reply w/ request
518 */
519 define nat44_address_dump {
522 };
523 
524 /** \brief NAT44 address details response
525  @param context - sender context, to match reply w/ request
526  @param ip_address - IPv4 address
527  @param twice_nat - twice NAT address range for extenal hosts
528  @param vrf_id - VRF id of tenant, ~0 means independent of VRF
529 */
530 define nat44_address_details {
535 };
536 
537 /** \brief Enable/disable NAT44 feature on the interface
538  @param client_index - opaque cookie to identify the sender
539  @param context - sender context, to match reply w/ request
540  @param is_add - 1 if add, 0 if delete
541  @param is_inside - 1 if inside, 0 if outside
542  @param sw_if_index - software index of the interface
543 */
544 autoreply define nat44_interface_add_del_feature {
550 };
551 
552 /** \brief Dump interfaces with NAT44 feature
553  @param client_index - opaque cookie to identify the sender
554  @param context - sender context, to match reply w/ request
555 */
556 define nat44_interface_dump {
559 };
560 
561 /** \brief NAT44 interface details response
562  @param context - sender context, to match reply w/ request
563  @param is_inside - 1 if inside, 0 if outside, 2 if inside and outside
564  @param sw_if_index - software index of the interface
565 */
566 define nat44_interface_details {
570 };
571 
572 /** \brief Enable/disbale NAT44 as an interface output feature (postrouting
573  in2out translation)
574  @param client_index - opaque cookie to identify the sender
575  @param context - sender context, to match reply w/ request
576  @param is_add - 1 if add, 0 if delete
577  @param is_inside - 1 if inside, 0 if outside
578  @param sw_if_index - software index of the interface
579 */
580 autoreply define nat44_interface_add_del_output_feature {
586 };
587 
588 /** \brief Dump interfaces with NAT44 output feature
589  @param client_index - opaque cookie to identify the sender
590  @param context - sender context, to match reply w/ request
591 */
592 define nat44_interface_output_feature_dump {
595 };
596 
597 /** \brief NAT44 interface with output feature details response
598  @param context - sender context, to match reply w/ request
599  @param is_inside - 1 if inside, 0 if outside
600  @param sw_if_index - software index of the interface
601 */
602 define nat44_interface_output_feature_details {
606 };
607 
608 /** \brief Add/delete NAT44 static mapping
609  @param client_index - opaque cookie to identify the sender
610  @param context - sender context, to match reply w/ request
611  @param is_add - 1 if add, 0 if delete
612  @param addr_only - 1 if address only mapping
613  @param local_ip_address - local IPv4 address
614  @param external_ip_address - external IPv4 address
615  @param protocol - IP protocol, used only if addr_only=0
616  @param local_port - local port number, used only if addr_only=0
617  @param external_port - external port number, used only if addr_only=0
618  @param external_sw_if_index - external interface (if set
619  external_ip_address is ignored, ~0 means not
620  used)
621  @param vfr_id - VRF ID
622  @param twice_nat - if 1 translate external host address and port, only for
623  1:1 NAPT (addr_only must be 0)
624  @param self_twice_nat - if 1 translate external host address and port
625  whenever external host address equals
626  local address of internal host
627  @param out2in_only - if 1 rule match only out2in direction
628  @param tag - opaque string tag
629 */
630 autoreply define nat44_add_del_static_mapping {
635  u8 local_ip_address[4];
636  u8 external_ip_address[4];
645  u8 tag[64];
646 };
647 
648 /** \brief Dump NAT44 static mappings
649  @param client_index - opaque cookie to identify the sender
650  @param context - sender context, to match reply w/ request
651 */
652 define nat44_static_mapping_dump {
655 };
656 
657 /** \brief NAT44 static mapping details response
658  @param context - sender context, to match reply w/ request
659  @param addr_only - 1 if address only mapping
660  @param local_ip_address - local IPv4 address
661  @param external_ip_address - external IPv4 address
662  @param protocol - IP protocol, valid only if addr_only=0
663  @param local_port - local port number, valid only if addr_only=0
664  @param external_port - external port number, valid only if addr_only=0
665  @param external_sw_if_index - external interface
666  @param vfr_id - VRF ID
667  @param twice_nat - if 1 translate external host address and port
668  @param self_twice_nat - if 1 translate external host address and port
669  whenever external host address equals
670  local address of internal host
671  @param out2in_only - if 1 rule match only out2in direction
672  @param tag - opaque string tag
673 */
674 define nat44_static_mapping_details {
677  u8 local_ip_address[4];
678  u8 external_ip_address[4];
687  u8 tag[64];
688 };
689 
690 /** \brief Add/delete NAT44 identity mapping
691  @param client_index - opaque cookie to identify the sender
692  @param context - sender context, to match reply w/ request
693  @param is_add - 1 if add, 0 if delete
694  @param addr_only - 1 if address only mapping
695  @param ip_address - IPv4 address
696  @param protocol - IP protocol
697  @param port - port number
698  @param sw_if_index - interface (if set ip_address is ignored, ~0 means not
699  used)
700  @param vfr_id - VRF ID (if ~0 use default VRF)
701  @param tag - opaque string tag
702 */
703 autoreply define nat44_add_del_identity_mapping {
713  u8 tag[64];
714 };
715 
716 /** \brief Dump NAT44 identity mappings
717  @param client_index - opaque cookie to identify the sender
718  @param context - sender context, to match reply w/ request
719 */
720 define nat44_identity_mapping_dump {
723 };
724 
725 /** \brief NAT44 identity mapping details response
726  @param context - sender context, to match reply w/ request
727  @param addr_only - 1 if address only mapping
728  @param ip_address - IPv4 address
729  @param protocol - IP protocol
730  @param port - port number
731  @param sw_if_index - interface
732  @param vfr_id - VRF ID
733  @param tag - opaque string tag
734 */
735 define nat44_identity_mapping_details {
743  u8 tag[64];
744 };
745 
746 /** \brief Add/delete NAT44 pool address from specific interfce
747  @param client_index - opaque cookie to identify the sender
748  @param context - sender context, to match reply w/ request
749  @param is_add - 1 if add, 0 if delete
750  @param twice_nat - twice NAT address for extenal hosts
751  @param sw_if_index - software index of the interface
752 */
753 autoreply define nat44_add_del_interface_addr {
759 };
760 
761 /** \brief Dump NAT44 pool addresses interfaces
762  @param client_index - opaque cookie to identify the sender
763  @param context - sender context, to match reply w/ request
764 */
765 define nat44_interface_addr_dump {
768 };
769 
770 /** \brief NAT44 pool addresses interfaces details response
771  @param context - sender context, to match reply w/ request
772  @param sw_if_index - software index of the interface
773  @param twice_nat - twice NAT address for extenal hosts
774 */
775 define nat44_interface_addr_details {
779 };
780 
781 /** \brief Dump NAT44 users
782  @param client_index - opaque cookie to identify the sender
783  @param context - sender context, to match reply w/ request
784 */
785 define nat44_user_dump {
788 };
789 
790 /** \brief NAT44 users response
791  @param context - sender context, to match reply w/ request
792  @vrf_id - VRF ID
793  @param ip_adress - IPv4 address
794  @param nsessions - number of dynamic sessions
795  @param nstaticsessions - number of static sessions
796 */
797 define nat44_user_details {
803 };
804 
805 /** \brief NAT44 user's sessions
806  @param client_index - opaque cookie to identify the sender
807  @param context - sender context, to match reply w/ request
808  @param is_ip4 - 1 if address type is IPv4
809  @param user_ip - IP address of the user to dump
810  @param vrf_id - VRF_ID
811 */
812 define nat44_user_session_dump {
817 };
818 
819 /** \brief NAT44 user's sessions response
820  @param context - sender context, to match reply w/ request
821  @param outside_ip_address - outside IPv4 address
822  @param outside_port - outside port
823  @param inside_ip_address - inside IPv4 address
824  @param inside_port - inside port
825  @param protocol - protocol
826  @param is_static - 1 if session is static
827  @param last_heard - last heard timer
828  @param total_bytes - count of bytes sent through session
829  @param total_pkts - count of pakets sent through session
830  @param is_twicenat - 1 if session is twice-nat
831  @param ext_host_valid - 1 if external host address and port are valid
832  @param ext_host_address - external host IPv4 address
833  @param ext_host_port - external host port
834  @param ext_host_nat_address - post-NAT external host IPv4 address (valid
835  only if twice-nat session)
836  @param ext_host_nat_port - post-NAT external host port (valid only if
837  twice-nat session)
838 */
839 define nat44_user_session_details {
841  u8 outside_ip_address[4];
843  u8 inside_ip_address[4];
852  u8 ext_host_address[4];
854  u8 ext_host_nat_address[4];
856 };
857 
858 /** \brief NAT44 load-balancing address and port pair
859  @param addr - IPv4 address of the internal node
860  @param port - L4 port number of the internal node
861  @param probability - probability of the internal node to be randomly matched
862 */
863 typeonly manual_endian define nat44_lb_addr_port {
864  u8 addr[4];
868 };
869 
870 /** \brief Add/delete NAT44 load-balancing static mapping rule
871  @param client_index - opaque cookie to identify the sender
872  @param context - sender context, to match reply w/ request
873  @param is_add - 1 if add, 0 if delete
874  @param external_addr - external IPv4 address of the service
875  @param external_port - external L4 port number of the service
876  @param protocol - IP protocol number of the service
877  @param twice_nat - if 1 translate external host address and port
878  @param self_twice_nat - if 1 translate external host address and port
879  whenever external host address equals
880  local address of internal host
881  @param out2in_only - if 1 rule match only out2in direction
882  @param tag - opaque string tag
883  @param affinity - if 0 disabled, otherwise client IP affinity sticky time
884  in seconds
885  @param local_num - number of local network nodes
886  @param locals - local network nodes
887 */
888 autoreply manual_endian define nat44_add_del_lb_static_mapping {
892  u8 external_addr[4];
898  u8 tag[64];
901  vl_api_nat44_lb_addr_port_t locals[local_num];
902 };
903 
904 /** \brief Add/delete NAT44 load-balancing static mapping rule backend
905  @param client_index - opaque cookie to identify the sender
906  @param context - sender context, to match reply w/ request
907  @param is_add - 1 if add, 0 if delete
908  @param external_addr - external IPv4 address of the service
909  @param external_port - external L4 port number of the service
910  @param protocol - IP protocol number of the service
911  @param local - local network node
912 */
917  u8 external_addr[4];
921 };
922 
923 /** \brief Dump NAT44 load-balancing static mapping rules
924  @param client_index - opaque cookie to identify the sender
925  @param context - sender context, to match reply w/ request
926 */
927 define nat44_lb_static_mapping_dump {
930 };
931 
932 /** \brief NAT44 load-balancing static mapping rule details response
933  @param context - sender context, to match reply w/ request
934  @param is_add - 1 if add, 0 if delete
935  @param external_addr - external IPv4 address of the service
936  @param external_port - external L4 port number of the service
937  @param protocol - IP protocol number of the service
938  @param twice_nat - if 1 translate external host address and port
939  @param self_twice_nat - if 1 translate external host address and port
940  whenever external host address equals
941  local address of internal host
942  @param out2in_only - if 1 rule match only out2in direction
943  @param tag - opaque string tag
944  @param affinity - if 0 disabled, otherwise client IP affinity sticky time
945  in seconds
946  @param local_num - number of local network nodes
947  @param locals - local network nodes
948 */
949 manual_endian define nat44_lb_static_mapping_details {
951  u8 external_addr[4];
957  u8 tag[64];
960  vl_api_nat44_lb_addr_port_t locals[local_num];
961 };
962 
963 /** \brief Delete NAT44 session
964  @param client_index - opaque cookie to identify the sender
965  @param context - sender context, to match reply w/ request
966  @param is_in - 1 if inside network address and port pair, 0 if outside
967  @param ip_address - IPv4 address
968  @param protocol - IP protocol
969  @param port - port number
970  @param vfr_id - VRF ID
971  @param ext_host_valid - 1 if external host address and port are valid
972  @param ext_host_address - external host IPv4 address
973  @param ext_host_port - external host port
974 */
975 autoreply define nat44_del_session {
984  u8 ext_host_address[4];
986 };
987 
988 /** \brief Enable/disable forwarding for NAT44
989  Forward packets which don't match existing translation
990  or static mapping instead of dropping them.
991  @param client_index - opaque cookie to identify the sender
992  @param context - sender context, to match reply w/ request
993  @param enable - 0 for enable, 1 for disable
994 */
995 autoreply define nat44_forwarding_enable_disable {
999 };
1000 
1001 /** \brief Check if forwarding is enabled or disabled
1002  @param client_index - opaque cookie to identify the sender
1003  @param context - sender context, to match reply w/ request
1004 */
1005 define nat44_forwarding_is_enabled {
1008 };
1009 
1010 /** \brief Response to check if forwarding is enabled or disabled
1011  @param context - sender context, to match reply w/ request
1012  @param enabled - 1 if enabled, 0 if disabled
1013 */
1014 define nat44_forwarding_is_enabled_reply {
1017 };
1018 
1019 
1020 /*
1021  * Deterministic NAT (CGN) APIs
1022  */
1023 
1024 /** \brief Add/delete NAT deterministic mapping
1025  @param client_index - opaque cookie to identify the sender
1026  @param context - sender context, to match reply w/ request
1027  @param is_add - 1 if add, 0 if delete
1028  @param is_nat44 - 1 if NAT44
1029  @param in_addr - inside IP address
1030  @param in_plen - inside IP address prefix length
1031  @param out_addr - outside IPv4 address
1032  @param out_addr - outside IPv4 address prefix length
1033 */
1034 autoreply define nat_det_add_del_map {
1040  u8 in_addr[16];
1042  u8 out_addr[4];
1044 };
1045 
1046 /** \brief Get outside address and port range from inside address
1047  @param client_index - opaque cookie to identify the sender
1048  @param context - sender context, to match reply w/ request
1049  @param is_nat44 - 1 if NAT44
1050  @param in_addr - inside IP address
1051 */
1052 define nat_det_forward {
1056  u8 in_addr[16];
1057 };
1058 
1059 /** \brief Get outside address and port range from inside address
1060  @param context - sender context, to match reply w/ request
1061  @param retval - return code
1062  @param out_port_lo - outside port range start
1063  @param out_port_hi - outside port range end
1064  @param out_addr - outside IPv4 address
1065 */
1066 define nat_det_forward_reply {
1071  u8 out_addr[4];
1072 };
1073 
1074 /** \brief Get inside address from outside address and port
1075  @param client_index - opaque cookie to identify the sender
1076  @param context - sender context, to match reply w/ request
1077  @param out_port - outside port
1078  @param out_addr - outside IPv4 address
1079 */
1080 define nat_det_reverse {
1084  u8 out_addr[4];
1085 };
1086 
1087 /** \brief Get inside address from outside address and port reply
1088  @param context - sender context, to match reply w/ request
1089  @param retval - return code
1090  @param is_nat44 - 1 if NAT44
1091  @param in_addr - inside IP address
1092 */
1093 define nat_det_reverse_reply {
1097  u8 in_addr[16];
1098 };
1099 
1100 /** \brief Dump NAT deterministic mappings
1101  @param client_index - opaque cookie to identify the sender
1102  @param context - sender context, to match reply w/ request
1103 */
1104 define nat_det_map_dump {
1107 };
1108 
1109 /** \brief NAT users response
1110  @param context - sender context, to match reply w/ request
1111  @param is_nat44 - 1 if NAT44
1112  @param in_addr - inside IP address
1113  @param in_plen - inside IP address prefix length
1114  @param out_addr - outside IPv4 address
1115  @param out_plen - outside IPv4 address prefix length
1116  @param sharing_ratio - outside to inside address sharing ratio
1117  @param ports_per_host - number of ports available to a host
1118  @param ses_num - number of sessions belonging to this mapping
1119 */
1120 define nat_det_map_details {
1123  u8 in_addr[16];
1125  u8 out_addr[4];
1130 };
1131 
1132 /** \brief Close deterministic NAT session by outside address and port
1133  @param client_index - opaque cookie to identify the sender
1134  @param context - sender context, to match reply w/ request
1135  @param out_addr - outside IPv4 address
1136  @param out_port - outside port
1137  @param ext_addr - external host IPv4 address
1138  @param ext_port - external host port
1139 */
1140 autoreply define nat_det_close_session_out {
1143  u8 out_addr[4];
1145  u8 ext_addr[4];
1147 };
1148 
1149 /** \brief Close deterministic NAT session by inside address and port
1150  @param client_index - opaque cookie to identify the sender
1151  @param context - sender context, to match reply w/ request
1152  @param is_nat44 - 1 if NAT44
1153  @param in_addr - inside IP address
1154  @param in_port - inside port
1155  @param ext_addr - external host IP address
1156  @param ext_port - external host port
1157 */
1158 autoreply define nat_det_close_session_in {
1162  u8 in_addr[16];
1164  u8 ext_addr[16];
1166 };
1167 
1168 /** \brief Dump determinstic NAT sessions
1169  @param client_index - opaque cookie to identify the sender
1170  @param context - sender context, to match reply w/ request
1171  @param is_nat44 - 1 if NAT44
1172  @param user_addr - address of an inside user whose sessions to dump
1173 */
1174 define nat_det_session_dump {
1178  u8 user_addr[16];
1179 };
1180 
1181 /** \brief Deterministic NAT sessions reply
1182  @param context - sender context, to match reply w/ request
1183  @param in_port - inside port
1184  @param ext_addr - external host address
1185  @param ext_port - external host port
1186  @param out_port - outside NAT port
1187  @param state - session state
1188  @param expire - session expiration timestamp
1189 */
1190 define nat_det_session_details {
1193  u8 ext_addr[4];
1198 };
1199 
1200 /*
1201  * NAT64 APIs
1202  */
1203 
1204 /** \brief Add/delete address range to NAT64 pool
1205  @param client_index - opaque cookie to identify the sender
1206  @param context - sender context, to match reply w/ request
1207  @param start_addr - start address of the range
1208  @param end_addr - end address of the range
1209  @param vrf_id - VRF id of tenant, ~0 means independent of VRF
1210  @param is_add - 1 if add, 0 if delete
1211 */
1212 autoreply define nat64_add_del_pool_addr_range {
1215  u8 start_addr[4];
1216  u8 end_addr[4];
1219 };
1220 
1221 /** \brief Dump NAT64 pool addresses
1222  @param client_index - opaque cookie to identify the sender
1223  @param context - sender context, to match reply w/ request
1224 */
1225 define nat64_pool_addr_dump {
1228 };
1229 
1230 /** \brief NAT64 pool address details response
1231  @param context - sender context, to match reply w/ request
1232  @param address - IPv4 address
1233  @param vfr_id - VRF id of tenant, ~0 means independent of VRF
1234 */
1235 define nat64_pool_addr_details {
1239 };
1240 
1241 /** \brief Enable/disable NAT64 feature on the interface
1242  @param client_index - opaque cookie to identify the sender
1243  @param context - sender context, to match reply w/ request
1244  @param sw_if_index - index of the interface
1245  @param is_inside - 1 if inside, 0 if outside
1246  @param is_add - 1 if add, 0 if delete
1247 */
1248 autoreply define nat64_add_del_interface {
1254 };
1255 
1256 /** \brief Dump interfaces with NAT64 feature
1257  @param client_index - opaque cookie to identify the sender
1258  @param context - sender context, to match reply w/ request
1259 */
1260 define nat64_interface_dump {
1263 };
1264 
1265 /** \brief NAT64 interface details response
1266  @param context - sender context, to match reply w/ request
1267  @param is_inside - 1 if inside, 0 if outside
1268  @param sw_if_index - index of the interface
1269 */
1270 define nat64_interface_details {
1274 };
1275 
1276 /** \brief Add/delete NAT64 static BIB entry
1277  @param client_index - opaque cookie to identify the sender
1278  @param context - sender context, to match reply w/ request
1279  @param i_addr - inside IPv6 address
1280  @param o_addr - outside IPv4 address
1281  @param i_port - inside port number
1282  @param o_port - outside port number
1283  @param vrf_id - VRF id of tenant
1284  @param proto - protocol number
1285  @param is_add - 1 if add, 0 if delete
1286 */
1287  autoreply define nat64_add_del_static_bib {
1290  u8 i_addr[16];
1291  u8 o_addr[4];
1297 };
1298 
1299 /** \brief Dump NAT64 BIB
1300  @param client_index - opaque cookie to identify the sender
1301  @param context - sender context, to match reply w/ request
1302  @param proto - protocol of the BIB: 255 - all BIBs
1303  6 - TCP BIB
1304  17 - UDP BIB
1305  1/58 - ICMP BIB
1306  otherwise - "unknown" protocol BIB
1307 */
1308 define nat64_bib_dump {
1312 };
1313 
1314 /** \brief NAT64 BIB details response
1315  @param context - sender context, to match reply w/ request
1316  @param i_addr - inside IPv6 address
1317  @param o_addr - outside IPv4 address
1318  @param i_port - inside port number
1319  @param o_port - outside port number
1320  @param vrf_id - VRF id of tenant
1321  @param proto - protocol number
1322  @param is_static - 1 if static BIB entry, 0 if dynamic
1323  @param ses_num - number of sessions associated with the BIB entry
1324 */
1325 define nat64_bib_details {
1327  u8 i_addr[16];
1328  u8 o_addr[4];
1335 };
1336 
1337 /** \brief Dump NAT64 session table
1338  @param client_index - opaque cookie to identify the sender
1339  @param context - sender context, to match reply w/ request
1340  @param proto - protocol of the session table: 255 - all STs
1341  6 - TCP ST
1342  17 - UDP ST
1343  1/58 - ICMP ST
1344  otherwise - "unknown" proto ST
1345 */
1346 define nat64_st_dump {
1350 };
1351 
1352 /** \brief NAT64 session table details response
1353  @param context - sender context, to match reply w/ request
1354  @param il_addr - inside IPv6 address of the local host
1355  @param ol_addr - outside IPv4 address of the local host
1356  @param il_port - inside port number id of the local host/inside ICMP id
1357  @param ol_port - outside port number of the local host/outside ICMP id
1358  @param il_addr - inside IPv6 address of the remote host
1359  @param ol_addr - outside IPv4 address of the remote host
1360  @param l_port - port number of the remote host (not used for ICMP)
1361  @param vrf_id - VRF id of tenant
1362  @param proto - protocol number
1363 */
1364 define nat64_st_details {
1366  u8 il_addr[16];
1367  u8 ol_addr[4];
1370  u8 ir_addr[16];
1371  u8 or_addr[4];
1375 };
1376 
1377 /** \brief Add/del NAT64 prefix
1378  @param client_index - opaque cookie to identify the sender
1379  @param context - sender context, to match reply w/ request
1380  @param prefix - NAT64 prefix
1381  @param prefix - NAT64 prefix length
1382  @param vrf_id - VRF id of tenant
1383  @param is_add - 1 if add, 0 if delete
1384 */
1385 autoreply define nat64_add_del_prefix {
1388  u8 prefix[16];
1392 };
1393 
1394 /** \brief Dump NAT64 prefix
1395  @param client_index - opaque cookie to identify the sender
1396  @param context - sender context, to match reply w/ request
1397 */
1398 define nat64_prefix_dump {
1401 };
1402 
1403 /** \brief Dump NAT64 prefix details response
1404  @param context - sender context, to match reply w/ request
1405  @param prefix - NAT64 prefix
1406  @param prefix - NAT64 prefix length
1407  @param vrf_id - VRF id of tenant
1408 */
1409 define nat64_prefix_details {
1411  u8 prefix[16];
1414 };
1415 
1416 /** \brief Add/delete NAT64 pool address from specific interfce
1417  @param client_index - opaque cookie to identify the sender
1418  @param context - sender context, to match reply w/ request
1419  @param is_add - 1 if add, 0 if delete
1420  @param sw_if_index - software index of the interface
1421 */
1422 autoreply define nat64_add_del_interface_addr {
1428 };
1429 
1430 
1431 /*
1432  * DS-Lite APIs
1433  */
1434 
1435 /** \brief Add/delete address range to DS-Lite pool
1436  @param client_index - opaque cookie to identify the sender
1437  @param context - sender context, to match reply w/ request
1438  @param start_addr - start address of the range
1439  @param end_addr - end address of the range
1440  @param is_add - 1 if add, 0 if delete
1441 */
1442 autoreply define dslite_add_del_pool_addr_range {
1445  u8 start_addr[4];
1446  u8 end_addr[4];
1448 };
1449 
1450 /** \brief Dump DS-Lite addresses
1451  @param client_index - opaque cookie to identify the sender
1452  @param context - sender context, to match reply w/ request
1453 */
1454 define dslite_address_dump {
1457 };
1458 
1459 /** \brief DS-Lite address details response
1460  @param context - sender context, to match reply w/ request
1461  @param ip_address - IPv4 address
1462 */
1463 define dslite_address_details {
1466 };
1467 
1468 /** \brief Set AFTR IPv6 and IPv4 addresses
1469  @param client_index - opaque cookie to identify the sender
1470  @param context - sender context, to match reply w/ request
1471  @param ip4_addr - IPv4 address
1472  @param ip6_addr - IP64 address
1473 */
1474 autoreply define dslite_set_aftr_addr {
1477  u8 ip4_addr[4];
1478  u8 ip6_addr[16];
1479 };
1480 
1481 /** \brief Get AFTR IPv6 and IPv4 addresses
1482  @param client_index - opaque cookie to identify the sender
1483  @param context - sender context, to match reply w/ request
1484 */
1485 define dslite_get_aftr_addr {
1488 };
1489 
1490 /** \brief Response to get AFTR IPv6 and IPv4 addresses
1491  @param context - sender context, to match reply w/ request
1492  @param retval - return code
1493  @param ip4_addr - IPv4 address
1494  @param ip6_addr - IP64 address
1495 */
1496 define dslite_get_aftr_addr_reply {
1499  u8 ip4_addr[4];
1500  u8 ip6_addr[16];
1501 };
1502 
1503 /** \brief Set B4 IPv6 and IPv4 addresses
1504  @param client_index - opaque cookie to identify the sender
1505  @param context - sender context, to match reply w/ request
1506  @param ip4_addr - IPv4 address
1507  @param ip6_addr - IP64 address
1508 */
1509 autoreply define dslite_set_b4_addr {
1512  u8 ip4_addr[4];
1513  u8 ip6_addr[16];
1514 };
1515 
1516 /** \brief Get B4 IPv6 and IPv4 addresses
1517  @param client_index - opaque cookie to identify the sender
1518  @param context - sender context, to match reply w/ request
1519 */
1520 define dslite_get_b4_addr {
1523 };
1524 
1525 /** \brief Response to get B4 IPv6 and IPv4 addresses
1526  @param context - sender context, to match reply w/ request
1527  @param retval - return code
1528  @param ip4_addr - IPv4 address
1529  @param ip6_addr - IP64 address
1530 */
1531 define dslite_get_b4_addr_reply {
1534  u8 ip4_addr[4];
1535  u8 ip6_addr[16];
1536 };
1537 
1538 /*
1539  * NAT66 APIs
1540  */
1541 /** \brief Enable/disable NAT66 feature on the interface
1542  @param client_index - opaque cookie to identify the sender
1543  @param context - sender context, to match reply w/ request
1544  @param is_add - 1 if add, 0 if delete
1545  @param is_inside - 1 if inside, 0 if outside
1546  @param sw_if_index - software index of the interface
1547 */
1548 autoreply define nat66_add_del_interface {
1554 };
1555 
1556 /** \brief Dump interfaces with NAT66 feature
1557  @param client_index - opaque cookie to identify the sender
1558  @param context - sender context, to match reply w/ request
1559 */
1560 define nat66_interface_dump {
1563 };
1564 
1565 /** \brief NAT66 interface details response
1566  @param context - sender context, to match reply w/ request
1567  @param is_inside - 1 if inside, 0 if outside
1568  @param sw_if_index - software index of the interface
1569 */
1570 define nat66_interface_details {
1574 };
1575 
1576 /** \brief Add/delete 1:1 NAT66
1577  @param client_index - opaque cookie to identify the sender
1578  @param context - sender context, to match reply w/ request
1579  @param is_add - 1 if add, 0 if delete
1580  @param local_ip_address - local IPv6 address
1581  @param external_ip_address - external IPv6 address
1582  @param vrf_id - VRF id of tenant
1583 */
1584 autoreply define nat66_add_del_static_mapping {
1588  u8 local_ip_address[16];
1589  u8 external_ip_address[16];
1591 };
1592 
1593 /** \brief Dump NAT66 static mappings
1594  @param client_index - opaque cookie to identify the sender
1595  @param context - sender context, to match reply w/ request
1596 */
1597 define nat66_static_mapping_dump {
1600 };
1601 
1602 /** \brief NAT66 static mapping details response
1603  @param context - sender context, to match reply w/ request
1604  @param local_ip_address - local IPv6 address
1605  @param external_ip_address - external IPv6 address
1606  @param vrf_id - VRF id of tenant
1607  @param total_bytes - count of bytes sent through static mapping
1608  @param total_pkts - count of pakets sent through static mapping
1609 */
1610 define nat66_static_mapping_details {
1612  u8 local_ip_address[16];
1613  u8 external_ip_address[16];
1617 };
typedef address
Definition: ip_types.api:30
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:453
vl_api_ip4_address_t ip_address
Definition: nat.api:446
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:1159
int nat_ha_resync(u32 client_index, u32 pid, nat_ha_resync_event_cb_t event_callback)
Resync HA (resend existing sessions to new failover)
NAT44 load-balancing address and port pair.
Definition: nat.api:863
option version
Definition: nat.api:16
unsigned int u32
Definition: types.h:88
service
Definition: nat.api:488
unsigned short u16
Definition: types.h:57
void nat_ha_get_listener(ip4_address_t *addr, u16 *port, u32 *path_mtu)
Get HA listener/local configuration.
Definition: nat_ha.c:378
void nat_ha_flush(u8 is_resync)
Flush the current HA data (for testing)
Definition: nat_ha.c:674
u8 name[64]
Definition: memclnt.api:152
u8 vl_api_ip4_address_t[4]
Definition: ip_types_api.h:31
vl_api_ip4_address_t ip_address
Definition: nat.api:381
int nat64_add_del_prefix(ip6_address_t *prefix, u8 plen, u32 vrf_id, u8 is_add)
Add/delete NAT64 prefix.
Definition: nat64.c:1002
int nat_ha_set_listener(ip4_address_t *addr, u16 port, u32 path_mtu)
Set HA listener (local settings)
Definition: nat_ha.c:345
signed int i32
Definition: types.h:77
int nat_ha_set_failover(ip4_address_t *addr, u16 port, u32 session_refresh_interval)
Set HA failover (remote settings)
Definition: nat_ha.c:388
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:3935
typedef prefix
Definition: ip_types.api:35
void nat_ha_get_failover(ip4_address_t *addr, u16 *port, u32 *session_refresh_interval)
Get HA failover/remote settings.
Definition: nat_ha.c:403
vl_api_ip4_address_t ip_address
Definition: nat.api:397
vl_api_address_t ip_address
Definition: ip.api:129
vl_api_nat44_lb_addr_port_t local
Definition: nat.api:920
int nat44_lb_static_mapping_add_del_local(ip4_address_t e_addr, u16 e_port, ip4_address_t l_addr, u16 l_port, snat_protocol_t proto, u32 vrf_id, u8 probability, u8 is_add)
Definition: nat.c:1435
vl_api_ip4_address_t ip_address
Definition: nat.api:421