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