docs: Use newer Ubuntu LTS in tutorial
[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.5.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_ed.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 NAT44ED 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 sessions - maximum number of sessions per thread
44     @param session_memory - overwrite hash allocation parameter
45     @param enable - true if enable, false if disable
46     @param flags - flag NAT44_IS_STATIC_MAPPING_ONLY,
47                         NAT44_IS_CONNECTION_TRACKING
48 */
49 autoreply define nat44_ed_plugin_enable_disable {
50   u32 client_index;
51   u32 context;
52   u32 inside_vrf;
53   u32 outside_vrf;
54   u32 sessions;
55   u32 session_memory;
56   bool enable;
57   vl_api_nat44_config_flags_t flags;
58 };
59
60 /** \brief Enable/disable forwarding for NAT44
61     Forward packets which don't match existing translation
62     or static mapping instead of dropping them.
63     @param client_index - opaque cookie to identify the sender
64     @param context - sender context, to match reply w/ request
65     @param enable - true for enable, false for disable
66 */
67 autoreply define nat44_forwarding_enable_disable {
68   option deprecated;
69   u32 client_index;
70   u32 context;
71   bool enable;
72 };
73
74 /** \brief Enable/disable NAT IPFIX logging
75     @param client_index - opaque cookie to identify the sender
76     @param context - sender context, to match reply w/ request
77     @param domain_id - observation domain ID
78     @param src_port - source port number
79     @param enable - true if enable, false if disable
80 */
81 autoreply define nat_ipfix_enable_disable {
82   option deprecated;
83   u32 client_index;
84   u32 context;
85   u32 domain_id;
86   u16 src_port;
87   bool enable;
88 };
89
90 /** \brief Set values of timeouts for NAT sessions (seconds)
91     @param client_index - opaque cookie to identify the sender
92     @param context - sender context, to match reply w/ request
93     @param udp - UDP timeout (default 300sec)
94     @param tcp_established - TCP established timeout (default 7440sec)
95     @param tcp_transitory - TCP transitory timeout (default 240sec)
96     @param icmp - ICMP timeout (default 60sec)
97 */
98 autoreply define nat_set_timeouts {
99   option deprecated;
100   u32 client_index;
101   u32 context;
102   u32 udp;
103   u32 tcp_established;
104   u32 tcp_transitory;
105   u32 icmp;
106 };
107
108 /** \brief NAT44 set session limit
109     @param client_index - opaque cookie to identify the sender
110     @param context - sender context, to match reply w/ request
111     @param session_limit - session limit
112     @param vrf_id - vrf id
113 */
114 autoreply define nat44_set_session_limit {
115   u32 client_index;
116   u32 context;
117   u32 session_limit;
118   u32 vrf_id;
119 };
120
121 /** \brief Show NAT44 plugin running config
122     @param client_index - opaque cookie to identify the sender
123     @param context - sender context, to match reply w/ request
124 */
125 define nat44_show_running_config
126 {
127   u32 client_index;
128   u32 context;
129 };
130
131 /** \brief Show NAT44 plugin running config reply
132     @param context - sender context, to match reply w/ request
133     @param retval - return code for the request
134     @param inside_vrf - default inside VRF id
135     @param outside_vrf - outside VRF id
136     @param users - maximum number of users per worker thread
137                   (NAT44_IS_ENDPOINT_INDEPENDENT)
138     @param sessions - maximum number of sessions per worker thread
139     @param user_sessions - maximum number of sessions per user
140                           (NAT44_IS_ENDPOINT_INDEPENDENT)
141     @param user_buckets - number of user hash buckets
142                          (NAT44_IS_ENDPOINT_INDEPENDENT)
143     @param translation_buckets - number of translation hash buckets
144     @param flags - flag NAT44_IS_ENDPOINT_INDEPENDENT,
145                         NAT44_IS_ENDPOINT_DEPENDENT,
146                         NAT44_IS_STATIC_MAPPING_ONLY,
147                         NAT44_IS_CONNECTION_TRACKING,
148                         NAT44_IS_OUT2IN_DPO
149 */
150 define nat44_show_running_config_reply
151 {
152   u32 context;
153   i32 retval;
154   u32 inside_vrf;
155   u32 outside_vrf;
156   u32 users;
157   u32 sessions;
158   u32 user_sessions;
159   u32 user_buckets;
160   u32 translation_buckets;
161   bool forwarding_enabled;
162   bool ipfix_logging_enabled;
163   vl_api_nat_timeouts_t timeouts;
164   vl_api_nat_log_level_t log_level;
165   vl_api_nat44_config_flags_t flags;
166 };
167
168 /** \brief Set NAT workers
169     @param client_index - opaque cookie to identify the sender
170     @param context - sender context, to match reply w/ request
171     @param worker_mask - NAT workers mask
172 */
173 autoreply define nat_set_workers {
174   u32 client_index;
175   u32 context;
176   u64 worker_mask;
177 };
178
179 /** \brief Dump NAT workers
180     @param client_index - opaque cookie to identify the sender
181     @param context - sender context, to match reply w/ request
182 */
183 define nat_worker_dump {
184   u32 client_index;
185   u32 context;
186 };
187
188 /** \brief NAT workers details response
189     @param context - sender context, to match reply w/ request
190     @param worker_index - worker index
191     @param lcore_id - lcore ID
192     @param name - worker name
193 */
194 define nat_worker_details {
195   u32 context;
196   u32 worker_index;
197   u32 lcore_id;
198   string name[64];
199 };
200
201 /** \brief Add/delete inter VRF NAT44-ED routing table
202     @param client_index - opaque cookie to identify the sender
203     @param context - sender context, to match reply w/ request
204     @param table_vrf_id - id of (rx) VRF used for resolving
205                           destination (tx) VRF during dynamic
206                           session creation
207     @param is_add - if true add else del
208 */
209 autoreply define nat44_ed_add_del_vrf_table {
210   u32 client_index;
211   u32 context;
212   u32 table_vrf_id;
213   bool is_add;
214 };
215
216 /** \brief Add/del inter VRF NAT44-ED route record
217     @param client_index - opaque cookie to identify the sender
218     @param context - sender context, to match reply w/ request
219     @param table_vrf_id - id of the VRF NAT routing table
220     @param vrf_id - id of resolving destination (tx) VRF table
221     @param is_add - if true add else del
222 */
223 autoreply define nat44_ed_add_del_vrf_route {
224   u32 client_index;
225   u32 context;
226   u32 table_vrf_id;
227   u32 vrf_id;
228   bool is_add;
229 };
230
231 /** \brief Dump NAT44-ED inter VRF NAT routing tables
232     @param client_index - opaque cookie to identify the sender
233     @param context - sender context, to match reply w/ request
234 */
235 define nat44_ed_vrf_tables_dump {
236   u32 client_index;
237   u32 context;
238   option deprecated;
239 };
240
241 /** \brief NAT44-ED inter VRF NAT routing table details response
242     @param context - sender context, to match reply w/ request
243     @param table_vrf_id - id of the VRF NAT routing table
244     @param n_vrf_ids - number of vrf_ids
245     @param vrf_ids - ids of resolving destination (tx) VRFs
246 */
247 define nat44_ed_vrf_tables_details {
248   u32 context;
249   u32 table_vrf_id;
250   u32 n_vrf_ids;
251   u32 vrf_ids[n_vrf_ids];
252   option deprecated;
253 };
254
255 /** \brief Dump NAT44-ED inter VRF NAT routing tables
256     @param client_index - opaque cookie to identify the sender
257     @param context - sender context, to match reply w/ request
258 */
259 define nat44_ed_vrf_tables_v2_dump {
260   u32 client_index;
261   u32 context;
262   option status="in_progress";
263 };
264
265 /** \brief NAT44-ED inter VRF NAT routing table details response
266     @param context - sender context, to match reply w/ request
267     @param table_vrf_id - id of the VRF NAT routing table
268     @param n_vrf_ids - number of vrf_ids
269     @param vrf_ids - ids of resolving destination (tx) VRFs
270 */
271 define nat44_ed_vrf_tables_v2_details {
272   u32 context;
273   u32 table_vrf_id;
274   u32 n_vrf_ids;
275   u32 vrf_ids[n_vrf_ids];
276   option status="in_progress";
277 };
278
279 /** \brief Set TCP MSS rewriting configuration
280     @param client_index - opaque cookie to identify the sender
281     @param context - sender context, to match reply w/ request
282     @param mss_value - MSS value to be used for MSS rewriting
283     @param enable - if true enable MSS rewriting feature else disable
284 */
285 autoreply define nat_set_mss_clamping {
286   u32 client_index;
287   u32 context;
288   u16 mss_value;
289   bool enable;
290 };
291
292 /** \brief Get TCP MSS rewriting configuration
293     @param client_index - opaque cookie to identify the sender
294     @param context - sender context, to match reply w/ request
295 */
296 define nat_get_mss_clamping {
297   u32 client_index;
298   u32 context;
299 };
300
301 /** \brief Get TCP MSS rewriting configuration reply
302     @param context - sender context, to match reply w/ request
303     @param retval - return code
304     @param mss_value - MSS value to be used for MSS rewriting
305     @param enable - if true enable MSS rewriting feature else disable
306 */
307 define nat_get_mss_clamping_reply {
308   u32 context;
309   i32 retval;
310   u16 mss_value;
311   bool enable;
312 };
313
314 /** \brief Set NAT handoff frame queue options
315     @param client_index - opaque cookie to identify the sender
316     @param context - sender context, to match reply w/ request
317     @param frame_queue_nelts - number of worker handoff frame queue elements
318 */
319 autoreply define nat44_ed_set_fq_options {
320   u32 client_index;
321   u32 context;
322   u32 frame_queue_nelts;
323 };
324
325 /** \brief Show NAT handoff frame queue options
326     @param client_index - opaque cookie to identify the sender
327     @param context - sender context, to match reply w/ request
328 */
329 define nat44_ed_show_fq_options
330 {
331   u32 client_index;
332   u32 context;
333 };
334
335 /** \brief Show NAT handoff frame queue options reply
336     @param context - sender context, to match reply w/ request
337     @param retval - return code for the request
338     @param frame_queue_nelts - number of worker handoff frame queue elements
339 */
340 define nat44_ed_show_fq_options_reply
341 {
342   u32 context;
343   i32 retval;
344   u32 frame_queue_nelts;
345 };
346
347 /** \brief Add/delete NAT44 pool address from specific interfce
348     @param client_index - opaque cookie to identify the sender
349     @param context - sender context, to match reply w/ request
350     @param is_add - true if add, false if delete
351     @param sw_if_index - software index of the interface
352     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts
353 */
354 autoreply define nat44_add_del_interface_addr {
355   u32 client_index;
356   u32 context;
357   bool is_add;
358   vl_api_interface_index_t sw_if_index;
359   vl_api_nat_config_flags_t flags;
360 };
361
362 /** \brief Dump NAT44 pool addresses interfaces
363     @param client_index - opaque cookie to identify the sender
364     @param context - sender context, to match reply w/ request
365 */
366 define nat44_interface_addr_dump {
367   u32 client_index;
368   u32 context;
369 };
370
371 /** \brief NAT44 pool addresses interfaces details response
372     @param context - sender context, to match reply w/ request
373     @param sw_if_index - software index of the interface
374     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts
375
376 */
377 define nat44_interface_addr_details {
378   u32 context;
379   vl_api_interface_index_t sw_if_index;
380   vl_api_nat_config_flags_t flags;
381 };
382
383 /** \brief Add/del NAT44 address range
384     @param client_index - opaque cookie to identify the sender
385     @param context - sender context, to match reply w/ request
386     @param first_ip_address - first IPv4 address
387     @param last_ip_address - last IPv4 address
388     @param vrf_id - VRF id of tenant, ~0 means independent of VRF
389     @param is_add - true if add, false if delete
390     @param flags - flag NAT_IS_TWICE_NAT if NAT address range for external hosts
391
392 */
393 autoreply define nat44_add_del_address_range {
394   u32 client_index;
395   u32 context;
396   vl_api_ip4_address_t first_ip_address;
397   vl_api_ip4_address_t last_ip_address;
398   u32 vrf_id;
399   bool is_add;
400   vl_api_nat_config_flags_t flags;
401 };
402
403 /** \brief Dump NAT44 addresses
404     @param client_index - opaque cookie to identify the sender
405     @param context - sender context, to match reply w/ request
406 */
407 define nat44_address_dump {
408   u32 client_index;
409   u32 context;
410 };
411
412 /** \brief NAT44 address details response
413     @param context - sender context, to match reply w/ request
414     @param ip_address - IPv4 address
415     @param flags - flag NAT_IS_TWICE_NAT if NAT address range for external hosts
416     @param vrf_id - VRF id of tenant, ~0 means independent of VRF
417 */
418 define nat44_address_details {
419   u32 context;
420   vl_api_ip4_address_t ip_address;
421   vl_api_nat_config_flags_t flags;
422   u32 vrf_id;
423 };
424
425 /** \brief Enable/disable NAT44 feature on the interface
426     @param client_index - opaque cookie to identify the sender
427     @param context - sender context, to match reply w/ request
428     @param is_add - true if add, false if delete
429     @param flags - flag NAT_IS_INSIDE if interface is inside else
430                    interface is outside
431     @param sw_if_index - software index of the interface
432 */
433 autoreply define nat44_interface_add_del_feature {
434   u32 client_index;
435   u32 context;
436   bool is_add;
437   vl_api_nat_config_flags_t flags;
438   vl_api_interface_index_t sw_if_index;
439 };
440
441 /** \brief Dump interfaces with NAT44 feature
442     @param client_index - opaque cookie to identify the sender
443     @param context - sender context, to match reply w/ request
444 */
445 define nat44_interface_dump {
446   u32 client_index;
447   u32 context;
448 };
449
450 /** \brief NAT44 interface details response
451     @param context - sender context, to match reply w/ request
452     @param sw_if_index - software index of the interface
453     @param flags - flag NAT_IS_INSIDE if interface is inside,
454                    flag NAT_IS_OUTSIDE if interface is outside
455                    and if both flags are set the interface is
456                    both inside and outside
457 */
458 define nat44_interface_details {
459   u32 context;
460   vl_api_nat_config_flags_t flags;
461   vl_api_interface_index_t sw_if_index;
462 };
463
464 /** \brief add/del NAT output interface (postrouting
465            in2out translation)
466     @param client_index - opaque cookie to identify the sender
467     @param context - sender context, to match reply w/ request
468     @param is_add - true if add, false if delete
469     @param sw_if_index - software index of the interface
470 */
471 autoendian autoreply define nat44_ed_add_del_output_interface {
472   u32 client_index;
473   u32 context;
474   bool is_add;
475   vl_api_interface_index_t sw_if_index;
476 };
477
478 service {
479   rpc nat44_ed_output_interface_get returns nat44_ed_output_interface_get_reply
480     stream nat44_ed_output_interface_details;
481 };
482
483 define nat44_ed_output_interface_get
484 {
485   u32 client_index;
486   u32 context;
487   u32 cursor;
488 };
489
490 define nat44_ed_output_interface_get_reply
491 {
492   u32 context;
493   i32 retval;
494   u32 cursor;
495 };
496
497 define nat44_ed_output_interface_details
498 {
499   u32 context;
500   vl_api_interface_index_t sw_if_index;
501 };
502
503 /** \brief Add/delete NAT44 static mapping
504     @param client_index - opaque cookie to identify the sender
505     @param context - sender context, to match reply w/ request
506     @param is_add - true if add, false if delete
507     @param flags - flag NAT_IS_ADDR_ONLY if address only mapping,
508                    flag nat_is_twice_nat if nat address range for external hosts,
509                    flag NAT_IS_SELF_TWICE_NAT if translate external host address
510                    and port whenever external host address equals local
511                    address of internal host,
512                    flag NAT_IS_OUT2IN_ONLY if rule match only out2in direction
513     @param local_ip_address - local IPv4 address
514     @param external_ip_address - external IPv4 address
515     @param protocol - IP protocol, used only if addr_only=0
516     @param local_port - local port number, used only if addr_only=0
517     @param external_port - external port number, used only if addr_only=0
518     @param external_sw_if_index - external interface (if set
519                                   external_ip_address is ignored, ~0 means not
520                                   used)
521     @param vfr_id - VRF ID
522     @param tag - opaque string tag
523 */
524 autoreply define nat44_add_del_static_mapping {
525   option deprecated;
526
527   u32 client_index;
528   u32 context;
529   bool is_add;
530   vl_api_nat_config_flags_t flags;
531   vl_api_ip4_address_t local_ip_address;
532   vl_api_ip4_address_t external_ip_address;
533   u8 protocol;
534   u16 local_port;
535   u16 external_port;
536   vl_api_interface_index_t external_sw_if_index;
537   u32 vrf_id;
538   string tag[64];
539 };
540
541 /** \brief Add/delete NAT44 static mapping
542     @param client_index - opaque cookie to identify the sender
543     @param context - sender context, to match reply w/ request
544     @param is_add - true if add, false if delete
545     @param match_pool - true if use specific pool_ip_address
546     @param flags - flag NAT_IS_ADDR_ONLY if address only mapping,
547                    flag nat_is_twice_nat if nat address range for external hosts,
548                    flag NAT_IS_SELF_TWICE_NAT if translate external host address
549                    and port whenever external host address equals local
550                    address of internal host,
551                    flag NAT_IS_OUT2IN_ONLY if rule match only out2in direction
552     @param pool_ip_address - pool IPv4 address to match with pool
553     @param local_ip_address - local IPv4 address
554     @param external_ip_address - external IPv4 address
555     @param protocol - IP protocol, used only if addr_only=0
556     @param local_port - local port number, used only if addr_only=0
557     @param external_port - external port number, used only if addr_only=0
558     @param external_sw_if_index - external interface (if set
559                                   external_ip_address is ignored, ~0 means not
560                                   used)
561     @param vfr_id - VRF ID
562     @param tag - opaque string tag
563 */
564 autoreply define nat44_add_del_static_mapping_v2 {
565   u32 client_index;
566   u32 context;
567   bool is_add;
568   bool match_pool;
569   vl_api_nat_config_flags_t flags;
570   vl_api_ip4_address_t pool_ip_address;
571   vl_api_ip4_address_t local_ip_address;
572   vl_api_ip4_address_t external_ip_address;
573   u8 protocol;
574   u16 local_port;
575   u16 external_port;
576   vl_api_interface_index_t external_sw_if_index;
577   u32 vrf_id;
578   string tag[64];
579 };
580
581 /** \brief Dump NAT44 static mappings
582     @param client_index - opaque cookie to identify the sender
583     @param context - sender context, to match reply w/ request
584 */
585 define nat44_static_mapping_dump {
586   u32 client_index;
587   u32 context;
588 };
589
590 /** \brief NAT44 static mapping details response
591     @param context - sender context, to match reply w/ request
592     @param flags - flag NAT_ADDR_ONLY if address only mapping,
593                    flag NAT_TWICE_NAT if NAT address range for external hosts,
594                    flag NAT_SELF_TWICE_NAT if translate external host address
595                    and port whenever external host address equals local
596                    address of internal host,
597                    flag NAT_OUT2IN_ONLY if rule match only out2in direction
598     @param local_ip_address - local IPv4 address
599     @param external_ip_address - external IPv4 address
600     @param protocol - IP protocol, valid only if no NAT_ADDR_ONLY flag
601     @param local_port - local port number, valid only if no NAT_ADDR_ONLY flag
602     @param external_port - external port number, valid only if no NAT_ADDR_ONLY flag
603     @param external_sw_if_index - external interface
604     @param vfr_id - VRF ID
605     @param tag - opaque string tag
606 */
607 define nat44_static_mapping_details {
608   u32 context;
609   vl_api_nat_config_flags_t flags;
610   vl_api_ip4_address_t local_ip_address;
611   vl_api_ip4_address_t external_ip_address;
612   u8 protocol;
613   u16 local_port;
614   u16 external_port;
615   vl_api_interface_index_t external_sw_if_index;
616   u32 vrf_id;
617   string tag[64];
618 };
619
620 /** \brief Add/delete NAT44 identity mapping
621     @param client_index - opaque cookie to identify the sender
622     @param context - sender context, to match reply w/ request
623     @param is_add - true if add, false if delete
624     @param flags - flag NAT_ADDR_ONLY if address only mapping
625     @param ip_address - IPv4 address
626     @param protocol - IP protocol
627     @param port - port number
628     @param sw_if_index - interface (if set ip_address is ignored, ~0 means not
629                                     used)
630     @param vfr_id - VRF ID (if ~0 use default VRF)
631     @param tag - opaque string tag
632 */
633 autoreply define nat44_add_del_identity_mapping {
634   u32 client_index;
635   u32 context;
636   bool is_add;
637   vl_api_nat_config_flags_t flags;
638   vl_api_ip4_address_t ip_address;
639   u8 protocol;
640   u16 port;
641   vl_api_interface_index_t sw_if_index;
642   u32 vrf_id;
643   string tag[64];
644 };
645
646 /** \brief Dump NAT44 identity mappings
647     @param client_index - opaque cookie to identify the sender
648     @param context - sender context, to match reply w/ request
649 */
650 define nat44_identity_mapping_dump {
651   u32 client_index;
652   u32 context;
653 };
654
655 /** \brief NAT44 identity mapping details response
656     @param context - sender context, to match reply w/ request
657     @param flags - flag NAT_ADDR_ONLY if address only mapping
658     @param ip_address - IPv4 address
659     @param protocol - IP protocol
660     @param port - port number
661     @param sw_if_index - interface
662     @param vfr_id - VRF ID
663     @param tag - opaque string tag
664 */
665 define nat44_identity_mapping_details {
666   u32 context;
667   vl_api_nat_config_flags_t flags;
668   vl_api_ip4_address_t ip_address;
669   u8 protocol;
670   u16 port;
671   vl_api_interface_index_t sw_if_index;
672   u32 vrf_id;
673   string tag[64];
674 };
675
676 /** \brief NAT44 load-balancing address and port pair
677     @param addr - IPv4 address of the internal node
678     @param port - L4 port number of the internal node
679     @param probability - probability of the internal node to be randomly matched
680     @param vrf_id - VRF id
681 */
682 typedef nat44_lb_addr_port {
683   vl_api_ip4_address_t addr;
684   u16 port;
685   u8 probability;
686   u32 vrf_id;
687 };
688
689 /** \brief Add/delete NAT44 load-balancing static mapping rule
690     @param client_index - opaque cookie to identify the sender
691     @param context - sender context, to match reply w/ request
692     @param is_add - true if add, false if delete
693     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
694                    flag NAT_SELF_TWICE_NAT if translate external host address
695                    and port whenever external host address equals local
696                    address of internal host,
697                    flag NAT_OUT2IN_ONLY if rule match only out2in direction
698     @param external_addr - external IPv4 address of the service
699     @param external_port - external L4 port number of the service
700     @param protocol - IP protocol number of the service
701     @param affinity - if 0 disabled, otherwise client IP affinity sticky time
702                       in seconds
703     @param local_num - number of local network nodes
704     @param locals - local network nodes
705     @param tag - opaque string tag
706 */
707 autoreply define nat44_add_del_lb_static_mapping {
708   u32 client_index;
709   u32 context;
710   bool is_add;
711   vl_api_nat_config_flags_t flags;
712   vl_api_ip4_address_t external_addr;
713   u16 external_port;
714   u8 protocol;
715   u32 affinity;
716   string tag[64];
717   u32 local_num;
718   vl_api_nat44_lb_addr_port_t locals[local_num];
719 };
720
721 /** \brief Add/delete NAT44 load-balancing static mapping rule backend
722     @param client_index - opaque cookie to identify the sender
723     @param context - sender context, to match reply w/ request
724     @param is_add - true if add, false if delete
725     @param external_addr - external IPv4 address of the service
726     @param external_port - external L4 port number of the service
727     @param protocol - IP protocol number of the service
728     @param local - local network node
729 */
730 autoreply define nat44_lb_static_mapping_add_del_local {
731   u32 client_index;
732   u32 context;
733   bool is_add;
734   vl_api_ip4_address_t external_addr;
735   u16 external_port;
736   u8 protocol;
737   vl_api_nat44_lb_addr_port_t local;
738 };
739
740 /** \brief Dump NAT44 load-balancing static mapping rules
741     @param client_index - opaque cookie to identify the sender
742     @param context - sender context, to match reply w/ request
743 */
744 define nat44_lb_static_mapping_dump {
745   u32 client_index;
746   u32 context;
747 };
748
749 /** \brief NAT44 load-balancing static mapping rule details response
750     @param context - sender context, to match reply w/ request
751     @param external_addr - external IPv4 address of the service
752     @param external_port - external L4 port number of the service
753     @param protocol - IP protocol number of the service
754     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
755                    flag NAT_SELF_TWICE_NAT if translate external host address
756                    and port whenever external host address equals local
757                    address of internal host,
758                    flag NAT_OUT2IN_ONLY if rule match only out2in direction
759     @param affinity - if 0 disabled, otherwise client IP affinity sticky time
760                       in seconds
761     @param local_num - number of local network nodes
762     @param locals - local network nodes
763     @param tag - opaque string tag
764 */
765 define nat44_lb_static_mapping_details {
766   u32 context;
767   vl_api_ip4_address_t external_addr;
768   u16 external_port;
769   u8 protocol;
770   vl_api_nat_config_flags_t flags;
771   u32 affinity;
772   string tag[64];
773   u32 local_num;
774   vl_api_nat44_lb_addr_port_t locals[local_num];
775 };
776
777 /** \brief Delete NAT44 session
778     @param client_index - opaque cookie to identify the sender
779     @param context - sender context, to match reply w/ request
780     @param ip_address - IPv4 address
781     @param protocol - IP protocol
782     @param port - port number
783     @param vfr_id - VRF ID
784     @param flags - flag NAT_IS_INSIDE if interface is inside or
785                    interface is outside,
786                    flag NAT_IS_EXT_HOST_VALID if external host address and
787                    port are valid
788     @param ext_host_address - external host IPv4 address
789     @param ext_host_port - external host port
790 */
791 autoreply define nat44_del_session {
792   u32 client_index;
793   u32 context;
794   vl_api_ip4_address_t address;
795   u8 protocol;
796   u16 port;
797   u32 vrf_id;
798   vl_api_nat_config_flags_t flags;
799   vl_api_ip4_address_t ext_host_address;
800   u16 ext_host_port;
801 };
802
803 /** \brief Dump NAT44 users
804     @param client_index - opaque cookie to identify the sender
805     @param context - sender context, to match reply w/ request
806 */
807 define nat44_user_dump {
808   u32 client_index;
809   u32 context;
810 };
811
812 /** \brief NAT44 users response
813     @param context - sender context, to match reply w/ request
814     @vrf_id - VRF ID
815     @param ip_address - IPv4 address
816     @param nsessions - number of dynamic sessions
817     @param nstaticsessions - number of static sessions
818 */
819 define nat44_user_details {
820   u32 context;
821   u32 vrf_id;
822   vl_api_ip4_address_t ip_address;
823   u32 nsessions;
824   u32 nstaticsessions;
825 };
826
827 /** \brief NAT44 user's sessions
828     @param client_index - opaque cookie to identify the sender
829     @param context - sender context, to match reply w/ request
830     @param ip_address - IPv4 address of the user to dump
831     @param vrf_id - VRF_ID
832 */
833 define nat44_user_session_dump {
834   option deprecated;
835
836   u32 client_index;
837   u32 context;
838   vl_api_ip4_address_t ip_address;
839   u32 vrf_id;
840 };
841
842 /** \brief NAT44 user's sessions response
843     @param context - sender context, to match reply w/ request
844     @param outside_ip_address - outside IPv4 address
845     @param outside_port - outside port
846     @param inside_ip_address - inside IPv4 address
847     @param inside_port - inside port
848     @param protocol - protocol
849     @param flags - flag NAT_IS_STATIC if session is static,
850                    flag NAT_IS_TWICE_NAT if session is twice-nat,
851                    flag NAT_IS_EXT_HOST_VALID if external host address
852                    and port are valid
853     @param last_heard - last heard timer
854     @param total_bytes - count of bytes sent through session
855     @param total_pkts - count of pakets sent through session
856     @param ext_host_address - external host IPv4 address
857     @param ext_host_port - external host port
858     @param ext_host_nat_address - post-NAT external host IPv4 address (valid
859                                   only if twice-nat session)
860     @param ext_host_nat_port - post-NAT external host port (valid only if
861                                twice-nat session)
862 */
863 define nat44_user_session_details {
864   option deprecated;
865
866   u32 context;
867   vl_api_ip4_address_t outside_ip_address;
868   u16 outside_port;
869   vl_api_ip4_address_t inside_ip_address;
870   u16 inside_port;
871   u16 protocol;
872   vl_api_nat_config_flags_t flags;
873   u64 last_heard;
874   u64 total_bytes;
875   u32 total_pkts;
876   vl_api_ip4_address_t ext_host_address;
877   u16 ext_host_port;
878   vl_api_ip4_address_t ext_host_nat_address;
879   u16 ext_host_nat_port;
880 };
881
882 /** \brief NAT44 user's sessions
883     @param client_index - opaque cookie to identify the sender
884     @param context - sender context, to match reply w/ request
885     @param ip_address - IPv4 address of the user to dump
886     @param vrf_id - VRF_ID
887 */
888 define nat44_user_session_v2_dump {
889   option deprecated;
890
891   u32 client_index;
892   u32 context;
893   vl_api_ip4_address_t ip_address;
894   u32 vrf_id;
895 };
896
897 /** \brief NAT44 user's sessions response
898     @param context - sender context, to match reply w/ request
899     @param outside_ip_address - outside IPv4 address
900     @param outside_port - outside port
901     @param inside_ip_address - inside IPv4 address
902     @param inside_port - inside port
903     @param protocol - protocol
904     @param flags - flag NAT_IS_STATIC if session is static,
905                    flag NAT_IS_TWICE_NAT if session is twice-nat,
906                    flag NAT_IS_EXT_HOST_VALID if external host address
907                    and port are valid
908     @param last_heard - last heard timer
909     @param total_bytes - count of bytes sent through session
910     @param total_pkts - count of pakets sent through session
911     @param ext_host_address - external host IPv4 address
912     @param ext_host_port - external host port
913     @param ext_host_nat_address - post-NAT external host IPv4 address (valid
914                                   only if twice-nat session)
915     @param ext_host_nat_port - post-NAT external host port (valid only if
916                                twice-nat session)
917     @param is_timed_out - true, if session is timed out, and false, if session
918                           is active
919 */
920 define nat44_user_session_v2_details {
921   option deprecated;
922
923   u32 context;
924   vl_api_ip4_address_t outside_ip_address;
925   u16 outside_port;
926   vl_api_ip4_address_t inside_ip_address;
927   u16 inside_port;
928   u16 protocol;
929   vl_api_nat_config_flags_t flags;
930   u64 last_heard;
931   u64 total_bytes;
932   u32 total_pkts;
933   vl_api_ip4_address_t ext_host_address;
934   u16 ext_host_port;
935   vl_api_ip4_address_t ext_host_nat_address;
936   u16 ext_host_nat_port;
937   bool is_timed_out;
938 };
939
940 /** \brief NAT44 user's sessions response
941     @param context - sender context, to match reply w/ request
942     @param outside_ip_address - outside IPv4 address
943     @param outside_port - outside port
944     @param inside_ip_address - inside IPv4 address
945     @param inside_port - inside port
946     @param protocol - protocol
947     @param flags - flag NAT_IS_STATIC if session is static,
948                    flag NAT_IS_TWICE_NAT if session is twice-nat,
949                    flag NAT_IS_EXT_HOST_VALID if external host address
950                    and port are valid
951     @param last_heard - last heard timer since VPP start
952     @param time_since_last_heard - difference between current vpp time and last_heard value
953     @param total_bytes - count of bytes sent through session
954     @param total_pkts - count of pakets sent through session
955     @param ext_host_address - external host IPv4 address
956     @param ext_host_port - external host port
957     @param ext_host_nat_address - post-NAT external host IPv4 address (valid
958                                   only if twice-nat session)
959     @param ext_host_nat_port - post-NAT external host port (valid only if
960                                twice-nat session)
961     @param is_timed_out - true, if session is timed out, and false, if session
962                           is active
963 */
964 define nat44_user_session_v3_details {
965   u32 context;
966   vl_api_ip4_address_t outside_ip_address;
967   u16 outside_port;
968   vl_api_ip4_address_t inside_ip_address;
969   u16 inside_port;
970   u16 protocol;
971   vl_api_nat_config_flags_t flags;
972   u64 last_heard;
973   u64 time_since_last_heard;
974   u64 total_bytes;
975   u32 total_pkts;
976   vl_api_ip4_address_t ext_host_address;
977   u16 ext_host_port;
978   vl_api_ip4_address_t ext_host_nat_address;
979   u16 ext_host_nat_port;
980   bool is_timed_out;
981 };
982
983 /** \brief NAT44 user's sessions
984     @param client_index - opaque cookie to identify the sender
985     @param context - sender context, to match reply w/ request
986     @param ip_address - IPv4 address of the user to dump
987     @param vrf_id - VRF_ID
988 */
989 define nat44_user_session_v3_dump {
990   u32 client_index;
991   u32 context;
992   vl_api_ip4_address_t ip_address;
993   u32 vrf_id;
994 };