docs: Use newer Ubuntu LTS in tutorial
[vpp.git] / src / plugins / nat / det44 / det44.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 det44.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 DET44 plugin
30     @param client_index - opaque cookie to identify the sender
31     @param context - sender context, to match reply w/ request
32     @param inside_vrf - inside VRF id
33     @param outside_vrf - outside VRF id
34     @param enable - true if enable, false if disable
35 */
36 autoreply define det44_plugin_enable_disable {
37   u32 client_index;
38   u32 context;
39   u32 inside_vrf;
40   u32 outside_vrf;
41   bool enable;
42 };
43
44 /** \brief Enable/disable DET44 feature on the interface
45     @param client_index - opaque cookie to identify the sender
46     @param context - sender context, to match reply w/ request
47     @param is_add - true if add, false if delete
48     @param is_inside - true if interface is inside, false if outside
49     @param sw_if_index - software index of the interface
50 */
51 autoreply define det44_interface_add_del_feature {
52   u32 client_index;
53   u32 context;
54   bool is_add;
55   bool is_inside;
56   vl_api_interface_index_t sw_if_index;
57 };
58
59 /** \brief Dump interfaces with DET44 feature
60     @param client_index - opaque cookie to identify the sender
61     @param context - sender context, to match reply w/ request
62 */
63 define det44_interface_dump {
64   u32 client_index;
65   u32 context;
66 };
67
68 /** \brief DET44 interface details response
69     @param context - sender context, to match reply w/ request
70     @param is_inside - true if interface is inside, false if outside
71     @param sw_if_index - software index of the interface
72 */
73 define det44_interface_details {
74   u32 context;
75   bool is_inside;
76   bool is_outside;
77   vl_api_interface_index_t sw_if_index;
78 };
79
80 /** \brief Add/delete DET44 mapping
81     @param client_index - opaque cookie to identify the sender
82     @param context - sender context, to match reply w/ request
83     @param is_add - true if add, false if delete
84     @param in_addr - inside IPv4 address
85     @param in_plen - inside IPv4 address prefix length
86     @param out_addr - outside IPv4 address
87     @param out_plen - outside IPv4 address prefix length
88 */
89 autoreply define det44_add_del_map {
90   u32 client_index;
91   u32 context;
92   bool is_add;
93   vl_api_ip4_address_t in_addr;
94   u8 in_plen;
95   vl_api_ip4_address_t out_addr;
96   u8 out_plen;
97 };
98
99 /** \brief Get outside address and port range from inside address
100     @param client_index - opaque cookie to identify the sender
101     @param context - sender context, to match reply w/ request
102     @param in_addr - inside IP address
103 */
104 define det44_forward {
105   u32 client_index;
106   u32 context;
107   vl_api_ip4_address_t in_addr;
108 };
109
110 /** \brief Get outside address and port range from inside address
111     @param context - sender context, to match reply w/ request
112     @param retval - return code
113     @param out_port_lo - outside port range start
114     @param out_port_hi - outside port range end
115     @param out_addr - outside IPv4 address
116 */
117 define det44_forward_reply {
118   u32 context;
119   i32 retval;
120   u16 out_port_lo;
121   u16 out_port_hi;
122   vl_api_ip4_address_t out_addr;
123 };
124
125 /** \brief Get inside address from outside address and port
126     @param client_index - opaque cookie to identify the sender
127     @param context - sender context, to match reply w/ request
128     @param out_port - outside port
129     @param out_addr - outside IPv4 address
130 */
131 define det44_reverse {
132   u32 client_index;
133   u32 context;
134   u16 out_port;
135   vl_api_ip4_address_t out_addr;
136 };
137
138 /** \brief Get inside address from outside address and port reply
139     @param context - sender context, to match reply w/ request
140     @param retval - return code
141     @param in_addr - inside IP address
142 */
143 define det44_reverse_reply {
144   u32 context;
145   i32 retval;
146   vl_api_ip4_address_t in_addr;
147 };
148
149 /** \brief Dump DET44 mappings
150     @param client_index - opaque cookie to identify the sender
151     @param context - sender context, to match reply w/ request
152 */
153 define det44_map_dump {
154   u32 client_index;
155   u32 context;
156 };
157
158 /** \brief DET44 users response
159     @param context - sender context, to match reply w/ request
160     @param in_addr - inside IPv4 address
161     @param in_plen - inside IPv4 address prefix length
162     @param out_addr - outside IPv4 address
163     @param out_plen - outside IPv4 address prefix length
164     @param sharing_ratio - outside to inside address sharing ratio
165     @param ports_per_host - number of ports available to a host
166     @param ses_num - number of sessions belonging to this mapping
167 */
168 define det44_map_details {
169   u32 context;
170   vl_api_ip4_address_t in_addr;
171   u8 in_plen;
172   vl_api_ip4_address_t out_addr;
173   u8 out_plen;
174   u32 sharing_ratio;
175   u16 ports_per_host;
176   u32 ses_num;
177 };
178
179 /** \brief Close DET44 session by outside address and port
180     @param client_index - opaque cookie to identify the sender
181     @param context - sender context, to match reply w/ request
182     @param out_addr - outside IPv4 address
183     @param out_port - outside port
184     @param ext_addr - external host IPv4 address
185     @param ext_port - external host port
186 */
187 autoreply define det44_close_session_out {
188   u32 client_index;
189   u32 context;
190   vl_api_ip4_address_t out_addr;
191   u16 out_port;
192   vl_api_ip4_address_t ext_addr;
193   u16 ext_port;
194 };
195
196 /** \brief Close DET44 session by inside address and port
197     @param client_index - opaque cookie to identify the sender
198     @param context - sender context, to match reply w/ request
199     @param in_addr - inside IP address
200     @param in_port - inside port
201     @param ext_addr - external host IP address
202     @param ext_port - external host port
203 */
204 autoreply define det44_close_session_in {
205   u32 client_index;
206   u32 context;
207   vl_api_ip4_address_t in_addr;
208   u16 in_port;
209   vl_api_ip4_address_t ext_addr;
210   u16 ext_port;
211 };
212
213 /** \brief Dump DET44 sessions
214     @param client_index - opaque cookie to identify the sender
215     @param context - sender context, to match reply w/ request
216     @param user_addr - address of an inside user whose sessions to dump
217 */
218 define det44_session_dump {
219   u32 client_index;
220   u32 context;
221   vl_api_ip4_address_t user_addr;
222 };
223
224 /** \brief DET44 sessions reply
225     @param context - sender context, to match reply w/ request
226     @param in_port - inside port
227     @param ext_addr - external host IPv4 address
228     @param ext_port - external host port
229     @param out_port - outside port
230     @param state - session state
231     @param expire - session expiration timestamp
232 */
233 define det44_session_details {
234   u32 context;
235   u16 in_port;
236   vl_api_ip4_address_t ext_addr;
237   u16 ext_port;
238   u16 out_port;
239   u8 state;
240   u32 expire;
241 };
242
243 /** \brief Set values of timeouts for DET44 sessions (seconds)
244     @param client_index - opaque cookie to identify the sender
245     @param context - sender context, to match reply w/ request
246     @param udp - UDP timeout (default 300sec)
247     @param tcp_established - TCP established timeout (default 7440sec)
248     @param tcp_transitory - TCP transitory timeout (default 240sec)
249     @param icmp - ICMP timeout (default 60sec)
250 */
251 autoreply define det44_set_timeouts {
252   u32 client_index;
253   u32 context;
254   u32 udp;
255   u32 tcp_established;
256   u32 tcp_transitory;
257   u32 icmp;
258   option status="in_progress";
259 };
260
261 /** \brief Get values of timeouts for DET44 sessions (seconds)
262     @param client_index - opaque cookie to identify the sender
263     @param context - sender context, to match reply w/ request
264 */
265 define det44_get_timeouts {
266   u32 client_index;
267   u32 context;
268 };
269
270 /** \brief Get values of timeouts for DET44 sessions reply
271     @param context - sender context, to match reply w/ request
272     @param retval - return code
273     @param udp - UDP timeout
274     @param tcp_established - TCP established timeout
275     @param tcp_transitory - TCP transitory timeout
276     @param icmp - ICMP timeout
277 */
278 define det44_get_timeouts_reply {
279   u32 context;
280   i32 retval;
281   u32 udp;
282   u32 tcp_established;
283   u32 tcp_transitory;
284   u32 icmp;
285   option status="in_progress";
286 };
287
288 /*
289  * Obsolete deterministic API to be removed
290  */
291
292 /** \brief Add/delete NAT deterministic mapping
293     @param client_index - opaque cookie to identify the sender
294     @param context - sender context, to match reply w/ request
295     @param is_add - true if add, false if delete
296     @param in_addr - inside IPv4 address
297     @param in_plen - inside IPv4 address prefix length
298     @param out_addr - outside IPv4 address
299     @param out_plen - outside IPv4 address prefix length
300 */
301 autoreply define nat_det_add_del_map {
302   u32 client_index;
303   u32 context;
304   bool is_add;
305   vl_api_ip4_address_t in_addr;
306   u8 in_plen;
307   vl_api_ip4_address_t out_addr;
308   u8 out_plen;
309   option deprecated;
310 };
311
312 /** \brief Get outside address and port range from inside address
313     @param client_index - opaque cookie to identify the sender
314     @param context - sender context, to match reply w/ request
315     @param in_addr - inside IP address
316 */
317 define nat_det_forward {
318   u32 client_index;
319   u32 context;
320   vl_api_ip4_address_t in_addr;
321   option deprecated;
322 };
323
324 /** \brief Get outside address and port range from inside address
325     @param context - sender context, to match reply w/ request
326     @param retval - return code
327     @param out_port_lo - outside port range start
328     @param out_port_hi - outside port range end
329     @param out_addr - outside IPv4 address
330 */
331 define nat_det_forward_reply {
332   u32 context;
333   i32 retval;
334   u16 out_port_lo;
335   u16 out_port_hi;
336   vl_api_ip4_address_t out_addr;
337   option deprecated;
338 };
339
340 /** \brief Get inside address from outside address and port
341     @param client_index - opaque cookie to identify the sender
342     @param context - sender context, to match reply w/ request
343     @param out_port - outside port
344     @param out_addr - outside IPv4 address
345 */
346 define nat_det_reverse {
347   u32 client_index;
348   u32 context;
349   u16 out_port;
350   vl_api_ip4_address_t out_addr;
351   option deprecated;
352 };
353
354 /** \brief Get inside address from outside address and port reply
355     @param context - sender context, to match reply w/ request
356     @param retval - return code
357     @param in_addr - inside IP address
358 */
359 define nat_det_reverse_reply {
360   u32 context;
361   i32 retval;
362   vl_api_ip4_address_t in_addr;
363   option deprecated;
364 };
365
366 /** \brief Dump NAT deterministic mappings
367     @param client_index - opaque cookie to identify the sender
368     @param context - sender context, to match reply w/ request
369 */
370 define nat_det_map_dump {
371   u32 client_index;
372   u32 context;
373   option deprecated;
374 };
375
376 /** \brief NAT users response
377     @param context - sender context, to match reply w/ request
378     @param in_addr - inside IPv4 address
379     @param in_plen - inside IPv4 address prefix length
380     @param out_addr - outside IPv4 address
381     @param out_plen - outside IPv4 address prefix length
382     @param sharing_ratio - outside to inside address sharing ratio
383     @param ports_per_host - number of ports available to a host
384     @param ses_num - number of sessions belonging to this mapping
385 */
386 define nat_det_map_details {
387   u32 context;
388   vl_api_ip4_address_t in_addr;
389   u8 in_plen;
390   vl_api_ip4_address_t out_addr;
391   u8 out_plen;
392   u32 sharing_ratio;
393   u16 ports_per_host;
394   u32 ses_num;
395   option deprecated;
396 };
397
398 /** \brief Close deterministic NAT session by outside address and port
399     @param client_index - opaque cookie to identify the sender
400     @param context - sender context, to match reply w/ request
401     @param out_addr - outside IPv4 address
402     @param out_port - outside port
403     @param ext_addr - external host IPv4 address
404     @param ext_port - external host port
405 */
406 autoreply define nat_det_close_session_out {
407   u32 client_index;
408   u32 context;
409   vl_api_ip4_address_t out_addr;
410   u16 out_port;
411   vl_api_ip4_address_t ext_addr;
412   u16 ext_port;
413   option deprecated;
414 };
415
416 /** \brief Close deterministic NAT session by inside address and port
417     @param client_index - opaque cookie to identify the sender
418     @param context - sender context, to match reply w/ request
419     @param in_addr - inside IP address
420     @param in_port - inside port
421     @param ext_addr - external host IP address
422     @param ext_port - external host port
423 */
424 autoreply define nat_det_close_session_in {
425   u32 client_index;
426   u32 context;
427   vl_api_ip4_address_t in_addr;
428   u16 in_port;
429   vl_api_ip4_address_t ext_addr;
430   u16 ext_port;
431   option deprecated;
432 };
433
434 /** \brief Dump determinstic NAT sessions
435     @param client_index - opaque cookie to identify the sender
436     @param context - sender context, to match reply w/ request
437     @param user_addr - address of an inside user whose sessions to dump
438 */
439 define nat_det_session_dump {
440   u32 client_index;
441   u32 context;
442   vl_api_ip4_address_t user_addr;
443   option deprecated;
444 };
445
446 /** \brief Deterministic NAT sessions reply
447     @param context - sender context, to match reply w/ request
448     @param in_port - inside port
449     @param ext_addr - external host IPv4 address
450     @param ext_port - external host port
451     @param out_port - outside NAT port
452     @param state - session state
453     @param expire - session expiration timestamp
454 */
455 define nat_det_session_details {
456   u32 context;
457   u16 in_port;
458   vl_api_ip4_address_t ext_addr;
459   u16 ext_port;
460   u16 out_port;
461   u8 state;
462   u32 expire;
463   option deprecated;
464 };