nat: Final NAT44 EI/ED split patch
[vpp.git] / src / plugins / nat / nat64 / nat64.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 = "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 {
39   u32 client_index;
40   u32 context;
41   u32 bib_buckets;
42   u32 bib_memory_size;
43   u32 st_buckets;
44   u32 st_memory_size;
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 {
58   u32 client_index;
59   u32 context;
60   u32 udp;
61   u32 tcp_established;
62   u32 tcp_transitory;
63   u32 icmp;
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 {
71   u32 client_index;
72   u32 context;
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 {
84   u32 context;
85   i32 retval;
86   u32 udp;
87   u32 tcp_established;
88   u32 tcp_transitory;
89   u32 icmp;
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 {
101   u32 client_index;
102   u32 context;
103   vl_api_ip4_address_t start_addr;
104   vl_api_ip4_address_t end_addr;
105   u32 vrf_id;
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 {
114   u32 client_index;
115   u32 context;
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 {
124   u32 context;
125   vl_api_ip4_address_t address;
126   u32 vrf_id;
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 {
138   u32 client_index;
139   u32 context;
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 {
150   u32 client_index;
151   u32 context;
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 {
163   u32 context;
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 {
180   u32 client_index;
181   u32 context;
182   vl_api_ip6_address_t i_addr;
183   vl_api_ip4_address_t o_addr;
184   u16 i_port;
185   u16 o_port;
186   u32 vrf_id;
187   u8 proto;
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 {
201   u32 client_index;
202   u32 context;
203   u8 proto;
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 {
219   u32 context;
220   vl_api_ip6_address_t i_addr;
221   vl_api_ip4_address_t o_addr;
222   u16 i_port;
223   u16 o_port;
224   u32 vrf_id;
225   u8 proto;
226   vl_api_nat_config_flags_t flags;
227   u32 ses_num;
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 {
240   u32 client_index;
241   u32 context;
242   u8 proto;
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 {
258   u32 context;
259   vl_api_ip6_address_t il_addr;
260   vl_api_ip4_address_t ol_addr;
261   u16 il_port;
262   u16 ol_port;
263   vl_api_ip6_address_t ir_addr;
264   vl_api_ip4_address_t or_addr;
265   u16 r_port;
266   u32 vrf_id;
267   u8 proto;
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 {
278   u32 client_index;
279   u32 context;
280   vl_api_ip6_prefix_t prefix;
281   u32 vrf_id;
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 {
290   u32 client_index;
291   u32 context;
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 {
300   u32 context;
301   vl_api_ip6_prefix_t prefix;
302   u32 vrf_id;
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 {
312   u32 client_index;
313   u32 context;
314   bool is_add;
315   vl_api_interface_index_t sw_if_index;
316 };