NAT: Remove old SNAT API (VPP-1070)
[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 vl_api_version 2.0.0
17
18 /**
19  * @file nat.api
20  * @brief VPP control-plane API messages.
21  *
22  * This file defines VPP control-plane API messages which are generally
23  * called through a shared memory interface.
24  */
25
26 /*
27  * Common NAT plugin APIs
28  */
29
30 /** \brief Control ping from client to api server request
31     @param client_index - opaque cookie to identify the sender
32     @param context - sender context, to match reply w/ request
33 */
34 define nat_control_ping
35 {
36   u32 client_index;
37   u32 context;
38 };
39
40 /** \brief Control ping from the client to the server response
41     @param client_index - opaque cookie to identify the sender
42     @param context - sender context, to match reply w/ request
43     @param retval - return code for the request
44     @param vpe_pid - the pid of the vpe, returned by the server
45 */
46 define nat_control_ping_reply
47 {
48   u32 context;
49   i32 retval;
50   u32 client_index;
51   u32 vpe_pid;
52 };
53
54 /** \brief Show NAT plugin startup config
55     @param client_index - opaque cookie to identify the sender
56     @param context - sender context, to match reply w/ request
57 */
58 define nat_show_config
59 {
60   u32 client_index;
61   u32 context;
62 };
63
64 /** \brief Show NAT plugin startup config reply
65     @param context - sender context, to match reply w/ request
66     @param retval - return code for the request
67     @param static_mapping_only - if 1 dynamic translations disabled
68     @param static_mapping_connection_tracking - if 1 create session data
69     @param deterministic - if 1 deterministic mapping
70     @param translation_buckets - number of translation hash buckets
71     @param translation_memory_size - translation hash memory size
72     @param user_buckets - number of user hash buckets
73     @param user_memory_size - user hash memory size
74     @param max_translations_per_user - maximum number of translations per user
75     @param outside_vrf_id - outside VRF id
76     @param inside_vrf_id - default inside VRF id
77 */
78 define nat_show_config_reply
79 {
80   u32 context;
81   i32 retval;
82   u8 static_mapping_only;
83   u8 static_mapping_connection_tracking;
84   u8 deterministic;
85   u32 translation_buckets;
86   u32 translation_memory_size;
87   u32 user_buckets;
88   u32 user_memory_size;
89   u32 max_translations_per_user;
90   u32 outside_vrf_id;
91   u32 inside_vrf_id;
92 };
93
94 /** \brief Set NAT workers
95     @param client_index - opaque cookie to identify the sender
96     @param context - sender context, to match reply w/ request
97     @param worker_mask - NAT workers mask
98 */
99 autoreply define nat_set_workers {
100   u32 client_index;
101   u32 context;
102   u64 worker_mask;
103 };
104
105 /** \brief Dump NAT workers
106     @param client_index - opaque cookie to identify the sender
107     @param context - sender context, to match reply w/ request
108 */
109 define nat_worker_dump {
110   u32 client_index;
111   u32 context;
112 };
113
114 /** \brief NAT workers details response
115     @param context - sender context, to match reply w/ request
116     @param worker_index - worker index
117     @param lcore_id - lcore ID
118     @param name - worker name
119 */
120 define nat_worker_details {
121   u32 context;
122   u32 worker_index;
123   u32 lcore_id;
124   u8 name[64];
125 };
126
127 /** \brief Enable/disable NAT IPFIX logging
128     @param client_index - opaque cookie to identify the sender
129     @param context - sender context, to match reply w/ request
130     @param domain_id - observation domain ID
131     @param src_port - source port number
132     @param enable - 1 if enable, 0 if disable
133 */
134 autoreply define nat_ipfix_enable_disable {
135   u32 client_index;
136   u32 context;
137   u32 domain_id;
138   u16 src_port;
139   u8 enable;
140 };
141
142 /** \brief Set NAT virtual fragmentation reassembly
143     @param client_index - opaque cookie to identify the sender
144     @param context - sender context, to match reply w/ request
145     @param timeout - reassembly timeout
146     @param max_reass - maximum number of concurrent reassemblies
147     @param max_frag - maximum number of fragmets per reassembly
148     @param drop_frag - if 0 translate fragments, otherwise drop fragments
149     @param is_ip6 - 1 if IPv6, 0 if IPv4
150 */
151 autoreply define nat_set_reass {
152   u32 client_index;
153   u32 context;
154   u32 timeout;
155   u16 max_reass;
156   u8  max_frag;
157   u8  drop_frag;
158   u8  is_ip6;
159 };
160
161 /** \brief Get NAT virtual fragmentation reassembly configuration
162     @param client_index - opaque cookie to identify the sender
163     @param context - sender context, to match reply w/ request
164 */
165 define nat_get_reass {
166   u32 client_index;
167   u32 context;
168 };
169
170 /** \brief Get NAT virtual fragmentation reassembly configuration reply
171     @param context - sender context, to match reply w/ request
172     @param retval - return code
173     @param ip4_timeout - reassembly timeout
174     @param ip4_max_reass - maximum number of concurrent reassemblies
175     @param ip4_max_frag - maximum number of fragmets per reassembly
176     @param ip4_drop_frag - if 0 translate fragments, otherwise drop fragments
177     @param ip6_timeout - reassembly timeout
178     @param ip6_max_reass - maximum number of concurrent reassemblies
179     @param ip6_max_frag - maximum number of fragmets per reassembly
180     @param ip6_drop_frag - if 0 translate fragments, otherwise drop fragments
181 */
182 define nat_get_reass_reply {
183   u32 context;
184   i32 retval;
185   u32 ip4_timeout;
186   u16 ip4_max_reass;
187   u8  ip4_max_frag;
188   u8  ip4_drop_frag;
189   u32 ip6_timeout;
190   u16 ip6_max_reass;
191   u8  ip6_max_frag;
192   u8  ip6_drop_frag;
193 };
194
195 /** \brief Dump NAT virtual fragmentation reassemblies
196     @param client_index - opaque cookie to identify the sender
197     @param context - sender context, to match reply w/ request
198 */
199 define nat_reass_dump {
200   u32 client_index;
201   u32 context;
202 };
203
204 /** \brief NAT virtual fragmentation reassemblies response
205     @param context - sender context, to match reply w/ request
206     @param is_ip4 - 1 if address type is IPv4
207     @param src_addr - source IP address
208     @param dst_addr - destination IP address
209     @param frag_id - fragment ID
210     @param proto - protocol
211     @param frag_n - number of cached fragments
212 */
213 define nat_reass_details {
214   u32 context;
215   u8 is_ip4;
216   u8 src_addr[16];
217   u8 dst_addr[16];
218   u32 frag_id;
219   u8 proto;
220   u8 frag_n;
221 };
222
223 /*
224  * NAT44 APIs
225  */
226
227 /** \brief Add/del NAT44 address range
228     @param client_index - opaque cookie to identify the sender
229     @param context - sender context, to match reply w/ request
230     @param first_ip_address - first IPv4 address
231     @param last_ip_address - last IPv4 address
232     @param vrf_id - VRF id of tenant, ~0 means independent of VRF
233     @param is_add - 1 if add, 0 if delete
234 */
235 autoreply define nat44_add_del_address_range {
236   u32 client_index;
237   u32 context;
238   u8 first_ip_address[4];
239   u8 last_ip_address[4];
240   u32 vrf_id;
241   u8 is_add;
242 };
243
244 /** \brief Dump NAT44 addresses
245     @param client_index - opaque cookie to identify the sender
246     @param context - sender context, to match reply w/ request
247 */
248 define nat44_address_dump {
249   u32 client_index;
250   u32 context;
251 };
252
253 /** \brief NAT44 address details response
254     @param context - sender context, to match reply w/ request
255     @param ip_address - IPv4 address
256     @param vrf_id - VRF id of tenant, ~0 means independent of VRF
257 */
258 define nat44_address_details {
259   u32 context;
260   u8 ip_address[4];
261   u32 vrf_id;
262 };
263
264 /** \brief Enable/disable NAT44 feature on the interface
265     @param client_index - opaque cookie to identify the sender
266     @param context - sender context, to match reply w/ request
267     @param is_add - 1 if add, 0 if delete
268     @param is_inside - 1 if inside, 0 if outside
269     @param sw_if_index - software index of the interface
270 */
271 autoreply define nat44_interface_add_del_feature {
272   u32 client_index;
273   u32 context;
274   u8 is_add;
275   u8 is_inside;
276   u32 sw_if_index;
277 };
278
279 /** \brief Dump interfaces with NAT44 feature
280     @param client_index - opaque cookie to identify the sender
281     @param context - sender context, to match reply w/ request
282 */
283 define nat44_interface_dump {
284   u32 client_index;
285   u32 context;
286 };
287
288 /** \brief NAT44 interface details response
289     @param context - sender context, to match reply w/ request
290     @param is_inside - 1 if inside, 0 if outside, 2 if inside and outside
291     @param sw_if_index - software index of the interface
292 */
293 define nat44_interface_details {
294   u32 context;
295   u8 is_inside;
296   u32 sw_if_index;
297 };
298
299 /** \brief Enable/disbale NAT44 as an interface output feature (postrouting
300            in2out translation)
301     @param client_index - opaque cookie to identify the sender
302     @param context - sender context, to match reply w/ request
303     @param is_add - 1 if add, 0 if delete
304     @param is_inside - 1 if inside, 0 if outside
305     @param sw_if_index - software index of the interface
306 */
307 autoreply define nat44_interface_add_del_output_feature {
308   u32 client_index;
309   u32 context;
310   u8 is_add;
311   u8 is_inside;
312   u32 sw_if_index;
313 };
314
315 /** \brief Dump interfaces with NAT44 output feature
316     @param client_index - opaque cookie to identify the sender
317     @param context - sender context, to match reply w/ request
318 */
319 define nat44_interface_output_feature_dump {
320   u32 client_index;
321   u32 context;
322 };
323
324 /** \brief NAT44 interface with output feature details response
325     @param context - sender context, to match reply w/ request
326     @param is_inside - 1 if inside, 0 if outside
327     @param sw_if_index - software index of the interface
328 */
329 define nat44_interface_output_feature_details {
330   u32 context;
331   u8 is_inside;
332   u32 sw_if_index;
333 };
334
335 /** \brief Add/delete NAT44 static mapping
336     @param client_index - opaque cookie to identify the sender
337     @param context - sender context, to match reply w/ request
338     @param is_add - 1 if add, 0 if delete
339     @param addr_only - 1 if address only mapping
340     @param local_ip_address - local IPv4 address
341     @param external_ip_address - external IPv4 address
342     @param protocol - IP protocol
343     @param local_port - local port number
344     @param external_port - external port number
345     @param external_sw_if_index - external interface (if set
346                                   external_ip_address is ignored, ~0 means not
347                                   used)
348     @param vfr_id - VRF ID
349 */
350 autoreply define nat44_add_del_static_mapping {
351   u32 client_index;
352   u32 context;
353   u8 is_add;
354   u8 addr_only;
355   u8 local_ip_address[4];
356   u8 external_ip_address[4];
357   u8 protocol;
358   u16 local_port;
359   u16 external_port;
360   u32 external_sw_if_index;
361   u32 vrf_id;
362 };
363
364 /** \brief Dump NAT44 static mappings
365     @param client_index - opaque cookie to identify the sender
366     @param context - sender context, to match reply w/ request
367 */
368 define nat44_static_mapping_dump {
369   u32 client_index;
370   u32 context;
371 };
372
373 /** \brief NAT44 static mapping details response
374     @param context - sender context, to match reply w/ request
375     @param addr_only - 1 if address only mapping
376     @param local_ip_address - local IPv4 address
377     @param external_ip_address - external IPv4 address
378     @param protocol - IP protocol
379     @param local_port - local port number
380     @param external_port - external port number
381     @param external_sw_if_index - external interface
382     @param vfr_id - VRF ID
383 */
384 define nat44_static_mapping_details {
385   u32 context;
386   u8 addr_only;
387   u8 local_ip_address[4];
388   u8 external_ip_address[4];
389   u8 protocol;
390   u16 local_port;
391   u16 external_port;
392   u32 external_sw_if_index;
393   u32 vrf_id;
394 };
395
396 /** \brief Add/delete NAT44 pool address from specific interfce
397     @param client_index - opaque cookie to identify the sender
398     @param context - sender context, to match reply w/ request
399     @param is_add - 1 if add, 0 if delete
400     @param sw_if_index - software index of the interface
401 */
402 autoreply define nat44_add_del_interface_addr {
403   u32 client_index;
404   u32 context;
405   u8 is_add;
406   u8 is_inside;
407   u32 sw_if_index;
408 };
409
410 /** \brief Dump NAT44 pool addresses interfaces
411     @param client_index - opaque cookie to identify the sender
412     @param context - sender context, to match reply w/ request
413 */
414 define nat44_interface_addr_dump {
415   u32 client_index;
416   u32 context;
417 };
418
419 /** \brief NAT44 pool addresses interfaces details response
420     @param context - sender context, to match reply w/ request
421     @param sw_if_index - software index of the interface
422 */
423 define nat44_interface_addr_details {
424   u32 context;
425   u32 sw_if_index;
426 };
427
428 /** \brief Dump NAT44 users
429     @param client_index - opaque cookie to identify the sender
430     @param context - sender context, to match reply w/ request
431 */
432 define nat44_user_dump {
433   u32 client_index;
434   u32 context;
435 };
436
437 /** \brief NAT44 users response
438     @param context - sender context, to match reply w/ request
439     @vrf_id - VRF ID
440     @param ip_adress - IPv4 address
441     @param nsessions - number of dynamic sessions
442     @param nstaticsessions - number of static sessions
443 */
444 define nat44_user_details {
445   u32 context;
446   u32 vrf_id;
447   u8 ip_address[4];
448   u32 nsessions;
449   u32 nstaticsessions;
450 };
451
452 /** \brief NAT44 user's sessions
453     @param client_index - opaque cookie to identify the sender
454     @param context - sender context, to match reply w/ request
455     @param is_ip4 - 1 if address type is IPv4
456     @param user_ip - IP address of the user to dump
457     @param vrf_id - VRF_ID
458 */
459 define nat44_user_session_dump {
460   u32 client_index;
461   u32 context;
462   u8 ip_address[4];
463   u32 vrf_id;
464 };
465
466 /** \brief NAT44 user's sessions response
467     @param context - sender context, to match reply w/ request
468     @param outside_ip_address - outside IPv4 address
469     @param outside_port - outside port
470     @param inside_ip_address - inside IPv4 address
471     @param inside_port - inside port
472     @param protocol - protocol
473     @param is_static - 1 if session is static
474     @param last_heard - last heard timer
475     @param total_bytes - count of bytes sent through session
476     @param total_pkts - count of pakets sent through session
477 */
478 define nat44_user_session_details {
479   u32 context;
480   u8 outside_ip_address[4];
481   u16 outside_port;
482   u8 inside_ip_address[4];
483   u16 inside_port;
484   u16 protocol;
485   u8 is_static;
486   u64 last_heard;
487   u64 total_bytes;
488   u32 total_pkts;
489 };
490
491 typeonly manual_endian define nat44_lb_addr_port {
492   u8 addr[4];
493   u16 port;
494   u8 probability;
495 };
496
497 autoreply manual_endian define nat44_add_del_lb_static_mapping {
498   u32 client_index;
499   u32 context;
500   u8 is_add;
501   u8 external_addr[4];
502   u16 external_port;
503   u8 protocol;
504   u32 vrf_id;
505   u8 local_num;
506   vl_api_nat44_lb_addr_port_t locals[local_num];
507 };
508
509 define nat44_lb_static_mapping_dump {
510   u32 client_index;
511   u32 context;
512 };
513
514 manual_endian define nat44_lb_static_mapping_details {
515   u32 context;
516   u8 external_addr[4];
517   u16 external_port;
518   u8 protocol;
519   u32 vrf_id;
520   u8 local_num;
521   vl_api_nat44_lb_addr_port_t locals[local_num];
522 };
523
524 /** \brief Delete NAT44 session
525     @param client_index - opaque cookie to identify the sender
526     @param context - sender context, to match reply w/ request
527     @param is_in - 1 if inside network addres and port pari, 0 if outside
528     @param ip_address - IPv4 address
529     @param protocol - IP protocol
530     @param port - port number
531     @param vfr_id - VRF ID
532 */
533 autoreply define nat44_del_session {
534   u32 client_index;
535   u32 context;
536   u8 is_in;
537   u8 address[4];
538   u8 protocol;
539   u16 port;
540   u32 vrf_id;
541 };
542
543
544 /*
545  * Deterministic NAT (CGN) APIs
546  */
547
548 /** \brief Add/delete NAT deterministic mapping
549     @param client_index - opaque cookie to identify the sender
550     @param context - sender context, to match reply w/ request
551     @param is_add - 1 if add, 0 if delete
552     @param is_nat44 - 1 if NAT44
553     @param in_addr - inside IP address
554     @param in_plen - inside IP address prefix length
555     @param out_addr - outside IPv4 address
556     @param out_addr - outside IPv4 address prefix length
557 */
558 autoreply define nat_det_add_del_map {
559   u32 client_index;
560   u32 context;
561   u8 is_add;
562   u8 is_nat44;
563   u8 addr_only;
564   u8 in_addr[16];
565   u8 in_plen;
566   u8 out_addr[4];
567   u8 out_plen;
568 };
569
570 /** \brief Get outside address and port range from inside address
571     @param client_index - opaque cookie to identify the sender
572     @param context - sender context, to match reply w/ request
573     @param is_nat44 - 1 if NAT44
574     @param in_addr - inside IP address
575 */
576 define nat_det_forward {
577   u32 client_index;
578   u32 context;
579   u8 is_nat44;
580   u8 in_addr[16];
581 };
582
583 /** \brief Get outside address and port range from inside address
584     @param context - sender context, to match reply w/ request
585     @param retval - return code
586     @param out_port_lo - outside port range start
587     @param out_port_hi - outside port range end
588     @param out_addr - outside IPv4 address
589 */
590 define nat_det_forward_reply {
591   u32 context;
592   i32 retval;
593   u16 out_port_lo;
594   u16 out_port_hi;
595   u8 out_addr[4];
596 };
597
598 /** \brief Get inside address from outside address and port
599     @param client_index - opaque cookie to identify the sender
600     @param context - sender context, to match reply w/ request
601     @param out_port - outside port
602     @param out_addr - outside IPv4 address
603 */
604 define nat_det_reverse {
605   u32 client_index;
606   u32 context;
607   u16 out_port;
608   u8 out_addr[4];
609 };
610
611 /** \brief Get inside address from outside address and port reply
612     @param context - sender context, to match reply w/ request
613     @param retval - return code
614     @param is_nat44 - 1 if NAT44
615     @param in_addr - inside IP address
616 */
617 define nat_det_reverse_reply {
618   u32 context;
619   i32 retval;
620   u8 is_nat44;
621   u8 in_addr[16];
622 };
623
624 /** \brief Dump NAT deterministic mappings
625     @param client_index - opaque cookie to identify the sender
626     @param context - sender context, to match reply w/ request
627 */
628 define nat_det_map_dump {
629   u32 client_index;
630   u32 context;
631 };
632
633 /** \brief NAT users response
634     @param context - sender context, to match reply w/ request
635     @param is_nat44 - 1 if NAT44
636     @param in_addr - inside IP address
637     @param in_plen - inside IP address prefix length
638     @param out_addr - outside IPv4 address
639     @param out_plen - outside IPv4 address prefix length
640     @param sharing_ratio - outside to inside address sharing ratio
641     @param ports_per_host - number of ports available to a host
642     @param ses_num - number of sessions belonging to this mapping
643 */
644 define nat_det_map_details {
645   u32 context;
646   u8 is_nat44;
647   u8 in_addr[16];
648   u8 in_plen;
649   u8 out_addr[4];
650   u8 out_plen;
651   u32 sharing_ratio;
652   u16 ports_per_host;
653   u32 ses_num;
654 };
655
656 /** \brief Set values of timeouts for deterministic NAT (seconds, 0 = default)
657     @param client_index - opaque cookie to identify the sender
658     @param context - sender context, to match reply w/ request
659     @param udp - UDP timeout (default 300sec)
660     @param tcp_established - TCP established timeout (default 7440sec)
661     @param tcp_transitory - TCP transitory timeout (default 240sec)
662     @param icmp - ICMP timeout (default 60sec)
663 */
664 autoreply define nat_det_set_timeouts {
665   u32 client_index;
666   u32 context;
667   u32 udp;
668   u32 tcp_established;
669   u32 tcp_transitory;
670   u32 icmp;
671 };
672
673 /** \brief Get values of timeouts for deterministic NAT (seconds)
674     @param client_index - opaque cookie to identify the sender
675     @param context - sender context, to match reply w/ request
676 */
677 define nat_det_get_timeouts {
678   u32 client_index;
679   u32 context;
680 };
681
682 /** \brief Get values of timeouts for deterministic NAT reply
683     @param context - sender context, to match reply w/ request
684     @param retval - return code
685     @param udp - UDP timeout (default 300sec)
686     @param tcp_established - TCP established timeout (default 7440sec)
687     @param tcp_transitory - TCP transitory timeout (default 240sec)
688     @param icmp - ICMP timeout (default 60sec)
689 */
690 define nat_det_get_timeouts_reply {
691   u32 context;
692   i32 retval;
693   u32 udp;
694   u32 tcp_established;
695   u32 tcp_transitory;
696   u32 icmp;
697 };
698
699 /** \brief Close deterministic NAT session by outside address and port
700     @param client_index - opaque cookie to identify the sender
701     @param context - sender context, to match reply w/ request
702     @param out_addr - outside IPv4 address
703     @param out_port - outside port
704     @param ext_addr - external host IPv4 address
705     @param ext_port - external host port
706 */
707 autoreply define nat_det_close_session_out {
708   u32 client_index;
709   u32 context;
710   u8 out_addr[4];
711   u16 out_port;
712   u8 ext_addr[4];
713   u16 ext_port;
714 };
715
716 /** \brief Close deterministic NAT session by inside address and port
717     @param client_index - opaque cookie to identify the sender
718     @param context - sender context, to match reply w/ request
719     @param is_nat44 - 1 if NAT44
720     @param in_addr - inside IP address
721     @param in_port - inside port
722     @param ext_addr - external host IP address
723     @param ext_port - external host port
724 */
725 autoreply define nat_det_close_session_in {
726   u32 client_index;
727   u32 context;
728   u8 is_nat44;
729   u8 in_addr[16];
730   u16 in_port;
731   u8 ext_addr[16];
732   u16 ext_port;
733 };
734
735 /** \brief Dump determinstic NAT sessions
736     @param client_index - opaque cookie to identify the sender
737     @param context - sender context, to match reply w/ request
738     @param is_nat44 - 1 if NAT44
739     @param user_addr - address of an inside user whose sessions to dump
740 */
741 define nat_det_session_dump {
742   u32 client_index;
743   u32 context;
744   u8 is_nat44;
745   u8 user_addr[16];
746 };
747
748 /** \brief Deterministic NAT sessions reply
749     @param context - sender context, to match reply w/ request
750     @param in_port - inside port
751     @param ext_addr - external host address
752     @param ext_port - external host port
753     @param out_port - outside NAT port
754     @param state - session state
755     @param expire - session expiration timestamp
756 */
757 define nat_det_session_details {
758   u32 client_index;
759   u32 context;
760   u16 in_port;
761   u8 ext_addr[4];
762   u16 ext_port;
763   u16 out_port;
764   u8 state;
765   u32 expire;
766 };
767
768 /*
769  * NAT64 APIs
770  */
771
772 /** \brief Add/delete address range to NAT64 pool
773     @param client_index - opaque cookie to identify the sender
774     @param context - sender context, to match reply w/ request
775     @param start_addr - start address of the range
776     @param end_addr - end address of the range
777     @param vrf_id - VRF id of tenant, ~0 means independent of VRF
778     @param is_add - 1 if add, 0 if delete
779 */
780 autoreply define nat64_add_del_pool_addr_range {
781   u32 client_index;
782   u32 context;
783   u8 start_addr[4];
784   u8 end_addr[4];
785   u32 vrf_id;
786   u8 is_add;
787 };
788
789 /** \brief Dump NAT64 pool addresses
790     @param client_index - opaque cookie to identify the sender
791     @param context - sender context, to match reply w/ request
792 */
793 define nat64_pool_addr_dump {
794   u32 client_index;
795   u32 context;
796 };
797
798 /** \brief NAT64 pool address details response
799     @param context - sender context, to match reply w/ request
800     @param address - IPv4 address
801     @param vfr_id - VRF id of tenant, ~0 means independent of VRF
802 */
803 define nat64_pool_addr_details {
804   u32 context;
805   u8 address[4];
806   u32 vrf_id;
807 };
808
809 /** \brief Enable/disable NAT64 feature on the interface
810     @param client_index - opaque cookie to identify the sender
811     @param context - sender context, to match reply w/ request
812     @param sw_if_index - index of the interface
813     @param is_inside - 1 if inside, 0 if outside
814     @param is_add - 1 if add, 0 if delete
815 */
816 autoreply define nat64_add_del_interface {
817   u32 client_index;
818   u32 context;
819   u32 sw_if_index;
820   u8 is_inside;
821   u8 is_add;
822 };
823
824 /** \brief Dump interfaces with NAT64 feature
825     @param client_index - opaque cookie to identify the sender
826     @param context - sender context, to match reply w/ request
827 */
828 define nat64_interface_dump {
829   u32 client_index;
830   u32 context;
831 };
832
833 /** \brief NAT64 interface details response
834     @param context - sender context, to match reply w/ request
835     @param is_inside - 1 if inside, 0 if outside
836     @param sw_if_index - index of the interface
837 */
838 define nat64_interface_details {
839   u32 context;
840   u8 is_inside;
841   u32 sw_if_index;
842 };
843
844 /** \brief Add/delete NAT64 static BIB entry
845     @param client_index - opaque cookie to identify the sender
846     @param context - sender context, to match reply w/ request
847     @param i_addr - inside IPv6 address
848     @param o_addr - outside IPv4 address
849     @param i_port - inside port number
850     @param o_port - outside port number
851     @param vrf_id - VRF id of tenant
852     @param proto - protocol number
853     @param is_add - 1 if add, 0 if delete
854 */
855  autoreply define nat64_add_del_static_bib {
856   u32 client_index;
857   u32 context;
858   u8 i_addr[16];
859   u8 o_addr[4];
860   u16 i_port;
861   u16 o_port;
862   u32 vrf_id;
863   u8 proto;
864   u8 is_add;
865 };
866
867 /** \brief Dump NAT64 BIB
868     @param client_index - opaque cookie to identify the sender
869     @param context - sender context, to match reply w/ request
870     @param proto - protocol of the BIB: 255 - all BIBs
871                                         6 - TCP BIB
872                                         17 - UDP BIB
873                                         1/58 - ICMP BIB
874                                         otherwise - "unknown" protocol BIB
875 */
876 define nat64_bib_dump {
877   u32 client_index;
878   u32 context;
879   u8 proto;
880 };
881
882 /** \brief NAT64 BIB details response
883     @param context - sender context, to match reply w/ request
884     @param i_addr - inside IPv6 address
885     @param o_addr - outside IPv4 address
886     @param i_port - inside port number
887     @param o_port - outside port number
888     @param vrf_id - VRF id of tenant
889     @param proto - protocol number
890     @param is_static - 1 if static BIB entry, 0 if dynamic
891     @param ses_num - number of sessions associated with the BIB entry
892 */
893 define nat64_bib_details {
894   u32 context;
895   u8 i_addr[16];
896   u8 o_addr[4];
897   u16 i_port;
898   u16 o_port;
899   u32 vrf_id;
900   u8 proto;
901   u8 is_static;
902   u32 ses_num;
903 };
904
905 /** \brief Set values of timeouts for NAT64 (seconds, 0 = default)
906     @param client_index - opaque cookie to identify the sender
907     @param context - sender context, to match reply w/ request
908     @param udp - UDP timeout (default 300sec)
909     @param icmp - ICMP timeout (default 60sec)
910     @param tcp_trans - TCP transitory timeout (default 240sec)
911     @param tcp_est - TCP established timeout (default 7440sec)
912     @param tcp_incoming_syn - TCP incoming SYN timeout (default 6sec)
913 */
914 autoreply define nat64_set_timeouts {
915   u32 client_index;
916   u32 context;
917   u32 udp;
918   u32 icmp;
919   u32 tcp_trans;
920   u32 tcp_est;
921   u32 tcp_incoming_syn;
922 };
923
924 /** \brief Get values of timeouts for NAT64 (seconds)
925     @param client_index - opaque cookie to identify the sender
926     @param context - sender context, to match reply w/ request
927 */
928 define nat64_get_timeouts {
929   u32 client_index;
930   u32 context;
931 };
932
933 /** \brief Get values of timeouts for NAT64 reply
934     @param context - sender context, to match reply w/ request
935     @param retval - return code
936     @param udp - UDP timeout
937     @param icmp - ICMP timeout
938     @param tcp_trans - TCP transitory timeout
939     @param tcp_est - TCP established timeout
940     @param tcp_incoming_syn - TCP incoming SYN timeout
941 */
942 define nat64_get_timeouts_reply {
943   u32 context;
944   i32 retval;
945   u32 udp;
946   u32 icmp;
947   u32 tcp_trans;
948   u32 tcp_est;
949   u32 tcp_incoming_syn;
950 };
951
952 /** \brief Dump NAT64 session table
953     @param client_index - opaque cookie to identify the sender
954     @param context - sender context, to match reply w/ request
955     @param proto - protocol of the session table: 255 - all STs
956                                                   6 - TCP ST
957                                                   17 - UDP ST
958                                                   1/58 - ICMP ST
959                                                   otherwise - "unknown" proto ST
960 */
961 define nat64_st_dump {
962   u32 client_index;
963   u32 context;
964   u8 proto;
965 };
966
967 /** \brief NAT64 session table details response
968     @param context - sender context, to match reply w/ request
969     @param il_addr - inside IPv6 address of the local host
970     @param ol_addr - outside IPv4 address of the local host
971     @param il_port - inside port number id of the local host/inside ICMP id
972     @param ol_port - outside port number of the local host/outside ICMP id
973     @param il_addr - inside IPv6 address of the remote host
974     @param ol_addr - outside IPv4 address of the remote host
975     @param l_port - port number of the remote host (not used for ICMP)
976     @param vrf_id - VRF id of tenant
977     @param proto - protocol number
978 */
979 define nat64_st_details {
980   u32 context;
981   u8 il_addr[16];
982   u8 ol_addr[4];
983   u16 il_port;
984   u16 ol_port;
985   u8 ir_addr[16];
986   u8 or_addr[4];
987   u16 r_port;
988   u32 vrf_id;
989   u8 proto;
990 };
991
992 /** \brief Add/del NAT64 prefix
993     @param client_index - opaque cookie to identify the sender
994     @param context - sender context, to match reply w/ request
995     @param prefix - NAT64 prefix
996     @param prefix - NAT64 prefix length
997     @param vrf_id - VRF id of tenant
998     @param is_add - 1 if add, 0 if delete
999 */
1000 autoreply define nat64_add_del_prefix {
1001   u32 client_index;
1002   u32 context;
1003   u8 prefix[16];
1004   u8 prefix_len;
1005   u32 vrf_id;
1006   u8 is_add;
1007 };
1008
1009 /** \brief Dump NAT64 prefix
1010     @param client_index - opaque cookie to identify the sender
1011     @param context - sender context, to match reply w/ request
1012 */
1013 define nat64_prefix_dump {
1014   u32 client_index;
1015   u32 context;
1016 };
1017
1018 /** \brief Dump NAT64 prefix details response
1019     @param context - sender context, to match reply w/ request
1020     @param prefix - NAT64 prefix
1021     @param prefix - NAT64 prefix length
1022     @param vrf_id - VRF id of tenant
1023 */
1024 define nat64_prefix_details {
1025   u32 context;
1026   u8 prefix[16];
1027   u8 prefix_len;
1028   u32 vrf_id;
1029 };
1030
1031 /** \brief Add/delete NAT64 pool address from specific interfce
1032     @param client_index - opaque cookie to identify the sender
1033     @param context - sender context, to match reply w/ request
1034     @param is_add - 1 if add, 0 if delete
1035     @param sw_if_index - software index of the interface
1036 */
1037 autoreply define nat64_add_del_interface_addr {
1038   u32 client_index;
1039   u32 context;
1040   u8 is_add;
1041   u8 is_inside;
1042   u32 sw_if_index;
1043 };
1044
1045
1046 /*
1047  * DS-Lite APIs
1048  */
1049
1050 /** \brief Add/delete address range to DS-Lite pool
1051     @param client_index - opaque cookie to identify the sender
1052     @param context - sender context, to match reply w/ request
1053     @param start_addr - start address of the range
1054     @param end_addr - end address of the range
1055     @param is_add - 1 if add, 0 if delete
1056 */
1057 autoreply define dslite_add_del_pool_addr_range {
1058   u32 client_index;
1059   u32 context;
1060   u8 start_addr[4];
1061   u8 end_addr[4];
1062   u8 is_add;
1063 };
1064
1065 autoreply define dslite_set_aftr_addr {
1066   u32 client_index;
1067   u32 context;
1068   u8 ip4_addr[4];
1069   u8 ip6_addr[16];
1070 };