ff1d9bc1b8a4b8a83865ecde0845f4cc4241a1f3
[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 local_port - local port number
122     @param external_port - external port number
123     @param vfr_id - VRF ID
124 */
125 define snat_add_static_mapping {
126   u32 client_index;
127   u32 context;
128   u8 is_add;
129   u8 is_ip4;
130   u8 addr_only;
131   u8 local_ip_address[16];
132   u8 external_ip_address[16];
133   u16 local_port;
134   u16 external_port;
135   u32 vrf_id;
136 };
137
138 /** \brief Add/delete S-NAT static mapping reply
139     @param context - sender context, to match reply w/ request
140     @param retval - return code
141 */
142 define snat_add_static_mapping_reply {
143   u32 context;
144   i32 retval;
145 };
146
147 /** \brief Dump S-NAT static mappings
148     @param client_index - opaque cookie to identify the sender
149     @param context - sender context, to match reply w/ request
150 */
151 define snat_static_mapping_dump {
152   u32 client_index;
153   u32 context;
154 };
155
156 /** \brief S-NAT static mapping details response
157     @param context - sender context, to match reply w/ request
158     @param is_ip4 - 1 if address type is IPv4
159     @param addr_only - 1 if address only mapping
160     @param local_ip_address - local IP address
161     @param external_ip_address - external IP address
162     @param local_port - local port number
163     @param external_port - external port number
164     @param vfr_id - VRF ID
165 */
166 define snat_static_mapping_details {
167   u32 context;
168   u8 is_ip4;
169   u8 addr_only;
170   u8 local_ip_address[16];
171   u8 external_ip_address[16];
172   u16 local_port;
173   u16 external_port;
174   u32 vrf_id;
175 };
176
177 /** \brief Control ping from client to api server request
178     @param client_index - opaque cookie to identify the sender
179     @param context - sender context, to match reply w/ request
180 */
181 define snat_control_ping
182 {
183   u32 client_index;
184   u32 context;
185 };
186
187 /** \brief Control ping from the client to the server response
188     @param client_index - opaque cookie to identify the sender
189     @param context - sender context, to match reply w/ request
190     @param retval - return code for the request
191     @param vpe_pid - the pid of the vpe, returned by the server
192 */
193 define snat_control_ping_reply
194 {
195   u32 context;
196   i32 retval;
197   u32 client_index;
198   u32 vpe_pid;
199 };
200
201 /** \brief Show S-NAT plugin startup config
202     @param client_index - opaque cookie to identify the sender
203     @param context - sender context, to match reply w/ request
204 */
205 define snat_show_config
206 {
207   u32 client_index;
208   u32 context;
209 };
210
211 /** \brief Show S-NAT plugin startup config reply
212     @param context - sender context, to match reply w/ request
213     @param retval - return code for the request
214     @param static_mapping_only - if 1 dynamic translations disabled
215     @param static_mapping_connection_tracking - if 1 create session data
216     @param translation_buckets - number of translation hash buckets
217     @param translation_memory_size - translation hash memory size
218     @param user_buckets - number of user hash buckets
219     @param user_memory_size - user hash memory size
220     @param max_translations_per_user - maximum number of translations per user
221     @param outside_vrf_id - outside VRF id
222     @param inside_vrf_id - default inside VRF id
223 */
224 define snat_show_config_reply
225 {
226   u32 context;
227   i32 retval;
228   u8 static_mapping_only;
229   u8 static_mapping_connection_tracking;
230   u32 translation_buckets;
231   u32 translation_memory_size;
232   u32 user_buckets;
233   u32 user_memory_size;
234   u32 max_translations_per_user;
235   u32 outside_vrf_id;
236   u32 inside_vrf_id;
237 };
238
239 /** \brief Set S-NAT workers
240     @param client_index - opaque cookie to identify the sender
241     @param context - sender context, to match reply w/ request
242     @param worker_mask - S-NAT workers mask
243 */
244 define snat_set_workers {
245   u32 client_index;
246   u32 context;
247   u64 worker_mask;
248 };
249
250 /** \brief Set S-NAT workers reply
251     @param context - sender context, to match reply w/ request
252     @param retval - return code
253 */
254 define snat_set_workers_reply {
255   u32 context;
256   i32 retval;
257 };
258
259 /** \brief Dump S-NAT workers
260     @param client_index - opaque cookie to identify the sender
261     @param context - sender context, to match reply w/ request
262 */
263 define snat_worker_dump {
264   u32 client_index;
265   u32 context;
266 };
267
268 /** \brief S-NAT workers details response
269     @param context - sender context, to match reply w/ request
270     @param worker_index - worker index
271     @param lcore_id - lcore ID
272     @param name - worker name
273 */
274 define snat_worker_details {
275   u32 context;
276   u32 worker_index;
277   u32 lcore_id;
278   u8 name[64];
279 };
280
281 /** \brief Add/delete S-NAT pool address from specific interfce
282     @param client_index - opaque cookie to identify the sender
283     @param context - sender context, to match reply w/ request
284     @param is_add - 1 if add, 0 if delete
285     @param sw_if_index - software index of the interface
286 */
287 define snat_add_del_interface_addr {
288   u32 client_index;
289   u32 context;
290   u8 is_add;
291   u8 is_inside;
292   u32 sw_if_index;
293 };
294
295 /** \brief Add/delete S-NAT pool address from specific interfce reply
296     @param context - sender context, to match reply w/ request
297     @param retval - return code
298 */
299 define snat_add_del_interface_addr_reply {
300   u32 context;
301   i32 retval;
302 };
303
304 /** \brief Dump S-NAT pool addresses interfaces
305     @param client_index - opaque cookie to identify the sender
306     @param context - sender context, to match reply w/ request
307 */
308 define snat_interface_addr_dump {
309   u32 client_index;
310   u32 context;
311 };
312
313 /** \brief S-NAT pool addresses interfaces details response
314     @param context - sender context, to match reply w/ request
315     @param sw_if_index - software index of the interface
316 */
317 define snat_interface_addr_details {
318   u32 context;
319   u32 sw_if_index;
320 };
321
322 /** \brief Enable/disable S-NAT IPFIX logging
323     @param client_index - opaque cookie to identify the sender
324     @param context - sender context, to match reply w/ request
325     @param domain_id - observation domain ID
326     @param src_port - source port number
327     @param enable - 1 if enable, 0 if disable
328 */
329 define snat_ipfix_enable_disable {
330   u32 client_index;
331   u32 context;
332   u32 domain_id;
333   u16 src_port;
334   u8 enable;
335 };
336
337 /** \brief Enable/disable S-NAT IPFIX logging reply
338     @param context - sender context, to match reply w/ request
339     @param retval - return code
340 */
341 define snat_ipfix_enable_disable_reply {
342   u32 context;
343   i32 retval;
344 };