Reorganize source tree to use single autotools instance
[vpp.git] / src / vnet / ipsec / ipsec.api
1 /*
2  * Copyright (c) 2015-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 /** \brief IPsec: Add/delete Security Policy Database
17     @param client_index - opaque cookie to identify the sender
18     @param context - sender context, to match reply w/ request
19     @param is_add - add SPD if non-zero, else delete
20     @param spd_id - SPD instance id (control plane allocated)
21 */
22
23 define ipsec_spd_add_del
24 {
25   u32 client_index;
26   u32 context;
27   u8 is_add;
28   u32 spd_id;
29 };
30
31 /** \brief Reply for IPsec: Add/delete Security Policy Database entry
32     @param context - returned sender context, to match reply w/ request
33     @param retval - return code
34 */
35
36 define ipsec_spd_add_del_reply
37 {
38   u32 context;
39   i32 retval;
40 };
41
42 /** \brief IPsec: Add/delete SPD from interface
43
44     @param client_index - opaque cookie to identify the sender
45     @param context - sender context, to match reply w/ request
46     @param is_add - add security mode if non-zero, else delete
47     @param sw_if_index - index of the interface
48     @param spd_id - SPD instance id to use for lookups
49 */
50
51
52 define ipsec_interface_add_del_spd
53 {
54   u32 client_index;
55   u32 context;
56
57   u8 is_add;
58   u32 sw_if_index;
59   u32 spd_id;
60 };
61
62 /** \brief Reply for IPsec: Add/delete SPD from interface
63     @param context - returned sender context, to match reply w/ request
64     @param retval - return code
65 */
66
67 define ipsec_interface_add_del_spd_reply
68 {
69   u32 context;
70   i32 retval;
71 };
72
73 /** \brief IPsec: Add/delete Security Policy Database entry
74
75     See RFC 4301, 4.4.1.1 on how to match packet to selectors
76
77     @param client_index - opaque cookie to identify the sender
78     @param context - sender context, to match reply w/ request
79     @param is_add - add SPD if non-zero, else delete
80     @param spd_id - SPD instance id (control plane allocated)
81     @param priority - priority of SPD entry (non-unique value).  Used to order SPD matching - higher priorities match before lower
82     @param is_outbound - entry applies to outbound traffic if non-zero, otherwise applies to inbound traffic
83     @param is_ipv6 - remote/local address are IPv6 if non-zero, else IPv4
84     @param remote_address_start - start of remote address range to match
85     @param remote_address_stop - end of remote address range to match
86     @param local_address_start - start of local address range to match
87     @param local_address_stop - end of local address range to match
88     @param protocol - protocol type to match [0 means any]
89     @param remote_port_start - start of remote port range to match ...
90     @param remote_port_stop - end of remote port range to match [0 to 65535 means ANY, 65535 to 0 means OPAQUE]
91     @param local_port_start - start of local port range to match ...
92     @param local_port_stop - end of remote port range to match [0 to 65535 means ANY, 65535 to 0 means OPAQUE]
93     @param policy - 0 = bypass (no IPsec processing), 1 = discard (discard packet with ICMP processing), 2 = resolve (send request to control plane for SA resolving, and discard without ICMP processing), 3 = protect (apply IPsec policy using following parameters)
94     @param sa_id - SAD instance id (control plane allocated)
95
96 */
97
98 define ipsec_spd_add_del_entry
99 {
100   u32 client_index;
101   u32 context;
102   u8 is_add;
103
104   u32 spd_id;
105   i32 priority;
106   u8 is_outbound;
107
108   // Selector
109   u8 is_ipv6;
110   u8 is_ip_any;
111   u8 remote_address_start[16];
112   u8 remote_address_stop[16];
113   u8 local_address_start[16];
114   u8 local_address_stop[16];
115
116   u8 protocol;
117
118   u16 remote_port_start;
119   u16 remote_port_stop;
120   u16 local_port_start;
121   u16 local_port_stop;
122
123   // Policy
124   u8 policy;
125   u32 sa_id;
126 };
127
128 /** \brief Reply for IPsec: Add/delete Security Policy Database entry
129     @param context - returned sender context, to match reply w/ request
130     @param retval - return code
131 */
132
133 define ipsec_spd_add_del_entry_reply
134 {
135   u32 context;
136   i32 retval;
137 };
138
139 /** \brief IPsec: Add/delete Security Association Database entry
140     @param client_index - opaque cookie to identify the sender
141     @param context - sender context, to match reply w/ request
142     @param is_add - add SAD entry if non-zero, else delete
143
144     @param sad_id - sad id
145
146     @param spi - security parameter index
147
148     @param protocol - 0 = AH, 1 = ESP
149
150     @param crypto_algorithm - 0 = Null, 1 = AES-CBC-128, 2 = AES-CBC-192, 3 = AES-CBC-256, 4 = 3DES-CBC
151     @param crypto_key_length - length of crypto_key in bytes
152     @param crypto_key - crypto keying material
153
154     @param integrity_algorithm - 0 = None, 1 = MD5-96, 2 = SHA1-96, 3 = SHA-256, 4 = SHA-384, 5=SHA-512
155     @param integrity_key_length - length of integrity_key in bytes
156     @param integrity_key - integrity keying material
157
158     @param use_extended_sequence_number - use ESN when non-zero
159
160     @param is_tunnel - IPsec tunnel mode if non-zero, else transport mode
161     @param is_tunnel_ipv6 - IPsec tunnel mode is IPv6 if non-zero, else IPv4 tunnel only valid if is_tunnel is non-zero
162     @param tunnel_src_address - IPsec tunnel source address IPv6 if is_tunnel_ipv6 is non-zero, else IPv4. Only valid if is_tunnel is non-zero
163     @param tunnel_dst_address - IPsec tunnel destination address IPv6 if is_tunnel_ipv6 is non-zero, else IPv4. Only valid if is_tunnel is non-zero
164
165     To be added:
166      Anti-replay
167      IPsec tunnel address copy mode (to support GDOI)
168  */
169
170 define ipsec_sad_add_del_entry
171 {
172   u32 client_index;
173   u32 context;
174   u8 is_add;
175
176   u32 sad_id;
177
178   u32 spi;
179
180   u8 protocol;
181
182   u8 crypto_algorithm;
183   u8 crypto_key_length;
184   u8 crypto_key[128];
185
186   u8 integrity_algorithm;
187   u8 integrity_key_length;
188   u8 integrity_key[128];
189
190   u8 use_extended_sequence_number;
191
192   u8 is_tunnel;
193   u8 is_tunnel_ipv6;
194   u8 tunnel_src_address[16];
195   u8 tunnel_dst_address[16];
196 };
197
198 /** \brief Reply for IPsec: Add/delete Security Association Database entry
199     @param context - returned sender context, to match reply w/ request
200     @param retval - return code
201 */
202
203 define ipsec_sad_add_del_entry_reply
204 {
205   u32 context;
206   i32 retval;
207 };
208
209 /** \brief IPsec: Update Security Association keys
210     @param client_index - opaque cookie to identify the sender
211     @param context - sender context, to match reply w/ request
212
213     @param sa_id - sa id
214
215     @param crypto_key_length - length of crypto_key in bytes
216     @param crypto_key - crypto keying material
217
218     @param integrity_key_length - length of integrity_key in bytes
219     @param integrity_key - integrity keying material
220 */
221
222 define ipsec_sa_set_key
223 {
224   u32 client_index;
225   u32 context;
226
227   u32 sa_id;
228
229   u8 crypto_key_length;
230   u8 crypto_key[128];
231
232   u8 integrity_key_length;
233   u8 integrity_key[128];
234 };
235
236 /** \brief Reply for IPsec: Update Security Association keys
237     @param context - returned sender context, to match reply w/ request
238     @param retval - return code
239 */
240
241 define ipsec_sa_set_key_reply
242 {
243   u32 context;
244   i32 retval;
245 };
246
247 /** \brief IKEv2: Add/delete profile
248     @param client_index - opaque cookie to identify the sender
249     @param context - sender context, to match reply w/ request
250
251     @param name - IKEv2 profile name
252     @param is_add - Add IKEv2 profile if non-zero, else delete
253 */
254 define ikev2_profile_add_del
255 {
256   u32 client_index;
257   u32 context;
258
259   u8 name[64];
260   u8 is_add;
261 };
262
263 /** \brief Reply for IKEv2: Add/delete profile
264     @param context - returned sender context, to match reply w/ request
265     @param retval - return code
266 */
267 define ikev2_profile_add_del_reply
268 {
269   u32 context;
270   i32 retval;
271 };
272
273 /** \brief IKEv2: Set IKEv2 profile authentication method
274     @param client_index - opaque cookie to identify the sender
275     @param context - sender context, to match reply w/ request
276
277     @param name - IKEv2 profile name
278     @param auth_method - IKEv2 authentication method (shared-key-mic/rsa-sig)
279     @param is_hex - Authentication data in hex format if non-zero, else string
280     @param data_len - Authentication data length
281     @param data - Authentication data (for rsa-sig cert file path)
282 */
283 define ikev2_profile_set_auth
284 {
285   u32 client_index;
286   u32 context;
287
288   u8 name[64];
289   u8 auth_method;
290   u8 is_hex;
291   u32 data_len;
292   u8 data[0];
293 };
294
295 /** \brief Reply for IKEv2: Set IKEv2 profile authentication method
296     @param context - returned sender context, to match reply w/ request
297     @param retval - return code
298 */
299 define ikev2_profile_set_auth_reply
300 {
301   u32 context;
302   i32 retval;
303 };
304
305 /** \brief IKEv2: Set IKEv2 profile local/remote identification
306     @param client_index - opaque cookie to identify the sender
307     @param context - sender context, to match reply w/ request
308
309     @param name - IKEv2 profile name
310     @param is_local - Identification is local if non-zero, else remote
311     @param id_type - Identification type
312     @param data_len - Identification data length
313     @param data - Identification data
314 */
315 define ikev2_profile_set_id
316 {
317   u32 client_index;
318   u32 context;
319
320   u8 name[64];
321   u8 is_local;
322   u8 id_type;
323   u32 data_len;
324   u8 data[0];
325 };
326
327 /** \brief Reply for IKEv2:
328     @param context - returned sender context, to match reply w/ request
329     @param retval - return code
330 */
331 define ikev2_profile_set_id_reply
332 {
333   u32 context;
334   i32 retval;
335 };
336
337 /** \brief IKEv2: Set IKEv2 profile traffic selector parameters
338     @param client_index - opaque cookie to identify the sender
339     @param context - sender context, to match reply w/ request
340
341     @param name - IKEv2 profile name
342     @param is_local - Traffic selector is local if non-zero, else remote
343     @param proto - Traffic selector IP protocol (if zero not relevant)
344     @param start_port - The smallest port number allowed by traffic selector
345     @param end_port - The largest port number allowed by traffic selector
346     @param start_addr - The smallest address included in traffic selector
347     @param end_addr - The largest address included in traffic selector
348 */
349 define ikev2_profile_set_ts
350 {
351   u32 client_index;
352   u32 context;
353
354   u8 name[64];
355   u8 is_local;
356   u8 proto;
357   u16 start_port;
358   u16 end_port;
359   u32 start_addr;
360   u32 end_addr;
361 };
362
363 /** \brief Reply for IKEv2: Set IKEv2 profile traffic selector parameters
364     @param context - returned sender context, to match reply w/ request
365     @param retval - return code
366 */
367 define ikev2_profile_set_ts_reply
368 {
369   u32 context;
370   i32 retval;
371 };
372
373 /** \brief IKEv2: Set IKEv2 local RSA private key
374     @param client_index - opaque cookie to identify the sender
375     @param context - sender context, to match reply w/ request
376
377     @param key_file - Key file absolute path
378 */
379 define ikev2_set_local_key
380 {
381   u32 client_index;
382   u32 context;
383
384   u8 key_file[256];
385 };
386
387 /** \brief Reply for IKEv2: Set IKEv2 local key
388     @param context - returned sender context, to match reply w/ request
389     @param retval - return code
390 */
391 define ikev2_set_local_key_reply
392 {
393   u32 context;
394   i32 retval;
395 };
396
397 /** \brief Dump ipsec policy database data
398     @param client_index - opaque cookie to identify the sender
399     @param context - sender context, to match reply w/ request
400     @param spd_id - SPD instance id
401     @param sa_id - SA id, optional, set to ~0 to see all policies in SPD
402 */
403 define ipsec_spd_dump {
404     u32 client_index;
405     u32 context;
406     u32 spd_id;
407     u32 sa_id;
408 };
409
410 /** \brief IPsec policy database response
411     @param context - sender context which was passed in the request
412     @param spd_id - SPD instance id
413     @param priority - numeric value to control policy evaluation order
414     @param is_outbound - [1|0] to indicate if direction is [out|in]bound
415     @param is_ipv6 - [1|0] to indicate if address family is ipv[6|4]
416     @param local_start_addr - first address in local traffic selector range
417     @param local_stop_addr - last address in local traffic selector range
418     @param local_start_port - first port in local traffic selector range
419     @param local_stop_port - last port in local traffic selector range
420     @param remote_start_addr - first address in remote traffic selector range
421     @param remote_stop_addr - last address in remote traffic selector range
422     @param remote_start_port - first port in remote traffic selector range
423     @param remote_stop_port - last port in remote traffic selector range
424     @param protocol - traffic selector protocol
425     @param policy - policy action
426     @param sa_id - SA id
427     @param bytes - byte count of packets matching this policy
428     @param packets - count of packets matching this policy
429 */
430
431 define ipsec_spd_details {
432     u32 context;
433     u32 spd_id;
434     i32 priority;
435     u8 is_outbound;
436     u8 is_ipv6;
437     u8 local_start_addr[16];
438     u8 local_stop_addr[16];
439     u16 local_start_port;
440     u16 local_stop_port;
441     u8 remote_start_addr[16];
442     u8 remote_stop_addr[16];
443     u16 remote_start_port;
444     u16 remote_stop_port;
445     u8 protocol;
446     u8 policy;
447     u32 sa_id;
448     u64 bytes;
449     u64 packets;
450 };
451
452 /*
453  * Local Variables:
454  * eval: (c-set-style "gnu")
455  * End:
456  */
457