SNAT: user's dump and session dump of a certain snat user.
[vpp.git] / src / plugins / snat / snat.api
1 /*
2  * Copyright (c) 2016 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  * @file snat.api
17  * @brief VPP control-plane API messages.
18  *
19  * This file defines VPP control-plane API messages which are generally
20  * called through a shared memory interface.
21  */
22
23 /** \brief Add/del S-NAT address range
24     @param client_index - opaque cookie to identify the sender
25     @param context - sender context, to match reply w/ request
26     @param is_ip4 - 1 if address type is IPv4
27     @param first_ip_address - first IP address
28     @param last_ip_address - last IP address
29     @param is_add - 1 if add, 0 if delete
30 */
31 define snat_add_address_range {
32   u32 client_index;
33   u32 context;
34   u8 is_ip4;
35   u8 first_ip_address[16];
36   u8 last_ip_address[16];
37   u8 is_add;
38 };
39
40 /** \brief Add S-NAT address range reply
41     @param context - sender context, to match reply w/ request
42     @param retval - return code
43 */
44 define snat_add_address_range_reply {
45   u32 context;
46   i32 retval;
47 };
48
49 /** \brief Dump S-NAT addresses
50     @param client_index - opaque cookie to identify the sender
51     @param context - sender context, to match reply w/ request
52 */
53 define snat_address_dump {
54   u32 client_index;
55   u32 context;
56 };
57
58 /** \brief S-NAT address details response
59     @param context - sender context, to match reply w/ request
60     @param is_ip4 - 1 if address type is IPv4
61     @param ip_address - IP address
62 */
63 define snat_address_details {
64   u32 context;
65   u8 is_ip4;
66   u8 ip_address[16];
67 };
68
69 /** \brief Enable/disable S-NAT feature on the interface
70     @param client_index - opaque cookie to identify the sender
71     @param context - sender context, to match reply w/ request
72     @param is_add - 1 if add, 0 if delete
73     @param is_inside - 1 if inside, 0 if outside
74     @param sw_if_index - software index of the interface
75 */
76 define snat_interface_add_del_feature {
77   u32 client_index;
78   u32 context;
79   u8 is_add;
80   u8 is_inside;
81   u32 sw_if_index;
82 };
83
84 /** \brief Enable/disable S-NAT feature on the interface reply
85     @param context - sender context, to match reply w/ request
86     @param retval - return code
87 */
88 define snat_interface_add_del_feature_reply {
89   u32 context;
90   i32 retval;
91 };
92
93 /** \brief Dump interfaces with S-NAT feature
94     @param client_index - opaque cookie to identify the sender
95     @param context - sender context, to match reply w/ request
96 */
97 define snat_interface_dump {
98   u32 client_index;
99   u32 context;
100 };
101
102 /** \brief S-NAT interface details response
103     @param context - sender context, to match reply w/ request
104     @param is_inside - 1 if inside, 0 if outside
105     @param sw_if_index - software index of the interface
106 */
107 define snat_interface_details {
108   u32 context;
109   u8 is_inside;
110   u32 sw_if_index;
111 };
112
113 /** \brief Add/delete S-NAT static mapping
114     @param client_index - opaque cookie to identify the sender
115     @param context - sender context, to match reply w/ request
116     @param is_add - 1 if add, 0 if delete
117     @param is_ip4 - 1 if address type is IPv4
118     @param addr_only - 1 if address only mapping
119     @param local_ip_address - local IP address
120     @param external_ip_address - external IP address
121     @param protocol - IP protocol
122     @param local_port - local port number
123     @param external_port - external port number
124     @param external_sw_if_index - external interface (if set
125                                   external_ip_address is ignored)
126     @param vfr_id - VRF ID
127 */
128 define snat_add_static_mapping {
129   u32 client_index;
130   u32 context;
131   u8 is_add;
132   u8 is_ip4;
133   u8 addr_only;
134   u8 local_ip_address[16];
135   u8 external_ip_address[16];
136   u8 protocol;
137   u16 local_port;
138   u16 external_port;
139   u32 external_sw_if_index;
140   u32 vrf_id;
141 };
142
143 /** \brief Add/delete S-NAT static mapping reply
144     @param context - sender context, to match reply w/ request
145     @param retval - return code
146 */
147 define snat_add_static_mapping_reply {
148   u32 context;
149   i32 retval;
150 };
151
152 /** \brief Dump S-NAT static mappings
153     @param client_index - opaque cookie to identify the sender
154     @param context - sender context, to match reply w/ request
155 */
156 define snat_static_mapping_dump {
157   u32 client_index;
158   u32 context;
159 };
160
161 /** \brief S-NAT static mapping details response
162     @param context - sender context, to match reply w/ request
163     @param is_ip4 - 1 if address type is IPv4
164     @param addr_only - 1 if address only mapping
165     @param local_ip_address - local IP address
166     @param external_ip_address - external IP address
167     @param protocol - IP protocol
168     @param local_port - local port number
169     @param external_port - external port number
170     @param external_sw_if_index - external interface
171     @param vfr_id - VRF ID
172 */
173 define snat_static_mapping_details {
174   u32 context;
175   u8 is_ip4;
176   u8 addr_only;
177   u8 local_ip_address[16];
178   u8 external_ip_address[16];
179   u8 protocol;
180   u16 local_port;
181   u16 external_port;
182   u32 external_sw_if_index;
183   u32 vrf_id;
184 };
185
186 /** \brief Control ping from client to api server request
187     @param client_index - opaque cookie to identify the sender
188     @param context - sender context, to match reply w/ request
189 */
190 define snat_control_ping
191 {
192   u32 client_index;
193   u32 context;
194 };
195
196 /** \brief Control ping from the client to the server response
197     @param client_index - opaque cookie to identify the sender
198     @param context - sender context, to match reply w/ request
199     @param retval - return code for the request
200     @param vpe_pid - the pid of the vpe, returned by the server
201 */
202 define snat_control_ping_reply
203 {
204   u32 context;
205   i32 retval;
206   u32 client_index;
207   u32 vpe_pid;
208 };
209
210 /** \brief Show S-NAT plugin startup config
211     @param client_index - opaque cookie to identify the sender
212     @param context - sender context, to match reply w/ request
213 */
214 define snat_show_config
215 {
216   u32 client_index;
217   u32 context;
218 };
219
220 /** \brief Show S-NAT plugin startup config reply
221     @param context - sender context, to match reply w/ request
222     @param retval - return code for the request
223     @param static_mapping_only - if 1 dynamic translations disabled
224     @param static_mapping_connection_tracking - if 1 create session data
225     @param translation_buckets - number of translation hash buckets
226     @param translation_memory_size - translation hash memory size
227     @param user_buckets - number of user hash buckets
228     @param user_memory_size - user hash memory size
229     @param max_translations_per_user - maximum number of translations per user
230     @param outside_vrf_id - outside VRF id
231     @param inside_vrf_id - default inside VRF id
232 */
233 define snat_show_config_reply
234 {
235   u32 context;
236   i32 retval;
237   u8 static_mapping_only;
238   u8 static_mapping_connection_tracking;
239   u32 translation_buckets;
240   u32 translation_memory_size;
241   u32 user_buckets;
242   u32 user_memory_size;
243   u32 max_translations_per_user;
244   u32 outside_vrf_id;
245   u32 inside_vrf_id;
246 };
247
248 /** \brief Set S-NAT workers
249     @param client_index - opaque cookie to identify the sender
250     @param context - sender context, to match reply w/ request
251     @param worker_mask - S-NAT workers mask
252 */
253 define snat_set_workers {
254   u32 client_index;
255   u32 context;
256   u64 worker_mask;
257 };
258
259 /** \brief Set S-NAT workers reply
260     @param context - sender context, to match reply w/ request
261     @param retval - return code
262 */
263 define snat_set_workers_reply {
264   u32 context;
265   i32 retval;
266 };
267
268 /** \brief Dump S-NAT workers
269     @param client_index - opaque cookie to identify the sender
270     @param context - sender context, to match reply w/ request
271 */
272 define snat_worker_dump {
273   u32 client_index;
274   u32 context;
275 };
276
277 /** \brief S-NAT workers details response
278     @param context - sender context, to match reply w/ request
279     @param worker_index - worker index
280     @param lcore_id - lcore ID
281     @param name - worker name
282 */
283 define snat_worker_details {
284   u32 context;
285   u32 worker_index;
286   u32 lcore_id;
287   u8 name[64];
288 };
289
290 /** \brief Add/delete S-NAT pool address from specific interfce
291     @param client_index - opaque cookie to identify the sender
292     @param context - sender context, to match reply w/ request
293     @param is_add - 1 if add, 0 if delete
294     @param sw_if_index - software index of the interface
295 */
296 define snat_add_del_interface_addr {
297   u32 client_index;
298   u32 context;
299   u8 is_add;
300   u8 is_inside;
301   u32 sw_if_index;
302 };
303
304 /** \brief Add/delete S-NAT pool address from specific interfce reply
305     @param context - sender context, to match reply w/ request
306     @param retval - return code
307 */
308 define snat_add_del_interface_addr_reply {
309   u32 context;
310   i32 retval;
311 };
312
313 /** \brief Dump S-NAT pool addresses interfaces
314     @param client_index - opaque cookie to identify the sender
315     @param context - sender context, to match reply w/ request
316 */
317 define snat_interface_addr_dump {
318   u32 client_index;
319   u32 context;
320 };
321
322 /** \brief S-NAT pool addresses interfaces details response
323     @param context - sender context, to match reply w/ request
324     @param sw_if_index - software index of the interface
325 */
326 define snat_interface_addr_details {
327   u32 context;
328   u32 sw_if_index;
329 };
330
331 /** \brief Enable/disable S-NAT IPFIX logging
332     @param client_index - opaque cookie to identify the sender
333     @param context - sender context, to match reply w/ request
334     @param domain_id - observation domain ID
335     @param src_port - source port number
336     @param enable - 1 if enable, 0 if disable
337 */
338 define snat_ipfix_enable_disable {
339   u32 client_index;
340   u32 context;
341   u32 domain_id;
342   u16 src_port;
343   u8 enable;
344 };
345
346 /** \brief Enable/disable S-NAT IPFIX logging reply
347     @param context - sender context, to match reply w/ request
348     @param retval - return code
349 */
350 define snat_ipfix_enable_disable_reply {
351   u32 context;
352   i32 retval;
353 };
354
355 /** \brief Dump S-NAT users
356     @param client_index - opaque cookie to identify the sender
357     @param context - sender context, to match reply w/ request
358 */
359 define snat_user_dump {
360   u32 client_index;
361   u32 context;
362 };
363
364 /** \brief S-NAT users response
365     @param context - sender context, to match reply w/ request
366     @vrf_id - VRF ID
367     @param is_ip4 - 1 if address type is IPv4
368     @param ip_adress - IP address
369     @param nsessions - number of dynamic sessions
370     @param nstaticsessions - number of static sessions
371 */
372 define snat_user_details {
373   u32 context;
374   u32 vrf_id;
375   u8 is_ip4;
376   u8 ip_address[16];
377   u32 nsessions;
378   u32 nstaticsessions;
379 };
380
381 /** \brief S-NAT user's sessions
382     @param client_index - opaque cookie to identify the sender
383     @param context - sender context, to match reply w/ request
384     @param user_ip - IP address of the user to dump
385     @param vrf_id - VRF_ID
386 */
387 define snat_user_session_dump {
388   u32 client_index;
389   u32 context;
390   u8 ip_address[16];
391   u32 vrf_id;
392 };
393
394 /** \brief S-NAT user's sessions response
395     @param context - sender context, to match reply w/ request
396     @param is_ip4 - 1 if address type is IPv4
397     @param outside_ip_address - outside IP address
398     @param outside_port - outside port
399     @param inside_ip_address - inside IP address
400     @param inside_port - inside port
401     @param protocol - protocol
402     @param is_static - 1 if session is static
403     @param last_heard - last heard timer
404     @param total_bytes - count of bytes sent through session
405     @param total_pkts - count of pakets sent through session
406 */
407 define snat_user_session_details {
408   u32 context;
409   u8 is_ip4;
410   u8 outside_ip_address[16];
411   u16 outside_port;
412   u8 inside_ip_address[16];
413   u16 inside_port;
414   u16 protocol;
415   u8 is_static;
416   f64 last_heard;
417   u64 total_bytes;
418   u32 total_pkts;
419 };