VPPAPIGEN: vppapigen replacement in Python PLY.
[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 option version = "1.0.0";
17
18 /** \brief IPsec: Add/delete Security Policy Database
19     @param client_index - opaque cookie to identify the sender
20     @param context - sender context, to match reply w/ request
21     @param is_add - add SPD if non-zero, else delete
22     @param spd_id - SPD instance id (control plane allocated)
23 */
24
25 autoreply define ipsec_spd_add_del
26 {
27   u32 client_index;
28   u32 context;
29   u8 is_add;
30   u32 spd_id;
31 };
32
33 /** \brief IPsec: Add/delete SPD from interface
34
35     @param client_index - opaque cookie to identify the sender
36     @param context - sender context, to match reply w/ request
37     @param is_add - add security mode if non-zero, else delete
38     @param sw_if_index - index of the interface
39     @param spd_id - SPD instance id to use for lookups
40 */
41
42
43 autoreply define ipsec_interface_add_del_spd
44 {
45   u32 client_index;
46   u32 context;
47
48   u8 is_add;
49   u32 sw_if_index;
50   u32 spd_id;
51 };
52
53 /** \brief IPsec: Add/delete Security Policy Database entry
54
55     See RFC 4301, 4.4.1.1 on how to match packet to selectors
56
57     @param client_index - opaque cookie to identify the sender
58     @param context - sender context, to match reply w/ request
59     @param is_add - add SPD if non-zero, else delete
60     @param spd_id - SPD instance id (control plane allocated)
61     @param priority - priority of SPD entry (non-unique value).  Used to order SPD matching - higher priorities match before lower
62     @param is_outbound - entry applies to outbound traffic if non-zero, otherwise applies to inbound traffic
63     @param is_ipv6 - remote/local address are IPv6 if non-zero, else IPv4
64     @param remote_address_start - start of remote address range to match
65     @param remote_address_stop - end of remote address range to match
66     @param local_address_start - start of local address range to match
67     @param local_address_stop - end of local address range to match
68     @param protocol - protocol type to match [0 means any]
69     @param remote_port_start - start of remote port range to match ...
70     @param remote_port_stop - end of remote port range to match [0 to 65535 means ANY, 65535 to 0 means OPAQUE]
71     @param local_port_start - start of local port range to match ...
72     @param local_port_stop - end of remote port range to match [0 to 65535 means ANY, 65535 to 0 means OPAQUE]
73     @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)
74     @param sa_id - SAD instance id (control plane allocated)
75
76 */
77
78 autoreply define ipsec_spd_add_del_entry
79 {
80   u32 client_index;
81   u32 context;
82   u8 is_add;
83
84   u32 spd_id;
85   i32 priority;
86   u8 is_outbound;
87
88   // Selector
89   u8 is_ipv6;
90   u8 is_ip_any;
91   u8 remote_address_start[16];
92   u8 remote_address_stop[16];
93   u8 local_address_start[16];
94   u8 local_address_stop[16];
95
96   u8 protocol;
97
98   u16 remote_port_start;
99   u16 remote_port_stop;
100   u16 local_port_start;
101   u16 local_port_stop;
102
103   // Policy
104   u8 policy;
105   u32 sa_id;
106 };
107
108 /** \brief IPsec: Add/delete Security Association Database entry
109     @param client_index - opaque cookie to identify the sender
110     @param context - sender context, to match reply w/ request
111     @param is_add - add SAD entry if non-zero, else delete
112
113     @param sad_id - sad id
114
115     @param spi - security parameter index
116
117     @param protocol - 0 = AH, 1 = ESP
118
119     @param crypto_algorithm - 0 = Null, 1 = AES-CBC-128, 2 = AES-CBC-192, 3 = AES-CBC-256, 4 = 3DES-CBC
120     @param crypto_key_length - length of crypto_key in bytes
121     @param crypto_key - crypto keying material
122
123     @param integrity_algorithm - 0 = None, 1 = MD5-96, 2 = SHA1-96, 3 = SHA-256, 4 = SHA-384, 5=SHA-512
124     @param integrity_key_length - length of integrity_key in bytes
125     @param integrity_key - integrity keying material
126
127     @param use_extended_sequence_number - use ESN when non-zero
128
129     @param is_tunnel - IPsec tunnel mode if non-zero, else transport mode
130     @param is_tunnel_ipv6 - IPsec tunnel mode is IPv6 if non-zero, else IPv4 tunnel only valid if is_tunnel is non-zero
131     @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
132     @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
133
134     To be added:
135      Anti-replay
136      IPsec tunnel address copy mode (to support GDOI)
137  */
138
139 autoreply define ipsec_sad_add_del_entry
140 {
141   u32 client_index;
142   u32 context;
143   u8 is_add;
144
145   u32 sad_id;
146
147   u32 spi;
148
149   u8 protocol;
150
151   u8 crypto_algorithm;
152   u8 crypto_key_length;
153   u8 crypto_key[128];
154
155   u8 integrity_algorithm;
156   u8 integrity_key_length;
157   u8 integrity_key[128];
158
159   u8 use_extended_sequence_number;
160   u8 use_anti_replay;
161
162   u8 is_tunnel;
163   u8 is_tunnel_ipv6;
164   u8 tunnel_src_address[16];
165   u8 tunnel_dst_address[16];
166 };
167
168 /** \brief IPsec: Update Security Association keys
169     @param client_index - opaque cookie to identify the sender
170     @param context - sender context, to match reply w/ request
171
172     @param sa_id - sa id
173
174     @param crypto_key_length - length of crypto_key in bytes
175     @param crypto_key - crypto keying material
176
177     @param integrity_key_length - length of integrity_key in bytes
178     @param integrity_key - integrity keying material
179 */
180
181 autoreply define ipsec_sa_set_key
182 {
183   u32 client_index;
184   u32 context;
185
186   u32 sa_id;
187
188   u8 crypto_key_length;
189   u8 crypto_key[128];
190
191   u8 integrity_key_length;
192   u8 integrity_key[128];
193 };
194
195 /** \brief IKEv2: Add/delete profile
196     @param client_index - opaque cookie to identify the sender
197     @param context - sender context, to match reply w/ request
198
199     @param name - IKEv2 profile name
200     @param is_add - Add IKEv2 profile if non-zero, else delete
201 */
202 autoreply define ikev2_profile_add_del
203 {
204   u32 client_index;
205   u32 context;
206
207   u8 name[64];
208   u8 is_add;
209 };
210
211 /** \brief IKEv2: Set IKEv2 profile authentication method
212     @param client_index - opaque cookie to identify the sender
213     @param context - sender context, to match reply w/ request
214
215     @param name - IKEv2 profile name
216     @param auth_method - IKEv2 authentication method (shared-key-mic/rsa-sig)
217     @param is_hex - Authentication data in hex format if non-zero, else string
218     @param data_len - Authentication data length
219     @param data - Authentication data (for rsa-sig cert file path)
220 */
221 autoreply define ikev2_profile_set_auth
222 {
223   u32 client_index;
224   u32 context;
225
226   u8 name[64];
227   u8 auth_method;
228   u8 is_hex;
229   u32 data_len;
230   u8 data[0];
231 };
232
233 /** \brief IKEv2: Set IKEv2 profile local/remote identification
234     @param client_index - opaque cookie to identify the sender
235     @param context - sender context, to match reply w/ request
236
237     @param name - IKEv2 profile name
238     @param is_local - Identification is local if non-zero, else remote
239     @param id_type - Identification type
240     @param data_len - Identification data length
241     @param data - Identification data
242 */
243 autoreply define ikev2_profile_set_id
244 {
245   u32 client_index;
246   u32 context;
247
248   u8 name[64];
249   u8 is_local;
250   u8 id_type;
251   u32 data_len;
252   u8 data[0];
253 };
254
255 /** \brief IKEv2: Set IKEv2 profile traffic selector parameters
256     @param client_index - opaque cookie to identify the sender
257     @param context - sender context, to match reply w/ request
258
259     @param name - IKEv2 profile name
260     @param is_local - Traffic selector is local if non-zero, else remote
261     @param proto - Traffic selector IP protocol (if zero not relevant)
262     @param start_port - The smallest port number allowed by traffic selector
263     @param end_port - The largest port number allowed by traffic selector
264     @param start_addr - The smallest address included in traffic selector
265     @param end_addr - The largest address included in traffic selector
266 */
267 autoreply define ikev2_profile_set_ts
268 {
269   u32 client_index;
270   u32 context;
271
272   u8 name[64];
273   u8 is_local;
274   u8 proto;
275   u16 start_port;
276   u16 end_port;
277   u32 start_addr;
278   u32 end_addr;
279 };
280
281 /** \brief IKEv2: Set IKEv2 local RSA private key
282     @param client_index - opaque cookie to identify the sender
283     @param context - sender context, to match reply w/ request
284
285     @param key_file - Key file absolute path
286 */
287 autoreply define ikev2_set_local_key
288 {
289   u32 client_index;
290   u32 context;
291
292   u8 key_file[256];
293 };
294
295 /** \brief IKEv2: Set IKEv2 responder interface and IP address
296     @param client_index - opaque cookie to identify the sender
297     @param context - sender context, to match reply w/ request
298
299     @param name - IKEv2 profile name
300     @param sw_if_index - interface index
301     @param address - interface address
302 */
303 autoreply define ikev2_set_responder
304 {
305   u32 client_index;
306   u32 context;
307
308   u8 name[64];
309   u32 sw_if_index;
310   u8 address[4];
311 };
312
313 /** \brief IKEv2: Set IKEv2 IKE transforms in SA_INIT proposal (RFC 7296)
314     @param client_index - opaque cookie to identify the sender
315     @param context - sender context, to match reply w/ request
316
317     @param name - IKEv2 profile name
318     @param crypto_alg - encryption algorithm
319     @param crypto_key_size - encryption key size
320     @param integ_alg - integrity algorithm
321     @param dh_group - Diffie-Hellman group
322     
323 */
324 autoreply define ikev2_set_ike_transforms
325 {
326   u32 client_index;
327   u32 context;
328
329   u8 name[64];
330   u32 crypto_alg;
331   u32 crypto_key_size;
332   u32 integ_alg;
333   u32 dh_group;
334 };
335
336 /** \brief IKEv2: Set IKEv2 ESP transforms in SA_INIT proposal (RFC 7296)
337     @param client_index - opaque cookie to identify the sender
338     @param context - sender context, to match reply w/ request
339
340     @param name - IKEv2 profile name
341     @param crypto_alg - encryption algorithm
342     @param crypto_key_size - encryption key size
343     @param integ_alg - integrity algorithm
344     @param dh_group - Diffie-Hellman group
345     
346 */
347 autoreply define ikev2_set_esp_transforms
348 {
349   u32 client_index;
350   u32 context;
351
352   u8 name[64];
353   u32 crypto_alg;
354   u32 crypto_key_size;
355   u32 integ_alg;
356   u32 dh_group;
357 };
358
359 /** \brief IKEv2: Set Child SA lifetime, limited by time and/or data
360     @param client_index - opaque cookie to identify the sender
361     @param context - sender context, to match reply w/ request
362
363     @param name - IKEv2 profile name
364     @param lifetime - SA maximum life time in seconds (0 to disable)
365     @param lifetime_jitter - Jitter added to prevent simultaneounus rekeying
366     @param handover - Hand over time
367     @param lifetime_maxdata - SA maximum life time in bytes (0 to disable)
368     
369 */
370 autoreply define ikev2_set_sa_lifetime
371 {
372   u32 client_index;
373   u32 context;
374
375   u8 name[64];
376   u64 lifetime;
377   u32 lifetime_jitter;
378   u32 handover;
379   u64 lifetime_maxdata;
380 };
381
382 /** \brief IKEv2: Initiate the SA_INIT exchange
383     @param client_index - opaque cookie to identify the sender
384     @param context - sender context, to match reply w/ request
385
386     @param name - IKEv2 profile name
387     
388 */
389 autoreply define ikev2_initiate_sa_init
390 {
391   u32 client_index;
392   u32 context;
393
394   u8 name[64];
395 };
396
397 /** \brief IKEv2: Initiate the delete IKE SA exchange
398     @param client_index - opaque cookie to identify the sender
399     @param context - sender context, to match reply w/ request
400
401     @param ispi - IKE SA initiator SPI
402     
403 */
404 autoreply define ikev2_initiate_del_ike_sa
405 {
406   u32 client_index;
407   u32 context;
408
409   u64 ispi;
410 };
411
412 /** \brief IKEv2: Initiate the delete Child SA exchange
413     @param client_index - opaque cookie to identify the sender
414     @param context - sender context, to match reply w/ request
415
416     @param ispi - Child SA initiator SPI
417     
418 */
419 autoreply define ikev2_initiate_del_child_sa
420 {
421   u32 client_index;
422   u32 context;
423
424   u32 ispi;
425 };
426
427 /** \brief IKEv2: Initiate the rekey Child SA exchange
428     @param client_index - opaque cookie to identify the sender
429     @param context - sender context, to match reply w/ request
430
431     @param ispi - Child SA initiator SPI
432     
433 */
434 autoreply define ikev2_initiate_rekey_child_sa
435 {
436   u32 client_index;
437   u32 context;
438
439   u32 ispi;
440 };
441
442 /** \brief Dump ipsec policy database data
443     @param client_index - opaque cookie to identify the sender
444     @param context - sender context, to match reply w/ request
445     @param spd_id - SPD instance id
446     @param sa_id - SA id, optional, set to ~0 to see all policies in SPD
447 */
448 define ipsec_spd_dump {
449     u32 client_index;
450     u32 context;
451     u32 spd_id;
452     u32 sa_id;
453 };
454
455 /** \brief IPsec policy database response
456     @param context - sender context which was passed in the request
457     @param spd_id - SPD instance id
458     @param priority - numeric value to control policy evaluation order
459     @param is_outbound - [1|0] to indicate if direction is [out|in]bound
460     @param is_ipv6 - [1|0] to indicate if address family is ipv[6|4]
461     @param local_start_addr - first address in local traffic selector range
462     @param local_stop_addr - last address in local traffic selector range
463     @param local_start_port - first port in local traffic selector range
464     @param local_stop_port - last port in local traffic selector range
465     @param remote_start_addr - first address in remote traffic selector range
466     @param remote_stop_addr - last address in remote traffic selector range
467     @param remote_start_port - first port in remote traffic selector range
468     @param remote_stop_port - last port in remote traffic selector range
469     @param protocol - traffic selector protocol
470     @param policy - policy action
471     @param sa_id - SA id
472     @param bytes - byte count of packets matching this policy
473     @param packets - count of packets matching this policy
474 */
475 define ipsec_spd_details {
476     u32 context;
477     u32 spd_id;
478     i32 priority;
479     u8 is_outbound;
480     u8 is_ipv6;
481     u8 local_start_addr[16];
482     u8 local_stop_addr[16];
483     u16 local_start_port;
484     u16 local_stop_port;
485     u8 remote_start_addr[16];
486     u8 remote_stop_addr[16];
487     u16 remote_start_port;
488     u16 remote_stop_port;
489     u8 protocol;
490     u8 policy;
491     u32 sa_id;
492     u64 bytes;
493     u64 packets;
494 };
495
496 /** \brief Add or delete IPsec tunnel interface
497     @param client_index - opaque cookie to identify the sender
498     @param context - sender context, to match reply w/ request
499     @param is_add - add IPsec tunnel interface if nonzero, else delete
500     @param esn - enable extended sequence numbers if nonzero, else disable
501     @param anti_replay - enable anti replay check if nonzero, else disable
502     @param local_ip - local IP address
503     @param remote_ip - IP address of remote IPsec peer
504     @param local_spi - SPI of outbound IPsec SA
505     @param remote_spi - SPI of inbound IPsec SA
506     @param crypto_alg - encryption algorithm ID
507     @param local_crypto_key_len - length of local crypto key in bytes
508     @param local_crypto_key - crypto key for outbound IPsec SA
509     @param remote_crypto_key_len - length of remote crypto key in bytes
510     @param remote_crypto_key - crypto key for inbound IPsec SA
511     @param integ_alg - integrity algorithm ID
512     @param local_integ_key_len - length of local integrity key in bytes
513     @param local_integ_key - integrity key for outbound IPsec SA
514     @param remote_integ_key_len - length of remote integrity key in bytes
515     @param remote_integ_key - integrity key for inbound IPsec SA
516 */
517 define ipsec_tunnel_if_add_del {
518   u32 client_index;
519   u32 context;
520   u8 is_add;
521   u8 esn;
522   u8 anti_replay;
523   u8 local_ip[4];
524   u8 remote_ip[4];
525   u32 local_spi;
526   u32 remote_spi;
527   u8 crypto_alg;
528   u8 local_crypto_key_len;
529   u8 local_crypto_key[128];
530   u8 remote_crypto_key_len;
531   u8 remote_crypto_key[128];
532   u8 integ_alg;
533   u8 local_integ_key_len;
534   u8 local_integ_key[128];
535   u8 remote_integ_key_len;
536   u8 remote_integ_key[128];
537 };
538
539 /** \brief Add/delete IPsec tunnel interface response
540     @param context - sender context, to match reply w/ request
541     @param retval - return status
542     @param sw_if_index - sw_if_index of new interface (for successful add)
543 */
544 define ipsec_tunnel_if_add_del_reply {
545   u32 context;
546   i32 retval;
547   u32 sw_if_index;
548 };
549
550 /** \brief Dump IPsec security association
551     @param client_index - opaque cookie to identify the sender
552     @param context - sender context, to match reply w/ request
553     @param sa_id - optional ID of an SA to dump, if ~0 dump all SAs in SAD
554 */
555 define ipsec_sa_dump {
556   u32 client_index;
557   u32 context;
558   u32 sa_id;
559 };
560
561 /** \brief IPsec security association database response
562     @param context - sender context which was passed in the request
563     @param sa_id - SA ID, policy-based SAs >=0, tunnel interface SAs = 0 
564     @param sw_if_index - sw_if_index of tunnel interface, policy-based SAs = ~0
565     @param spi - security parameter index
566     @param protocol - IPsec protocol (value from ipsec_protocol_t)
567     @param crypto_alg - crypto algorithm (value from ipsec_crypto_alg_t)
568     @param crypto_key_len - length of crypto_key in bytes
569     @param crypto_key - crypto keying material
570     @param integ_alg - integrity algorithm (value from ipsec_integ_alg_t)
571     @param integ_key_len - length of integ_key in bytes
572     @param integ_key - integrity keying material
573     @param use_esn - using extended sequence numbers when non-zero
574     @param use_anti_replay - using anti-replay window when non-zero
575     @param is_tunnel - IPsec tunnel mode when non-zero, else transport mode
576     @param is_tunnel_ipv6 - If using tunnel mode, endpoints are IPv6
577     @param tunnel_src_addr - Tunnel source address if using tunnel mode
578     @param tunnel_dst_addr - Tunnel destination address is using tunnel mode
579     @param salt - 4 byte salt 
580     @param seq - current sequence number for outbound
581     @param seq_hi - high 32 bits of ESN for outbound 
582     @param last_seq - highest sequence number received inbound
583     @param last_seq_hi - high 32 bits of highest ESN received inbound
584     @param replay_window - bit map of seq nums received relative to last_seq if using anti-replay
585     @param total_data_size - total bytes sent or received
586 */
587 define ipsec_sa_details {
588   u32 context;
589   u32 sa_id;
590   u32 sw_if_index;
591
592   u32 spi;
593   u8 protocol;
594
595   u8 crypto_alg;
596   u8 crypto_key_len;
597   u8 crypto_key[128];
598
599   u8 integ_alg;
600   u8 integ_key_len;
601   u8 integ_key[128];
602
603   u8 use_esn;
604   u8 use_anti_replay;
605
606   u8 is_tunnel;
607   u8 is_tunnel_ip6;
608   u8 tunnel_src_addr[16];
609   u8 tunnel_dst_addr[16];
610
611   u32 salt;
612   u64 seq_outbound;
613   u64 last_seq_inbound;
614   u64 replay_window;
615
616   u64 total_data_size;
617 };
618
619 /** \brief Set key on IPsec interface
620     @param client_index - opaque cookie to identify the sender
621     @param context - sender context, to match reply w/ request
622     @param sw_if_index - index of tunnel interface
623     @param key_type - type of key being set
624     @param alg - algorithm used with key
625     @param key_len - length key in bytes
626     @param key - key
627 */
628 autoreply define ipsec_tunnel_if_set_key {
629   u32 client_index;
630   u32 context;
631   u32 sw_if_index;
632   u8 key_type;
633   u8 alg;
634   u8 key_len;
635   u8 key[128];
636 };
637
638 /** \brief Set new SA on IPsec interface
639     @param client_index - opaque cookie to identify the sender
640     @param context - sender context, to match reply w/ request
641     @param sw_if_index - index of tunnel interface
642     @param sa_id - ID of SA to use
643     @param is_outbound - 1 if outbound (local) SA, 0 if inbound (remote)
644 */
645 autoreply define ipsec_tunnel_if_set_sa {
646   u32 client_index;
647   u32 context;
648   u32 sw_if_index;
649   u32 sa_id;
650   u8 is_outbound;
651 };
652
653 /*
654  * Local Variables:
655  * eval: (c-set-style "gnu")
656  * End:
657  */
658