FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
nat64.api
Go to the documentation of this file.
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 = "1.0.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 nat64.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 /** \brief Enable/disable NAT64 plugin
30  @param client_index - opaque cookie to identify the sender
31  @param context - sender context, to match reply w/ request
32  @param bib_buckets - Number of BIB hash buckets
33  @param bib_memory_size - Memory size of BIB hash
34  @param st_buckets - Number of session table hash buckets
35  @param st_memory_size - Memory size of session table hash
36  @param enable - true if enable, false if disable
37 */
38 autoreply define nat64_plugin_enable_disable {
45  bool enable;
46  option status="in_progress";
47 };
48 
49 /** \brief Set values of timeouts for NAT64 sessions (seconds)
50  @param client_index - opaque cookie to identify the sender
51  @param context - sender context, to match reply w/ request
52  @param udp - UDP timeout (default 300sec)
53  @param tcp_established - TCP established timeout (default 7440sec)
54  @param tcp_transitory - TCP transitory timeout (default 240sec)
55  @param icmp - ICMP timeout (default 60sec)
56 */
57 autoreply define nat64_set_timeouts {
64 };
65 
66 /** \brief Get values of timeouts for NAT64 sessions (seconds)
67  @param client_index - opaque cookie to identify the sender
68  @param context - sender context, to match reply w/ request
69 */
70 define nat64_get_timeouts {
73 };
74 
75 /** \brief Get values of timeouts for NAT64 sessions reply
76  @param context - sender context, to match reply w/ request
77  @param retval - return code
78  @param udp - UDP timeout
79  @param tcp_established - TCP established timeout
80  @param tcp_transitory - TCP transitory timeout
81  @param icmp - ICMP timeout
82 */
83 define nat64_get_timeouts_reply {
90 };
91 
92 /** \brief Add/delete address range to NAT64 pool
93  @param client_index - opaque cookie to identify the sender
94  @param context - sender context, to match reply w/ request
95  @param start_addr - start IPv4 address of the range
96  @param end_addr - end IPv4 address of the range
97  @param vrf_id - VRF id of tenant, ~0 means independent of VRF
98  @param is_add - true if add, false if delete
99 */
100 autoreply define nat64_add_del_pool_addr_range {
103  vl_api_ip4_address_t start_addr;
104  vl_api_ip4_address_t end_addr;
106  bool is_add;
107 };
108 
109 /** \brief Dump NAT64 pool addresses
110  @param client_index - opaque cookie to identify the sender
111  @param context - sender context, to match reply w/ request
112 */
113 define nat64_pool_addr_dump {
116 };
117 
118 /** \brief NAT64 pool address details response
119  @param context - sender context, to match reply w/ request
120  @param address - IPv4 address
121  @param vfr_id - VRF id of tenant, ~0 means independent of VRF
122 */
123 define nat64_pool_addr_details {
125  vl_api_ip4_address_t address;
127 };
128 
129 /** \brief Enable/disable NAT64 feature on the interface
130  @param client_index - opaque cookie to identify the sender
131  @param context - sender context, to match reply w/ request
132  @param is_add - true if add, false if delete
133  @param flags - flag NAT_IS_INSIDE if interface is inside else
134  interface is outside
135  @param sw_if_index - index of the interface
136 */
137 autoreply define nat64_add_del_interface {
140  bool is_add;
141  vl_api_nat_config_flags_t flags;
142  vl_api_interface_index_t sw_if_index;
143 };
144 
145 /** \brief Dump interfaces with NAT64 feature
146  @param client_index - opaque cookie to identify the sender
147  @param context - sender context, to match reply w/ request
148 */
149 define nat64_interface_dump {
152 };
153 
154 /** \brief NAT64 interface details response
155  @param context - sender context, to match reply w/ request
156  @param flags - flag NAT_IS_INSIDE if interface is inside,
157  flag NAT_IS_OUTSIDE if interface is outside
158  and if both flags are set the interface is
159  both inside and outside
160  @param sw_if_index - index of the interface
161 */
162 define nat64_interface_details {
164  vl_api_nat_config_flags_t flags;
165  vl_api_interface_index_t sw_if_index;
166 };
167 
168 /** \brief Add/delete NAT64 static BIB entry
169  @param client_index - opaque cookie to identify the sender
170  @param context - sender context, to match reply w/ request
171  @param i_addr - inside IPv6 address
172  @param o_addr - outside IPv4 address
173  @param i_port - inside port number
174  @param o_port - outside port number
175  @param vrf_id - VRF id of tenant
176  @param proto - protocol number
177  @param is_add - true if add, false if delete
178 */
179  autoreply define nat64_add_del_static_bib {
182  vl_api_ip6_address_t i_addr;
183  vl_api_ip4_address_t o_addr;
188  bool is_add;
189 };
190 
191 /** \brief Dump NAT64 BIB
192  @param client_index - opaque cookie to identify the sender
193  @param context - sender context, to match reply w/ request
194  @param proto - protocol of the BIB: 255 - all BIBs
195  6 - TCP BIB
196  17 - UDP BIB
197  1/58 - ICMP BIB
198  otherwise - "unknown" protocol BIB
199 */
200 define nat64_bib_dump {
204 };
205 
206 /** \brief NAT64 BIB details response
207  @param context - sender context, to match reply w/ request
208  @param i_addr - inside IPv6 address
209  @param o_addr - outside IPv4 address
210  @param i_port - inside port number
211  @param o_port - outside port number
212  @param vrf_id - VRF id of tenant
213  @param proto - protocol number
214  @param flags - flag NAT_IS_STATIC if BIB entry is static
215  or BIB entry is dynamic
216  @param ses_num - number of sessions associated with the BIB entry
217 */
218 define nat64_bib_details {
220  vl_api_ip6_address_t i_addr;
221  vl_api_ip4_address_t o_addr;
226  vl_api_nat_config_flags_t flags;
228 };
229 
230 /** \brief Dump NAT64 session table
231  @param client_index - opaque cookie to identify the sender
232  @param context - sender context, to match reply w/ request
233  @param proto - protocol of the session table: 255 - all STs
234  6 - TCP ST
235  17 - UDP ST
236  1/58 - ICMP ST
237  otherwise - "unknown" proto ST
238 */
239 define nat64_st_dump {
243 };
244 
245 /** \brief NAT64 session table details response
246  @param context - sender context, to match reply w/ request
247  @param il_addr - inside IPv6 address of the local host
248  @param ol_addr - outside IPv4 address of the local host
249  @param il_port - inside port number id of the local host/inside ICMP id
250  @param ol_port - outside port number of the local host/outside ICMP id
251  @param ir_addr - inside IPv6 address of the remote host
252  @param or_addr - outside IPv4 address of the remote host
253  @param r_port - port number of the remote host (not used for ICMP)
254  @param vrf_id - VRF id of tenant
255  @param proto - protocol number
256 */
257 define nat64_st_details {
259  vl_api_ip6_address_t il_addr;
260  vl_api_ip4_address_t ol_addr;
263  vl_api_ip6_address_t ir_addr;
264  vl_api_ip4_address_t or_addr;
268 };
269 
270 /** \brief Add/del NAT64 prefix
271  @param client_index - opaque cookie to identify the sender
272  @param context - sender context, to match reply w/ request
273  @param prefix - NAT64 prefix
274  @param vrf_id - VRF id of tenant
275  @param is_add - true if add, false if delete
276 */
277 autoreply define nat64_add_del_prefix {
280  vl_api_ip6_prefix_t prefix;
282  bool is_add;
283 };
284 
285 /** \brief Dump NAT64 prefix
286  @param client_index - opaque cookie to identify the sender
287  @param context - sender context, to match reply w/ request
288 */
289 define nat64_prefix_dump {
292 };
293 
294 /** \brief Dump NAT64 prefix details response
295  @param context - sender context, to match reply w/ request
296  @param prefix - NAT64 prefix
297  @param vrf_id - VRF id of tenant
298 */
299 define nat64_prefix_details {
301  vl_api_ip6_prefix_t prefix;
303 };
304 
305 /** \brief Add/delete NAT64 pool address from specific interfce
306  @param client_index - opaque cookie to identify the sender
307  @param context - sender context, to match reply w/ request
308  @param is_add - true if add, false if delete
309  @param sw_if_index - software index of the interface
310 */
311 autoreply define nat64_add_del_interface_addr {
314  bool is_add;
315  vl_api_interface_index_t sw_if_index;
316 };
nat64_add_del_prefix
int nat64_add_del_prefix(ip6_address_t *prefix, u8 plen, u32 vrf_id, u8 is_add)
Add/delete NAT64 prefix.
Definition: nat64.c:1206
vl_api_nat64_pool_addr_details_t::vrf_id
u32 vrf_id
Definition: nat64.api:126
vl_api_nat64_bib_details_t::i_addr
vl_api_ip6_address_t i_addr
Definition: nat64.api:220
vl_api_nat64_add_del_static_bib_t::proto
u8 proto
Definition: nat64.api:187
vl_api_nat64_add_del_interface_t::client_index
u32 client_index
Definition: nat64.api:138
vl_api_nat64_add_del_prefix_t
Add/del NAT64 prefix.
Definition: nat64.api:277
vl_api_nat64_get_timeouts_reply_t::tcp_established
u32 tcp_established
Definition: nat64.api:87
vl_api_nat64_interface_details_t::context
u32 context
Definition: nat64.api:163
vl_api_nat64_add_del_static_bib_t::o_port
u16 o_port
Definition: nat64.api:185
vl_api_nat64_st_dump_t::client_index
u32 client_index
Definition: nat64.api:240
vl_api_nat64_bib_details_t::i_port
u16 i_port
Definition: nat64.api:222
vl_api_nat64_prefix_details_t
Dump NAT64 prefix details response.
Definition: nat64.api:299
vl_api_nat64_plugin_enable_disable_t::bib_memory_size
u32 bib_memory_size
Definition: nat64.api:42
vl_api_nat64_prefix_dump_t::context
u32 context
Definition: nat64.api:291
vl_api_nat64_add_del_interface_addr_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: nat64.api:315
vl_api_nat64_add_del_static_bib_t::o_addr
vl_api_ip4_address_t o_addr
Definition: nat64.api:183
vl_api_nat64_get_timeouts_reply_t::retval
i32 retval
Definition: nat64.api:85
vl_api_nat64_set_timeouts_t::tcp_established
u32 tcp_established
Definition: nat64.api:61
u16
unsigned short u16
Definition: types.h:57
vl_api_nat64_bib_details_t::ses_num
u32 ses_num
Definition: nat64.api:227
vl_api_nat64_add_del_pool_addr_range_t::is_add
bool is_add
Definition: nat64.api:106
vl_api_nat64_add_del_interface_addr_t::context
u32 context
Definition: nat64.api:313
vl_api_nat64_st_details_t::context
u32 context
Definition: nat64.api:258
vl_api_nat64_add_del_pool_addr_range_t
Add/delete address range to NAT64 pool.
Definition: nat64.api:100
vl_api_nat64_add_del_static_bib_t::client_index
u32 client_index
Definition: nat64.api:180
vl_api_nat64_get_timeouts_t
Get values of timeouts for NAT64 sessions (seconds)
Definition: nat64.api:70
vl_api_nat64_prefix_details_t::prefix
vl_api_ip6_prefix_t prefix
Definition: nat64.api:301
vl_api_nat64_pool_addr_details_t::context
u32 context
Definition: nat64.api:124
vl_api_nat64_add_del_static_bib_t::i_addr
vl_api_ip6_address_t i_addr
Definition: nat64.api:182
vl_api_nat64_get_timeouts_reply_t::tcp_transitory
u32 tcp_transitory
Definition: nat64.api:88
vl_api_nat64_bib_dump_t
Dump NAT64 BIB.
Definition: nat64.api:200
i32
signed int i32
Definition: types.h:77
vl_api_nat64_add_del_static_bib_t
Add/delete NAT64 static BIB entry.
Definition: nat64.api:179
vl_api_nat64_set_timeouts_t::tcp_transitory
u32 tcp_transitory
Definition: nat64.api:62
vl_api_nat64_set_timeouts_t::udp
u32 udp
Definition: nat64.api:60
vl_api_nat64_get_timeouts_t::context
u32 context
Definition: nat64.api:72
vl_api_nat64_plugin_enable_disable_t::st_buckets
u32 st_buckets
Definition: nat64.api:43
vl_api_nat64_add_del_interface_t
Enable/disable NAT64 feature on the interface.
Definition: nat64.api:137
vl_api_nat64_set_timeouts_t::client_index
u32 client_index
Definition: nat64.api:58
vl_api_nat64_interface_dump_t::context
u32 context
Definition: nat64.api:151
vl_api_nat64_bib_details_t::o_addr
vl_api_ip4_address_t o_addr
Definition: nat64.api:221
vl_api_nat64_bib_dump_t::context
u32 context
Definition: nat64.api:202
vl_api_nat64_get_timeouts_reply_t::udp
u32 udp
Definition: nat64.api:86
version
option version
Definition: nat64.api:16
vl_api_nat64_add_del_pool_addr_range_t::context
u32 context
Definition: nat64.api:102
vl_api_nat64_add_del_interface_addr_t
Add/delete NAT64 pool address from specific interfce.
Definition: nat64.api:311
vl_api_nat64_st_details_t::or_addr
vl_api_ip4_address_t or_addr
Definition: nat64.api:264
vl_api_nat64_add_del_pool_addr_range_t::client_index
u32 client_index
Definition: nat64.api:101
vl_api_nat64_st_dump_t::proto
u8 proto
Definition: nat64.api:242
vl_api_nat64_bib_details_t::context
u32 context
Definition: nat64.api:219
vl_api_nat64_add_del_prefix_t::client_index
u32 client_index
Definition: nat64.api:278
vl_api_nat64_st_details_t::vrf_id
u32 vrf_id
Definition: nat64.api:266
vl_api_nat64_plugin_enable_disable_t::enable
bool enable
Definition: nat64.api:45
vl_api_nat64_add_del_static_bib_t::i_port
u16 i_port
Definition: nat64.api:184
vl_api_nat64_bib_details_t::flags
vl_api_nat_config_flags_t flags
Definition: nat64.api:226
vl_api_nat64_add_del_prefix_t::vrf_id
u32 vrf_id
Definition: nat64.api:281
vl_api_nat64_plugin_enable_disable_t::context
u32 context
Definition: nat64.api:40
vl_api_nat64_interface_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: nat64.api:165
vl_api_nat64_prefix_details_t::vrf_id
u32 vrf_id
Definition: nat64.api:302
vl_api_nat64_add_del_interface_t::context
u32 context
Definition: nat64.api:139
vl_api_nat64_plugin_enable_disable_t::st_memory_size
u32 st_memory_size
Definition: nat64.api:44
vl_api_nat64_bib_details_t::o_port
u16 o_port
Definition: nat64.api:223
vl_api_nat64_add_del_prefix_t::prefix
vl_api_ip6_prefix_t prefix
Definition: nat64.api:280
vl_api_nat64_plugin_enable_disable_t
Enable/disable NAT64 plugin.
Definition: nat64.api:38
vl_api_nat64_add_del_interface_t::flags
vl_api_nat_config_flags_t flags
Definition: nat64.api:141
vl_api_nat64_add_del_interface_addr_t::client_index
u32 client_index
Definition: nat64.api:312
vl_api_nat64_interface_dump_t::client_index
u32 client_index
Definition: nat64.api:150
vl_api_nat64_st_details_t::il_port
u16 il_port
Definition: nat64.api:261
vl_api_nat64_interface_details_t::flags
vl_api_nat_config_flags_t flags
Definition: nat64.api:164
vl_api_nat64_st_details_t::il_addr
vl_api_ip6_address_t il_addr
Definition: nat64.api:259
vl_api_nat64_bib_details_t::proto
u8 proto
Definition: nat64.api:225
vl_api_nat64_interface_dump_t
Dump interfaces with NAT64 feature.
Definition: nat64.api:149
vl_api_nat64_add_del_static_bib_t::context
u32 context
Definition: nat64.api:181
u32
unsigned int u32
Definition: types.h:88
vl_api_nat64_get_timeouts_t::client_index
u32 client_index
Definition: nat64.api:71
vl_api_nat64_prefix_dump_t::client_index
u32 client_index
Definition: nat64.api:290
vl_api_nat64_add_del_interface_t::is_add
bool is_add
Definition: nat64.api:140
vl_api_nat64_bib_details_t::vrf_id
u32 vrf_id
Definition: nat64.api:224
vl_api_nat64_bib_dump_t::proto
u8 proto
Definition: nat64.api:203
vl_api_nat64_add_del_interface_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: nat64.api:142
vl_api_nat64_pool_addr_dump_t::client_index
u32 client_index
Definition: nat64.api:114
vl_api_nat64_add_del_pool_addr_range_t::start_addr
vl_api_ip4_address_t start_addr
Definition: nat64.api:103
vl_api_nat64_pool_addr_details_t::address
vl_api_ip4_address_t address
Definition: nat64.api:125
vl_api_nat64_pool_addr_details_t
NAT64 pool address details response.
Definition: nat64.api:123
vl_api_nat64_get_timeouts_reply_t::context
u32 context
Definition: nat64.api:84
vl_api_nat64_bib_dump_t::client_index
u32 client_index
Definition: nat64.api:201
vl_api_nat64_set_timeouts_t::icmp
u32 icmp
Definition: nat64.api:63
vl_api_nat64_st_details_t::r_port
u16 r_port
Definition: nat64.api:265
vl_api_nat64_get_timeouts_reply_t::icmp
u32 icmp
Definition: nat64.api:89
vl_api_nat64_add_del_prefix_t::context
u32 context
Definition: nat64.api:279
vl_api_nat64_add_del_prefix_t::is_add
bool is_add
Definition: nat64.api:282
u8
unsigned char u8
Definition: types.h:56
vl_api_nat64_plugin_enable_disable_t::client_index
u32 client_index
Definition: nat64.api:39
vl_api_nat64_pool_addr_dump_t
Dump NAT64 pool addresses.
Definition: nat64.api:113
vl_api_nat64_add_del_static_bib_t::vrf_id
u32 vrf_id
Definition: nat64.api:186
vl_api_nat64_st_details_t::ol_port
u16 ol_port
Definition: nat64.api:262
vl_api_nat64_st_details_t::ol_addr
vl_api_ip4_address_t ol_addr
Definition: nat64.api:260
vl_api_nat64_st_details_t
NAT64 session table details response.
Definition: nat64.api:257
vl_api_nat64_st_dump_t
Dump NAT64 session table.
Definition: nat64.api:239
vl_api_nat64_plugin_enable_disable_t::status
option status
Definition: nat64.api:46
vl_api_nat64_add_del_pool_addr_range_t::end_addr
vl_api_ip4_address_t end_addr
Definition: nat64.api:104
vl_api_nat64_prefix_details_t::context
u32 context
Definition: nat64.api:300
vl_api_nat64_st_details_t::ir_addr
vl_api_ip6_address_t ir_addr
Definition: nat64.api:263
vl_api_nat64_prefix_dump_t
Dump NAT64 prefix.
Definition: nat64.api:289
vl_api_nat64_pool_addr_dump_t::context
u32 context
Definition: nat64.api:115
vl_api_nat64_plugin_enable_disable_t::bib_buckets
u32 bib_buckets
Definition: nat64.api:41
vl_api_nat64_add_del_pool_addr_range_t::vrf_id
u32 vrf_id
Definition: nat64.api:105
vl_api_nat64_st_dump_t::context
u32 context
Definition: nat64.api:241
vl_api_nat64_bib_details_t
NAT64 BIB details response.
Definition: nat64.api:218
vl_api_nat64_set_timeouts_t
Set values of timeouts for NAT64 sessions (seconds)
Definition: nat64.api:57
vl_api_nat64_st_details_t::proto
u8 proto
Definition: nat64.api:267
vl_api_nat64_get_timeouts_reply_t
Get values of timeouts for NAT64 sessions reply.
Definition: nat64.api:83
vl_api_nat64_set_timeouts_t::context
u32 context
Definition: nat64.api:59
vl_api_nat64_add_del_static_bib_t::is_add
bool is_add
Definition: nat64.api:188
vl_api_nat64_add_del_interface_addr_t::is_add
bool is_add
Definition: nat64.api:314
vl_api_nat64_interface_details_t
NAT64 interface details response.
Definition: nat64.api:162