Move java,lua api and remaining plugins to src/
[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     @first_ip_address - first IP address
28     @last_ip_address - last IP address
29     @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 client_index - opaque cookie to identify the sender
42     @param context - sender context, to match reply w/ request
43     @param retval - return code
44 */
45 define snat_add_address_range_reply {
46   u32 context;
47   i32 retval;
48 };
49
50 /** \brief Dump S-NAT addresses
51     @param client_index - opaque cookie to identify the sender
52     @param context - sender context, to match reply w/ request
53 */
54 define snat_address_dump {
55   u32 client_index;
56   u32 context;
57 };
58
59 /** \brief S-NAT address details response
60     @param context - sender context, to match reply w/ request
61     @param is_ip4 - 1 if address type is IPv4
62     @param ip_address - IP address
63 */
64 define snat_address_details {
65   u32 context;
66   u8 is_ip4;
67   u8 ip_address[16];
68 };
69
70 /** \brief Enable/disable S-NAT feature on the interface
71     @param client_index - opaque cookie to identify the sender
72     @param context - sender context, to match reply w/ request
73     @param is_add - 1 if add, 0 if delete
74     @param is_inside - 1 if inside, 0 if outside
75     @param sw_if_index - software index of the interface
76 */
77 define snat_interface_add_del_feature {
78   u32 client_index;
79   u32 context;
80   u8 is_add;
81   u8 is_inside;
82   u32 sw_if_index;
83 };
84
85 /** \brief Enable/disable S-NAT feature on the interface reply
86     @param client_index - opaque cookie to identify the sender
87     @param context - sender context, to match reply w/ request
88     @param retval - return code
89 */
90 define snat_interface_add_del_feature_reply {
91   u32 context;
92   i32 retval;
93 };
94
95 /** \brief Dump interfaces with S-NAT feature
96     @param client_index - opaque cookie to identify the sender
97     @param context - sender context, to match reply w/ request
98 */
99 define snat_interface_dump {
100   u32 client_index;
101   u32 context;
102 };
103
104 /** \brief S-NAT interface details response
105     @param context - sender context, to match reply w/ request
106     @param is_inside - 1 if inside, 0 if outside
107     @param sw_if_index - software index of the interface
108 */
109 define snat_interface_details {
110   u32 context;
111   u8 is_inside;
112   u32 sw_if_index;
113 };
114
115 /** \brief Add/delete S-NAT static mapping
116     @param client_index - opaque cookie to identify the sender
117     @param context - sender context, to match reply w/ request
118     @param is_add - 1 if add, 0 if delete
119     @param is_ip4 - 1 if address type is IPv4
120     @param addr_only - 1 if address only mapping
121     @param local_ip_address - local IP address
122     @param external_ip_address - external IP address
123     @param local_port - local port number
124     @param external_port - external port number
125     @param vfr_id - VRF ID
126 */
127 define snat_add_static_mapping {
128   u32 client_index;
129   u32 context;
130   u8 is_add;
131   u8 is_ip4;
132   u8 addr_only;
133   u8 local_ip_address[16];
134   u8 external_ip_address[16];
135   u16 local_port;
136   u16 external_port;
137   u32 vrf_id;
138 };
139
140 /** \brief Add/delete S-NAT static mapping reply
141     @param client_index - opaque cookie to identify the sender
142     @param context - sender context, to match reply w/ request
143     @param retval - return code
144 */
145 define snat_add_static_mapping_reply {
146   u32 context;
147   i32 retval;
148 };
149
150 /** \brief Dump S-NAT static mappings
151     @param client_index - opaque cookie to identify the sender
152     @param context - sender context, to match reply w/ request
153 */
154 define snat_static_mapping_dump {
155   u32 client_index;
156   u32 context;
157 };
158
159 /** \brief S-NAT static mapping details response
160     @param context - sender context, to match reply w/ request
161     @param is_ip4 - 1 if address type is IPv4
162     @param addr_only - 1 if address only mapping
163     @param local_ip_address - local IP address
164     @param external_ip_address - external IP address
165     @param local_port - local port number
166     @param external_port - external port number
167     @param vfr_id - VRF ID
168 */
169 define snat_static_mapping_details {
170   u32 context;
171   u8 is_ip4;
172   u8 addr_only;
173   u8 local_ip_address[16];
174   u8 external_ip_address[16];
175   u16 local_port;
176   u16 external_port;
177   u32 vrf_id;
178 };
179
180 /** \brief Control ping from client to api server request
181     @param client_index - opaque cookie to identify the sender
182     @param context - sender context, to match reply w/ request
183 */
184 define snat_control_ping
185 {
186   u32 client_index;
187   u32 context;
188 };
189
190 /** \brief Control ping from the client to the server response
191     @param client_index - opaque cookie to identify the sender
192     @param context - sender context, to match reply w/ request
193     @param retval - return code for the request
194     @param vpe_pid - the pid of the vpe, returned by the server
195 */
196 define snat_control_ping_reply
197 {
198   u32 context;
199   i32 retval;
200   u32 client_index;
201   u32 vpe_pid;
202 };
203
204 /** \brief Show S-NAT plugin startup config
205     @param client_index - opaque cookie to identify the sender
206     @param context - sender context, to match reply w/ request
207 */
208 define snat_show_config
209 {
210   u32 client_index;
211   u32 context;
212 };
213
214 /** \brief Show S-NAT plugin startup config reply
215     @param context - sender context, to match reply w/ request
216     @param retval - return code for the request
217     @param static_mapping_only - if 1 dynamic translations disabled
218     @param static_mapping_connection_tracking - if 1 create session data
219     @param translation_buckets - number of translation hash buckets
220     @param translation_memory_size - translation hash memory size
221     @param user_buckets - number of user hash buckets
222     @param user_memory_size - user hash memory size
223     @param max_translations_per_user - maximum number of translations per user
224     @param outside_vrf_id - outside VRF id
225     @param inside_vrf_id - default inside VRF id
226 */
227 define snat_show_config_reply
228 {
229   u32 context;
230   i32 retval;
231   u8 static_mapping_only;
232   u8 static_mapping_connection_tracking;
233   u32 translation_buckets;
234   u32 translation_memory_size;
235   u32 user_buckets;
236   u32 user_memory_size;
237   u32 max_translations_per_user;
238   u32 outside_vrf_id;
239   u32 inside_vrf_id;
240 };
241
242 /** \brief Set S-NAT workers
243     @param client_index - opaque cookie to identify the sender
244     @param context - sender context, to match reply w/ request
245     @param worker_mask - S-NAT workers mask
246 */
247 define snat_set_workers {
248   u32 client_index;
249   u32 context;
250   u64 worker_mask;
251 };
252
253 /** \brief Set S-NAT workers reply
254     @param client_index - opaque cookie to identify the sender
255     @param context - sender context, to match reply w/ request
256     @param retval - return code
257 */
258 define snat_set_workers_reply {
259   u32 context;
260   i32 retval;
261 };
262
263 /** \brief Dump S-NAT workers
264     @param client_index - opaque cookie to identify the sender
265     @param context - sender context, to match reply w/ request
266 */
267 define snat_worker_dump {
268   u32 client_index;
269   u32 context;
270 };
271
272 /** \brief S-NAT workers details response
273     @param context - sender context, to match reply w/ request
274     @param worker_index - worker index
275     @param lcore_id - lcore ID
276     @param name - worker name
277 */
278 define snat_worker_details {
279   u32 context;
280   u32 worker_index;
281   u32 lcore_id;
282   u8 name[64];
283 };