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