ad4ad698be0057d36ecc77e46e4b81b489296fbb
[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   u32 client_index;
526   u32 context;
527   bool is_add;
528   vl_api_nat_config_flags_t flags;
529   vl_api_ip4_address_t local_ip_address;
530   vl_api_ip4_address_t external_ip_address;
531   u8 protocol;
532   u16 local_port;
533   u16 external_port;
534   vl_api_interface_index_t external_sw_if_index;
535   u32 vrf_id;
536   string tag[64];
537 };
538
539 /** \brief Add/delete NAT44 static mapping
540     @param client_index - opaque cookie to identify the sender
541     @param context - sender context, to match reply w/ request
542     @param is_add - true if add, false if delete
543     @param match_pool - true if use specific pool_ip_address
544     @param flags - flag NAT_IS_ADDR_ONLY if address only mapping,
545                    flag nat_is_twice_nat if nat address range for external hosts,
546                    flag NAT_IS_SELF_TWICE_NAT if translate external host address
547                    and port whenever external host address equals local
548                    address of internal host,
549                    flag NAT_IS_OUT2IN_ONLY if rule match only out2in direction
550     @param pool_ip_address - pool IPv4 address to match with pool
551     @param local_ip_address - local IPv4 address
552     @param external_ip_address - external IPv4 address
553     @param protocol - IP protocol, used only if addr_only=0
554     @param local_port - local port number, used only if addr_only=0
555     @param external_port - external port number, used only if addr_only=0
556     @param external_sw_if_index - external interface (if set
557                                   external_ip_address is ignored, ~0 means not
558                                   used)
559     @param vfr_id - VRF ID
560     @param tag - opaque string tag
561 */
562 autoreply define nat44_add_del_static_mapping_v2 {
563   u32 client_index;
564   u32 context;
565   bool is_add;
566   bool match_pool;
567   vl_api_nat_config_flags_t flags;
568   vl_api_ip4_address_t pool_ip_address;
569   vl_api_ip4_address_t local_ip_address;
570   vl_api_ip4_address_t external_ip_address;
571   u8 protocol;
572   u16 local_port;
573   u16 external_port;
574   vl_api_interface_index_t external_sw_if_index;
575   u32 vrf_id;
576   string tag[64];
577 };
578
579 /** \brief Dump NAT44 static mappings
580     @param client_index - opaque cookie to identify the sender
581     @param context - sender context, to match reply w/ request
582 */
583 define nat44_static_mapping_dump {
584   u32 client_index;
585   u32 context;
586 };
587
588 /** \brief NAT44 static mapping details response
589     @param context - sender context, to match reply w/ request
590     @param flags - flag NAT_ADDR_ONLY if address only mapping,
591                    flag NAT_TWICE_NAT if NAT address range for external hosts,
592                    flag NAT_SELF_TWICE_NAT if translate external host address
593                    and port whenever external host address equals local
594                    address of internal host,
595                    flag NAT_OUT2IN_ONLY if rule match only out2in direction
596     @param local_ip_address - local IPv4 address
597     @param external_ip_address - external IPv4 address
598     @param protocol - IP protocol, valid only if no NAT_ADDR_ONLY flag
599     @param local_port - local port number, valid only if no NAT_ADDR_ONLY flag
600     @param external_port - external port number, valid only if no NAT_ADDR_ONLY flag
601     @param external_sw_if_index - external interface
602     @param vfr_id - VRF ID
603     @param tag - opaque string tag
604 */
605 define nat44_static_mapping_details {
606   u32 context;
607   vl_api_nat_config_flags_t flags;
608   vl_api_ip4_address_t local_ip_address;
609   vl_api_ip4_address_t external_ip_address;
610   u8 protocol;
611   u16 local_port;
612   u16 external_port;
613   vl_api_interface_index_t external_sw_if_index;
614   u32 vrf_id;
615   string tag[64];
616 };
617
618 /** \brief Add/delete NAT44 identity mapping
619     @param client_index - opaque cookie to identify the sender
620     @param context - sender context, to match reply w/ request
621     @param is_add - true if add, false if delete
622     @param flags - flag NAT_ADDR_ONLY if address only mapping
623     @param ip_address - IPv4 address
624     @param protocol - IP protocol
625     @param port - port number
626     @param sw_if_index - interface (if set ip_address is ignored, ~0 means not
627                                     used)
628     @param vfr_id - VRF ID (if ~0 use default VRF)
629     @param tag - opaque string tag
630 */
631 autoreply define nat44_add_del_identity_mapping {
632   u32 client_index;
633   u32 context;
634   bool is_add;
635   vl_api_nat_config_flags_t flags;
636   vl_api_ip4_address_t ip_address;
637   u8 protocol;
638   u16 port;
639   vl_api_interface_index_t sw_if_index;
640   u32 vrf_id;
641   string tag[64];
642 };
643
644 /** \brief Dump NAT44 identity mappings
645     @param client_index - opaque cookie to identify the sender
646     @param context - sender context, to match reply w/ request
647 */
648 define nat44_identity_mapping_dump {
649   u32 client_index;
650   u32 context;
651 };
652
653 /** \brief NAT44 identity mapping details response
654     @param context - sender context, to match reply w/ request
655     @param flags - flag NAT_ADDR_ONLY if address only mapping
656     @param ip_address - IPv4 address
657     @param protocol - IP protocol
658     @param port - port number
659     @param sw_if_index - interface
660     @param vfr_id - VRF ID
661     @param tag - opaque string tag
662 */
663 define nat44_identity_mapping_details {
664   u32 context;
665   vl_api_nat_config_flags_t flags;
666   vl_api_ip4_address_t ip_address;
667   u8 protocol;
668   u16 port;
669   vl_api_interface_index_t sw_if_index;
670   u32 vrf_id;
671   string tag[64];
672 };
673
674 /** \brief NAT44 load-balancing address and port pair
675     @param addr - IPv4 address of the internal node
676     @param port - L4 port number of the internal node
677     @param probability - probability of the internal node to be randomly matched
678     @param vrf_id - VRF id
679 */
680 typedef nat44_lb_addr_port {
681   vl_api_ip4_address_t addr;
682   u16 port;
683   u8 probability;
684   u32 vrf_id;
685 };
686
687 /** \brief Add/delete NAT44 load-balancing static mapping rule
688     @param client_index - opaque cookie to identify the sender
689     @param context - sender context, to match reply w/ request
690     @param is_add - true if add, false if delete
691     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
692                    flag NAT_SELF_TWICE_NAT if translate external host address
693                    and port whenever external host address equals local
694                    address of internal host,
695                    flag NAT_OUT2IN_ONLY if rule match only out2in direction
696     @param external_addr - external IPv4 address of the service
697     @param external_port - external L4 port number of the service
698     @param protocol - IP protocol number of the service
699     @param affinity - if 0 disabled, otherwise client IP affinity sticky time
700                       in seconds
701     @param local_num - number of local network nodes
702     @param locals - local network nodes
703     @param tag - opaque string tag
704 */
705 autoreply define nat44_add_del_lb_static_mapping {
706   u32 client_index;
707   u32 context;
708   bool is_add;
709   vl_api_nat_config_flags_t flags;
710   vl_api_ip4_address_t external_addr;
711   u16 external_port;
712   u8 protocol;
713   u32 affinity;
714   string tag[64];
715   u32 local_num;
716   vl_api_nat44_lb_addr_port_t locals[local_num];
717 };
718
719 /** \brief Add/delete NAT44 load-balancing static mapping rule backend
720     @param client_index - opaque cookie to identify the sender
721     @param context - sender context, to match reply w/ request
722     @param is_add - true if add, false if delete
723     @param external_addr - external IPv4 address of the service
724     @param external_port - external L4 port number of the service
725     @param protocol - IP protocol number of the service
726     @param local - local network node
727 */
728 autoreply define nat44_lb_static_mapping_add_del_local {
729   u32 client_index;
730   u32 context;
731   bool is_add;
732   vl_api_ip4_address_t external_addr;
733   u16 external_port;
734   u8 protocol;
735   vl_api_nat44_lb_addr_port_t local;
736 };
737
738 /** \brief Dump NAT44 load-balancing static mapping rules
739     @param client_index - opaque cookie to identify the sender
740     @param context - sender context, to match reply w/ request
741 */
742 define nat44_lb_static_mapping_dump {
743   u32 client_index;
744   u32 context;
745 };
746
747 /** \brief NAT44 load-balancing static mapping rule details response
748     @param context - sender context, to match reply w/ request
749     @param external_addr - external IPv4 address of the service
750     @param external_port - external L4 port number of the service
751     @param protocol - IP protocol number of the service
752     @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
753                    flag NAT_SELF_TWICE_NAT if translate external host address
754                    and port whenever external host address equals local
755                    address of internal host,
756                    flag NAT_OUT2IN_ONLY if rule match only out2in direction
757     @param affinity - if 0 disabled, otherwise client IP affinity sticky time
758                       in seconds
759     @param local_num - number of local network nodes
760     @param locals - local network nodes
761     @param tag - opaque string tag
762 */
763 define nat44_lb_static_mapping_details {
764   u32 context;
765   vl_api_ip4_address_t external_addr;
766   u16 external_port;
767   u8 protocol;
768   vl_api_nat_config_flags_t flags;
769   u32 affinity;
770   string tag[64];
771   u32 local_num;
772   vl_api_nat44_lb_addr_port_t locals[local_num];
773 };
774
775 /** \brief Delete NAT44 session
776     @param client_index - opaque cookie to identify the sender
777     @param context - sender context, to match reply w/ request
778     @param ip_address - IPv4 address
779     @param protocol - IP protocol
780     @param port - port number
781     @param vfr_id - VRF ID
782     @param flags - flag NAT_IS_INSIDE if interface is inside or
783                    interface is outside,
784                    flag NAT_IS_EXT_HOST_VALID if external host address and
785                    port are valid
786     @param ext_host_address - external host IPv4 address
787     @param ext_host_port - external host port
788 */
789 autoreply define nat44_del_session {
790   u32 client_index;
791   u32 context;
792   vl_api_ip4_address_t address;
793   u8 protocol;
794   u16 port;
795   u32 vrf_id;
796   vl_api_nat_config_flags_t flags;
797   vl_api_ip4_address_t ext_host_address;
798   u16 ext_host_port;
799 };
800
801 /** \brief Dump NAT44 users
802     @param client_index - opaque cookie to identify the sender
803     @param context - sender context, to match reply w/ request
804 */
805 define nat44_user_dump {
806   u32 client_index;
807   u32 context;
808 };
809
810 /** \brief NAT44 users response
811     @param context - sender context, to match reply w/ request
812     @vrf_id - VRF ID
813     @param ip_address - IPv4 address
814     @param nsessions - number of dynamic sessions
815     @param nstaticsessions - number of static sessions
816 */
817 define nat44_user_details {
818   u32 context;
819   u32 vrf_id;
820   vl_api_ip4_address_t ip_address;
821   u32 nsessions;
822   u32 nstaticsessions;
823 };
824
825 /** \brief NAT44 user's sessions
826     @param client_index - opaque cookie to identify the sender
827     @param context - sender context, to match reply w/ request
828     @param ip_address - IPv4 address of the user to dump
829     @param vrf_id - VRF_ID
830 */
831 define nat44_user_session_dump {
832   u32 client_index;
833   u32 context;
834   vl_api_ip4_address_t ip_address;
835   u32 vrf_id;
836 };
837
838 /** \brief NAT44 user's sessions response
839     @param context - sender context, to match reply w/ request
840     @param outside_ip_address - outside IPv4 address
841     @param outside_port - outside port
842     @param inside_ip_address - inside IPv4 address
843     @param inside_port - inside port
844     @param protocol - protocol
845     @param flags - flag NAT_IS_STATIC if session is static,
846                    flag NAT_IS_TWICE_NAT if session is twice-nat,
847                    flag NAT_IS_EXT_HOST_VALID if external host address
848                    and port are valid
849     @param last_heard - last heard timer
850     @param total_bytes - count of bytes sent through session
851     @param total_pkts - count of pakets sent through session
852     @param ext_host_address - external host IPv4 address
853     @param ext_host_port - external host port
854     @param ext_host_nat_address - post-NAT external host IPv4 address (valid
855                                   only if twice-nat session)
856     @param ext_host_nat_port - post-NAT external host port (valid only if
857                                twice-nat session)
858 */
859 define nat44_user_session_details {
860   u32 context;
861   vl_api_ip4_address_t outside_ip_address;
862   u16 outside_port;
863   vl_api_ip4_address_t inside_ip_address;
864   u16 inside_port;
865   u16 protocol;
866   vl_api_nat_config_flags_t flags;
867   u64 last_heard;
868   u64 total_bytes;
869   u32 total_pkts;
870   vl_api_ip4_address_t ext_host_address;
871   u16 ext_host_port;
872   vl_api_ip4_address_t ext_host_nat_address;
873   u16 ext_host_nat_port;
874 };
875
876 /** \brief NAT44 user's sessions
877     @param client_index - opaque cookie to identify the sender
878     @param context - sender context, to match reply w/ request
879     @param ip_address - IPv4 address of the user to dump
880     @param vrf_id - VRF_ID
881 */
882 define nat44_user_session_v2_dump {
883   u32 client_index;
884   u32 context;
885   vl_api_ip4_address_t ip_address;
886   u32 vrf_id;
887 };
888
889 /** \brief NAT44 user's sessions response
890     @param context - sender context, to match reply w/ request
891     @param outside_ip_address - outside IPv4 address
892     @param outside_port - outside port
893     @param inside_ip_address - inside IPv4 address
894     @param inside_port - inside port
895     @param protocol - protocol
896     @param flags - flag NAT_IS_STATIC if session is static,
897                    flag NAT_IS_TWICE_NAT if session is twice-nat,
898                    flag NAT_IS_EXT_HOST_VALID if external host address
899                    and port are valid
900     @param last_heard - last heard timer
901     @param total_bytes - count of bytes sent through session
902     @param total_pkts - count of pakets sent through session
903     @param ext_host_address - external host IPv4 address
904     @param ext_host_port - external host port
905     @param ext_host_nat_address - post-NAT external host IPv4 address (valid
906                                   only if twice-nat session)
907     @param ext_host_nat_port - post-NAT external host port (valid only if
908                                twice-nat session)
909     @param is_timed_out - true, if session is timed out, and false, if session
910                           is active
911 */
912 define nat44_user_session_v2_details {
913   u32 context;
914   vl_api_ip4_address_t outside_ip_address;
915   u16 outside_port;
916   vl_api_ip4_address_t inside_ip_address;
917   u16 inside_port;
918   u16 protocol;
919   vl_api_nat_config_flags_t flags;
920   u64 last_heard;
921   u64 total_bytes;
922   u32 total_pkts;
923   vl_api_ip4_address_t ext_host_address;
924   u16 ext_host_port;
925   vl_api_ip4_address_t ext_host_nat_address;
926   u16 ext_host_nat_port;
927   bool is_timed_out;
928 };
929
930 /** \brief NAT44 user's sessions response
931     @param context - sender context, to match reply w/ request
932     @param outside_ip_address - outside IPv4 address
933     @param outside_port - outside port
934     @param inside_ip_address - inside IPv4 address
935     @param inside_port - inside port
936     @param protocol - protocol
937     @param flags - flag NAT_IS_STATIC if session is static,
938                    flag NAT_IS_TWICE_NAT if session is twice-nat,
939                    flag NAT_IS_EXT_HOST_VALID if external host address
940                    and port are valid
941     @param last_heard - last heard timer since VPP start
942     @param time_since_last_heard - difference between current vpp time and last_heard value
943     @param total_bytes - count of bytes sent through session
944     @param total_pkts - count of pakets sent through session
945     @param ext_host_address - external host IPv4 address
946     @param ext_host_port - external host port
947     @param ext_host_nat_address - post-NAT external host IPv4 address (valid
948                                   only if twice-nat session)
949     @param ext_host_nat_port - post-NAT external host port (valid only if
950                                twice-nat session)
951     @param is_timed_out - true, if session is timed out, and false, if session
952                           is active
953 */
954 define nat44_user_session_v3_details {
955   u32 context;
956   vl_api_ip4_address_t outside_ip_address;
957   u16 outside_port;
958   vl_api_ip4_address_t inside_ip_address;
959   u16 inside_port;
960   u16 protocol;
961   vl_api_nat_config_flags_t flags;
962   u64 last_heard;
963   u64 time_since_last_heard;
964   u64 total_bytes;
965   u32 total_pkts;
966   vl_api_ip4_address_t ext_host_address;
967   u16 ext_host_port;
968   vl_api_ip4_address_t ext_host_nat_address;
969   u16 ext_host_nat_port;
970   bool is_timed_out;
971 };
972
973 /** \brief NAT44 user's sessions
974     @param client_index - opaque cookie to identify the sender
975     @param context - sender context, to match reply w/ request
976     @param ip_address - IPv4 address of the user to dump
977     @param vrf_id - VRF_ID
978 */
979 define nat44_user_session_v3_dump {
980   u32 client_index;
981   u32 context;
982   vl_api_ip4_address_t ip_address;
983   u32 vrf_id;
984 };