nat: nat44-ed add session timing out indicator in api
[vpp.git] / src / plugins / nat / nat44-ed / nat44_ed.api
1 /*
2  * Copyright (c) 2020 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 option version = "5.4.0";
17 import "vnet/ip/ip_types.api";
18 import "vnet/interface_types.api";
19 import "plugins/nat/lib/nat_types.api";
20
21 /**
22  * @file nat44.api
23  * @brief VPP control-plane API messages.
24  *
25  * This file defines VPP control-plane API messages which are generally
26  * called through a shared memory interface.
27  */
28
29 enum nat44_config_flags : u8
30 {
31   NAT44_IS_ENDPOINT_INDEPENDENT = 0x00,
32   NAT44_IS_ENDPOINT_DEPENDENT = 0x01,
33   NAT44_IS_STATIC_MAPPING_ONLY = 0x02,
34   NAT44_IS_CONNECTION_TRACKING = 0x04,
35   NAT44_IS_OUT2IN_DPO = 0x08,
36 };
37
38 /** \brief Enable/disable NAT44 plugin
39     @param client_index - opaque cookie to identify the sender
40     @param context - sender context, to match reply w/ request
41     @param inside_vrf - inside vrf id
42     @param outside_vrf - outside vrf id
43     @param users - maximum number of users per thread
44                   (NAT44_IS_ENDPOINT_INDEPENDENT)
45     @param user_memory - overwrite hash allocation parameter
46                         (NAT44_IS_ENDPOINT_INDEPENDENT)
47     @param sessions - maximum number of sessions per thread
48     @param session_memory - overwrite hash allocation parameter
49     @param user_sessions - maximum number of sessions per user
50                           (NAT44_IS_ENDPOINT_INDEPENDENT)
51     @param enable - true if enable, false if disable
52     @param flags - flag NAT44_IS_ENDPOINT_INDEPENDENT,
53                         NAT44_IS_ENDPOINT_DEPENDENT,
54                         NAT44_IS_STATIC_MAPPING_ONLY,
55                         NAT44_IS_CONNECTION_TRACKING,
56                         NAT44_IS_OUT2IN_DPO
57 */
58 autoreply define nat44_plugin_enable_disable {
59   option deprecated;
60   u32 client_index;
61   u32 context;
62   u32 inside_vrf;
63   u32 outside_vrf;
64   u32 users;
65   u32 user_memory;
66   u32 sessions;
67   u32 session_memory;
68   u32 user_sessions;
69   bool enable;
70   vl_api_nat44_config_flags_t flags;
71 };
72
73 /** \brief Enable/disable NAT44ED plugin
74     @param client_index - opaque cookie to identify the sender
75     @param context - sender context, to match reply w/ request
76     @param inside_vrf - inside vrf id
77     @param outside_vrf - outside vrf id
78     @param sessions - maximum number of sessions per thread
79     @param session_memory - overwrite hash allocation parameter
80     @param enable - true if enable, false if disable
81     @param flags - flag NAT44_IS_STATIC_MAPPING_ONLY,
82                         NAT44_IS_CONNECTION_TRACKING
83 */
84 autoreply define nat44_ed_plugin_enable_disable {
85   option in_progress;
86   u32 client_index;
87   u32 context;
88   u32 inside_vrf;
89   u32 outside_vrf;
90   u32 sessions;
91   u32 session_memory;
92   bool enable;
93   vl_api_nat44_config_flags_t flags;
94 };
95
96 /** \brief Control ping from client to api server request
97     @param client_index - opaque cookie to identify the sender
98     @param context - sender context, to match reply w/ request
99 */
100 define nat_control_ping
101 {
102   option deprecated;
103   u32 client_index;
104   u32 context;
105 };
106
107 /** \brief Control ping from the client to the server response
108     @param client_index - opaque cookie to identify the sender
109     @param context - sender context, to match reply w/ request
110     @param retval - return code for the request
111     @param vpe_pid - the pid of the vpe, returned by the server
112 */
113 define nat_control_ping_reply
114 {
115   option deprecated;
116   u32 context;
117   i32 retval;
118   u32 client_index;
119   u32 vpe_pid;
120 };
121
122 /** \brief Show NAT plugin startup config
123     @param client_index - opaque cookie to identify the sender
124     @param context - sender context, to match reply w/ request
125 */
126 define nat_show_config
127 {
128   option deprecated;
129   u32 client_index;
130   u32 context;
131 };
132
133 /** \brief DEPRECATED: Show NAT plugin startup config reply
134     @param context - sender context, to match reply w/ request
135     @param retval - return code for the request
136     @param static_mapping_only - if true dynamic translations disabled
137     @param static_mapping_connection_tracking - if true create session data
138     @param deterministic - if true deterministic mapping
139     @param endpoint_dependent - if true endpoint-dependent mode
140     @param out2in_dpo - if true out2in dpo mode
141     @param dslite_ce - if true DS-Lite is CE/B4 element, if false AFTR elemet
142     @param translation_buckets - number of translation hash buckets
143     @param translation_memory_size - translation hash memory size
144     @param user_buckets - number of user hash buckets
145     @param user_memory_size - user hash memory size
146     @param max_translations_per_user - maximum number of translations per user
147     @param outside_vrf_id - outside VRF id
148     @param inside_vrf_id - default inside VRF id
149     @param nat64_bib_buckets - number of NAT64 BIB hash buckets
150     @param nat64_bib_memory_size - memory size of NAT64 BIB hash
151     @param nat64_st_buckets - number of NAT64 session table hash buckets
152     @param nat64_st_memory_size - memory size of NAT64 session table hash
153 */
154 define nat_show_config_reply
155 {
156   option deprecated;
157   u32 context;
158   i32 retval;
159   bool static_mapping_only;
160   bool static_mapping_connection_tracking;
161   bool deterministic;
162   bool endpoint_dependent;
163   bool out2in_dpo;
164   bool dslite_ce;
165   u32 translation_buckets;
166   u32 translation_memory_size;
167   u32 user_buckets;
168   u64 user_memory_size;
169   u32 max_translations_per_user;
170   u32 outside_vrf_id;
171   u32 inside_vrf_id;
172   u32 nat64_bib_buckets;
173   u64 nat64_bib_memory_size;
174   u32 nat64_st_buckets;
175   u64 nat64_st_memory_size;
176 };
177
178 /** \brief Show NAT plugin startup config
179     @param client_index - opaque cookie to identify the sender
180     @param context - sender context, to match reply w/ request
181 */
182 define nat_show_config_2
183 {
184   option deprecated;
185   u32 client_index;
186   u32 context;
187 };
188
189 /** \brief Show NAT plugin startup config reply
190     @param context - sender context, to match reply w/ request
191     @param retval - return code for the request
192     @param static_mapping_only - if true dynamic translations disabled
193     @param static_mapping_connection_tracking - if true create session data
194     @param deterministic - if true deterministic mapping
195     @param endpoint_dependent - if true endpoint-dependent mode
196     @param out2in_dpo - if true out2in dpo mode
197     @param dslite_ce - if true DS-Lite is CE/B4 element, if false AFTR elemet
198     @param translation_buckets - number of translation hash buckets
199     @param translation_memory_size - translation hash memory size
200     @param user_buckets - number of user hash buckets
201     @param user_memory_size - user hash memory size
202     @param max_translations_per_user - maximum number of translations per user
203     @param outside_vrf_id - outside VRF id
204     @param inside_vrf_id - default inside VRF id
205     @param nat64_bib_buckets - number of NAT64 BIB hash buckets
206     @param nat64_bib_memory_size - memory size of NAT64 BIB hash
207     @param nat64_st_buckets - number of NAT64 session table hash buckets
208     @param nat64_st_memory_size - memory size of NAT64 session table hash
209     @param max_translations_per_thread - max translations per worker thread
210     @param max_users_per_thread - max users per worker thread
211 */
212 define nat_show_config_2_reply
213 {
214   option deprecated;
215   u32 context;
216   i32 retval;
217   bool static_mapping_only;
218   bool static_mapping_connection_tracking;
219   bool deterministic;
220   bool endpoint_dependent;
221   bool out2in_dpo;
222   bool dslite_ce;
223   u32 translation_buckets;
224   u64 translation_memory_size;
225   u32 user_buckets;
226   u64 user_memory_size;
227   u32 max_translations_per_user;
228   u32 outside_vrf_id;
229   u32 inside_vrf_id;
230   u32 nat64_bib_buckets;
231   u64 nat64_bib_memory_size;
232   u32 nat64_st_buckets;
233   u64 nat64_st_memory_size;
234   u32 max_translations_per_thread;
235   u32 max_users_per_thread;
236 };
237
238 /** \brief Show NAT44 plugin running config
239     @param client_index - opaque cookie to identify the sender
240     @param context - sender context, to match reply w/ request
241 */
242 define nat44_show_running_config
243 {
244   option in_progress;
245   u32 client_index;
246   u32 context;
247 };
248
249 /** \brief Show NAT44 plugin running config reply
250     @param context - sender context, to match reply w/ request
251     @param retval - return code for the request
252     @param inside_vrf - default inside VRF id
253     @param outside_vrf - outside VRF id
254     @param users - maximum number of users per worker thread
255                   (NAT44_IS_ENDPOINT_INDEPENDENT)
256     @param sessions - maximum number of sessions per worker thread
257     @param user_sessions - maximum number of sessions per user
258                           (NAT44_IS_ENDPOINT_INDEPENDENT)
259     @param user_buckets - number of user hash buckets
260                          (NAT44_IS_ENDPOINT_INDEPENDENT)
261     @param translation_buckets - number of translation hash buckets
262     @param flags - flag NAT44_IS_ENDPOINT_INDEPENDENT,
263                         NAT44_IS_ENDPOINT_DEPENDENT,
264                         NAT44_IS_STATIC_MAPPING_ONLY,
265                         NAT44_IS_CONNECTION_TRACKING,
266                         NAT44_IS_OUT2IN_DPO
267 */
268 define nat44_show_running_config_reply
269 {
270   option in_progress;
271   u32 context;
272   i32 retval;
273   u32 inside_vrf;
274   u32 outside_vrf;
275   u32 users;
276   u32 sessions;
277   u32 user_sessions;
278   u32 user_buckets;
279   u32 translation_buckets;
280   bool forwarding_enabled;
281   bool ipfix_logging_enabled;
282   vl_api_nat_timeouts_t timeouts;
283   vl_api_nat_log_level_t log_level;
284   vl_api_nat44_config_flags_t flags;
285 };
286
287 /** \brief Run nat44 garbage collection
288     @param client_index - opaque cookie to identify the sender
289     @param context - sender context, to match reply w/ request
290 */
291 autoreply define nat44_session_cleanup {
292   option deprecated;
293   u32 client_index;
294   u32 context;
295 };
296
297 /** \brief NAT44 set session limit
298     @param client_index - opaque cookie to identify the sender
299     @param context - sender context, to match reply w/ request
300     @param session_limit - session limit
301     @param vrf_id - vrf id
302 */
303 autoreply define nat44_set_session_limit {
304   u32 client_index;
305   u32 context;
306   u32 session_limit;
307   u32 vrf_id;
308 };
309
310 /** \brief Set NAT logging level
311     @param client_index - opaque cookie to identify the sender
312     @param context - sender context, to match reply w/ request
313     @param log_level - logging level
314 */
315 autoreply define nat_set_log_level {
316   option deprecated;
317   u32 client_index;
318   u32 context;
319   vl_api_nat_log_level_t log_level;
320 };
321
322 /** \brief Set NAT workers
323     @param client_index - opaque cookie to identify the sender
324     @param context - sender context, to match reply w/ request
325     @param worker_mask - NAT workers mask
326 */
327 autoreply define nat_set_workers {
328   u32 client_index;
329   u32 context;
330   u64 worker_mask;
331 };
332
333 /** \brief Dump NAT workers
334     @param client_index - opaque cookie to identify the sender
335     @param context - sender context, to match reply w/ request
336 */
337 define nat_worker_dump {
338   u32 client_index;
339   u32 context;
340 };
341
342 /** \brief NAT workers details response
343     @param context - sender context, to match reply w/ request
344     @param worker_index - worker index
345     @param lcore_id - lcore ID
346     @param name - worker name
347 */
348 define nat_worker_details {
349   u32 context;
350   u32 worker_index;
351   u32 lcore_id;
352   string name[64];
353 };
354
355 /** \brief Enable/disable NAT IPFIX logging
356     @param client_index - opaque cookie to identify the sender
357     @param context - sender context, to match reply w/ request
358     @param domain_id - observation domain ID
359     @param src_port - source port number
360     @param enable - true if enable, false if disable
361 */
362 autoreply define nat_ipfix_enable_disable {
363   option deprecated;
364   u32 client_index;
365   u32 context;
366   u32 domain_id;
367   u16 src_port;
368   bool enable;
369 };
370
371 /** \brief Set values of timeouts for NAT sessions (seconds)
372     @param client_index - opaque cookie to identify the sender
373     @param context - sender context, to match reply w/ request
374     @param udp - UDP timeout (default 300sec)
375     @param tcp_established - TCP established timeout (default 7440sec)
376     @param tcp_transitory - TCP transitory timeout (default 240sec)
377     @param icmp - ICMP timeout (default 60sec)
378 */
379 autoreply define nat_set_timeouts {
380   option deprecated;
381   u32 client_index;
382   u32 context;
383   u32 udp;
384   u32 tcp_established;
385   u32 tcp_transitory;
386   u32 icmp;
387 };
388
389 /** \brief Get values of timeouts for NAT sessions (seconds)
390     @param client_index - opaque cookie to identify the sender
391     @param context - sender context, to match reply w/ request
392 */
393 define nat_get_timeouts {
394   option deprecated;
395   u32 client_index;
396   u32 context;
397 };
398
399 /** \brief Get values of timeouts for NAT sessions reply
400     @param context - sender context, to match reply w/ request
401     @param retval - return code
402     @param udp - UDP timeout
403     @param tcp_established - TCP established timeout
404     @param tcp_transitory - TCP transitory timeout
405     @param icmp - ICMP timeout
406 */
407 define nat_get_timeouts_reply {
408   option deprecated;
409   u32 context;
410   i32 retval;
411   u32 udp;
412   u32 tcp_established;
413   u32 tcp_transitory;
414   u32 icmp;
415 };
416
417 /** \brief Set address and port assignment algorithm
418     @param client_index - opaque cookie to identify the sender
419     @param context - sender context, to match reply w/ request
420     @param alg - address and port assignment algorithm:
421                  0 - default, 1 - MAP-E, 2 - port range
422                  (see nat_addr_and_port_alloc_alg_t in nat.h)
423     @param psid_offset - number of offset bits (valid only for MAP-E alg)
424     @param psid_length - length of PSID (valid only for MAP-E alg)
425     @param psid - Port Set Identifier (PSID) value (valid only for MAP-E alg)
426     @param start_port - beginning of the port range
427     @param end_port - end of the port range
428 */
429 autoreply define nat_set_addr_and_port_alloc_alg {
430   u32 client_index;
431   u32 context;
432   u8 alg;
433   u8 psid_offset;
434   u8 psid_length;
435   u16 psid;
436   u16 start_port;
437   u16 end_port;
438 };
439
440 /** \brief Get address and port assignment algorithm
441     @param client_index - opaque cookie to identify the sender
442     @param context - sender context, to match reply w/ request
443 */
444 define nat_get_addr_and_port_alloc_alg {
445   u32 client_index;
446   u32 context;
447 };
448
449 /** \brief Get address and port assignment algorithm reply
450     @param context - sender context, to match reply w/ request
451     @param retval - return code
452     @param alg - address and port assignment algorithm:
453                  0 - default, 1 - MAP-E, 2 - port range
454                  (see nat_addr_and_port_alloc_alg_t in nat.h)
455     @param psid_offset - number of offset bits (valid only for MAP-E alg)
456     @param psid_length - length of PSID (valid only for MAP-E alg)
457     @param psid - Port Set Identifier (PSID) value (valid only for MAP-E alg)
458     @param start_port - beginning of the port range
459     @param end_port - end of the port range
460 */
461 define nat_get_addr_and_port_alloc_alg_reply {
462   u32 context;
463   i32 retval;
464   u8 alg;
465   u8 psid_offset;
466   u8 psid_length;
467   u16 psid;
468   u16 start_port;
469   u16 end_port;
470 };
471
472 /** \brief Set TCP MSS rewriting configuration
473     @param client_index - opaque cookie to identify the sender
474     @param context - sender context, to match reply w/ request
475     @param mss_value - MSS value to be used for MSS rewriting
476     @param enable - if true enable MSS rewriting feature else disable
477 */
478 autoreply define nat_set_mss_clamping {
479   u32 client_index;
480   u32 context;
481   u16 mss_value;
482   bool enable;
483 };
484
485 /** \brief Get TCP MSS rewriting configuration
486     @param client_index - opaque cookie to identify the sender
487     @param context - sender context, to match reply w/ request
488 */
489 define nat_get_mss_clamping {
490   u32 client_index;
491   u32 context;
492 };
493
494 /** \brief Get TCP MSS rewriting configuration reply
495     @param context - sender context, to match reply w/ request
496     @param retval - return code
497     @param mss_value - MSS value to be used for MSS rewriting
498     @param enable - if true enable MSS rewriting feature else disable
499 */
500 define nat_get_mss_clamping_reply {
501   u32 context;
502   i32 retval;
503   u16 mss_value;
504   bool enable;
505 };
506
507 /** \brief Set HA listener (local settings)
508     @param client_index - opaque cookie to identify the sender
509     @param context - sender context, to match reply w/ request
510     @param ip_address - local IP4 address
511     @param port - local UDP port number
512     @param path_mtu - path MTU between local and failover
513 */
514 autoreply define nat_ha_set_listener {
515   u32 client_index;
516   u32 context;
517   vl_api_ip4_address_t ip_address;
518   u16 port;
519   u32 path_mtu;
520 };
521
522 /** \brief Set HA failover (remote settings)
523     @param client_index - opaque cookie to identify the sender
524     @param context - sender context, to match reply w/ request
525     @param ip_address - failover IP4 address
526     @param port - failvoer UDP port number
527     @param session_refresh_interval - number of seconds after which to send
528                                       session counters refresh
529 */
530 autoreply define nat_ha_set_failover {
531   u32 client_index;
532   u32 context;
533   vl_api_ip4_address_t ip_address;
534   u16 port;
535   u32 session_refresh_interval;
536 };
537
538 /** \brief Get HA listener/local configuration
539     @param client_index - opaque cookie to identify the sender
540     @param context - sender context, to match reply w/ request
541 */
542 define nat_ha_get_listener {
543   u32 client_index;
544   u32 context;
545 };
546
547 /** \brief Get HA listener/local configuration reply
548     @param context - sender context, to match reply w/ request
549     @param retval - return code
550     @param ip_address - local IP4 address
551     @param port - local UDP port number
552     @param path_mtu - Path MTU between local and failover
553 */
554 define nat_ha_get_listener_reply {
555   u32 context;
556   i32 retval;
557   vl_api_ip4_address_t ip_address;
558   u16 port;
559   u32 path_mtu;
560 };
561
562 /** \brief Get HA failover/remote settings
563     @param client_index - opaque cookie to identify the sender
564     @param context - sender context, to match reply w/ request
565 */
566 define nat_ha_get_failover {
567   u32 client_index;
568   u32 context;
569 };
570
571 /** \brief Get HA failover/remote settings reply
572     @param context - sender context, to match reply w/ request
573     @param retval - return code
574     @param ip_address - failover IP4 address
575     @param port - failvoer UDP port number
576     @param session_refresh_interval - number of seconds after which to send
577                                       session counters refresh
578 */
579 define nat_ha_get_failover_reply {
580   u32 context;
581   i32 retval;
582   vl_api_ip4_address_t ip_address;
583   u16 port;
584   u32 session_refresh_interval;
585 };
586
587 /** \brief Flush the current HA data (for testing)
588     @param client_index - opaque cookie to identify the sender
589     @param context - sender context, to match reply w/ request
590 */
591 autoreply define nat_ha_flush {
592   u32 client_index;
593   u32 context;
594 };
595
596 /** \brief Resync HA (resend existing sessions to new failover)
597     @param client_index - opaque cookie to identify the sender
598     @param context - sender context, to match reply w/ request
599     @param want_resync_event - resync completed event sent to the sender via
600                                nat_ha_resync_completed_event API message if
601                                non-zero
602     @param pid - sender's pid
603 */
604 autoreply define nat_ha_resync
605 {
606   u32 client_index;
607   u32 context;
608   u8 want_resync_event;
609   u32 pid;
610 };
611
612 /** \brief Tell client about a HA resync completion event
613     @param client_index - opaque cookie to identify the sender
614     @param pid - client pid registered to receive notification
615     @param missed_count - number of missed (not ACKed) messages
616 */
617 define nat_ha_resync_completed_event
618 {
619   u32 client_index;
620   u32 pid;
621   u32 missed_count;
622 };
623
624 service {
625   rpc nat_ha_resync returns nat_ha_resync_reply events nat_ha_resync_completed_event;
626 };
627
628 /** \brief Del NAT44 user
629     @param client_index - opaque cookie to identify the sender
630     @param context - sender context, to match reply w/ request
631     @param ip_address - IPv4 address
632     @param fib_index - FIB index
633 */
634 autoreply define nat44_del_user {
635   u32 client_index;
636   u32 context;
637   vl_api_ip4_address_t ip_address;
638   u32 fib_index;
639 };
640
641 /** \brief Add/del NAT44 address range
642     @param client_index - opaque cookie to identify the sender
643     @param context - sender context, to match reply w/ request
644     @param first_ip_address - first IPv4 address
645     @param last_ip_address - last IPv4 address
646     @param vrf_id - VRF id of tenant, ~0 means independent of VRF
647     @param is_add - true if add, false if delete
648     @param flags - flag NAT_IS_TWICE_NAT if NAT address range for external hosts
649
650 */
651 autoreply define nat44_add_del_address_range {
652   u32 client_index;
653   u32 context;
654   vl_api_ip4_address_t first_ip_address;
655   vl_api_ip4_address_t last_ip_address;
656   u32 vrf_id;
657   bool is_add;
658   vl_api_nat_config_flags_t flags;
659 };
660
661 /** \brief Dump NAT44 addresses
662     @param client_index - opaque cookie to identify the sender
663     @param context - sender context, to match reply w/ request
664 */
665 define nat44_address_dump {
666   u32 client_index;
667   u32 context;
668 };
669
670 /** \brief NAT44 address details response
671     @param context - sender context, to match reply w/ request
672     @param ip_address - IPv4 address
673     @param flags - flag NAT_IS_TWICE_NAT if NAT address range for external hosts
674     @param vrf_id - VRF id of tenant, ~0 means independent of VRF
675 */
676 define nat44_address_details {
677   u32 context;
678   vl_api_ip4_address_t ip_address;
679   vl_api_nat_config_flags_t flags;
680   u32 vrf_id;
681 };
682
683 /** \brief Enable/disable NAT44 feature on the interface
684     @param client_index - opaque cookie to identify the sender
685     @param context - sender context, to match reply w/ request
686     @param is_add - true if add, false if delete
687     @param flags - flag NAT_IS_INSIDE if interface is inside else
688                    interface is outside
689     @param sw_if_index - software index of the interface
690 */
691 autoreply define nat44_interface_add_del_feature {
692   u32 client_index;
693   u32 context;
694   bool is_add;
695   vl_api_nat_config_flags_t flags;
696   vl_api_interface_index_t sw_if_index;
697 };
698
699 /** \brief Dump interfaces with NAT44 feature
700     @param client_index - opaque cookie to identify the sender
701     @param context - sender context, to match reply w/ request
702 */
703 define nat44_interface_dump {
704   u32 client_index;
705   u32 context;
706 };
707
708 /** \brief NAT44 interface details response
709     @param context - sender context, to match reply w/ request
710     @param sw_if_index - software index of the interface
711     @param flags - flag NAT_IS_INSIDE if interface is inside,
712                    flag NAT_IS_OUTSIDE if interface is outside
713                    and if both flags are set the interface is
714                    both inside and outside
715 */
716 define nat44_interface_details {
717   u32 context;
718   vl_api_nat_config_flags_t flags;
719   vl_api_interface_index_t sw_if_index;
720 };
721
722 /** \brief Enable/disbale NAT44 as an interface output feature (postrouting
723            in2out translation)
724     @param client_index - opaque cookie to identify the sender
725     @param context - sender context, to match reply w/ request
726     @param is_add - true if add, false if delete
727     @param flags - flag NAT_IS_INSIDE if interface is inside else
728                    interface is outside
729     @param sw_if_index - software index of the interface
730 */
731 autoreply define nat44_interface_add_del_output_feature {
732   u32 client_index;
733   u32 context;
734   bool is_add;
735   vl_api_nat_config_flags_t flags;
736   vl_api_interface_index_t sw_if_index;
737 };
738
739 /** \brief Dump interfaces with NAT44 output feature
740     @param client_index - opaque cookie to identify the sender
741     @param context - sender context, to match reply w/ request
742 */
743 define nat44_interface_output_feature_dump {
744   u32 client_index;
745   u32 context;
746 };
747
748 /** \brief NAT44 interface with output feature details response
749     @param context - sender context, to match reply w/ request
750     @param flags - flag NAT_IS_INSIDE if interface is inside else
751                    interface is outside
752     @param sw_if_index - software index of the interface
753 */
754 define nat44_interface_output_feature_details {
755   u32 context;
756   vl_api_nat_config_flags_t flags;
757   vl_api_interface_index_t sw_if_index;
758 };
759
760 /** \brief Add/delete NAT44 static mapping
761     @param client_index - opaque cookie to identify the sender
762     @param context - sender context, to match reply w/ request
763     @param is_add - true if add, false if delete
764     @param flags - flag NAT_IS_ADDR_ONLY if address only mapping,
765                    flag nat_is_twice_nat if nat address range for external hosts,
766                    flag NAT_IS_SELF_TWICE_NAT if translate external host address
767                    and port whenever external host address equals local
768                    address of internal host,
769                    flag NAT_IS_OUT2IN_ONLY if rule match only out2in direction
770     @param local_ip_address - local IPv4 address
771     @param external_ip_address - external IPv4 address
772     @param protocol - IP protocol, used only if addr_only=0
773     @param local_port - local port number, used only if addr_only=0
774     @param external_port - external port number, used only if addr_only=0
775     @param external_sw_if_index - external interface (if set
776                                   external_ip_address is ignored, ~0 means not
777                                   used)
778     @param vfr_id - VRF ID
779     @param tag - opaque string tag
780 */
781 autoreply define nat44_add_del_static_mapping {
782   u32 client_index;
783   u32 context;
784   bool is_add;
785   vl_api_nat_config_flags_t flags;
786   vl_api_ip4_address_t local_ip_address;
787   vl_api_ip4_address_t external_ip_address;
788   u8 protocol;
789   u16 local_port;
790   u16 external_port;
791   vl_api_interface_index_t external_sw_if_index;
792   u32 vrf_id;
793   string tag[64];
794 };
795
796 /** \brief Add/delete NAT44 static mapping
797     @param client_index - opaque cookie to identify the sender
798     @param context - sender context, to match reply w/ request
799     @param is_add - true if add, false if delete
800     @param match_pool - true if use specific pool_ip_address
801     @param flags - flag NAT_IS_ADDR_ONLY if address only mapping,
802                    flag nat_is_twice_nat if nat address range for external hosts,
803                    flag NAT_IS_SELF_TWICE_NAT if translate external host address
804                    and port whenever external host address equals local
805                    address of internal host,
806                    flag NAT_IS_OUT2IN_ONLY if rule match only out2in direction
807     @param pool_ip_address - pool IPv4 address to match with pool
808     @param local_ip_address - local IPv4 address
809     @param external_ip_address - external IPv4 address
810     @param protocol - IP protocol, used only if addr_only=0
811     @param local_port - local port number, used only if addr_only=0
812     @param external_port - external port number, used only if addr_only=0
813     @param external_sw_if_index - external interface (if set
814                                   external_ip_address is ignored, ~0 means not
815                                   used)
816     @param vfr_id - VRF ID
817     @param tag - opaque string tag
818 */
819 autoreply define nat44_add_del_static_mapping_v2 {
820   option in_progress;
821   u32 client_index;
822   u32 context;
823   bool is_add;
824   bool match_pool;
825   vl_api_nat_config_flags_t flags;
826   vl_api_ip4_address_t pool_ip_address;
827   vl_api_ip4_address_t local_ip_address;
828   vl_api_ip4_address_t external_ip_address;
829   u8 protocol;
830   u16 local_port;
831   u16 external_port;
832   vl_api_interface_index_t external_sw_if_index;
833   u32 vrf_id;
834   string tag[64];
835 };
836
837 /** \brief Dump NAT44 static mappings
838     @param client_index - opaque cookie to identify the sender
839     @param context - sender context, to match reply w/ request
840 */
841 define nat44_static_mapping_dump {
842   u32 client_index;
843   u32 context;
844 };
845
846 /** \brief NAT44 static mapping details response
847     @param context - sender context, to match reply w/ request
848     @param flags - flag NAT_ADDR_ONLY if address only mapping,
849                    flag NAT_TWICE_NAT if NAT address range for external hosts,
850                    flag NAT_SELF_TWICE_NAT if translate external host address
851                    and port whenever external host address equals local
852                    address of internal host,
853                    flag NAT_OUT2IN_ONLY if rule match only out2in direction
854     @param local_ip_address - local IPv4 address
855     @param external_ip_address - external IPv4 address
856     @param protocol - IP protocol, valid only if no NAT_ADDR_ONLY flag
857     @param local_port - local port number, valid only if no NAT_ADDR_ONLY flag
858     @param external_port - external port number, valid only if no NAT_ADDR_ONLY flag
859     @param external_sw_if_index - external interface
860     @param vfr_id - VRF ID
861     @param tag - opaque string tag
862 */
863 define nat44_static_mapping_details {
864   u32 context;
865   vl_api_nat_config_flags_t flags;
866   vl_api_ip4_address_t local_ip_address;
867   vl_api_ip4_address_t external_ip_address;
868   u8 protocol;
869   u16 local_port;
870   u16 external_port;
871   vl_api_interface_index_t external_sw_if_index;
872   u32 vrf_id;
873   string tag[64];
874 };
875
876 /** \brief Add/delete NAT44 identity mapping
877     @param client_index - opaque cookie to identify the sender
878     @param context - sender context, to match reply w/ request
879     @param is_add - true if add, false if delete
880     @param flags - flag NAT_ADDR_ONLY if address only mapping
881     @param ip_address - IPv4 address
882     @param protocol - IP protocol
883     @param port - port number
884     @param sw_if_index - interface (if set ip_address is ignored, ~0 means not
885                                     used)
886     @param vfr_id - VRF ID (if ~0 use default VRF)
887     @param tag - opaque string tag
888 */
889 autoreply define nat44_add_del_identity_mapping {
890   u32 client_index;
891   u32 context;
892   bool is_add;
893   vl_api_nat_config_flags_t flags;
894   vl_api_ip4_address_t ip_address;
895   u8 protocol;
896   u16 port;
897   vl_api_interface_index_t sw_if_index;
898   u32 vrf_id;
899   string tag[64];
900 };
901
902 /** \brief Dump NAT44 identity mappings
903     @param client_index - opaque cookie to identify the sender
904     @param context - sender context, to match reply w/ request
905 */
906 define nat44_identity_mapping_dump {
907   u32 client_index;
908   u32 context;
909 };
910
911 /** \brief NAT44 identity mapping details response
912     @param context - sender context, to match reply w/ request
913     @param flags - flag NAT_ADDR_ONLY if address only mapping
914     @param ip_address - IPv4 address
915     @param protocol - IP protocol
916     @param port - port number
917     @param sw_if_index - interface
918     @param vfr_id - VRF ID
919     @param tag - opaque string tag
920 */
921 define nat44_identity_mapping_details {
922   u32 context;
923   vl_api_nat_config_flags_t flags;
924   vl_api_ip4_address_t ip_address;
925   u8 protocol;
926   u16 port;
927   vl_api_interface_index_t sw_if_index;
928   u32 vrf_id;
929   string tag[64];
930 };
931
932 /** \brief Add/delete NAT44 pool address from specific interfce
933     @param client_index - opaque cookie to identify the sender
934     @param context - sender context, to match reply w/ request
935     @param is_add - true if add, false if delete
936     @param sw_if_index - software index of the interface
937     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts
938 */
939 autoreply define nat44_add_del_interface_addr {
940   u32 client_index;
941   u32 context;
942   bool is_add;
943   vl_api_interface_index_t sw_if_index;
944   vl_api_nat_config_flags_t flags;
945 };
946
947 /** \brief Dump NAT44 pool addresses interfaces
948     @param client_index - opaque cookie to identify the sender
949     @param context - sender context, to match reply w/ request
950 */
951 define nat44_interface_addr_dump {
952   u32 client_index;
953   u32 context;
954 };
955
956 /** \brief NAT44 pool addresses interfaces details response
957     @param context - sender context, to match reply w/ request
958     @param sw_if_index - software index of the interface
959     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts
960
961 */
962 define nat44_interface_addr_details {
963   u32 context;
964   vl_api_interface_index_t sw_if_index;
965   vl_api_nat_config_flags_t flags;
966 };
967
968 /** \brief Dump NAT44 users
969     @param client_index - opaque cookie to identify the sender
970     @param context - sender context, to match reply w/ request
971 */
972 define nat44_user_dump {
973   u32 client_index;
974   u32 context;
975 };
976
977 /** \brief NAT44 users response
978     @param context - sender context, to match reply w/ request
979     @vrf_id - VRF ID
980     @param ip_address - IPv4 address
981     @param nsessions - number of dynamic sessions
982     @param nstaticsessions - number of static sessions
983 */
984 define nat44_user_details {
985   u32 context;
986   u32 vrf_id;
987   vl_api_ip4_address_t ip_address;
988   u32 nsessions;
989   u32 nstaticsessions;
990 };
991
992 /** \brief NAT44 user's sessions
993     @param client_index - opaque cookie to identify the sender
994     @param context - sender context, to match reply w/ request
995     @param ip_address - IPv4 address of the user to dump
996     @param vrf_id - VRF_ID
997 */
998 define nat44_user_session_dump {
999   u32 client_index;
1000   u32 context;
1001   vl_api_ip4_address_t ip_address;
1002   u32 vrf_id;
1003 };
1004
1005 /** \brief NAT44 user's sessions response
1006     @param context - sender context, to match reply w/ request
1007     @param outside_ip_address - outside IPv4 address
1008     @param outside_port - outside port
1009     @param inside_ip_address - inside IPv4 address
1010     @param inside_port - inside port
1011     @param protocol - protocol
1012     @param flags - flag NAT_IS_STATIC if session is static,
1013                    flag NAT_IS_TWICE_NAT if session is twice-nat,
1014                    flag NAT_IS_EXT_HOST_VALID if external host address
1015                    and port are valid
1016     @param last_heard - last heard timer
1017     @param total_bytes - count of bytes sent through session
1018     @param total_pkts - count of pakets sent through session
1019     @param ext_host_address - external host IPv4 address
1020     @param ext_host_port - external host port
1021     @param ext_host_nat_address - post-NAT external host IPv4 address (valid
1022                                   only if twice-nat session)
1023     @param ext_host_nat_port - post-NAT external host port (valid only if
1024                                twice-nat session)
1025 */
1026 define nat44_user_session_details {
1027   u32 context;
1028   vl_api_ip4_address_t outside_ip_address;
1029   u16 outside_port;
1030   vl_api_ip4_address_t inside_ip_address;
1031   u16 inside_port;
1032   u16 protocol;
1033   vl_api_nat_config_flags_t flags;
1034   u64 last_heard;
1035   u64 total_bytes;
1036   u32 total_pkts;
1037   vl_api_ip4_address_t ext_host_address;
1038   u16 ext_host_port;
1039   vl_api_ip4_address_t ext_host_nat_address;
1040   u16 ext_host_nat_port;
1041 };
1042
1043 /** \brief NAT44 user's sessions
1044     @param client_index - opaque cookie to identify the sender
1045     @param context - sender context, to match reply w/ request
1046     @param ip_address - IPv4 address of the user to dump
1047     @param vrf_id - VRF_ID
1048 */
1049 define nat44_user_session_v2_dump {
1050   option in_progress;
1051   u32 client_index;
1052   u32 context;
1053   vl_api_ip4_address_t ip_address;
1054   u32 vrf_id;
1055 };
1056
1057 /** \brief NAT44 user's sessions response
1058     @param context - sender context, to match reply w/ request
1059     @param outside_ip_address - outside IPv4 address
1060     @param outside_port - outside port
1061     @param inside_ip_address - inside IPv4 address
1062     @param inside_port - inside port
1063     @param protocol - protocol
1064     @param flags - flag NAT_IS_STATIC if session is static,
1065                    flag NAT_IS_TWICE_NAT if session is twice-nat,
1066                    flag NAT_IS_EXT_HOST_VALID if external host address
1067                    and port are valid
1068     @param last_heard - last heard timer
1069     @param total_bytes - count of bytes sent through session
1070     @param total_pkts - count of pakets sent through session
1071     @param ext_host_address - external host IPv4 address
1072     @param ext_host_port - external host port
1073     @param ext_host_nat_address - post-NAT external host IPv4 address (valid
1074                                   only if twice-nat session)
1075     @param ext_host_nat_port - post-NAT external host port (valid only if
1076                                twice-nat session)
1077     @param is_timed_out - true, if session is timed out, and false, if session
1078                           is active
1079 */
1080 define nat44_user_session_v2_details {
1081   option in_progress;
1082   u32 context;
1083   vl_api_ip4_address_t outside_ip_address;
1084   u16 outside_port;
1085   vl_api_ip4_address_t inside_ip_address;
1086   u16 inside_port;
1087   u16 protocol;
1088   vl_api_nat_config_flags_t flags;
1089   u64 last_heard;
1090   u64 total_bytes;
1091   u32 total_pkts;
1092   vl_api_ip4_address_t ext_host_address;
1093   u16 ext_host_port;
1094   vl_api_ip4_address_t ext_host_nat_address;
1095   u16 ext_host_nat_port;
1096   bool is_timed_out;
1097 };
1098
1099 /** \brief NAT44 load-balancing address and port pair
1100     @param addr - IPv4 address of the internal node
1101     @param port - L4 port number of the internal node
1102     @param probability - probability of the internal node to be randomly matched
1103     @param vrf_id - VRF id
1104 */
1105 typedef nat44_lb_addr_port {
1106   vl_api_ip4_address_t addr;
1107   u16 port;
1108   u8 probability;
1109   u32 vrf_id;
1110 };
1111
1112 /** \brief Add/delete NAT44 load-balancing static mapping rule
1113     @param client_index - opaque cookie to identify the sender
1114     @param context - sender context, to match reply w/ request
1115     @param is_add - true if add, false if delete
1116     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
1117                    flag NAT_SELF_TWICE_NAT if translate external host address
1118                    and port whenever external host address equals local
1119                    address of internal host,
1120                    flag NAT_OUT2IN_ONLY if rule match only out2in direction
1121     @param external_addr - external IPv4 address of the service
1122     @param external_port - external L4 port number of the service
1123     @param protocol - IP protocol number of the service
1124     @param affinity - if 0 disabled, otherwise client IP affinity sticky time
1125                       in seconds
1126     @param local_num - number of local network nodes
1127     @param locals - local network nodes
1128     @param tag - opaque string tag
1129 */
1130 autoreply define nat44_add_del_lb_static_mapping {
1131   u32 client_index;
1132   u32 context;
1133   bool is_add;
1134   vl_api_nat_config_flags_t flags;
1135   vl_api_ip4_address_t external_addr;
1136   u16 external_port;
1137   u8 protocol;
1138   u32 affinity;
1139   string tag[64];
1140   u32 local_num;
1141   vl_api_nat44_lb_addr_port_t locals[local_num];
1142 };
1143
1144 /** \brief Add/delete NAT44 load-balancing static mapping rule backend
1145     @param client_index - opaque cookie to identify the sender
1146     @param context - sender context, to match reply w/ request
1147     @param is_add - true if add, false if delete
1148     @param external_addr - external IPv4 address of the service
1149     @param external_port - external L4 port number of the service
1150     @param protocol - IP protocol number of the service
1151     @param local - local network node
1152 */
1153 autoreply define nat44_lb_static_mapping_add_del_local {
1154   u32 client_index;
1155   u32 context;
1156   bool is_add;
1157   vl_api_ip4_address_t external_addr;
1158   u16 external_port;
1159   u8 protocol;
1160   vl_api_nat44_lb_addr_port_t local;
1161 };
1162
1163 /** \brief Dump NAT44 load-balancing static mapping rules
1164     @param client_index - opaque cookie to identify the sender
1165     @param context - sender context, to match reply w/ request
1166 */
1167 define nat44_lb_static_mapping_dump {
1168   u32 client_index;
1169   u32 context;
1170 };
1171
1172 /** \brief NAT44 load-balancing static mapping rule details response
1173     @param context - sender context, to match reply w/ request
1174     @param external_addr - external IPv4 address of the service
1175     @param external_port - external L4 port number of the service
1176     @param protocol - IP protocol number of the service
1177     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
1178                    flag NAT_SELF_TWICE_NAT if translate external host address
1179                    and port whenever external host address equals local
1180                    address of internal host,
1181                    flag NAT_OUT2IN_ONLY if rule match only out2in direction
1182     @param affinity - if 0 disabled, otherwise client IP affinity sticky time
1183                       in seconds
1184     @param local_num - number of local network nodes
1185     @param locals - local network nodes
1186     @param tag - opaque string tag
1187 */
1188 define nat44_lb_static_mapping_details {
1189   u32 context;
1190   vl_api_ip4_address_t external_addr;
1191   u16 external_port;
1192   u8 protocol;
1193   vl_api_nat_config_flags_t flags;
1194   u32 affinity;
1195   string tag[64];
1196   u32 local_num;
1197   vl_api_nat44_lb_addr_port_t locals[local_num];
1198 };
1199
1200 /** \brief Delete NAT44 session
1201     @param client_index - opaque cookie to identify the sender
1202     @param context - sender context, to match reply w/ request
1203     @param ip_address - IPv4 address
1204     @param protocol - IP protocol
1205     @param port - port number
1206     @param vfr_id - VRF ID
1207     @param flags - flag NAT_IS_INSIDE if interface is inside or
1208                    interface is outside,
1209                    flag NAT_IS_EXT_HOST_VALID if external host address and
1210                    port are valid
1211     @param ext_host_address - external host IPv4 address
1212     @param ext_host_port - external host port
1213 */
1214 autoreply define nat44_del_session {
1215   u32 client_index;
1216   u32 context;
1217   vl_api_ip4_address_t address;
1218   u8 protocol;
1219   u16 port;
1220   u32 vrf_id;
1221   vl_api_nat_config_flags_t flags;
1222   vl_api_ip4_address_t ext_host_address;
1223   u16 ext_host_port;
1224 };
1225
1226 /** \brief Enable/disable forwarding for NAT44
1227     Forward packets which don't match existing translation
1228     or static mapping instead of dropping them.
1229     @param client_index - opaque cookie to identify the sender
1230     @param context - sender context, to match reply w/ request
1231     @param enable - true for enable, false for disable
1232 */
1233 autoreply define nat44_forwarding_enable_disable {
1234   option deprecated;
1235   u32 client_index;
1236   u32 context;
1237   bool enable;
1238 };
1239
1240 /** \brief Check if forwarding is enabled or disabled
1241     @param client_index - opaque cookie to identify the sender
1242     @param context - sender context, to match reply w/ request
1243 */
1244 define nat44_forwarding_is_enabled {
1245   option deprecated;
1246   u32 client_index;
1247   u32 context;
1248 };
1249
1250 /** \brief Response to check if forwarding is enabled or disabled
1251     @param context - sender context, to match reply w/ request
1252     @param enabled - true if enabled, false if disabled
1253 */
1254 define nat44_forwarding_is_enabled_reply {
1255   option deprecated;
1256   u32 context;
1257   bool enabled;
1258 };
1259
1260 /** \brief Set NAT handoff frame queue options
1261     @param client_index - opaque cookie to identify the sender
1262     @param context - sender context, to match reply w/ request
1263     @param frame_queue_nelts - number of worker handoff frame queue elements
1264 */
1265 autoreply define nat44_ed_set_fq_options {
1266   option in_progress;
1267   u32 client_index;
1268   u32 context;
1269   u32 frame_queue_nelts;
1270 };
1271
1272 /** \brief Show NAT handoff frame queue options
1273     @param client_index - opaque cookie to identify the sender
1274     @param context - sender context, to match reply w/ request
1275 */
1276 define nat44_ed_show_fq_options
1277 {
1278   option in_progress;
1279   u32 client_index;
1280   u32 context;
1281 };
1282
1283 /** \brief Show NAT handoff frame queue options reply
1284     @param context - sender context, to match reply w/ request
1285     @param retval - return code for the request
1286     @param frame_queue_nelts - number of worker handoff frame queue elements
1287 */
1288 define nat44_ed_show_fq_options_reply
1289 {
1290   option in_progress;
1291   u32 context;
1292   i32 retval;
1293   u32 frame_queue_nelts;
1294 };