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