NAT44: identity NAT (VPP-1073)
[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 identity mapping
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 addr_only - 1 if address only mapping
401     @param ip_address - IPv4 address
402     @param protocol - IP protocol
403     @param port - port number
404     @param sw_if_index - interface (if set ip_address is ignored, ~0 means not
405                                     used)
406     @param vfr_id - VRF ID (if ~0 use default VRF)
407 */
408 autoreply define nat44_add_del_identity_mapping {
409   u32 client_index;
410   u32 context;
411   u8 is_add;
412   u8 addr_only;
413   u8 ip_address[4];
414   u8 protocol;
415   u16 port;
416   u32 sw_if_index;
417   u32 vrf_id;
418 };
419
420 /** \brief Dump NAT44 identity mappings
421     @param client_index - opaque cookie to identify the sender
422     @param context - sender context, to match reply w/ request
423 */
424 define nat44_identity_mapping_dump {
425   u32 client_index;
426   u32 context;
427 };
428
429 /** \brief NAT44 identity mapping details response
430     @param context - sender context, to match reply w/ request
431     @param addr_only - 1 if address only mapping
432     @param ip_address - IPv4 address
433     @param protocol - IP protocol
434     @param port - port number
435     @param sw_if_index - interface
436     @param vfr_id - VRF ID
437 */
438 define nat44_identity_mapping_details {
439   u32 context;
440   u8 addr_only;
441   u8 ip_address[4];
442   u8 protocol;
443   u16 port;
444   u32 sw_if_index;
445   u32 vrf_id;
446 };
447
448 /** \brief Add/delete NAT44 pool address from specific interfce
449     @param client_index - opaque cookie to identify the sender
450     @param context - sender context, to match reply w/ request
451     @param is_add - 1 if add, 0 if delete
452     @param sw_if_index - software index of the interface
453 */
454 autoreply define nat44_add_del_interface_addr {
455   u32 client_index;
456   u32 context;
457   u8 is_add;
458   u8 is_inside;
459   u32 sw_if_index;
460 };
461
462 /** \brief Dump NAT44 pool addresses interfaces
463     @param client_index - opaque cookie to identify the sender
464     @param context - sender context, to match reply w/ request
465 */
466 define nat44_interface_addr_dump {
467   u32 client_index;
468   u32 context;
469 };
470
471 /** \brief NAT44 pool addresses interfaces details response
472     @param context - sender context, to match reply w/ request
473     @param sw_if_index - software index of the interface
474 */
475 define nat44_interface_addr_details {
476   u32 context;
477   u32 sw_if_index;
478 };
479
480 /** \brief Dump NAT44 users
481     @param client_index - opaque cookie to identify the sender
482     @param context - sender context, to match reply w/ request
483 */
484 define nat44_user_dump {
485   u32 client_index;
486   u32 context;
487 };
488
489 /** \brief NAT44 users response
490     @param context - sender context, to match reply w/ request
491     @vrf_id - VRF ID
492     @param ip_adress - IPv4 address
493     @param nsessions - number of dynamic sessions
494     @param nstaticsessions - number of static sessions
495 */
496 define nat44_user_details {
497   u32 context;
498   u32 vrf_id;
499   u8 ip_address[4];
500   u32 nsessions;
501   u32 nstaticsessions;
502 };
503
504 /** \brief NAT44 user's sessions
505     @param client_index - opaque cookie to identify the sender
506     @param context - sender context, to match reply w/ request
507     @param is_ip4 - 1 if address type is IPv4
508     @param user_ip - IP address of the user to dump
509     @param vrf_id - VRF_ID
510 */
511 define nat44_user_session_dump {
512   u32 client_index;
513   u32 context;
514   u8 ip_address[4];
515   u32 vrf_id;
516 };
517
518 /** \brief NAT44 user's sessions response
519     @param context - sender context, to match reply w/ request
520     @param outside_ip_address - outside IPv4 address
521     @param outside_port - outside port
522     @param inside_ip_address - inside IPv4 address
523     @param inside_port - inside port
524     @param protocol - protocol
525     @param is_static - 1 if session is static
526     @param last_heard - last heard timer
527     @param total_bytes - count of bytes sent through session
528     @param total_pkts - count of pakets sent through session
529 */
530 define nat44_user_session_details {
531   u32 context;
532   u8 outside_ip_address[4];
533   u16 outside_port;
534   u8 inside_ip_address[4];
535   u16 inside_port;
536   u16 protocol;
537   u8 is_static;
538   u64 last_heard;
539   u64 total_bytes;
540   u32 total_pkts;
541 };
542
543 typeonly manual_endian define nat44_lb_addr_port {
544   u8 addr[4];
545   u16 port;
546   u8 probability;
547 };
548
549 autoreply manual_endian define nat44_add_del_lb_static_mapping {
550   u32 client_index;
551   u32 context;
552   u8 is_add;
553   u8 external_addr[4];
554   u16 external_port;
555   u8 protocol;
556   u32 vrf_id;
557   u8 local_num;
558   vl_api_nat44_lb_addr_port_t locals[local_num];
559 };
560
561 define nat44_lb_static_mapping_dump {
562   u32 client_index;
563   u32 context;
564 };
565
566 manual_endian define nat44_lb_static_mapping_details {
567   u32 context;
568   u8 external_addr[4];
569   u16 external_port;
570   u8 protocol;
571   u32 vrf_id;
572   u8 local_num;
573   vl_api_nat44_lb_addr_port_t locals[local_num];
574 };
575
576 /** \brief Delete NAT44 session
577     @param client_index - opaque cookie to identify the sender
578     @param context - sender context, to match reply w/ request
579     @param is_in - 1 if inside network addres and port pari, 0 if outside
580     @param ip_address - IPv4 address
581     @param protocol - IP protocol
582     @param port - port number
583     @param vfr_id - VRF ID
584 */
585 autoreply define nat44_del_session {
586   u32 client_index;
587   u32 context;
588   u8 is_in;
589   u8 address[4];
590   u8 protocol;
591   u16 port;
592   u32 vrf_id;
593 };
594
595
596 /*
597  * Deterministic NAT (CGN) APIs
598  */
599
600 /** \brief Add/delete NAT deterministic mapping
601     @param client_index - opaque cookie to identify the sender
602     @param context - sender context, to match reply w/ request
603     @param is_add - 1 if add, 0 if delete
604     @param is_nat44 - 1 if NAT44
605     @param in_addr - inside IP address
606     @param in_plen - inside IP address prefix length
607     @param out_addr - outside IPv4 address
608     @param out_addr - outside IPv4 address prefix length
609 */
610 autoreply define nat_det_add_del_map {
611   u32 client_index;
612   u32 context;
613   u8 is_add;
614   u8 is_nat44;
615   u8 addr_only;
616   u8 in_addr[16];
617   u8 in_plen;
618   u8 out_addr[4];
619   u8 out_plen;
620 };
621
622 /** \brief Get outside address and port range from inside address
623     @param client_index - opaque cookie to identify the sender
624     @param context - sender context, to match reply w/ request
625     @param is_nat44 - 1 if NAT44
626     @param in_addr - inside IP address
627 */
628 define nat_det_forward {
629   u32 client_index;
630   u32 context;
631   u8 is_nat44;
632   u8 in_addr[16];
633 };
634
635 /** \brief Get outside address and port range from inside address
636     @param context - sender context, to match reply w/ request
637     @param retval - return code
638     @param out_port_lo - outside port range start
639     @param out_port_hi - outside port range end
640     @param out_addr - outside IPv4 address
641 */
642 define nat_det_forward_reply {
643   u32 context;
644   i32 retval;
645   u16 out_port_lo;
646   u16 out_port_hi;
647   u8 out_addr[4];
648 };
649
650 /** \brief Get inside address from outside address and port
651     @param client_index - opaque cookie to identify the sender
652     @param context - sender context, to match reply w/ request
653     @param out_port - outside port
654     @param out_addr - outside IPv4 address
655 */
656 define nat_det_reverse {
657   u32 client_index;
658   u32 context;
659   u16 out_port;
660   u8 out_addr[4];
661 };
662
663 /** \brief Get inside address from outside address and port reply
664     @param context - sender context, to match reply w/ request
665     @param retval - return code
666     @param is_nat44 - 1 if NAT44
667     @param in_addr - inside IP address
668 */
669 define nat_det_reverse_reply {
670   u32 context;
671   i32 retval;
672   u8 is_nat44;
673   u8 in_addr[16];
674 };
675
676 /** \brief Dump NAT deterministic mappings
677     @param client_index - opaque cookie to identify the sender
678     @param context - sender context, to match reply w/ request
679 */
680 define nat_det_map_dump {
681   u32 client_index;
682   u32 context;
683 };
684
685 /** \brief NAT users response
686     @param context - sender context, to match reply w/ request
687     @param is_nat44 - 1 if NAT44
688     @param in_addr - inside IP address
689     @param in_plen - inside IP address prefix length
690     @param out_addr - outside IPv4 address
691     @param out_plen - outside IPv4 address prefix length
692     @param sharing_ratio - outside to inside address sharing ratio
693     @param ports_per_host - number of ports available to a host
694     @param ses_num - number of sessions belonging to this mapping
695 */
696 define nat_det_map_details {
697   u32 context;
698   u8 is_nat44;
699   u8 in_addr[16];
700   u8 in_plen;
701   u8 out_addr[4];
702   u8 out_plen;
703   u32 sharing_ratio;
704   u16 ports_per_host;
705   u32 ses_num;
706 };
707
708 /** \brief Set values of timeouts for deterministic NAT (seconds, 0 = default)
709     @param client_index - opaque cookie to identify the sender
710     @param context - sender context, to match reply w/ request
711     @param udp - UDP timeout (default 300sec)
712     @param tcp_established - TCP established timeout (default 7440sec)
713     @param tcp_transitory - TCP transitory timeout (default 240sec)
714     @param icmp - ICMP timeout (default 60sec)
715 */
716 autoreply define nat_det_set_timeouts {
717   u32 client_index;
718   u32 context;
719   u32 udp;
720   u32 tcp_established;
721   u32 tcp_transitory;
722   u32 icmp;
723 };
724
725 /** \brief Get values of timeouts for deterministic NAT (seconds)
726     @param client_index - opaque cookie to identify the sender
727     @param context - sender context, to match reply w/ request
728 */
729 define nat_det_get_timeouts {
730   u32 client_index;
731   u32 context;
732 };
733
734 /** \brief Get values of timeouts for deterministic NAT reply
735     @param context - sender context, to match reply w/ request
736     @param retval - return code
737     @param udp - UDP timeout (default 300sec)
738     @param tcp_established - TCP established timeout (default 7440sec)
739     @param tcp_transitory - TCP transitory timeout (default 240sec)
740     @param icmp - ICMP timeout (default 60sec)
741 */
742 define nat_det_get_timeouts_reply {
743   u32 context;
744   i32 retval;
745   u32 udp;
746   u32 tcp_established;
747   u32 tcp_transitory;
748   u32 icmp;
749 };
750
751 /** \brief Close deterministic NAT session by outside address and port
752     @param client_index - opaque cookie to identify the sender
753     @param context - sender context, to match reply w/ request
754     @param out_addr - outside IPv4 address
755     @param out_port - outside port
756     @param ext_addr - external host IPv4 address
757     @param ext_port - external host port
758 */
759 autoreply define nat_det_close_session_out {
760   u32 client_index;
761   u32 context;
762   u8 out_addr[4];
763   u16 out_port;
764   u8 ext_addr[4];
765   u16 ext_port;
766 };
767
768 /** \brief Close deterministic NAT session by inside address and port
769     @param client_index - opaque cookie to identify the sender
770     @param context - sender context, to match reply w/ request
771     @param is_nat44 - 1 if NAT44
772     @param in_addr - inside IP address
773     @param in_port - inside port
774     @param ext_addr - external host IP address
775     @param ext_port - external host port
776 */
777 autoreply define nat_det_close_session_in {
778   u32 client_index;
779   u32 context;
780   u8 is_nat44;
781   u8 in_addr[16];
782   u16 in_port;
783   u8 ext_addr[16];
784   u16 ext_port;
785 };
786
787 /** \brief Dump determinstic NAT sessions
788     @param client_index - opaque cookie to identify the sender
789     @param context - sender context, to match reply w/ request
790     @param is_nat44 - 1 if NAT44
791     @param user_addr - address of an inside user whose sessions to dump
792 */
793 define nat_det_session_dump {
794   u32 client_index;
795   u32 context;
796   u8 is_nat44;
797   u8 user_addr[16];
798 };
799
800 /** \brief Deterministic NAT sessions reply
801     @param context - sender context, to match reply w/ request
802     @param in_port - inside port
803     @param ext_addr - external host address
804     @param ext_port - external host port
805     @param out_port - outside NAT port
806     @param state - session state
807     @param expire - session expiration timestamp
808 */
809 define nat_det_session_details {
810   u32 client_index;
811   u32 context;
812   u16 in_port;
813   u8 ext_addr[4];
814   u16 ext_port;
815   u16 out_port;
816   u8 state;
817   u32 expire;
818 };
819
820 /*
821  * NAT64 APIs
822  */
823
824 /** \brief Add/delete address range to NAT64 pool
825     @param client_index - opaque cookie to identify the sender
826     @param context - sender context, to match reply w/ request
827     @param start_addr - start address of the range
828     @param end_addr - end address of the range
829     @param vrf_id - VRF id of tenant, ~0 means independent of VRF
830     @param is_add - 1 if add, 0 if delete
831 */
832 autoreply define nat64_add_del_pool_addr_range {
833   u32 client_index;
834   u32 context;
835   u8 start_addr[4];
836   u8 end_addr[4];
837   u32 vrf_id;
838   u8 is_add;
839 };
840
841 /** \brief Dump NAT64 pool addresses
842     @param client_index - opaque cookie to identify the sender
843     @param context - sender context, to match reply w/ request
844 */
845 define nat64_pool_addr_dump {
846   u32 client_index;
847   u32 context;
848 };
849
850 /** \brief NAT64 pool address details response
851     @param context - sender context, to match reply w/ request
852     @param address - IPv4 address
853     @param vfr_id - VRF id of tenant, ~0 means independent of VRF
854 */
855 define nat64_pool_addr_details {
856   u32 context;
857   u8 address[4];
858   u32 vrf_id;
859 };
860
861 /** \brief Enable/disable NAT64 feature on the interface
862     @param client_index - opaque cookie to identify the sender
863     @param context - sender context, to match reply w/ request
864     @param sw_if_index - index of the interface
865     @param is_inside - 1 if inside, 0 if outside
866     @param is_add - 1 if add, 0 if delete
867 */
868 autoreply define nat64_add_del_interface {
869   u32 client_index;
870   u32 context;
871   u32 sw_if_index;
872   u8 is_inside;
873   u8 is_add;
874 };
875
876 /** \brief Dump interfaces with NAT64 feature
877     @param client_index - opaque cookie to identify the sender
878     @param context - sender context, to match reply w/ request
879 */
880 define nat64_interface_dump {
881   u32 client_index;
882   u32 context;
883 };
884
885 /** \brief NAT64 interface details response
886     @param context - sender context, to match reply w/ request
887     @param is_inside - 1 if inside, 0 if outside
888     @param sw_if_index - index of the interface
889 */
890 define nat64_interface_details {
891   u32 context;
892   u8 is_inside;
893   u32 sw_if_index;
894 };
895
896 /** \brief Add/delete NAT64 static BIB entry
897     @param client_index - opaque cookie to identify the sender
898     @param context - sender context, to match reply w/ request
899     @param i_addr - inside IPv6 address
900     @param o_addr - outside IPv4 address
901     @param i_port - inside port number
902     @param o_port - outside port number
903     @param vrf_id - VRF id of tenant
904     @param proto - protocol number
905     @param is_add - 1 if add, 0 if delete
906 */
907  autoreply define nat64_add_del_static_bib {
908   u32 client_index;
909   u32 context;
910   u8 i_addr[16];
911   u8 o_addr[4];
912   u16 i_port;
913   u16 o_port;
914   u32 vrf_id;
915   u8 proto;
916   u8 is_add;
917 };
918
919 /** \brief Dump NAT64 BIB
920     @param client_index - opaque cookie to identify the sender
921     @param context - sender context, to match reply w/ request
922     @param proto - protocol of the BIB: 255 - all BIBs
923                                         6 - TCP BIB
924                                         17 - UDP BIB
925                                         1/58 - ICMP BIB
926                                         otherwise - "unknown" protocol BIB
927 */
928 define nat64_bib_dump {
929   u32 client_index;
930   u32 context;
931   u8 proto;
932 };
933
934 /** \brief NAT64 BIB details response
935     @param context - sender context, to match reply w/ request
936     @param i_addr - inside IPv6 address
937     @param o_addr - outside IPv4 address
938     @param i_port - inside port number
939     @param o_port - outside port number
940     @param vrf_id - VRF id of tenant
941     @param proto - protocol number
942     @param is_static - 1 if static BIB entry, 0 if dynamic
943     @param ses_num - number of sessions associated with the BIB entry
944 */
945 define nat64_bib_details {
946   u32 context;
947   u8 i_addr[16];
948   u8 o_addr[4];
949   u16 i_port;
950   u16 o_port;
951   u32 vrf_id;
952   u8 proto;
953   u8 is_static;
954   u32 ses_num;
955 };
956
957 /** \brief Set values of timeouts for NAT64 (seconds, 0 = default)
958     @param client_index - opaque cookie to identify the sender
959     @param context - sender context, to match reply w/ request
960     @param udp - UDP timeout (default 300sec)
961     @param icmp - ICMP timeout (default 60sec)
962     @param tcp_trans - TCP transitory timeout (default 240sec)
963     @param tcp_est - TCP established timeout (default 7440sec)
964     @param tcp_incoming_syn - TCP incoming SYN timeout (default 6sec)
965 */
966 autoreply define nat64_set_timeouts {
967   u32 client_index;
968   u32 context;
969   u32 udp;
970   u32 icmp;
971   u32 tcp_trans;
972   u32 tcp_est;
973   u32 tcp_incoming_syn;
974 };
975
976 /** \brief Get values of timeouts for NAT64 (seconds)
977     @param client_index - opaque cookie to identify the sender
978     @param context - sender context, to match reply w/ request
979 */
980 define nat64_get_timeouts {
981   u32 client_index;
982   u32 context;
983 };
984
985 /** \brief Get values of timeouts for NAT64 reply
986     @param context - sender context, to match reply w/ request
987     @param retval - return code
988     @param udp - UDP timeout
989     @param icmp - ICMP timeout
990     @param tcp_trans - TCP transitory timeout
991     @param tcp_est - TCP established timeout
992     @param tcp_incoming_syn - TCP incoming SYN timeout
993 */
994 define nat64_get_timeouts_reply {
995   u32 context;
996   i32 retval;
997   u32 udp;
998   u32 icmp;
999   u32 tcp_trans;
1000   u32 tcp_est;
1001   u32 tcp_incoming_syn;
1002 };
1003
1004 /** \brief Dump NAT64 session table
1005     @param client_index - opaque cookie to identify the sender
1006     @param context - sender context, to match reply w/ request
1007     @param proto - protocol of the session table: 255 - all STs
1008                                                   6 - TCP ST
1009                                                   17 - UDP ST
1010                                                   1/58 - ICMP ST
1011                                                   otherwise - "unknown" proto ST
1012 */
1013 define nat64_st_dump {
1014   u32 client_index;
1015   u32 context;
1016   u8 proto;
1017 };
1018
1019 /** \brief NAT64 session table details response
1020     @param context - sender context, to match reply w/ request
1021     @param il_addr - inside IPv6 address of the local host
1022     @param ol_addr - outside IPv4 address of the local host
1023     @param il_port - inside port number id of the local host/inside ICMP id
1024     @param ol_port - outside port number of the local host/outside ICMP id
1025     @param il_addr - inside IPv6 address of the remote host
1026     @param ol_addr - outside IPv4 address of the remote host
1027     @param l_port - port number of the remote host (not used for ICMP)
1028     @param vrf_id - VRF id of tenant
1029     @param proto - protocol number
1030 */
1031 define nat64_st_details {
1032   u32 context;
1033   u8 il_addr[16];
1034   u8 ol_addr[4];
1035   u16 il_port;
1036   u16 ol_port;
1037   u8 ir_addr[16];
1038   u8 or_addr[4];
1039   u16 r_port;
1040   u32 vrf_id;
1041   u8 proto;
1042 };
1043
1044 /** \brief Add/del NAT64 prefix
1045     @param client_index - opaque cookie to identify the sender
1046     @param context - sender context, to match reply w/ request
1047     @param prefix - NAT64 prefix
1048     @param prefix - NAT64 prefix length
1049     @param vrf_id - VRF id of tenant
1050     @param is_add - 1 if add, 0 if delete
1051 */
1052 autoreply define nat64_add_del_prefix {
1053   u32 client_index;
1054   u32 context;
1055   u8 prefix[16];
1056   u8 prefix_len;
1057   u32 vrf_id;
1058   u8 is_add;
1059 };
1060
1061 /** \brief Dump NAT64 prefix
1062     @param client_index - opaque cookie to identify the sender
1063     @param context - sender context, to match reply w/ request
1064 */
1065 define nat64_prefix_dump {
1066   u32 client_index;
1067   u32 context;
1068 };
1069
1070 /** \brief Dump NAT64 prefix details response
1071     @param context - sender context, to match reply w/ request
1072     @param prefix - NAT64 prefix
1073     @param prefix - NAT64 prefix length
1074     @param vrf_id - VRF id of tenant
1075 */
1076 define nat64_prefix_details {
1077   u32 context;
1078   u8 prefix[16];
1079   u8 prefix_len;
1080   u32 vrf_id;
1081 };
1082
1083 /** \brief Add/delete NAT64 pool address from specific interfce
1084     @param client_index - opaque cookie to identify the sender
1085     @param context - sender context, to match reply w/ request
1086     @param is_add - 1 if add, 0 if delete
1087     @param sw_if_index - software index of the interface
1088 */
1089 autoreply define nat64_add_del_interface_addr {
1090   u32 client_index;
1091   u32 context;
1092   u8 is_add;
1093   u8 is_inside;
1094   u32 sw_if_index;
1095 };
1096
1097
1098 /*
1099  * DS-Lite APIs
1100  */
1101
1102 /** \brief Add/delete address range to DS-Lite pool
1103     @param client_index - opaque cookie to identify the sender
1104     @param context - sender context, to match reply w/ request
1105     @param start_addr - start address of the range
1106     @param end_addr - end address of the range
1107     @param is_add - 1 if add, 0 if delete
1108 */
1109 autoreply define dslite_add_del_pool_addr_range {
1110   u32 client_index;
1111   u32 context;
1112   u8 start_addr[4];
1113   u8 end_addr[4];
1114   u8 is_add;
1115 };
1116
1117 autoreply define dslite_set_aftr_addr {
1118   u32 client_index;
1119   u32 context;
1120   u8 ip4_addr[4];
1121   u8 ip6_addr[16];
1122 };