nat: Final NAT44 EI/ED split patch
[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.2.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   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 address and port assignment algorithm
394     @param client_index - opaque cookie to identify the sender
395     @param context - sender context, to match reply w/ request
396     @param alg - address and port assignment algorithm:
397                  0 - default, 1 - MAP-E, 2 - port range
398                  (see nat_addr_and_port_alloc_alg_t in nat.h)
399     @param psid_offset - number of offset bits (valid only for MAP-E alg)
400     @param psid_length - length of PSID (valid only for MAP-E alg)
401     @param psid - Port Set Identifier (PSID) value (valid only for MAP-E alg)
402     @param start_port - beginning of the port range
403     @param end_port - end of the port range
404 */
405 autoreply define nat_set_addr_and_port_alloc_alg {
406   u32 client_index;
407   u32 context;
408   u8 alg;
409   u8 psid_offset;
410   u8 psid_length;
411   u16 psid;
412   u16 start_port;
413   u16 end_port;
414 };
415
416 /** \brief Get address and port assignment algorithm
417     @param client_index - opaque cookie to identify the sender
418     @param context - sender context, to match reply w/ request
419 */
420 define nat_get_addr_and_port_alloc_alg {
421   u32 client_index;
422   u32 context;
423 };
424
425 /** \brief Get address and port assignment algorithm reply
426     @param context - sender context, to match reply w/ request
427     @param retval - return code
428     @param alg - address and port assignment algorithm:
429                  0 - default, 1 - MAP-E, 2 - port range
430                  (see nat_addr_and_port_alloc_alg_t in nat.h)
431     @param psid_offset - number of offset bits (valid only for MAP-E alg)
432     @param psid_length - length of PSID (valid only for MAP-E alg)
433     @param psid - Port Set Identifier (PSID) value (valid only for MAP-E alg)
434     @param start_port - beginning of the port range
435     @param end_port - end of the port range
436 */
437 define nat_get_addr_and_port_alloc_alg_reply {
438   u32 context;
439   i32 retval;
440   u8 alg;
441   u8 psid_offset;
442   u8 psid_length;
443   u16 psid;
444   u16 start_port;
445   u16 end_port;
446 };
447
448 /** \brief Set TCP MSS rewriting configuration
449     @param client_index - opaque cookie to identify the sender
450     @param context - sender context, to match reply w/ request
451     @param mss_value - MSS value to be used for MSS rewriting
452     @param enable - if true enable MSS rewriting feature else disable
453 */
454 autoreply define nat_set_mss_clamping {
455   u32 client_index;
456   u32 context;
457   u16 mss_value;
458   bool enable;
459 };
460
461 /** \brief Get TCP MSS rewriting configuration
462     @param client_index - opaque cookie to identify the sender
463     @param context - sender context, to match reply w/ request
464 */
465 define nat_get_mss_clamping {
466   u32 client_index;
467   u32 context;
468 };
469
470 /** \brief Get TCP MSS rewriting configuration reply
471     @param context - sender context, to match reply w/ request
472     @param retval - return code
473     @param mss_value - MSS value to be used for MSS rewriting
474     @param enable - if true enable MSS rewriting feature else disable
475 */
476 define nat_get_mss_clamping_reply {
477   u32 context;
478   i32 retval;
479   u16 mss_value;
480   bool enable;
481 };
482
483 /** \brief Set HA listener (local settings)
484     @param client_index - opaque cookie to identify the sender
485     @param context - sender context, to match reply w/ request
486     @param ip_address - local IP4 address
487     @param port - local UDP port number
488     @param path_mtu - path MTU between local and failover
489 */
490 autoreply define nat_ha_set_listener {
491   u32 client_index;
492   u32 context;
493   vl_api_ip4_address_t ip_address;
494   u16 port;
495   u32 path_mtu;
496 };
497
498 /** \brief Set HA failover (remote settings)
499     @param client_index - opaque cookie to identify the sender
500     @param context - sender context, to match reply w/ request
501     @param ip_address - failover IP4 address
502     @param port - failvoer UDP port number
503     @param session_refresh_interval - number of seconds after which to send
504                                       session counters refresh
505 */
506 autoreply define nat_ha_set_failover {
507   u32 client_index;
508   u32 context;
509   vl_api_ip4_address_t ip_address;
510   u16 port;
511   u32 session_refresh_interval;
512 };
513
514 /** \brief Get HA listener/local configuration
515     @param client_index - opaque cookie to identify the sender
516     @param context - sender context, to match reply w/ request
517 */
518 define nat_ha_get_listener {
519   u32 client_index;
520   u32 context;
521 };
522
523 /** \brief Get HA listener/local configuration reply
524     @param context - sender context, to match reply w/ request
525     @param retval - return code
526     @param ip_address - local IP4 address
527     @param port - local UDP port number
528     @param path_mtu - Path MTU between local and failover
529 */
530 define nat_ha_get_listener_reply {
531   u32 context;
532   i32 retval;
533   vl_api_ip4_address_t ip_address;
534   u16 port;
535   u32 path_mtu;
536 };
537
538 /** \brief Get HA failover/remote settings
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_failover {
543   u32 client_index;
544   u32 context;
545 };
546
547 /** \brief Get HA failover/remote settings reply
548     @param context - sender context, to match reply w/ request
549     @param retval - return code
550     @param ip_address - failover IP4 address
551     @param port - failvoer UDP port number
552     @param session_refresh_interval - number of seconds after which to send
553                                       session counters refresh
554 */
555 define nat_ha_get_failover_reply {
556   u32 context;
557   i32 retval;
558   vl_api_ip4_address_t ip_address;
559   u16 port;
560   u32 session_refresh_interval;
561 };
562
563 /** \brief Flush the current HA data (for testing)
564     @param client_index - opaque cookie to identify the sender
565     @param context - sender context, to match reply w/ request
566 */
567 autoreply define nat_ha_flush {
568   u32 client_index;
569   u32 context;
570 };
571
572 /** \brief Resync HA (resend existing sessions to new failover)
573     @param client_index - opaque cookie to identify the sender
574     @param context - sender context, to match reply w/ request
575     @param want_resync_event - resync completed event sent to the sender via
576                                nat_ha_resync_completed_event API message if
577                                non-zero
578     @param pid - sender's pid
579 */
580 autoreply define nat_ha_resync
581 {
582   u32 client_index;
583   u32 context;
584   u8 want_resync_event;
585   u32 pid;
586 };
587
588 /** \brief Tell client about a HA resync completion event
589     @param client_index - opaque cookie to identify the sender
590     @param pid - client pid registered to receive notification
591     @param missed_count - number of missed (not ACKed) messages
592 */
593 define nat_ha_resync_completed_event
594 {
595   u32 client_index;
596   u32 pid;
597   u32 missed_count;
598 };
599
600 service {
601   rpc nat_ha_resync returns nat_ha_resync_reply events nat_ha_resync_completed_event;
602 };
603
604 /** \brief Del NAT44 user
605     @param client_index - opaque cookie to identify the sender
606     @param context - sender context, to match reply w/ request
607     @param ip_address - IPv4 address
608     @param fib_index - FIB index
609 */
610 autoreply define nat44_del_user {
611   u32 client_index;
612   u32 context;
613   vl_api_ip4_address_t ip_address;
614   u32 fib_index;
615 };
616
617 /** \brief Add/del NAT44 address range
618     @param client_index - opaque cookie to identify the sender
619     @param context - sender context, to match reply w/ request
620     @param first_ip_address - first IPv4 address
621     @param last_ip_address - last IPv4 address
622     @param vrf_id - VRF id of tenant, ~0 means independent of VRF
623     @param is_add - true if add, false if delete
624     @param flags - flag NAT_IS_TWICE_NAT if NAT address range for external hosts
625
626 */
627 autoreply define nat44_add_del_address_range {
628   u32 client_index;
629   u32 context;
630   vl_api_ip4_address_t first_ip_address;
631   vl_api_ip4_address_t last_ip_address;
632   u32 vrf_id;
633   bool is_add;
634   vl_api_nat_config_flags_t flags;
635 };
636
637 /** \brief Dump NAT44 addresses
638     @param client_index - opaque cookie to identify the sender
639     @param context - sender context, to match reply w/ request
640 */
641 define nat44_address_dump {
642   u32 client_index;
643   u32 context;
644 };
645
646 /** \brief NAT44 address details response
647     @param context - sender context, to match reply w/ request
648     @param ip_address - IPv4 address
649     @param flags - flag NAT_IS_TWICE_NAT if NAT address range for external hosts
650     @param vrf_id - VRF id of tenant, ~0 means independent of VRF
651 */
652 define nat44_address_details {
653   u32 context;
654   vl_api_ip4_address_t ip_address;
655   vl_api_nat_config_flags_t flags;
656   u32 vrf_id;
657 };
658
659 /** \brief Enable/disable NAT44 feature on the interface
660     @param client_index - opaque cookie to identify the sender
661     @param context - sender context, to match reply w/ request
662     @param is_add - true if add, false if delete
663     @param flags - flag NAT_IS_INSIDE if interface is inside else
664                    interface is outside
665     @param sw_if_index - software index of the interface
666 */
667 autoreply define nat44_interface_add_del_feature {
668   u32 client_index;
669   u32 context;
670   bool is_add;
671   vl_api_nat_config_flags_t flags;
672   vl_api_interface_index_t sw_if_index;
673 };
674
675 /** \brief Dump interfaces with NAT44 feature
676     @param client_index - opaque cookie to identify the sender
677     @param context - sender context, to match reply w/ request
678 */
679 define nat44_interface_dump {
680   u32 client_index;
681   u32 context;
682 };
683
684 /** \brief NAT44 interface details response
685     @param context - sender context, to match reply w/ request
686     @param sw_if_index - software index of the interface
687     @param flags - flag NAT_IS_INSIDE if interface is inside,
688                    flag NAT_IS_OUTSIDE if interface is outside
689                    and if both flags are set the interface is
690                    both inside and outside
691 */
692 define nat44_interface_details {
693   u32 context;
694   vl_api_nat_config_flags_t flags;
695   vl_api_interface_index_t sw_if_index;
696 };
697
698 /** \brief Enable/disbale NAT44 as an interface output feature (postrouting
699            in2out translation)
700     @param client_index - opaque cookie to identify the sender
701     @param context - sender context, to match reply w/ request
702     @param is_add - true if add, false if delete
703     @param flags - flag NAT_IS_INSIDE if interface is inside else
704                    interface is outside
705     @param sw_if_index - software index of the interface
706 */
707 autoreply define nat44_interface_add_del_output_feature {
708   u32 client_index;
709   u32 context;
710   bool is_add;
711   vl_api_nat_config_flags_t flags;
712   vl_api_interface_index_t sw_if_index;
713 };
714
715 /** \brief Dump interfaces with NAT44 output feature
716     @param client_index - opaque cookie to identify the sender
717     @param context - sender context, to match reply w/ request
718 */
719 define nat44_interface_output_feature_dump {
720   u32 client_index;
721   u32 context;
722 };
723
724 /** \brief NAT44 interface with output feature details response
725     @param context - sender context, to match reply w/ request
726     @param flags - flag NAT_IS_INSIDE if interface is inside else
727                    interface is outside
728     @param sw_if_index - software index of the interface
729 */
730 define nat44_interface_output_feature_details {
731   u32 context;
732   vl_api_nat_config_flags_t flags;
733   vl_api_interface_index_t sw_if_index;
734 };
735
736 /** \brief Add/delete NAT44 static mapping
737     @param client_index - opaque cookie to identify the sender
738     @param context - sender context, to match reply w/ request
739     @param is_add - true if add, false if delete
740     @param flags - flag NAT_IS_ADDR_ONLY if address only mapping,
741                    flag nat_is_twice_nat if nat address range for external hosts,
742                    flag NAT_IS_SELF_TWICE_NAT if translate external host address
743                    and port whenever external host address equals local
744                    address of internal host,
745                    flag NAT_IS_OUT2IN_ONLY if rule match only out2in direction
746     @param local_ip_address - local IPv4 address
747     @param external_ip_address - external IPv4 address
748     @param protocol - IP protocol, used only if addr_only=0
749     @param local_port - local port number, used only if addr_only=0
750     @param external_port - external port number, used only if addr_only=0
751     @param external_sw_if_index - external interface (if set
752                                   external_ip_address is ignored, ~0 means not
753                                   used)
754     @param vfr_id - VRF ID
755     @param tag - opaque string tag
756 */
757 autoreply define nat44_add_del_static_mapping {
758   u32 client_index;
759   u32 context;
760   bool is_add;
761   vl_api_nat_config_flags_t flags;
762   vl_api_ip4_address_t local_ip_address;
763   vl_api_ip4_address_t external_ip_address;
764   u8 protocol;
765   u16 local_port;
766   u16 external_port;
767   vl_api_interface_index_t external_sw_if_index;
768   u32 vrf_id;
769   string tag[64];
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 match_pool - true if use specific pool_ip_address
777     @param flags - flag NAT_IS_ADDR_ONLY if address only mapping,
778                    flag nat_is_twice_nat if nat address range for external hosts,
779                    flag NAT_IS_SELF_TWICE_NAT if translate external host address
780                    and port whenever external host address equals local
781                    address of internal host,
782                    flag NAT_IS_OUT2IN_ONLY if rule match only out2in direction
783     @param pool_ip_address - pool IPv4 address to match with pool
784     @param local_ip_address - local IPv4 address
785     @param external_ip_address - external IPv4 address
786     @param protocol - IP protocol, used only if addr_only=0
787     @param local_port - local port number, used only if addr_only=0
788     @param external_port - external port number, used only if addr_only=0
789     @param external_sw_if_index - external interface (if set
790                                   external_ip_address is ignored, ~0 means not
791                                   used)
792     @param vfr_id - VRF ID
793     @param tag - opaque string tag
794 */
795 autoreply define nat44_add_del_static_mapping_v2 {
796   option in_progress;
797   u32 client_index;
798   u32 context;
799   bool is_add;
800   bool match_pool;
801   vl_api_nat_config_flags_t flags;
802   vl_api_ip4_address_t pool_ip_address;
803   vl_api_ip4_address_t local_ip_address;
804   vl_api_ip4_address_t external_ip_address;
805   u8 protocol;
806   u16 local_port;
807   u16 external_port;
808   vl_api_interface_index_t external_sw_if_index;
809   u32 vrf_id;
810   string tag[64];
811 };
812
813 /** \brief Dump NAT44 static mappings
814     @param client_index - opaque cookie to identify the sender
815     @param context - sender context, to match reply w/ request
816 */
817 define nat44_static_mapping_dump {
818   u32 client_index;
819   u32 context;
820 };
821
822 /** \brief NAT44 static mapping details response
823     @param context - sender context, to match reply w/ request
824     @param flags - flag NAT_ADDR_ONLY if address only mapping,
825                    flag NAT_TWICE_NAT if NAT address range for external hosts,
826                    flag NAT_SELF_TWICE_NAT if translate external host address
827                    and port whenever external host address equals local
828                    address of internal host,
829                    flag NAT_OUT2IN_ONLY if rule match only out2in direction
830     @param local_ip_address - local IPv4 address
831     @param external_ip_address - external IPv4 address
832     @param protocol - IP protocol, valid only if no NAT_ADDR_ONLY flag
833     @param local_port - local port number, valid only if no NAT_ADDR_ONLY flag
834     @param external_port - external port number, valid only if no NAT_ADDR_ONLY flag
835     @param external_sw_if_index - external interface
836     @param vfr_id - VRF ID
837     @param tag - opaque string tag
838 */
839 define nat44_static_mapping_details {
840   u32 context;
841   vl_api_nat_config_flags_t flags;
842   vl_api_ip4_address_t local_ip_address;
843   vl_api_ip4_address_t external_ip_address;
844   u8 protocol;
845   u16 local_port;
846   u16 external_port;
847   vl_api_interface_index_t external_sw_if_index;
848   u32 vrf_id;
849   string tag[64];
850 };
851
852 /** \brief Add/delete NAT44 identity mapping
853     @param client_index - opaque cookie to identify the sender
854     @param context - sender context, to match reply w/ request
855     @param is_add - true if add, false if delete
856     @param flags - flag NAT_ADDR_ONLY if address only mapping
857     @param ip_address - IPv4 address
858     @param protocol - IP protocol
859     @param port - port number
860     @param sw_if_index - interface (if set ip_address is ignored, ~0 means not
861                                     used)
862     @param vfr_id - VRF ID (if ~0 use default VRF)
863     @param tag - opaque string tag
864 */
865 autoreply define nat44_add_del_identity_mapping {
866   u32 client_index;
867   u32 context;
868   bool is_add;
869   vl_api_nat_config_flags_t flags;
870   vl_api_ip4_address_t ip_address;
871   u8 protocol;
872   u16 port;
873   vl_api_interface_index_t sw_if_index;
874   u32 vrf_id;
875   string tag[64];
876 };
877
878 /** \brief Dump NAT44 identity mappings
879     @param client_index - opaque cookie to identify the sender
880     @param context - sender context, to match reply w/ request
881 */
882 define nat44_identity_mapping_dump {
883   u32 client_index;
884   u32 context;
885 };
886
887 /** \brief NAT44 identity mapping details response
888     @param context - sender context, to match reply w/ request
889     @param flags - flag NAT_ADDR_ONLY if address only mapping
890     @param ip_address - IPv4 address
891     @param protocol - IP protocol
892     @param port - port number
893     @param sw_if_index - interface
894     @param vfr_id - VRF ID
895     @param tag - opaque string tag
896 */
897 define nat44_identity_mapping_details {
898   u32 context;
899   vl_api_nat_config_flags_t flags;
900   vl_api_ip4_address_t ip_address;
901   u8 protocol;
902   u16 port;
903   vl_api_interface_index_t sw_if_index;
904   u32 vrf_id;
905   string tag[64];
906 };
907
908 /** \brief Add/delete NAT44 pool address from specific interfce
909     @param client_index - opaque cookie to identify the sender
910     @param context - sender context, to match reply w/ request
911     @param is_add - true if add, false if delete
912     @param sw_if_index - software index of the interface
913     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts
914 */
915 autoreply define nat44_add_del_interface_addr {
916   u32 client_index;
917   u32 context;
918   bool is_add;
919   vl_api_interface_index_t sw_if_index;
920   vl_api_nat_config_flags_t flags;
921 };
922
923 /** \brief Dump NAT44 pool addresses interfaces
924     @param client_index - opaque cookie to identify the sender
925     @param context - sender context, to match reply w/ request
926 */
927 define nat44_interface_addr_dump {
928   u32 client_index;
929   u32 context;
930 };
931
932 /** \brief NAT44 pool addresses interfaces details response
933     @param context - sender context, to match reply w/ request
934     @param sw_if_index - software index of the interface
935     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts
936
937 */
938 define nat44_interface_addr_details {
939   u32 context;
940   vl_api_interface_index_t sw_if_index;
941   vl_api_nat_config_flags_t flags;
942 };
943
944 /** \brief Dump NAT44 users
945     @param client_index - opaque cookie to identify the sender
946     @param context - sender context, to match reply w/ request
947 */
948 define nat44_user_dump {
949   u32 client_index;
950   u32 context;
951 };
952
953 /** \brief NAT44 users response
954     @param context - sender context, to match reply w/ request
955     @vrf_id - VRF ID
956     @param ip_address - IPv4 address
957     @param nsessions - number of dynamic sessions
958     @param nstaticsessions - number of static sessions
959 */
960 define nat44_user_details {
961   u32 context;
962   u32 vrf_id;
963   vl_api_ip4_address_t ip_address;
964   u32 nsessions;
965   u32 nstaticsessions;
966 };
967
968 /** \brief NAT44 user's sessions
969     @param client_index - opaque cookie to identify the sender
970     @param context - sender context, to match reply w/ request
971     @param ip_address - IPv4 address of the user to dump
972     @param vrf_id - VRF_ID
973 */
974 define nat44_user_session_dump {
975   u32 client_index;
976   u32 context;
977   vl_api_ip4_address_t ip_address;
978   u32 vrf_id;
979 };
980
981 /** \brief NAT44 user's sessions response
982     @param context - sender context, to match reply w/ request
983     @param outside_ip_address - outside IPv4 address
984     @param outside_port - outside port
985     @param inside_ip_address - inside IPv4 address
986     @param inside_port - inside port
987     @param protocol - protocol
988     @param flags - flag NAT_IS_STATIC if session is static,
989                    flag NAT_IS_TWICE_NAT if session is twice-nat,
990                    flag NAT_IS_EXT_HOST_VALID if external host address
991                    and port are valid
992     @param last_heard - last heard timer
993     @param total_bytes - count of bytes sent through session
994     @param total_pkts - count of pakets sent through session
995     @param ext_host_address - external host IPv4 address
996     @param ext_host_port - external host port
997     @param ext_host_nat_address - post-NAT external host IPv4 address (valid
998                                   only if twice-nat session)
999     @param ext_host_nat_port - post-NAT external host port (valid only if
1000                                twice-nat session)
1001 */
1002 define nat44_user_session_details {
1003   u32 context;
1004   vl_api_ip4_address_t outside_ip_address;
1005   u16 outside_port;
1006   vl_api_ip4_address_t inside_ip_address;
1007   u16 inside_port;
1008   u16 protocol;
1009   vl_api_nat_config_flags_t flags;
1010   u64 last_heard;
1011   u64 total_bytes;
1012   u32 total_pkts;
1013   vl_api_ip4_address_t ext_host_address;
1014   u16 ext_host_port;
1015   vl_api_ip4_address_t ext_host_nat_address;
1016   u16 ext_host_nat_port;
1017 };
1018
1019 /** \brief NAT44 load-balancing address and port pair
1020     @param addr - IPv4 address of the internal node
1021     @param port - L4 port number of the internal node
1022     @param probability - probability of the internal node to be randomly matched
1023     @param vrf_id - VRF id
1024 */
1025 typedef nat44_lb_addr_port {
1026   vl_api_ip4_address_t addr;
1027   u16 port;
1028   u8 probability;
1029   u32 vrf_id;
1030 };
1031
1032 /** \brief Add/delete NAT44 load-balancing static mapping rule
1033     @param client_index - opaque cookie to identify the sender
1034     @param context - sender context, to match reply w/ request
1035     @param is_add - true if add, false if delete
1036     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
1037                    flag NAT_SELF_TWICE_NAT if translate external host address
1038                    and port whenever external host address equals local
1039                    address of internal host,
1040                    flag NAT_OUT2IN_ONLY if rule match only out2in direction
1041     @param external_addr - external IPv4 address of the service
1042     @param external_port - external L4 port number of the service
1043     @param protocol - IP protocol number of the service
1044     @param affinity - if 0 disabled, otherwise client IP affinity sticky time
1045                       in seconds
1046     @param local_num - number of local network nodes
1047     @param locals - local network nodes
1048     @param tag - opaque string tag
1049 */
1050 autoreply define nat44_add_del_lb_static_mapping {
1051   u32 client_index;
1052   u32 context;
1053   bool is_add;
1054   vl_api_nat_config_flags_t flags;
1055   vl_api_ip4_address_t external_addr;
1056   u16 external_port;
1057   u8 protocol;
1058   u32 affinity;
1059   string tag[64];
1060   u32 local_num;
1061   vl_api_nat44_lb_addr_port_t locals[local_num];
1062 };
1063
1064 /** \brief Add/delete NAT44 load-balancing static mapping rule backend
1065     @param client_index - opaque cookie to identify the sender
1066     @param context - sender context, to match reply w/ request
1067     @param is_add - true if add, false if delete
1068     @param external_addr - external IPv4 address of the service
1069     @param external_port - external L4 port number of the service
1070     @param protocol - IP protocol number of the service
1071     @param local - local network node
1072 */
1073 autoreply define nat44_lb_static_mapping_add_del_local {
1074   u32 client_index;
1075   u32 context;
1076   bool is_add;
1077   vl_api_ip4_address_t external_addr;
1078   u16 external_port;
1079   u8 protocol;
1080   vl_api_nat44_lb_addr_port_t local;
1081 };
1082
1083 /** \brief Dump NAT44 load-balancing static mapping rules
1084     @param client_index - opaque cookie to identify the sender
1085     @param context - sender context, to match reply w/ request
1086 */
1087 define nat44_lb_static_mapping_dump {
1088   u32 client_index;
1089   u32 context;
1090 };
1091
1092 /** \brief NAT44 load-balancing static mapping rule details response
1093     @param context - sender context, to match reply w/ request
1094     @param external_addr - external IPv4 address of the service
1095     @param external_port - external L4 port number of the service
1096     @param protocol - IP protocol number of the service
1097     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
1098                    flag NAT_SELF_TWICE_NAT if translate external host address
1099                    and port whenever external host address equals local
1100                    address of internal host,
1101                    flag NAT_OUT2IN_ONLY if rule match only out2in direction
1102     @param affinity - if 0 disabled, otherwise client IP affinity sticky time
1103                       in seconds
1104     @param local_num - number of local network nodes
1105     @param locals - local network nodes
1106     @param tag - opaque string tag
1107 */
1108 define nat44_lb_static_mapping_details {
1109   u32 context;
1110   vl_api_ip4_address_t external_addr;
1111   u16 external_port;
1112   u8 protocol;
1113   vl_api_nat_config_flags_t flags;
1114   u32 affinity;
1115   string tag[64];
1116   u32 local_num;
1117   vl_api_nat44_lb_addr_port_t locals[local_num];
1118 };
1119
1120 /** \brief Delete NAT44 session
1121     @param client_index - opaque cookie to identify the sender
1122     @param context - sender context, to match reply w/ request
1123     @param ip_address - IPv4 address
1124     @param protocol - IP protocol
1125     @param port - port number
1126     @param vfr_id - VRF ID
1127     @param flags - flag NAT_IS_INSIDE if interface is inside or
1128                    interface is outside,
1129                    flag NAT_IS_EXT_HOST_VALID if external host address and
1130                    port are valid
1131     @param ext_host_address - external host IPv4 address
1132     @param ext_host_port - external host port
1133 */
1134 autoreply define nat44_del_session {
1135   u32 client_index;
1136   u32 context;
1137   vl_api_ip4_address_t address;
1138   u8 protocol;
1139   u16 port;
1140   u32 vrf_id;
1141   vl_api_nat_config_flags_t flags;
1142   vl_api_ip4_address_t ext_host_address;
1143   u16 ext_host_port;
1144 };
1145
1146 /** \brief Enable/disable forwarding for NAT44
1147     Forward packets which don't match existing translation
1148     or static mapping instead of dropping them.
1149     @param client_index - opaque cookie to identify the sender
1150     @param context - sender context, to match reply w/ request
1151     @param enable - true for enable, false for disable
1152 */
1153 autoreply define nat44_forwarding_enable_disable {
1154   option deprecated;
1155   u32 client_index;
1156   u32 context;
1157   bool enable;
1158 };
1159
1160 /** \brief Check if forwarding is enabled or disabled
1161     @param client_index - opaque cookie to identify the sender
1162     @param context - sender context, to match reply w/ request
1163 */
1164 define nat44_forwarding_is_enabled {
1165   option deprecated;
1166   u32 client_index;
1167   u32 context;
1168 };
1169
1170 /** \brief Response to check if forwarding is enabled or disabled
1171     @param context - sender context, to match reply w/ request
1172     @param enabled - true if enabled, false if disabled
1173 */
1174 define nat44_forwarding_is_enabled_reply {
1175   option deprecated;
1176   u32 context;
1177   bool enabled;
1178 };
1179
1180 /** \brief Set NAT handoff frame queue options
1181     @param client_index - opaque cookie to identify the sender
1182     @param context - sender context, to match reply w/ request
1183     @param frame_queue_nelts - number of worker handoff frame queue elements
1184 */
1185 autoreply define nat44_ed_set_fq_options {
1186   option in_progress;
1187   u32 client_index;
1188   u32 context;
1189   u32 frame_queue_nelts;
1190 };
1191
1192 /** \brief Show NAT handoff frame queue options
1193     @param client_index - opaque cookie to identify the sender
1194     @param context - sender context, to match reply w/ request
1195 */
1196 define nat44_ed_show_fq_options
1197 {
1198   option in_progress;
1199   u32 client_index;
1200   u32 context;
1201 };
1202
1203 /** \brief Show NAT handoff frame queue options reply
1204     @param context - sender context, to match reply w/ request
1205     @param retval - return code for the request
1206     @param frame_queue_nelts - number of worker handoff frame queue elements
1207 */
1208 define nat44_ed_show_fq_options_reply
1209 {
1210   option in_progress;
1211   u32 context;
1212   i32 retval;
1213   u32 frame_queue_nelts;
1214 };