updated Doxyfile
[strongswan.git] / src / charon / sa / ike_sa_id.h
1 /*
2 * Copyright (C) 2005-2006 Martin Willi
3 * Copyright (C) 2005 Jan Hutter
4 * Hochschule fuer Technik Rapperswil
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * $Id$
17 */
18
19 /**
20 * @defgroup ike_sa_id ike_sa_id
21 * @{ @ingroup sa
22 */
23
24 #ifndef IKE_SA_ID_H_
25 #define IKE_SA_ID_H_
26
27 typedef struct ike_sa_id_t ike_sa_id_t;
28
29 #include <library.h>
30
31 /**
32 * An object of type ike_sa_id_t is used to identify an IKE_SA.
33 *
34 * An IKE_SA is identified by its initiator and responder spi's.
35 * Additionaly it contains the role of the actual running IKEv2-Daemon
36 * for the specific IKE_SA (original initiator or responder).
37 */
38 struct ike_sa_id_t {
39
40 /**
41 * Set the SPI of the responder.
42 *
43 * This function is called when a request or reply of a IKE_SA_INIT is received.
44 *
45 * @param responder_spi SPI of responder to set
46 */
47 void (*set_responder_spi) (ike_sa_id_t *this, u_int64_t responder_spi);
48
49 /**
50 * Set the SPI of the initiator.
51 *
52 * @param initiator_spi SPI to set
53 */
54 void (*set_initiator_spi) (ike_sa_id_t *this, u_int64_t initiator_spi);
55
56 /**
57 * Get the initiator SPI.
58 *
59 * @return SPI of the initiator
60 */
61 u_int64_t (*get_initiator_spi) (ike_sa_id_t *this);
62
63 /**
64 * Get the responder SPI.
65 *
66 * @return SPI of the responder
67 */
68 u_int64_t (*get_responder_spi) (ike_sa_id_t *this);
69
70 /**
71 * Check if two ike_sa_id_t objects are equal.
72 *
73 * Two ike_sa_id_t objects are equal if both SPI values and the role matches.
74 *
75 * @param other ike_sa_id_t object to check if equal
76 * @return TRUE if given ike_sa_id_t are equal, FALSE otherwise
77 */
78 bool (*equals) (ike_sa_id_t *this, ike_sa_id_t *other);
79
80 /**
81 * Replace all values of a given ike_sa_id_t object with values.
82 * from another ike_sa_id_t object.
83 *
84 * After calling this function, both objects are equal.
85 *
86 * @param other ike_sa_id_t object from which values will be taken
87 */
88 void (*replace_values) (ike_sa_id_t *this, ike_sa_id_t *other);
89
90 /**
91 * Get the initiator flag.
92 *
93 * @return TRUE if we are the original initator
94 */
95 bool (*is_initiator) (ike_sa_id_t *this);
96
97 /**
98 * Switche the original initiator flag.
99 *
100 * @return TRUE if we are the original initator after switch, FALSE otherwise
101 */
102 bool (*switch_initiator) (ike_sa_id_t *this);
103
104 /**
105 * Clones a given ike_sa_id_t object.
106 *
107 * @return cloned ike_sa_id_t object
108 */
109 ike_sa_id_t *(*clone) (ike_sa_id_t *this);
110
111 /**
112 * Destroys an ike_sa_id_t object.
113 */
114 void (*destroy) (ike_sa_id_t *this);
115 };
116
117 /**
118 * Creates an ike_sa_id_t object with specific SPI's and defined role.
119 *
120 * @param initiator_spi initiators SPI
121 * @param responder_spi responders SPI
122 * @param is_initiaor TRUE if we are the original initiator
123 * @return ike_sa_id_t object
124 */
125 ike_sa_id_t * ike_sa_id_create(u_int64_t initiator_spi, u_int64_t responder_spi,
126 bool is_initiaor);
127
128 #endif /** IKE_SA_ID_H_ @}*/