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