updated Doxyfile
[strongswan.git] / src / charon / sa / ike_sa.h
1 /*
2 * Copyright (C) 2006-2008 Tobias Brunner
3 * Copyright (C) 2006 Daniel Roethlisberger
4 * Copyright (C) 2005-2008 Martin Willi
5 * Copyright (C) 2005 Jan Hutter
6 * Hochschule fuer Technik Rapperswil
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * for more details.
17 *
18 * $Id$
19 */
20
21 /**
22 * @defgroup ike_sa ike_sa
23 * @{ @ingroup sa
24 */
25
26 #ifndef IKE_SA_H_
27 #define IKE_SA_H_
28
29 typedef enum ike_extension_t ike_extension_t;
30 typedef enum ike_condition_t ike_condition_t;
31 typedef enum ike_sa_state_t ike_sa_state_t;
32 typedef enum statistic_t statistic_t;
33 typedef struct ike_sa_t ike_sa_t;
34
35 #include <library.h>
36 #include <encoding/message.h>
37 #include <encoding/payloads/proposal_substructure.h>
38 #include <sa/ike_sa_id.h>
39 #include <sa/child_sa.h>
40 #include <sa/tasks/task.h>
41 #include <sa/keymat.h>
42 #include <config/peer_cfg.h>
43 #include <config/ike_cfg.h>
44 #include <credentials/auth_info.h>
45
46 /**
47 * Timeout in milliseconds after that a half open IKE_SA gets deleted.
48 */
49 #define HALF_OPEN_IKE_SA_TIMEOUT 30000
50
51 /**
52 * Interval to send keepalives when NATed, in seconds.
53 */
54 #define KEEPALIVE_INTERVAL 20
55
56 /**
57 * After which time rekeying should be retried if it failed, in seconds.
58 */
59 #define RETRY_INTERVAL 30
60
61 /**
62 * Jitter to subtract from RETRY_INTERVAL to randomize rekey retry.
63 */
64 #define RETRY_JITTER 20
65
66 /**
67 * Extensions (or optional features) the peer supports
68 */
69 enum ike_extension_t {
70
71 /**
72 * peer supports NAT traversal as specified in RFC4306
73 */
74 EXT_NATT = (1<<0),
75
76 /**
77 * peer supports MOBIKE (RFC4555)
78 */
79 EXT_MOBIKE = (1<<1),
80
81 /**
82 * peer supports HTTP cert lookups as specified in RFC4306
83 */
84 EXT_HASH_AND_URL = (1<<2),
85 };
86
87 /**
88 * Conditions of an IKE_SA, change during its lifetime
89 */
90 enum ike_condition_t {
91
92 /**
93 * Connection is natted (or faked) somewhere
94 */
95 COND_NAT_ANY = (1<<0),
96
97 /**
98 * we are behind NAT
99 */
100 COND_NAT_HERE = (1<<1),
101
102 /**
103 * other is behind NAT
104 */
105 COND_NAT_THERE = (1<<2),
106
107 /**
108 * Faking NAT to enforce UDP encapsulation
109 */
110 COND_NAT_FAKE = (1<<3),
111
112 /**
113 * peer has ben authenticated using EAP
114 */
115 COND_EAP_AUTHENTICATED = (1<<4),
116
117 /**
118 * received a certificate request from the peer
119 */
120 COND_CERTREQ_SEEN = (1<<5),
121
122 /**
123 * Local peer is the "original" IKE initiator. Unaffected from rekeying.
124 */
125 COND_ORIGINAL_INITIATOR = (1<<6),
126 };
127
128 /**
129 * Timing information and statistics to query from an SA
130 */
131 enum statistic_t {
132 /** Timestamp of SA establishement */
133 STAT_ESTABLISHED = 0,
134 /** Timestamp of scheudled rekeying */
135 STAT_REKEY,
136 /** Timestamp of scheudled reauthentication */
137 STAT_REAUTH,
138 /** Timestamp of scheudled delete */
139 STAT_DELETE,
140 /** Timestamp of last inbound IKE packet */
141 STAT_INBOUND,
142 /** Timestamp of last outbound IKE packet */
143 STAT_OUTBOUND,
144
145 STAT_MAX
146 };
147
148 /**
149 * State of an IKE_SA.
150 *
151 * An IKE_SA passes various states in its lifetime. A newly created
152 * SA is in the state CREATED.
153 * @verbatim
154 +----------------+
155 ¦ SA_CREATED ¦
156 +----------------+
157 ¦
158 on initiate()---> ¦ <----- on IKE_SA_INIT received
159 V
160 +----------------+
161 ¦ SA_CONNECTING ¦
162 +----------------+
163 ¦
164 ¦ <----- on IKE_AUTH successfully completed
165 V
166 +----------------+
167 ¦ SA_ESTABLISHED ¦-------------------------+ <-- on rekeying
168 +----------------+ ¦
169 ¦ V
170 on delete()---> ¦ <----- on IKE_SA +-------------+
171 ¦ delete request ¦ SA_REKEYING ¦
172 ¦ received +-------------+
173 V ¦
174 +----------------+ ¦
175 ¦ SA_DELETING ¦<------------------------+ <-- after rekeying
176 +----------------+
177 ¦
178 ¦ <----- after delete() acknowledged
179 ¦
180 \V/
181 X
182 / \
183 @endverbatim
184 */
185 enum ike_sa_state_t {
186
187 /**
188 * IKE_SA just got created, but is not initiating nor responding yet.
189 */
190 IKE_CREATED,
191
192 /**
193 * IKE_SA gets initiated actively or passively
194 */
195 IKE_CONNECTING,
196
197 /**
198 * IKE_SA is fully established
199 */
200 IKE_ESTABLISHED,
201
202 /**
203 * IKE_SA is managed externally and does not process messages
204 */
205 IKE_PASSIVE,
206
207 /**
208 * IKE_SA rekeying in progress
209 */
210 IKE_REKEYING,
211
212 /**
213 * IKE_SA is in progress of deletion
214 */
215 IKE_DELETING,
216
217 /**
218 * IKE_SA object gets destroyed
219 */
220 IKE_DESTROYING,
221 };
222
223 /**
224 * enum names for ike_sa_state_t.
225 */
226 extern enum_name_t *ike_sa_state_names;
227
228 /**
229 * Class ike_sa_t representing an IKE_SA.
230 *
231 * An IKE_SA contains crypto information related to a connection
232 * with a peer. It contains multiple IPsec CHILD_SA, for which
233 * it is responsible. All traffic is handled by an IKE_SA, using
234 * the task manager and its tasks.
235 */
236 struct ike_sa_t {
237
238 /**
239 * Get the id of the SA.
240 *
241 * Returned ike_sa_id_t object is not getting cloned!
242 *
243 * @return ike_sa's ike_sa_id_t
244 */
245 ike_sa_id_t* (*get_id) (ike_sa_t *this);
246
247 /**
248 * Get the numerical ID uniquely defining this IKE_SA.
249 *
250 * @return unique ID
251 */
252 u_int32_t (*get_unique_id) (ike_sa_t *this);
253
254 /**
255 * Get the state of the IKE_SA.
256 *
257 * @return state of the IKE_SA
258 */
259 ike_sa_state_t (*get_state) (ike_sa_t *this);
260
261 /**
262 * Set the state of the IKE_SA.
263 *
264 * @param state state to set for the IKE_SA
265 */
266 void (*set_state) (ike_sa_t *this, ike_sa_state_t ike_sa);
267
268 /**
269 * Get the name of the connection this IKE_SA uses.
270 *
271 * @return name
272 */
273 char* (*get_name) (ike_sa_t *this);
274
275 /**
276 * Get statistic values from the IKE_SA.
277 *
278 * @param kind kind of requested value
279 * @return value as integer
280 */
281 u_int32_t (*get_statistic)(ike_sa_t *this, statistic_t kind);
282
283 /**
284 * Get the own host address.
285 *
286 * @return host address
287 */
288 host_t* (*get_my_host) (ike_sa_t *this);
289
290 /**
291 * Set the own host address.
292 *
293 * @param me host address
294 */
295 void (*set_my_host) (ike_sa_t *this, host_t *me);
296
297 /**
298 * Get the other peers host address.
299 *
300 * @return host address
301 */
302 host_t* (*get_other_host) (ike_sa_t *this);
303
304 /**
305 * Set the others host address.
306 *
307 * @param other host address
308 */
309 void (*set_other_host) (ike_sa_t *this, host_t *other);
310
311 /**
312 * Update the IKE_SAs host.
313 *
314 * Hosts may be NULL to use current host.
315 *
316 * @param me new local host address, or NULL
317 * @param other new remote host address, or NULL
318 */
319 void (*update_hosts)(ike_sa_t *this, host_t *me, host_t *other);
320
321 /**
322 * Get the own identification.
323 *
324 * @return identification
325 */
326 identification_t* (*get_my_id) (ike_sa_t *this);
327
328 /**
329 * Set the own identification.
330 *
331 * @param me identification
332 */
333 void (*set_my_id) (ike_sa_t *this, identification_t *me);
334
335 /**
336 * Get the other peer's identification.
337 *
338 * @return identification
339 */
340 identification_t* (*get_other_id) (ike_sa_t *this);
341
342 /**
343 * Set the other peer's identification.
344 *
345 * @param other identification
346 */
347 void (*set_other_id) (ike_sa_t *this, identification_t *other);
348
349 /**
350 * Get the peers EAP identity.
351 *
352 * The EAP identity is exchanged in a EAP-Identity exchange.
353 *
354 * @return identification, NULL if none set
355 */
356 identification_t* (*get_eap_identity) (ike_sa_t *this);
357
358 /**
359 * Set the peer's EAP identity.
360 *
361 * @param id identification
362 */
363 void (*set_eap_identity) (ike_sa_t *this, identification_t *id);
364
365 /**
366 * Get the config used to setup this IKE_SA.
367 *
368 * @return ike_config
369 */
370 ike_cfg_t* (*get_ike_cfg) (ike_sa_t *this);
371
372 /**
373 * Set the config to setup this IKE_SA.
374 *
375 * @param config ike_config to use
376 */
377 void (*set_ike_cfg) (ike_sa_t *this, ike_cfg_t* config);
378
379 /**
380 * Get the peer config used by this IKE_SA.
381 *
382 * @return peer_config
383 */
384 peer_cfg_t* (*get_peer_cfg) (ike_sa_t *this);
385
386 /**
387 * Set the peer config to use with this IKE_SA.
388 *
389 * @param config peer_config to use
390 */
391 void (*set_peer_cfg) (ike_sa_t *this, peer_cfg_t *config);
392
393 /**
394 * Get authentication/authorization info for local peer.
395 *
396 * @return auth_info for me
397 */
398 auth_info_t* (*get_my_auth)(ike_sa_t *this);
399
400 /**
401 * Get authentication/authorization info for remote peer.
402 *
403 * @return auth_info for me
404 */
405 auth_info_t* (*get_other_auth)(ike_sa_t *this);
406
407 /**
408 * Get the selected proposal of this IKE_SA.
409 *
410 * @return selected proposal
411 */
412 proposal_t* (*get_proposal)(ike_sa_t *this);
413
414 /**
415 * Set the proposal selected for this IKE_SA.
416 *
417 * @param selected proposal
418 */
419 void (*set_proposal)(ike_sa_t *this, proposal_t *proposal);
420
421 /**
422 * Set the message id of the IKE_SA.
423 *
424 * The IKE_SA stores two message IDs, one for initiating exchanges (send)
425 * and one to respond to exchanges (expect).
426 *
427 * @param initiate TRUE to set message ID for initiating
428 * @param mid message id to set
429 */
430 void (*set_message_id)(ike_sa_t *this, bool initiate, u_int32_t mid);
431
432 /**
433 * Add an additional address for the peer.
434 *
435 * In MOBIKE, a peer may transmit additional addresses where it is
436 * reachable. These are stored in the IKE_SA.
437 * The own list of addresses is not stored, they are queried from
438 * the kernel when required.
439 *
440 * @param host host to add to list
441 */
442 void (*add_additional_address)(ike_sa_t *this, host_t *host);
443
444 /**
445 * Create an iterator over all additional addresses of the peer.
446 *
447 * @return iterator over addresses
448 */
449 iterator_t* (*create_additional_address_iterator)(ike_sa_t *this);
450
451 /**
452 * Check if mappings have changed on a NAT for our source address.
453 *
454 * @param hash received DESTINATION_IP hash
455 * @return TRUE if mappings have changed
456 */
457 bool (*has_mapping_changed)(ike_sa_t *this, chunk_t hash);
458
459 /**
460 * Enable an extension the peer supports.
461 *
462 * If support for an IKE extension is detected, this method is called
463 * to enable that extension and behave accordingly.
464 *
465 * @param extension extension to enable
466 */
467 void (*enable_extension)(ike_sa_t *this, ike_extension_t extension);
468
469 /**
470 * Check if the peer supports an extension.
471 *
472 * @param extension extension to check for support
473 * @return TRUE if peer supports it, FALSE otherwise
474 */
475 bool (*supports_extension)(ike_sa_t *this, ike_extension_t extension);
476
477 /**
478 * Enable/disable a condition flag for this IKE_SA.
479 *
480 * @param condition condition to enable/disable
481 * @param enable TRUE to enable condition, FALSE to disable
482 */
483 void (*set_condition) (ike_sa_t *this, ike_condition_t condition, bool enable);
484
485 /**
486 * Check if a condition flag is set.
487 *
488 * @param condition condition to check
489 * @return TRUE if condition flag set, FALSE otherwise
490 */
491 bool (*has_condition) (ike_sa_t *this, ike_condition_t condition);
492
493 /**
494 * Get the number of queued MOBIKE address updates.
495 *
496 * @return number of pending updates
497 */
498 u_int32_t (*get_pending_updates)(ike_sa_t *this);
499
500 /**
501 * Set the number of queued MOBIKE address updates.
502 *
503 * @param updates number of pending updates
504 */
505 void (*set_pending_updates)(ike_sa_t *this, u_int32_t updates);
506
507 #ifdef ME
508 /**
509 * Activate mediation server functionality for this IKE_SA.
510 */
511 void (*act_as_mediation_server) (ike_sa_t *this);
512
513 /**
514 * Get the server reflexive host.
515 *
516 * @return server reflexive host
517 */
518 host_t* (*get_server_reflexive_host) (ike_sa_t *this);
519
520 /**
521 * Set the server reflexive host.
522 *
523 * @param host server reflexive host
524 */
525 void (*set_server_reflexive_host) (ike_sa_t *this, host_t *host);
526
527 /**
528 * Get the connect ID.
529 *
530 * @return connect ID
531 */
532 chunk_t (*get_connect_id) (ike_sa_t *this);
533
534 /**
535 * Initiate the mediation of a mediated connection (i.e. initiate a
536 * ME_CONNECT exchange).
537 *
538 * @param mediated_cfg peer_cfg of the mediated connection
539 * @return
540 * - SUCCESS if initialization started
541 * - DESTROY_ME if initialization failed
542 */
543 status_t (*initiate_mediation) (ike_sa_t *this, peer_cfg_t *mediated_cfg);
544
545 /**
546 * Initiate the mediated connection
547 *
548 * @param me local endpoint (gets cloned)
549 * @param other remote endpoint (gets cloned)
550 * @param connect_id connect ID (gets cloned)
551 * @return
552 * - SUCCESS if initialization started
553 * - DESTROY_ME if initialization failed
554 */
555 status_t (*initiate_mediated) (ike_sa_t *this, host_t *me, host_t *other,
556 chunk_t connect_id);
557
558 /**
559 * Relay data from one peer to another (i.e. initiate a
560 * ME_CONNECT exchange).
561 *
562 * Data is cloned.
563 *
564 * @param requester ID of the requesting peer
565 * @param connect_id data of the ME_CONNECTID payload
566 * @param connect_key data of the ME_CONNECTKEY payload
567 * @param endpoints endpoints
568 * @param response TRUE if this is a response
569 * @return
570 * - SUCCESS if relay started
571 * - DESTROY_ME if relay failed
572 */
573 status_t (*relay) (ike_sa_t *this, identification_t *requester, chunk_t connect_id,
574 chunk_t connect_key, linked_list_t *endpoints, bool response);
575
576 /**
577 * Send a callback to a peer.
578 *
579 * Data is cloned.
580 *
581 * @param peer_id ID of the other peer
582 * @return
583 * - SUCCESS if response started
584 * - DESTROY_ME if response failed
585 */
586 status_t (*callback) (ike_sa_t *this, identification_t *peer_id);
587
588 /**
589 * Respond to a ME_CONNECT request.
590 *
591 * Data is cloned.
592 *
593 * @param peer_id ID of the other peer
594 * @param connect_id the connect ID supplied by the initiator
595 * @return
596 * - SUCCESS if response started
597 * - DESTROY_ME if response failed
598 */
599 status_t (*respond) (ike_sa_t *this, identification_t *peer_id, chunk_t connect_id);
600 #endif /* ME */
601
602 /**
603 * Initiate a new connection.
604 *
605 * The configs are owned by the IKE_SA after the call.
606 *
607 * @param child_cfg child config to create CHILD from
608 * @return
609 * - SUCCESS if initialization started
610 * - DESTROY_ME if initialization failed
611 */
612 status_t (*initiate) (ike_sa_t *this, child_cfg_t *child_cfg);
613
614 /**
615 * Route a policy in the kernel.
616 *
617 * Installs the policies in the kernel. If traffic matches,
618 * the kernel requests connection setup from the IKE_SA via acquire().
619 *
620 * @param child_cfg child config to route
621 * @return
622 * - SUCCESS if routed successfully
623 * - FAILED if routing failed
624 */
625 status_t (*route) (ike_sa_t *this, child_cfg_t *child_cfg);
626
627 /**
628 * Unroute a policy in the kernel previously routed.
629 *
630 * @param reqid reqid of CHILD_SA to unroute
631 * @return
632 * - SUCCESS if route removed
633 * - NOT_FOUND if CHILD_SA not found
634 * - DESTROY_ME if last CHILD_SA was unrouted
635 */
636 status_t (*unroute) (ike_sa_t *this, u_int32_t reqid);
637
638 /**
639 * Acquire connection setup for an installed kernel policy.
640 *
641 * If an installed policy raises an acquire, the kernel calls
642 * this function to establish the CHILD_SA (and maybe the IKE_SA).
643 *
644 * @param reqid reqid of the CHILD_SA the policy belongs to.
645 * @return
646 * - SUCCESS if initialization started
647 * - DESTROY_ME if initialization failed
648 */
649 status_t (*acquire) (ike_sa_t *this, u_int32_t reqid);
650
651 /**
652 * Initiates the deletion of an IKE_SA.
653 *
654 * Sends a delete message to the remote peer and waits for
655 * its response. If the response comes in, or a timeout occurs,
656 * the IKE SA gets deleted.
657 *
658 * @return
659 * - SUCCESS if deletion is initialized
660 * - DESTROY_ME, if the IKE_SA is not in
661 * an established state and can not be
662 * deleted (but destroyed).
663 */
664 status_t (*delete) (ike_sa_t *this);
665
666 /**
667 * Update IKE_SAs after network interfaces have changed.
668 *
669 * Whenever the network interface configuration changes, the kernel
670 * interface calls roam() on each IKE_SA. The IKE_SA then checks if
671 * the new network config requires changes, and handles appropriate.
672 * If MOBIKE is supported, addresses are updated; If not, the tunnel is
673 * restarted.
674 *
675 * @param address TRUE if address list changed, FALSE otherwise
676 * @return SUCCESS, FAILED, DESTROY_ME
677 */
678 status_t (*roam)(ike_sa_t *this, bool address);
679
680 /**
681 * Processes a incoming IKEv2-Message.
682 *
683 * Message processing may fail. If a critical failure occurs,
684 * process_message() return DESTROY_ME. Then the caller must
685 * destroy the IKE_SA immediatly, as it is unusable.
686 *
687 * @param message message to process
688 * @return
689 * - SUCCESS
690 * - FAILED
691 * - DESTROY_ME if this IKE_SA MUST be deleted
692 */
693 status_t (*process_message) (ike_sa_t *this, message_t *message);
694
695 /**
696 * Generate a IKE message to send it to the peer.
697 *
698 * This method generates all payloads in the message and encrypts/signs
699 * the packet.
700 *
701 * @param message message to generate
702 * @param packet generated output packet
703 * @return
704 * - SUCCESS
705 * - FAILED
706 * - DESTROY_ME if this IKE_SA MUST be deleted
707 */
708 status_t (*generate_message) (ike_sa_t *this, message_t *message,
709 packet_t **packet);
710
711 /**
712 * Retransmits a request.
713 *
714 * @param message_id ID of the request to retransmit
715 * @return
716 * - SUCCESS
717 * - NOT_FOUND if request doesn't have to be retransmited
718 */
719 status_t (*retransmit) (ike_sa_t *this, u_int32_t message_id);
720
721 /**
722 * Sends a DPD request to the peer.
723 *
724 * To check if a peer is still alive, periodic
725 * empty INFORMATIONAL messages are sent if no
726 * other traffic was received.
727 *
728 * @return
729 * - SUCCESS
730 * - DESTROY_ME, if peer did not respond
731 */
732 status_t (*send_dpd) (ike_sa_t *this);
733
734 /**
735 * Sends a keep alive packet.
736 *
737 * To refresh NAT tables in a NAT router
738 * between the peers, periodic empty
739 * UDP packets are sent if no other traffic
740 * was sent.
741 */
742 void (*send_keepalive) (ike_sa_t *this);
743
744 /**
745 * Get the keying material of this IKE_SA.
746 *
747 * @return per IKE_SA keymat instance
748 */
749 keymat_t* (*get_keymat)(ike_sa_t *this);
750
751 /**
752 * Associates a child SA to this IKE SA
753 *
754 * @param child_sa child_sa to add
755 */
756 void (*add_child_sa) (ike_sa_t *this, child_sa_t *child_sa);
757
758 /**
759 * Get a CHILD_SA identified by protocol and SPI.
760 *
761 * @param protocol protocol of the SA
762 * @param spi SPI of the CHILD_SA
763 * @param inbound TRUE if SPI is inbound, FALSE if outbound
764 * @return child_sa, or NULL if none found
765 */
766 child_sa_t* (*get_child_sa) (ike_sa_t *this, protocol_id_t protocol,
767 u_int32_t spi, bool inbound);
768
769 /**
770 * Create an iterator over all CHILD_SAs.
771 *
772 * @return iterator
773 */
774 iterator_t* (*create_child_sa_iterator) (ike_sa_t *this);
775
776 /**
777 * Rekey the CHILD SA with the specified reqid.
778 *
779 * Looks for a CHILD SA owned by this IKE_SA, and start the rekeing.
780 *
781 * @param protocol protocol of the SA
782 * @param spi inbound SPI of the CHILD_SA
783 * @return
784 * - NOT_FOUND, if IKE_SA has no such CHILD_SA
785 * - SUCCESS, if rekeying initiated
786 */
787 status_t (*rekey_child_sa) (ike_sa_t *this, protocol_id_t protocol, u_int32_t spi);
788
789 /**
790 * Close the CHILD SA with the specified protocol/SPI.
791 *
792 * Looks for a CHILD SA owned by this IKE_SA, deletes it and
793 * notify's the remote peer about the delete. The associated
794 * states and policies in the kernel get deleted, if they exist.
795 *
796 * @param protocol protocol of the SA
797 * @param spi inbound SPI of the CHILD_SA
798 * @return
799 * - NOT_FOUND, if IKE_SA has no such CHILD_SA
800 * - SUCCESS, if delete message sent
801 */
802 status_t (*delete_child_sa) (ike_sa_t *this, protocol_id_t protocol, u_int32_t spi);
803
804 /**
805 * Destroy a CHILD SA with the specified protocol/SPI.
806 *
807 * Looks for a CHILD SA owned by this IKE_SA and destroys it.
808 *
809 * @param protocol protocol of the SA
810 * @param spi inbound SPI of the CHILD_SA
811 * @return
812 * - NOT_FOUND, if IKE_SA has no such CHILD_SA
813 * - SUCCESS
814 */
815 status_t (*destroy_child_sa) (ike_sa_t *this, protocol_id_t protocol, u_int32_t spi);
816
817 /**
818 * Rekey the IKE_SA.
819 *
820 * Sets up a new IKE_SA, moves all CHILDs to it and deletes this IKE_SA.
821 *
822 * @return - SUCCESS, if IKE_SA rekeying initiated
823 */
824 status_t (*rekey) (ike_sa_t *this);
825
826 /**
827 * Reauthenticate the IKE_SA.
828 *
829 * Create a completely new IKE_SA with authentication, recreates all children
830 * within the IKE_SA, closes this IKE_SA.
831 *
832 * @return DESTROY_ME to destroy the IKE_SA
833 */
834 status_t (*reauth) (ike_sa_t *this);
835
836 /**
837 * Restablish the IKE_SA.
838 *
839 * Reestablish an IKE_SA after it has been closed.
840 *
841 * @return DESTROY_ME to destroy the IKE_SA
842 */
843 status_t (*reestablish) (ike_sa_t *this);
844
845 /**
846 * Set the lifetime limit received from a AUTH_LIFETIME notify.
847 *
848 * @param lifetime lifetime in seconds
849 */
850 void (*set_auth_lifetime)(ike_sa_t *this, u_int32_t lifetime);
851
852 /**
853 * Set the virtual IP to use for this IKE_SA and its children.
854 *
855 * The virtual IP is assigned per IKE_SA, not per CHILD_SA. It has the same
856 * lifetime as the IKE_SA.
857 *
858 * @param local TRUE to set local address, FALSE for remote
859 * @param ip IP to set as virtual IP
860 */
861 void (*set_virtual_ip) (ike_sa_t *this, bool local, host_t *ip);
862
863 /**
864 * Get the virtual IP configured.
865 *
866 * @param local TRUE to get local virtual IP, FALSE for remote
867 * @return host_t *virtual IP
868 */
869 host_t* (*get_virtual_ip) (ike_sa_t *this, bool local);
870
871 /**
872 * Add a DNS server to the system.
873 *
874 * An IRAS may send a DNS server. To use it, it is installed on the
875 * system. The DNS entry has a lifetime until the IKE_SA gets closed.
876 *
877 * @param dns DNS server to install on the system
878 */
879 void (*add_dns_server) (ike_sa_t *this, host_t *dns);
880
881 /**
882 * Set local and remote host addresses to be used for IKE.
883 *
884 * These addresses are communicated via the KMADDRESS field of a MIGRATE
885 * message sent via the NETLINK or PF _KEY kernel socket interface.
886 *
887 * @param local local kmaddress
888 * @param remote remote kmaddress
889 */
890 void (*set_kmaddress) (ike_sa_t *this, host_t *local, host_t *remote);
891
892 /**
893 * Inherit all attributes of other to this after rekeying.
894 *
895 * When rekeying is completed, all CHILD_SAs, the virtual IP and all
896 * outstanding tasks are moved from other to this.
897 * As this call may initiate inherited tasks, a status is returned.
898 *
899 * @param other other task to inherit from
900 * @return DESTROY_ME if initiation of inherited task failed
901 */
902 status_t (*inherit) (ike_sa_t *this, ike_sa_t *other);
903
904 /**
905 * Reset the IKE_SA, useable when initiating fails
906 */
907 void (*reset) (ike_sa_t *this);
908
909 /**
910 * Destroys a ike_sa_t object.
911 */
912 void (*destroy) (ike_sa_t *this);
913 };
914
915 /**
916 * Creates an ike_sa_t object with a specific ID.
917 *
918 * @param ike_sa_id ike_sa_id_t object to associate with new IKE_SA
919 * @return ike_sa_t object
920 */
921 ike_sa_t *ike_sa_create(ike_sa_id_t *ike_sa_id);
922
923 #endif /** IKE_SA_H_ @}*/