vppapigen: remove support for legacy typedefs
[vpp.git] / src / plugins / nat / nat.api
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 = "5.1.0";
17 import "vnet/ip/ip_types.api";
18 import "vnet/interface_types.api";
19
20 /**
21  * @file nat.api
22  * @brief VPP control-plane API messages.
23  *
24  * This file defines VPP control-plane API messages which are generally
25  * called through a shared memory interface.
26  */
27
28 /*
29  * Common NAT plugin APIs
30  */
31
32 enum nat_config_flags : u8
33 {
34   NAT_IS_NONE = 0x00,
35   NAT_IS_TWICE_NAT = 0x01,
36   NAT_IS_SELF_TWICE_NAT = 0x02,
37   NAT_IS_OUT2IN_ONLY = 0x04,
38   NAT_IS_ADDR_ONLY = 0x08,
39   NAT_IS_OUTSIDE = 0x10,
40   NAT_IS_INSIDE = 0x20,
41   NAT_IS_STATIC = 0x40,
42   NAT_IS_EXT_HOST_VALID = 0x80,
43 };
44
45 /** \brief Control ping from client to api server request
46     @param client_index - opaque cookie to identify the sender
47     @param context - sender context, to match reply w/ request
48 */
49 define nat_control_ping
50 {
51   u32 client_index;
52   u32 context;
53 };
54
55 /** \brief Control ping from the client to the server response
56     @param client_index - opaque cookie to identify the sender
57     @param context - sender context, to match reply w/ request
58     @param retval - return code for the request
59     @param vpe_pid - the pid of the vpe, returned by the server
60 */
61 define nat_control_ping_reply
62 {
63   u32 context;
64   i32 retval;
65   u32 client_index;
66   u32 vpe_pid;
67 };
68
69 /** \brief Show NAT plugin startup config
70     @param client_index - opaque cookie to identify the sender
71     @param context - sender context, to match reply w/ request
72 */
73 define nat_show_config
74 {
75   u32 client_index;
76   u32 context;
77 };
78
79 /** \brief Show NAT plugin startup config reply
80     @param context - sender context, to match reply w/ request
81     @param retval - return code for the request
82     @param static_mapping_only - if true dynamic translations disabled
83     @param static_mapping_connection_tracking - if true create session data
84     @param deterministic - if true deterministic mapping
85     @param endpoint_dependent - if true endpoint-dependent mode
86     @param out2in_dpo - if true out2in dpo mode
87     @param dslite_ce - if true DS-Lite is CE/B4 element, if false AFTR elemet
88     @param translation_buckets - number of translation hash buckets
89     @param translation_memory_size - translation hash memory size
90     @param user_buckets - number of user hash buckets
91     @param user_memory_size - user hash memory size
92     @param max_translations_per_user - maximum number of translations per user
93     @param outside_vrf_id - outside VRF id
94     @param inside_vrf_id - default inside VRF id
95     @param nat64_bib_buckets - number of NAT64 BIB hash buckets
96     @param nat64_bib_memory_size - memory size of NAT64 BIB hash
97     @param nat64_st_buckets - number of NAT64 session table hash buckets
98     @param nat64_st_memory_size - memory size of NAT64 session table hash
99 */
100 define nat_show_config_reply
101 {
102   u32 context;
103   i32 retval;
104   bool static_mapping_only;
105   bool static_mapping_connection_tracking;
106   bool deterministic;
107   bool endpoint_dependent;
108   bool out2in_dpo;
109   bool dslite_ce;
110   u32 translation_buckets;
111   u32 translation_memory_size;
112   u32 user_buckets;
113   u32 user_memory_size;
114   u32 max_translations_per_user;
115   u32 outside_vrf_id;
116   u32 inside_vrf_id;
117   u32 nat64_bib_buckets;
118   u32 nat64_bib_memory_size;
119   u32 nat64_st_buckets;
120   u32 nat64_st_memory_size;
121 };
122
123 enum nat_log_level : u8
124 {
125   NAT_LOG_NONE = 0x00,
126   NAT_LOG_ERROR = 0x01,
127   NAT_LOG_WARNING = 0x02,
128   NAT_LOG_NOTICE = 0x03,
129   NAT_LOG_INFO = 0x04,
130   NAT_LOG_DEBUG = 0x05,
131 };
132
133 /** \brief Set NAT logging level
134     @param client_index - opaque cookie to identify the sender
135     @param context - sender context, to match reply w/ request
136     @param log_level - logging level
137 */
138 autoreply define nat_set_log_level {
139   u32 client_index;
140   u32 context;
141   vl_api_nat_log_level_t log_level;
142 };
143
144 /** \brief Set NAT workers
145     @param client_index - opaque cookie to identify the sender
146     @param context - sender context, to match reply w/ request
147     @param worker_mask - NAT workers mask
148 */
149 autoreply define nat_set_workers {
150   u32 client_index;
151   u32 context;
152   u64 worker_mask;
153 };
154
155 /** \brief Dump NAT workers
156     @param client_index - opaque cookie to identify the sender
157     @param context - sender context, to match reply w/ request
158 */
159 define nat_worker_dump {
160   u32 client_index;
161   u32 context;
162 };
163
164 /** \brief NAT workers details response
165     @param context - sender context, to match reply w/ request
166     @param worker_index - worker index
167     @param lcore_id - lcore ID
168     @param name - worker name
169 */
170 define nat_worker_details {
171   u32 context;
172   u32 worker_index;
173   u32 lcore_id;
174   string name;
175 };
176
177 /** \brief Enable/disable NAT IPFIX logging
178     @param client_index - opaque cookie to identify the sender
179     @param context - sender context, to match reply w/ request
180     @param domain_id - observation domain ID
181     @param src_port - source port number
182     @param enable - true if enable, false if disable
183 */
184 autoreply define nat_ipfix_enable_disable {
185   u32 client_index;
186   u32 context;
187   u32 domain_id;
188   u16 src_port;
189   bool enable;
190 };
191
192 /** \brief Set NAT virtual fragmentation reassembly
193     @param client_index - opaque cookie to identify the sender
194     @param context - sender context, to match reply w/ request
195     @param timeout - reassembly timeout
196     @param max_reass - maximum number of concurrent reassemblies
197     @param max_frag - maximum number of fragmets per reassembly
198     @param drop_frag - if 0 translate fragments, otherwise drop fragments
199     @param is_ip6 - true if IPv6, false if IPv4
200 */
201 autoreply define nat_set_reass {
202   u32 client_index;
203   u32 context;
204   u32 timeout;
205   u16 max_reass;
206   u8  max_frag;
207   u8  drop_frag;
208   bool  is_ip6;
209 };
210
211 /** \brief Get NAT virtual fragmentation reassembly configuration
212     @param client_index - opaque cookie to identify the sender
213     @param context - sender context, to match reply w/ request
214 */
215 define nat_get_reass {
216   u32 client_index;
217   u32 context;
218 };
219
220 /** \brief Get NAT virtual fragmentation reassembly configuration reply
221     @param context - sender context, to match reply w/ request
222     @param retval - return code
223     @param ip4_timeout - reassembly timeout
224     @param ip4_max_reass - maximum number of concurrent reassemblies
225     @param ip4_max_frag - maximum number of fragmets per reassembly
226     @param ip4_drop_frag - if 0 translate fragments, otherwise drop fragments
227     @param ip6_timeout - reassembly timeout
228     @param ip6_max_reass - maximum number of concurrent reassemblies
229     @param ip6_max_frag - maximum number of fragmets per reassembly
230     @param ip6_drop_frag - if 0 translate fragments, otherwise drop fragments
231 */
232 define nat_get_reass_reply {
233   u32 context;
234   i32 retval;
235   u32 ip4_timeout;
236   u16 ip4_max_reass;
237   u8  ip4_max_frag;
238   u8  ip4_drop_frag;
239   u32 ip6_timeout;
240   u16 ip6_max_reass;
241   u8  ip6_max_frag;
242   u8  ip6_drop_frag;
243 };
244
245 /** \brief Dump NAT virtual fragmentation reassemblies
246     @param client_index - opaque cookie to identify the sender
247     @param context - sender context, to match reply w/ request
248 */
249 define nat_reass_dump {
250   u32 client_index;
251   u32 context;
252 };
253
254 /** \brief NAT virtual fragmentation reassemblies response
255     @param context - sender context, to match reply w/ request
256     @param src_addr - source IPv4 address
257     @param dst_addr - destination IPv4 address
258     @param frag_id - fragment ID
259     @param proto - protocol
260     @param frag_n - number of cached fragments
261 */
262 define nat_reass_details {
263   u32 context;
264   vl_api_address_t src_addr;
265   vl_api_address_t dst_addr;
266   u32 frag_id;
267   u8 proto;
268   u8 frag_n;
269 };
270
271 /** \brief Set values of timeouts for NAT sessions (seconds)
272     @param client_index - opaque cookie to identify the sender
273     @param context - sender context, to match reply w/ request
274     @param udp - UDP timeout (default 300sec)
275     @param tcp_established - TCP established timeout (default 7440sec)
276     @param tcp_transitory - TCP transitory timeout (default 240sec)
277     @param icmp - ICMP timeout (default 60sec)
278 */
279 autoreply define nat_set_timeouts {
280   u32 client_index;
281   u32 context;
282   u32 udp;
283   u32 tcp_established;
284   u32 tcp_transitory;
285   u32 icmp;
286 };
287
288 /** \brief Get values of timeouts for NAT sessions (seconds)
289     @param client_index - opaque cookie to identify the sender
290     @param context - sender context, to match reply w/ request
291 */
292 define nat_get_timeouts {
293   u32 client_index;
294   u32 context;
295 };
296
297 /** \brief Get values of timeouts for NAT sessions reply
298     @param context - sender context, to match reply w/ request
299     @param retval - return code
300     @param udp - UDP timeout
301     @param tcp_established - TCP established timeout
302     @param tcp_transitory - TCP transitory timeout
303     @param icmp - ICMP timeout
304 */
305 define nat_get_timeouts_reply {
306   u32 context;
307   i32 retval;
308   u32 udp;
309   u32 tcp_established;
310   u32 tcp_transitory;
311   u32 icmp;
312 };
313
314 /** \brief Set address and port assignment algorithm
315     @param client_index - opaque cookie to identify the sender
316     @param context - sender context, to match reply w/ request
317     @param alg - address and port assignment algorithm:
318                  0 - default, 1 - MAP-E, 2 - port range
319                  (see nat_addr_and_port_alloc_alg_t in nat.h)
320     @param psid_offset - number of offset bits (valid only for MAP-E alg)
321     @param psid_length - length of PSID (valid only for MAP-E alg)
322     @param psid - Port Set Identifier (PSID) value (valid only for MAP-E alg)
323     @param start_port - beginning of the port range
324     @param end_port - end of the port range
325 */
326 autoreply define nat_set_addr_and_port_alloc_alg {
327   u32 client_index;
328   u32 context;
329   u8 alg;
330   u8 psid_offset;
331   u8 psid_length;
332   u16 psid;
333   u16 start_port;
334   u16 end_port;
335 };
336
337 /** \brief Get address and port assignment algorithm
338     @param client_index - opaque cookie to identify the sender
339     @param context - sender context, to match reply w/ request
340 */
341 define nat_get_addr_and_port_alloc_alg {
342   u32 client_index;
343   u32 context;
344 };
345
346 /** \brief Get address and port assignment algorithm reply
347     @param context - sender context, to match reply w/ request
348     @param retval - return code
349     @param alg - address and port assignment algorithm:
350                  0 - default, 1 - MAP-E, 2 - port range
351                  (see nat_addr_and_port_alloc_alg_t in nat.h)
352     @param psid_offset - number of offset bits (valid only for MAP-E alg)
353     @param psid_length - length of PSID (valid only for MAP-E alg)
354     @param psid - Port Set Identifier (PSID) value (valid only for MAP-E alg)
355     @param start_port - beginning of the port range
356     @param end_port - end of the port range
357 */
358 define nat_get_addr_and_port_alloc_alg_reply {
359   u32 context;
360   i32 retval;
361   u8 alg;
362   u8 psid_offset;
363   u8 psid_length;
364   u16 psid;
365   u16 start_port;
366   u16 end_port;
367 };
368
369 /** \brief Set TCP MSS rewriting configuration
370     @param client_index - opaque cookie to identify the sender
371     @param context - sender context, to match reply w/ request
372     @param mss_value - MSS value to be used for MSS rewriting
373     @param enable - if true enable MSS rewriting feature else disable
374 */
375 autoreply define nat_set_mss_clamping {
376   u32 client_index;
377   u32 context;
378   u16 mss_value;
379   bool enable;
380 };
381
382 /** \brief Get TCP MSS rewriting configuration
383     @param client_index - opaque cookie to identify the sender
384     @param context - sender context, to match reply w/ request
385 */
386 define nat_get_mss_clamping {
387   u32 client_index;
388   u32 context;
389 };
390
391 /** \brief Get TCP MSS rewriting configuration reply
392     @param context - sender context, to match reply w/ request
393     @param retval - return code
394     @param mss_value - MSS value to be used for MSS rewriting
395     @param enable - if true enable MSS rewriting feature else disable
396 */
397 define nat_get_mss_clamping_reply {
398   u32 context;
399   i32 retval;
400   u16 mss_value;
401   bool enable;
402 };
403
404 /** \brief Set HA listener (local settings)
405     @param client_index - opaque cookie to identify the sender
406     @param context - sender context, to match reply w/ request
407     @param ip_address - local IP4 address
408     @param port - local UDP port number
409     @param path_mtu - path MTU between local and failover
410 */
411 autoreply define nat_ha_set_listener {
412   u32 client_index;
413   u32 context;
414   vl_api_ip4_address_t ip_address;
415   u16 port;
416   u32 path_mtu;
417 };
418
419 /** \brief Set HA failover (remote settings)
420     @param client_index - opaque cookie to identify the sender
421     @param context - sender context, to match reply w/ request
422     @param ip_address - failover IP4 address
423     @param port - failvoer UDP port number
424     @param session_refresh_interval - number of seconds after which to send
425                                       session counters refresh
426 */
427 autoreply define nat_ha_set_failover {
428   u32 client_index;
429   u32 context;
430   vl_api_ip4_address_t ip_address;
431   u16 port;
432   u32 session_refresh_interval;
433 };
434
435 /** \brief Get HA listener/local configuration
436     @param client_index - opaque cookie to identify the sender
437     @param context - sender context, to match reply w/ request
438 */
439 define nat_ha_get_listener {
440   u32 client_index;
441   u32 context;
442 };
443
444 /** \brief Get HA listener/local configuration reply
445     @param context - sender context, to match reply w/ request
446     @param retval - return code
447     @param ip_address - local IP4 address
448     @param port - local UDP port number
449     @param path_mtu - Path MTU between local and failover
450 */
451 define nat_ha_get_listener_reply {
452   u32 context;
453   i32 retval;
454   vl_api_ip4_address_t ip_address;
455   u16 port;
456   u32 path_mtu;
457 };
458
459 /** \brief Get HA failover/remote settings
460     @param client_index - opaque cookie to identify the sender
461     @param context - sender context, to match reply w/ request
462 */
463 define nat_ha_get_failover {
464   u32 client_index;
465   u32 context;
466 };
467
468 /** \brief Get HA failover/remote settings reply
469     @param context - sender context, to match reply w/ request
470     @param retval - return code
471     @param ip_address - failover IP4 address
472     @param port - failvoer UDP port number
473     @param session_refresh_interval - number of seconds after which to send
474                                       session counters refresh
475 */
476 define nat_ha_get_failover_reply {
477   u32 context;
478   i32 retval;
479   vl_api_ip4_address_t ip_address;
480   u16 port;
481   u32 session_refresh_interval;
482 };
483
484 /** \brief Flush the current HA data (for testing)
485     @param client_index - opaque cookie to identify the sender
486     @param context - sender context, to match reply w/ request
487 */
488 autoreply define nat_ha_flush {
489   u32 client_index;
490   u32 context;
491 };
492
493 /** \brief Resync HA (resend existing sessions to new failover)
494     @param client_index - opaque cookie to identify the sender
495     @param context - sender context, to match reply w/ request
496     @param want_resync_event - resync completed event sent to the sender via
497                                nat_ha_resync_completed_event API message if
498                                non-zero
499     @param pid - sender's pid
500 */
501 autoreply define nat_ha_resync
502 {
503   u32 client_index;
504   u32 context;
505   u8 want_resync_event;
506   u32 pid;
507 };
508
509 /** \brief Tell client about a HA resync completion event
510     @param client_index - opaque cookie to identify the sender
511     @param pid - client pid registered to receive notification
512     @param missed_count - number of missed (not ACKed) messages
513 */
514 define nat_ha_resync_completed_event
515 {
516   u32 client_index;
517   u32 pid;
518   u32 missed_count;
519 };
520
521 service {
522   rpc nat_ha_resync returns nat_ha_resync_reply events nat_ha_resync_completed_event;
523 };
524
525 /*
526  * NAT44 APIs
527  */
528
529 /** \brief Add/del NAT44 address range
530     @param client_index - opaque cookie to identify the sender
531     @param context - sender context, to match reply w/ request
532     @param first_ip_address - first IPv4 address
533     @param last_ip_address - last IPv4 address
534     @param vrf_id - VRF id of tenant, ~0 means independent of VRF
535     @param is_add - true if add, false if delete
536     @param flags - flag NAT_IS_TWICE_NAT if NAT address range for external hosts
537
538 */
539 autoreply define nat44_add_del_address_range {
540   u32 client_index;
541   u32 context;
542   vl_api_ip4_address_t first_ip_address;
543   vl_api_ip4_address_t last_ip_address;
544   u32 vrf_id;
545   bool is_add;
546   vl_api_nat_config_flags_t flags;
547 };
548
549 /** \brief Dump NAT44 addresses
550     @param client_index - opaque cookie to identify the sender
551     @param context - sender context, to match reply w/ request
552 */
553 define nat44_address_dump {
554   u32 client_index;
555   u32 context;
556 };
557
558 /** \brief NAT44 address details response
559     @param context - sender context, to match reply w/ request
560     @param ip_address - IPv4 address
561     @param flags - flag NAT_IS_TWICE_NAT if NAT address range for external hosts
562     @param vrf_id - VRF id of tenant, ~0 means independent of VRF
563 */
564 define nat44_address_details {
565   u32 context;
566   vl_api_ip4_address_t ip_address;
567   vl_api_nat_config_flags_t flags;
568   u32 vrf_id;
569 };
570
571 /** \brief Enable/disable NAT44 feature on the interface
572     @param client_index - opaque cookie to identify the sender
573     @param context - sender context, to match reply w/ request
574     @param is_add - true if add, false if delete
575     @param flags - flag NAT_IS_INSIDE if interface is inside else
576                    interface is outside
577     @param sw_if_index - software index of the interface
578 */
579 autoreply define nat44_interface_add_del_feature {
580   u32 client_index;
581   u32 context;
582   bool is_add;
583   vl_api_nat_config_flags_t flags;
584   vl_api_interface_index_t sw_if_index;
585 };
586
587 /** \brief Dump interfaces with NAT44 feature
588     @param client_index - opaque cookie to identify the sender
589     @param context - sender context, to match reply w/ request
590 */
591 define nat44_interface_dump {
592   u32 client_index;
593   u32 context;
594 };
595
596 /** \brief NAT44 interface details response
597     @param context - sender context, to match reply w/ request
598     @param sw_if_index - software index of the interface
599     @param flags - flag NAT_IS_INSIDE if interface is inside,
600                    flag NAT_IS_OUTSIDE if interface is outside
601                    and if both flags are set the interface is
602                    both inside and outside
603 */
604 define nat44_interface_details {
605   u32 context;
606   vl_api_nat_config_flags_t flags;
607   vl_api_interface_index_t sw_if_index;
608 };
609
610 /** \brief Enable/disbale NAT44 as an interface output feature (postrouting
611            in2out translation)
612     @param client_index - opaque cookie to identify the sender
613     @param context - sender context, to match reply w/ request
614     @param is_add - true if add, false if delete
615     @param flags - flag NAT_IS_INSIDE if interface is inside else
616                    interface is outside
617     @param sw_if_index - software index of the interface
618 */
619 autoreply define nat44_interface_add_del_output_feature {
620   u32 client_index;
621   u32 context;
622   bool is_add;
623   vl_api_nat_config_flags_t flags;
624   vl_api_interface_index_t sw_if_index;
625 };
626
627 /** \brief Dump interfaces with NAT44 output feature
628     @param client_index - opaque cookie to identify the sender
629     @param context - sender context, to match reply w/ request
630 */
631 define nat44_interface_output_feature_dump {
632   u32 client_index;
633   u32 context;
634 };
635
636 /** \brief NAT44 interface with output feature details response
637     @param context - sender context, to match reply w/ request
638     @param flags - flag NAT_IS_INSIDE if interface is inside else
639                    interface is outside
640     @param sw_if_index - software index of the interface
641 */
642 define nat44_interface_output_feature_details {
643   u32 context;
644   vl_api_nat_config_flags_t flags;
645   vl_api_interface_index_t sw_if_index;
646 };
647
648 /** \brief Add/delete NAT44 static mapping
649     @param client_index - opaque cookie to identify the sender
650     @param context - sender context, to match reply w/ request
651     @param is_add - true if add, false if delete
652     @param flags - flag NAT_IS_ADDR_ONLY if address only mapping,
653                    flag nat_is_twice_nat if nat address range for external hosts,
654                    flag NAT_IS_SELF_TWICE_NAT if translate external host address
655                    and port whenever external host address equals local
656                    address of internal host,
657                    flag NAT_IS_OUT2IN_ONLY if rule match only out2in direction
658     @param local_ip_address - local IPv4 address
659     @param external_ip_address - external IPv4 address
660     @param protocol - IP protocol, used only if addr_only=0
661     @param local_port - local port number, used only if addr_only=0
662     @param external_port - external port number, used only if addr_only=0
663     @param external_sw_if_index - external interface (if set
664                                   external_ip_address is ignored, ~0 means not
665                                   used)
666     @param vfr_id - VRF ID
667     @param tag - opaque string tag
668 */
669 autoreply define nat44_add_del_static_mapping {
670   u32 client_index;
671   u32 context;
672   bool is_add;
673   vl_api_nat_config_flags_t flags;
674   vl_api_ip4_address_t local_ip_address;
675   vl_api_ip4_address_t external_ip_address;
676   u8 protocol;
677   u16 local_port;
678   u16 external_port;
679   vl_api_interface_index_t external_sw_if_index;
680   u32 vrf_id;
681   string tag;
682 };
683
684 /** \brief Dump NAT44 static mappings
685     @param client_index - opaque cookie to identify the sender
686     @param context - sender context, to match reply w/ request
687 */
688 define nat44_static_mapping_dump {
689   u32 client_index;
690   u32 context;
691 };
692
693 /** \brief NAT44 static mapping details response
694     @param context - sender context, to match reply w/ request
695     @param flags - flag NAT_ADDR_ONLY if address only mapping,
696                    flag NAT_TWICE_NAT if NAT address range for external hosts,
697                    flag NAT_SELF_TWICE_NAT if translate external host address
698                    and port whenever external host address equals local
699                    address of internal host,
700                    flag NAT_OUT2IN_ONLY if rule match only out2in direction
701     @param local_ip_address - local IPv4 address
702     @param external_ip_address - external IPv4 address
703     @param protocol - IP protocol, valid only if no NAT_ADDR_ONLY flag
704     @param local_port - local port number, valid only if no NAT_ADDR_ONLY flag
705     @param external_port - external port number, valid only if no NAT_ADDR_ONLY flag
706     @param external_sw_if_index - external interface
707     @param vfr_id - VRF ID
708     @param tag - opaque string tag
709 */
710 define nat44_static_mapping_details {
711   u32 context;
712   vl_api_nat_config_flags_t flags;
713   vl_api_ip4_address_t local_ip_address;
714   vl_api_ip4_address_t external_ip_address;
715   u8 protocol;
716   u16 local_port;
717   u16 external_port;
718   vl_api_interface_index_t external_sw_if_index;
719   u32 vrf_id;
720   string tag;
721 };
722
723 /** \brief Add/delete NAT44 identity mapping
724     @param client_index - opaque cookie to identify the sender
725     @param context - sender context, to match reply w/ request
726     @param is_add - true if add, false if delete
727     @param flags - flag NAT_ADDR_ONLY 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 (if set ip_address is ignored, ~0 means not
732                                     used)
733     @param vfr_id - VRF ID (if ~0 use default VRF)
734     @param tag - opaque string tag
735 */
736 autoreply define nat44_add_del_identity_mapping {
737   u32 client_index;
738   u32 context;
739   bool is_add;
740   vl_api_nat_config_flags_t flags;
741   vl_api_ip4_address_t ip_address;
742   u8 protocol;
743   u16 port;
744   vl_api_interface_index_t sw_if_index;
745   u32 vrf_id;
746   string tag;
747 };
748
749 /** \brief Dump NAT44 identity mappings
750     @param client_index - opaque cookie to identify the sender
751     @param context - sender context, to match reply w/ request
752 */
753 define nat44_identity_mapping_dump {
754   u32 client_index;
755   u32 context;
756 };
757
758 /** \brief NAT44 identity mapping details response
759     @param context - sender context, to match reply w/ request
760     @param flags - flag NAT_ADDR_ONLY if address only mapping
761     @param ip_address - IPv4 address
762     @param protocol - IP protocol
763     @param port - port number
764     @param sw_if_index - interface
765     @param vfr_id - VRF ID
766     @param tag - opaque string tag
767 */
768 define nat44_identity_mapping_details {
769   u32 context;
770   vl_api_nat_config_flags_t flags;
771   vl_api_ip4_address_t ip_address;
772   u8 protocol;
773   u16 port;
774   vl_api_interface_index_t sw_if_index;
775   u32 vrf_id;
776   string tag;
777 };
778
779 /** \brief Add/delete NAT44 pool address from specific interfce
780     @param client_index - opaque cookie to identify the sender
781     @param context - sender context, to match reply w/ request
782     @param is_add - true if add, false if delete
783     @param sw_if_index - software index of the interface
784     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts
785 */
786 autoreply define nat44_add_del_interface_addr {
787   u32 client_index;
788   u32 context;
789   bool is_add;
790   vl_api_interface_index_t sw_if_index;
791   vl_api_nat_config_flags_t flags;
792 };
793
794 /** \brief Dump NAT44 pool addresses interfaces
795     @param client_index - opaque cookie to identify the sender
796     @param context - sender context, to match reply w/ request
797 */
798 define nat44_interface_addr_dump {
799   u32 client_index;
800   u32 context;
801 };
802
803 /** \brief NAT44 pool addresses interfaces details response
804     @param context - sender context, to match reply w/ request
805     @param sw_if_index - software index of the interface
806     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts
807
808 */
809 define nat44_interface_addr_details {
810   u32 context;
811   vl_api_interface_index_t sw_if_index;
812   vl_api_nat_config_flags_t flags;
813 };
814
815 /** \brief Dump NAT44 users
816     @param client_index - opaque cookie to identify the sender
817     @param context - sender context, to match reply w/ request
818 */
819 define nat44_user_dump {
820   u32 client_index;
821   u32 context;
822 };
823
824 /** \brief NAT44 users response
825     @param context - sender context, to match reply w/ request
826     @vrf_id - VRF ID
827     @param ip_address - IPv4 address
828     @param nsessions - number of dynamic sessions
829     @param nstaticsessions - number of static sessions
830 */
831 define nat44_user_details {
832   u32 context;
833   u32 vrf_id;
834   vl_api_ip4_address_t ip_address;
835   u32 nsessions;
836   u32 nstaticsessions;
837 };
838
839 /** \brief NAT44 user's sessions
840     @param client_index - opaque cookie to identify the sender
841     @param context - sender context, to match reply w/ request
842     @param ip_address - IPv4 address of the user to dump
843     @param vrf_id - VRF_ID
844 */
845 define nat44_user_session_dump {
846   u32 client_index;
847   u32 context;
848   vl_api_ip4_address_t ip_address;
849   u32 vrf_id;
850 };
851
852 /** \brief NAT44 user's sessions response
853     @param context - sender context, to match reply w/ request
854     @param outside_ip_address - outside IPv4 address
855     @param outside_port - outside port
856     @param inside_ip_address - inside IPv4 address
857     @param inside_port - inside port
858     @param protocol - protocol
859     @param flags - flag NAT_IS_STATIC if session is static,
860                    flag NAT_IS_TWICE_NAT if session is twice-nat,
861                    flag NAT_IS_EXT_HOST_VALID if external host address
862                    and port are valid
863     @param last_heard - last heard timer
864     @param total_bytes - count of bytes sent through session
865     @param total_pkts - count of pakets sent through session
866     @param ext_host_address - external host IPv4 address
867     @param ext_host_port - external host port
868     @param ext_host_nat_address - post-NAT external host IPv4 address (valid
869                                   only if twice-nat session)
870     @param ext_host_nat_port - post-NAT external host port (valid only if
871                                twice-nat session)
872 */
873 define nat44_user_session_details {
874   u32 context;
875   vl_api_ip4_address_t outside_ip_address;
876   u16 outside_port;
877   vl_api_ip4_address_t inside_ip_address;
878   u16 inside_port;
879   u16 protocol;
880   vl_api_nat_config_flags_t flags;
881   u64 last_heard;
882   u64 total_bytes;
883   u32 total_pkts;
884   vl_api_ip4_address_t ext_host_address;
885   u16 ext_host_port;
886   vl_api_ip4_address_t ext_host_nat_address;
887   u16 ext_host_nat_port;
888 };
889
890 /** \brief NAT44 load-balancing address and port pair
891     @param addr - IPv4 address of the internal node
892     @param port - L4 port number of the internal node
893     @param probability - probability of the internal node to be randomly matched
894     @param vrf_id - VRF id
895 */
896 typedef nat44_lb_addr_port {
897   vl_api_ip4_address_t addr;
898   u16 port;
899   u8 probability;
900   u32 vrf_id;
901 };
902
903 /** \brief Add/delete NAT44 load-balancing static mapping rule
904     @param client_index - opaque cookie to identify the sender
905     @param context - sender context, to match reply w/ request
906     @param is_add - true if add, false if delete
907     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
908                    flag NAT_SELF_TWICE_NAT if translate external host address
909                    and port whenever external host address equals local
910                    address of internal host,
911                    flag NAT_OUT2IN_ONLY if rule match only out2in direction
912     @param external_addr - external IPv4 address of the service
913     @param external_port - external L4 port number of the service
914     @param protocol - IP protocol number of the service
915     @param affinity - if 0 disabled, otherwise client IP affinity sticky time
916                       in seconds
917     @param local_num - number of local network nodes
918     @param locals - local network nodes
919     @param tag - opaque string tag
920 */
921 autoreply manual_endian define nat44_add_del_lb_static_mapping {
922   u32 client_index;
923   u32 context;
924   bool is_add;
925   vl_api_nat_config_flags_t flags;
926   vl_api_ip4_address_t external_addr;
927   u16 external_port;
928   u8 protocol;
929   u32 affinity;
930   u32 local_num;
931   vl_api_nat44_lb_addr_port_t locals[local_num];
932   string tag;
933 };
934
935 /** \brief Add/delete NAT44 load-balancing static mapping rule backend
936     @param client_index - opaque cookie to identify the sender
937     @param context - sender context, to match reply w/ request
938     @param is_add - true if add, false if delete
939     @param external_addr - external IPv4 address of the service
940     @param external_port - external L4 port number of the service
941     @param protocol - IP protocol number of the service
942     @param local - local network node
943 */
944 autoreply define nat44_lb_static_mapping_add_del_local {
945   u32 client_index;
946   u32 context;
947   bool is_add;
948   vl_api_ip4_address_t external_addr;
949   u16 external_port;
950   u8 protocol;
951   vl_api_nat44_lb_addr_port_t local;
952 };
953
954 /** \brief Dump NAT44 load-balancing static mapping rules
955     @param client_index - opaque cookie to identify the sender
956     @param context - sender context, to match reply w/ request
957 */
958 define nat44_lb_static_mapping_dump {
959   u32 client_index;
960   u32 context;
961 };
962
963 /** \brief NAT44 load-balancing static mapping rule details response
964     @param context - sender context, to match reply w/ request
965     @param external_addr - external IPv4 address of the service
966     @param external_port - external L4 port number of the service
967     @param protocol - IP protocol number of the service
968     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
969                    flag NAT_SELF_TWICE_NAT if translate external host address
970                    and port whenever external host address equals local
971                    address of internal host,
972                    flag NAT_OUT2IN_ONLY if rule match only out2in direction
973     @param affinity - if 0 disabled, otherwise client IP affinity sticky time
974                       in seconds
975     @param local_num - number of local network nodes
976     @param locals - local network nodes
977     @param tag - opaque string tag
978 */
979 manual_endian define nat44_lb_static_mapping_details {
980   u32 context;
981   vl_api_ip4_address_t external_addr;
982   u16 external_port;
983   u8 protocol;
984   vl_api_nat_config_flags_t flags;
985   u32 affinity;
986   u32 local_num;
987   vl_api_nat44_lb_addr_port_t locals[local_num];
988   string tag;
989 };
990
991 /** \brief Delete NAT44 session
992     @param client_index - opaque cookie to identify the sender
993     @param context - sender context, to match reply w/ request
994     @param ip_address - IPv4 address
995     @param protocol - IP protocol
996     @param port - port number
997     @param vfr_id - VRF ID
998     @param flags - flag NAT_IS_INSIDE if interface is inside or
999                    interface is outside,
1000                    flag NAT_IS_EXT_HOST_VALID if external host address and
1001                    port are valid
1002     @param ext_host_address - external host IPv4 address
1003     @param ext_host_port - external host port
1004 */
1005 autoreply define nat44_del_session {
1006   u32 client_index;
1007   u32 context;
1008   vl_api_ip4_address_t address;
1009   u8 protocol;
1010   u16 port;
1011   u32 vrf_id;
1012   vl_api_nat_config_flags_t flags;
1013   vl_api_ip4_address_t ext_host_address;
1014   u16 ext_host_port;
1015 };
1016
1017 /** \brief Enable/disable forwarding for NAT44
1018     Forward packets which don't match existing translation
1019     or static mapping instead of dropping them.
1020     @param client_index - opaque cookie to identify the sender
1021     @param context - sender context, to match reply w/ request
1022     @param enable - true for enable, false for disable
1023 */
1024 autoreply define nat44_forwarding_enable_disable {
1025   u32 client_index;
1026   u32 context;
1027   bool enable;
1028 };
1029
1030 /** \brief Check if forwarding is enabled or disabled
1031     @param client_index - opaque cookie to identify the sender
1032     @param context - sender context, to match reply w/ request
1033 */
1034 define nat44_forwarding_is_enabled {
1035   u32 client_index;
1036   u32 context;
1037 };
1038
1039 /** \brief Response to check if forwarding is enabled or disabled
1040     @param context - sender context, to match reply w/ request
1041     @param enabled - true if enabled, false if disabled
1042 */
1043 define nat44_forwarding_is_enabled_reply {
1044   u32 context;
1045   bool enabled;
1046 };
1047
1048
1049 /*
1050  * Deterministic NAT (CGN) APIs
1051  */
1052
1053 /** \brief Add/delete NAT deterministic mapping
1054     @param client_index - opaque cookie to identify the sender
1055     @param context - sender context, to match reply w/ request
1056     @param is_add - true if add, false if delete
1057     @param in_addr - inside IPv4 address
1058     @param in_plen - inside IPv4 address prefix length
1059     @param out_addr - outside IPv4 address
1060     @param out_plen - outside IPv4 address prefix length
1061 */
1062 autoreply define nat_det_add_del_map {
1063   u32 client_index;
1064   u32 context;
1065   bool is_add;
1066   vl_api_ip4_address_t in_addr;
1067   u8 in_plen;
1068   vl_api_ip4_address_t out_addr;
1069   u8 out_plen;
1070 };
1071
1072 /** \brief Get outside address and port range from inside address
1073     @param client_index - opaque cookie to identify the sender
1074     @param context - sender context, to match reply w/ request
1075     @param in_addr - inside IP address
1076 */
1077 define nat_det_forward {
1078   u32 client_index;
1079   u32 context;
1080   vl_api_ip4_address_t in_addr;
1081 };
1082
1083 /** \brief Get outside address and port range from inside address
1084     @param context - sender context, to match reply w/ request
1085     @param retval - return code
1086     @param out_port_lo - outside port range start
1087     @param out_port_hi - outside port range end
1088     @param out_addr - outside IPv4 address
1089 */
1090 define nat_det_forward_reply {
1091   u32 context;
1092   i32 retval;
1093   u16 out_port_lo;
1094   u16 out_port_hi;
1095   vl_api_ip4_address_t out_addr;
1096 };
1097
1098 /** \brief Get inside address from outside address and port
1099     @param client_index - opaque cookie to identify the sender
1100     @param context - sender context, to match reply w/ request
1101     @param out_port - outside port
1102     @param out_addr - outside IPv4 address
1103 */
1104 define nat_det_reverse {
1105   u32 client_index;
1106   u32 context;
1107   u16 out_port;
1108   vl_api_ip4_address_t out_addr;
1109 };
1110
1111 /** \brief Get inside address from outside address and port reply
1112     @param context - sender context, to match reply w/ request
1113     @param retval - return code
1114     @param in_addr - inside IP address
1115 */
1116 define nat_det_reverse_reply {
1117   u32 context;
1118   i32 retval;
1119   vl_api_ip4_address_t in_addr;
1120 };
1121
1122 /** \brief Dump NAT deterministic mappings
1123     @param client_index - opaque cookie to identify the sender
1124     @param context - sender context, to match reply w/ request
1125 */
1126 define nat_det_map_dump {
1127   u32 client_index;
1128   u32 context;
1129 };
1130
1131 /** \brief NAT users response
1132     @param context - sender context, to match reply w/ request
1133     @param in_addr - inside IPv4 address
1134     @param in_plen - inside IPv4 address prefix length
1135     @param out_addr - outside IPv4 address
1136     @param out_plen - outside IPv4 address prefix length
1137     @param sharing_ratio - outside to inside address sharing ratio
1138     @param ports_per_host - number of ports available to a host
1139     @param ses_num - number of sessions belonging to this mapping
1140 */
1141 define nat_det_map_details {
1142   u32 context;
1143   vl_api_ip4_address_t in_addr;
1144   u8 in_plen;
1145   vl_api_ip4_address_t out_addr;
1146   u8 out_plen;
1147   u32 sharing_ratio;
1148   u16 ports_per_host;
1149   u32 ses_num;
1150 };
1151
1152 /** \brief Close deterministic NAT session by outside address and port
1153     @param client_index - opaque cookie to identify the sender
1154     @param context - sender context, to match reply w/ request
1155     @param out_addr - outside IPv4 address
1156     @param out_port - outside port
1157     @param ext_addr - external host IPv4 address
1158     @param ext_port - external host port
1159 */
1160 autoreply define nat_det_close_session_out {
1161   u32 client_index;
1162   u32 context;
1163   vl_api_ip4_address_t out_addr;
1164   u16 out_port;
1165   vl_api_ip4_address_t ext_addr;
1166   u16 ext_port;
1167 };
1168
1169 /** \brief Close deterministic NAT session by inside address and port
1170     @param client_index - opaque cookie to identify the sender
1171     @param context - sender context, to match reply w/ request
1172     @param in_addr - inside IP address
1173     @param in_port - inside port
1174     @param ext_addr - external host IP address
1175     @param ext_port - external host port
1176 */
1177 autoreply define nat_det_close_session_in {
1178   u32 client_index;
1179   u32 context;
1180   vl_api_ip4_address_t in_addr;
1181   u16 in_port;
1182   vl_api_ip4_address_t ext_addr;
1183   u16 ext_port;
1184 };
1185
1186 /** \brief Dump determinstic NAT sessions
1187     @param client_index - opaque cookie to identify the sender
1188     @param context - sender context, to match reply w/ request
1189     @param user_addr - address of an inside user whose sessions to dump
1190 */
1191 define nat_det_session_dump {
1192   u32 client_index;
1193   u32 context;
1194   vl_api_ip4_address_t user_addr;
1195 };
1196
1197 /** \brief Deterministic NAT sessions reply
1198     @param context - sender context, to match reply w/ request
1199     @param in_port - inside port
1200     @param ext_addr - external host IPv4 address
1201     @param ext_port - external host port
1202     @param out_port - outside NAT port
1203     @param state - session state
1204     @param expire - session expiration timestamp
1205 */
1206 define nat_det_session_details {
1207   u32 context;
1208   u16 in_port;
1209   vl_api_ip4_address_t ext_addr;
1210   u16 ext_port;
1211   u16 out_port;
1212   u8 state;
1213   u32 expire;
1214 };
1215
1216 /*
1217  * NAT64 APIs
1218  */
1219
1220 /** \brief Add/delete address range to NAT64 pool
1221     @param client_index - opaque cookie to identify the sender
1222     @param context - sender context, to match reply w/ request
1223     @param start_addr - start IPv4 address of the range
1224     @param end_addr - end IPv4 address of the range
1225     @param vrf_id - VRF id of tenant, ~0 means independent of VRF
1226     @param is_add - true if add, false if delete
1227 */
1228 autoreply define nat64_add_del_pool_addr_range {
1229   u32 client_index;
1230   u32 context;
1231   vl_api_ip4_address_t start_addr;
1232   vl_api_ip4_address_t end_addr;
1233   u32 vrf_id;
1234   bool is_add;
1235 };
1236
1237 /** \brief Dump NAT64 pool addresses
1238     @param client_index - opaque cookie to identify the sender
1239     @param context - sender context, to match reply w/ request
1240 */
1241 define nat64_pool_addr_dump {
1242   u32 client_index;
1243   u32 context;
1244 };
1245
1246 /** \brief NAT64 pool address details response
1247     @param context - sender context, to match reply w/ request
1248     @param address - IPv4 address
1249     @param vfr_id - VRF id of tenant, ~0 means independent of VRF
1250 */
1251 define nat64_pool_addr_details {
1252   u32 context;
1253   vl_api_ip4_address_t address;
1254   u32 vrf_id;
1255 };
1256
1257 /** \brief Enable/disable NAT64 feature on the interface
1258     @param client_index - opaque cookie to identify the sender
1259     @param context - sender context, to match reply w/ request
1260     @param is_add - true if add, false if delete
1261     @param flags - flag NAT_IS_INSIDE if interface is inside else
1262                    interface is outside
1263     @param sw_if_index - index of the interface
1264 */
1265 autoreply define nat64_add_del_interface {
1266   u32 client_index;
1267   u32 context;
1268   bool is_add;
1269   vl_api_nat_config_flags_t flags;
1270   vl_api_interface_index_t sw_if_index;
1271 };
1272
1273 /** \brief Dump interfaces with NAT64 feature
1274     @param client_index - opaque cookie to identify the sender
1275     @param context - sender context, to match reply w/ request
1276 */
1277 define nat64_interface_dump {
1278   u32 client_index;
1279   u32 context;
1280 };
1281
1282 /** \brief NAT64 interface details response
1283     @param context - sender context, to match reply w/ request
1284     @param flags - flag NAT_IS_INSIDE if interface is inside,
1285                    flag NAT_IS_OUTSIDE if interface is outside
1286                    and if both flags are set the interface is
1287                    both inside and outside
1288     @param sw_if_index - index of the interface
1289 */
1290 define nat64_interface_details {
1291   u32 context;
1292   vl_api_nat_config_flags_t flags;
1293   vl_api_interface_index_t sw_if_index;
1294 };
1295
1296 /** \brief Add/delete NAT64 static BIB entry
1297     @param client_index - opaque cookie to identify the sender
1298     @param context - sender context, to match reply w/ request
1299     @param i_addr - inside IPv6 address
1300     @param o_addr - outside IPv4 address
1301     @param i_port - inside port number
1302     @param o_port - outside port number
1303     @param vrf_id - VRF id of tenant
1304     @param proto - protocol number
1305     @param is_add - true if add, false if delete
1306 */
1307  autoreply define nat64_add_del_static_bib {
1308   u32 client_index;
1309   u32 context;
1310   vl_api_ip6_address_t i_addr;
1311   vl_api_ip4_address_t o_addr;
1312   u16 i_port;
1313   u16 o_port;
1314   u32 vrf_id;
1315   u8 proto;
1316   bool is_add;
1317 };
1318
1319 /** \brief Dump NAT64 BIB
1320     @param client_index - opaque cookie to identify the sender
1321     @param context - sender context, to match reply w/ request
1322     @param proto - protocol of the BIB: 255 - all BIBs
1323                                         6 - TCP BIB
1324                                         17 - UDP BIB
1325                                         1/58 - ICMP BIB
1326                                         otherwise - "unknown" protocol BIB
1327 */
1328 define nat64_bib_dump {
1329   u32 client_index;
1330   u32 context;
1331   u8 proto;
1332 };
1333
1334 /** \brief NAT64 BIB details response
1335     @param context - sender context, to match reply w/ request
1336     @param i_addr - inside IPv6 address
1337     @param o_addr - outside IPv4 address
1338     @param i_port - inside port number
1339     @param o_port - outside port number
1340     @param vrf_id - VRF id of tenant
1341     @param proto - protocol number
1342     @param flags - flag NAT_IS_STATIC if BIB entry is static 
1343                    or BIB entry is dynamic
1344     @param ses_num - number of sessions associated with the BIB entry
1345 */
1346 define nat64_bib_details {
1347   u32 context;
1348   vl_api_ip6_address_t i_addr;
1349   vl_api_ip4_address_t o_addr;
1350   u16 i_port;
1351   u16 o_port;
1352   u32 vrf_id;
1353   u8 proto;
1354   vl_api_nat_config_flags_t flags;
1355   u32 ses_num;
1356 };
1357
1358 /** \brief Dump NAT64 session table
1359     @param client_index - opaque cookie to identify the sender
1360     @param context - sender context, to match reply w/ request
1361     @param proto - protocol of the session table: 255 - all STs
1362                                                   6 - TCP ST
1363                                                   17 - UDP ST
1364                                                   1/58 - ICMP ST
1365                                                   otherwise - "unknown" proto ST
1366 */
1367 define nat64_st_dump {
1368   u32 client_index;
1369   u32 context;
1370   u8 proto;
1371 };
1372
1373 /** \brief NAT64 session table details response
1374     @param context - sender context, to match reply w/ request
1375     @param il_addr - inside IPv6 address of the local host
1376     @param ol_addr - outside IPv4 address of the local host
1377     @param il_port - inside port number id of the local host/inside ICMP id
1378     @param ol_port - outside port number of the local host/outside ICMP id
1379     @param ir_addr - inside IPv6 address of the remote host
1380     @param or_addr - outside IPv4 address of the remote host
1381     @param r_port - port number of the remote host (not used for ICMP)
1382     @param vrf_id - VRF id of tenant
1383     @param proto - protocol number
1384 */
1385 define nat64_st_details {
1386   u32 context;
1387   vl_api_ip6_address_t il_addr;
1388   vl_api_ip4_address_t ol_addr;
1389   u16 il_port;
1390   u16 ol_port;
1391   vl_api_ip6_address_t ir_addr;
1392   vl_api_ip4_address_t or_addr;
1393   u16 r_port;
1394   u32 vrf_id;
1395   u8 proto;
1396 };
1397
1398 /** \brief Add/del NAT64 prefix
1399     @param client_index - opaque cookie to identify the sender
1400     @param context - sender context, to match reply w/ request
1401     @param prefix - NAT64 prefix
1402     @param vrf_id - VRF id of tenant
1403     @param is_add - true if add, false if delete
1404 */
1405 autoreply define nat64_add_del_prefix {
1406   u32 client_index;
1407   u32 context;
1408   vl_api_ip6_prefix_t prefix;
1409   u32 vrf_id;
1410   bool is_add;
1411 };
1412
1413 /** \brief Dump NAT64 prefix
1414     @param client_index - opaque cookie to identify the sender
1415     @param context - sender context, to match reply w/ request
1416 */
1417 define nat64_prefix_dump {
1418   u32 client_index;
1419   u32 context;
1420 };
1421
1422 /** \brief Dump NAT64 prefix details response
1423     @param context - sender context, to match reply w/ request
1424     @param prefix - NAT64 prefix
1425     @param vrf_id - VRF id of tenant
1426 */
1427 define nat64_prefix_details {
1428   u32 context;
1429   vl_api_ip6_prefix_t prefix;
1430   u32 vrf_id;
1431 };
1432
1433 /** \brief Add/delete NAT64 pool address from specific interfce
1434     @param client_index - opaque cookie to identify the sender
1435     @param context - sender context, to match reply w/ request
1436     @param is_add - true if add, false if delete
1437     @param sw_if_index - software index of the interface
1438 */
1439 autoreply define nat64_add_del_interface_addr {
1440   u32 client_index;
1441   u32 context;
1442   bool is_add;
1443   vl_api_interface_index_t sw_if_index;
1444 };
1445
1446 /*
1447  * DS-Lite APIs
1448  */
1449
1450 /** \brief Add/delete address range to DS-Lite pool
1451     @param client_index - opaque cookie to identify the sender
1452     @param context - sender context, to match reply w/ request
1453     @param start_addr - start IPv4 address of the range
1454     @param end_addr - end IPv4 address of the range
1455     @param is_add - true if add, false if delete
1456 */
1457 autoreply define dslite_add_del_pool_addr_range {
1458   u32 client_index;
1459   u32 context;
1460   vl_api_ip4_address_t start_addr;
1461   vl_api_ip4_address_t end_addr;
1462   bool is_add;
1463 };
1464
1465 /** \brief Dump DS-Lite addresses
1466     @param client_index - opaque cookie to identify the sender
1467     @param context - sender context, to match reply w/ request
1468 */
1469 define dslite_address_dump {
1470   u32 client_index;
1471   u32 context;
1472 };
1473
1474 /** \brief DS-Lite address details response
1475     @param context - sender context, to match reply w/ request
1476     @param ip_address - IPv4 address
1477 */
1478 define dslite_address_details {
1479   u32 context;
1480   vl_api_ip4_address_t ip_address;
1481 };
1482
1483 /** \brief Set AFTR IPv6 and IPv4 addresses
1484     @param client_index - opaque cookie to identify the sender
1485     @param context - sender context, to match reply w/ request
1486     @param ip4_addr - IPv4 address
1487     @param ip6_addr - IPv6 address
1488 */
1489 autoreply define dslite_set_aftr_addr {
1490   u32 client_index;
1491   u32 context;
1492   vl_api_ip4_address_t ip4_addr;
1493   vl_api_ip6_address_t ip6_addr;
1494 };
1495
1496 /** \brief Get AFTR IPv6 and IPv4 addresses
1497     @param client_index - opaque cookie to identify the sender
1498     @param context - sender context, to match reply w/ request
1499 */
1500 define dslite_get_aftr_addr {
1501   u32 client_index;
1502   u32 context;
1503 };
1504
1505 /** \brief Response to get AFTR IPv6 and IPv4 addresses
1506     @param context - sender context, to match reply w/ request
1507     @param retval - return code
1508     @param ip4_addr - IPv4 address
1509     @param ip6_addr - IPv6 address
1510 */
1511 define dslite_get_aftr_addr_reply {
1512   u32 context;
1513   i32 retval;
1514   vl_api_ip4_address_t ip4_addr;
1515   vl_api_ip6_address_t ip6_addr;
1516 };
1517
1518 /** \brief Set B4 IPv6 and IPv4 addresses
1519     @param client_index - opaque cookie to identify the sender
1520     @param context - sender context, to match reply w/ request
1521     @param ip4_addr - IPv4 address
1522     @param ip6_addr - IPv6 address
1523 */
1524 autoreply define dslite_set_b4_addr {
1525   u32 client_index;
1526   u32 context;
1527   vl_api_ip4_address_t ip4_addr;
1528   vl_api_ip6_address_t ip6_addr;
1529 };
1530
1531 /** \brief Get B4 IPv6 and IPv4 addresses
1532     @param client_index - opaque cookie to identify the sender
1533     @param context - sender context, to match reply w/ request
1534 */
1535 define dslite_get_b4_addr {
1536   u32 client_index;
1537   u32 context;
1538 };
1539
1540 /** \brief Response to get B4 IPv6 and IPv4 addresses
1541     @param context - sender context, to match reply w/ request
1542     @param retval - return code
1543     @param ip4_addr - IPv4 address
1544     @param ip6_addr - IPv6 address
1545 */
1546 define dslite_get_b4_addr_reply {
1547   u32 context;
1548   i32 retval;
1549   vl_api_ip4_address_t ip4_addr;
1550   vl_api_ip6_address_t ip6_addr;
1551 };
1552
1553 /*
1554  * NAT66 APIs
1555  */
1556 /** \brief Enable/disable NAT66 feature on the interface
1557     @param client_index - opaque cookie to identify the sender
1558     @param context - sender context, to match reply w/ request
1559     @param is_add - true if add, false if delete
1560     @param flags - flag NAT_IS_INSIDE if interface is inside or
1561                    interface is outside,
1562     @param sw_if_index - software index of the interface
1563 */
1564 autoreply define nat66_add_del_interface {
1565   u32 client_index;
1566   u32 context;
1567   bool is_add;
1568   vl_api_nat_config_flags_t flags;
1569   vl_api_interface_index_t sw_if_index;
1570 };
1571
1572 /** \brief Dump interfaces with NAT66 feature
1573     @param client_index - opaque cookie to identify the sender
1574     @param context - sender context, to match reply w/ request
1575 */
1576 define nat66_interface_dump {
1577   u32 client_index;
1578   u32 context;
1579 };
1580
1581 /** \brief NAT66 interface details response
1582     @param context - sender context, to match reply w/ request
1583     @param flags - flag NAT_IS_INSIDE if interface is inside or
1584                    interface is outside,
1585     @param sw_if_index - software index of the interface
1586 */
1587 define nat66_interface_details {
1588   u32 context;
1589   vl_api_nat_config_flags_t flags;
1590   vl_api_interface_index_t sw_if_index;
1591 };
1592
1593 /** \brief Add/delete 1:1 NAT66
1594     @param client_index - opaque cookie to identify the sender
1595     @param context - sender context, to match reply w/ request
1596     @param is_add - true if add, false if delete
1597     @param local_ip_address - local IPv6 address
1598     @param external_ip_address - external IPv6 address
1599     @param vrf_id - VRF id of tenant
1600 */
1601 autoreply define nat66_add_del_static_mapping {
1602   u32 client_index;
1603   u32 context;
1604   bool is_add;
1605   vl_api_ip6_address_t local_ip_address;
1606   vl_api_ip6_address_t external_ip_address;
1607   u32 vrf_id;
1608 };
1609
1610 /** \brief Dump NAT66 static mappings
1611     @param client_index - opaque cookie to identify the sender
1612     @param context - sender context, to match reply w/ request
1613 */
1614 define nat66_static_mapping_dump {
1615   u32 client_index;
1616   u32 context;
1617 };
1618
1619 /** \brief NAT66 static mapping details response
1620     @param context - sender context, to match reply w/ request
1621     @param local_ip_address - local IPv6 address
1622     @param external_ip_address - external IPv6 address
1623     @param vrf_id - VRF id of tenant
1624     @param total_bytes - count of bytes sent through static mapping
1625     @param total_pkts - count of pakets sent through static mapping
1626 */
1627 define nat66_static_mapping_details {
1628   u32 context;
1629   vl_api_ip6_address_t local_ip_address;
1630   vl_api_ip6_address_t external_ip_address;
1631   u32 vrf_id;
1632   u64 total_bytes;
1633   u64 total_pkts;
1634 };