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