- dead end implementation
[strongswan.git] / Source / charon / config / configuration_manager.h
1 /**
2 * @file configuration_manager.h
3 *
4 * @brief Interface of configuration_manager_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 #ifndef CONFIGURATION_MANAGER_H_
24 #define CONFIGURATION_MANAGER_H_
25
26 #include <types.h>
27 #include <config/init_config.h>
28 #include <config/sa_config.h>
29 #include <transforms/rsa/rsa_private_key.h>
30 #include <transforms/rsa/rsa_public_key.h>
31
32
33 typedef struct configuration_manager_t configuration_manager_t;
34
35 /**
36 * @brief Manages all configuration aspects of the daemon.
37 *
38 * @b Constructors:
39 * - configuration_manager_create()
40 *
41 * @todo Build a (file) backend for the configuration manager.
42 *
43 * @ingroup config
44 */
45 struct configuration_manager_t {
46
47 /**
48 * @brief Returns the configuration information needed for IKE_SA_INIT exchange
49 * for a specific configuration name.
50 *
51 * The returned init_config_t object MUST NOT be destroyed cause it's managed by
52 * this configuration_manager_t object.
53 *
54 * @param this calling object
55 * @param name name of the configuration
56 * @param[out] init_config the init_config_t object is stored at this location
57 *
58 * @return
59 * - NOT_FOUND
60 * - SUCCESS
61 */
62 status_t (*get_init_config_for_name) (configuration_manager_t *this, char *name, init_config_t **init_config);
63
64 /**
65 * @brief Returns the configuration information needed for IKE_SA_INIT exchange
66 * for specific host informations.
67 *
68 * The returned init_config_t object MUST NOT be destroyed cause it's managed by
69 * this configuration_manager_t object.
70 *
71 * @param this calling object
72 * @param my_host my host informations
73 * @param other_host other host informations
74 * @param[out] init_config the init_config_t object is stored at this location
75 *
76 * @return
77 * - NOT_FOUND
78 * - SUCCESS
79 */
80 status_t (*get_init_config_for_host) (configuration_manager_t *this, host_t *my_host, host_t *other_host,init_config_t **init_config);
81
82 /**
83 * @brief Returns the configuration information needed after IKE_SA_INIT exchange
84 * for a specific configuration name.
85 *
86 * The returned sa_config_t object MUST NOT be destroyed cause it's managed by
87 * this configuration_manager_t object.
88 *
89 * @param this calling object
90 * @param name name of the configuration
91 * @param[out] sa_config the sa_config_t object is stored at this location
92 *
93 * @return
94 * - NOT_FOUND
95 * - SUCCESS
96 */
97 status_t (*get_sa_config_for_name) (configuration_manager_t *this, char *name, sa_config_t **sa_config);
98
99 /**
100 * @brief Returns the configuration information needed after IKE_SA_INIT exchange
101 * for specific init_config_t and ID data.
102 *
103 * The returned sa_config_t object MUST NOT be destroyed cause it's managed by
104 * this configuration_manager_t object.
105 *
106 * @param this calling object
107 * @param init_config init_config_t object
108 * @param other_id identification of other one
109 * @param my_id my identification (can be NULL)
110 * @param[out] sa_config the sa_config_t object is stored at this location
111 *
112 * @return
113 * - NOT_FOUND
114 * - SUCCESS
115 */
116 status_t (*get_sa_config_for_init_config_and_id) (configuration_manager_t *this, init_config_t *init_config, identification_t *other_id, identification_t *my_id,sa_config_t **sa_config);
117
118 /**
119 * @brief Returns the retransmit timeout.
120 *
121 * The timeout values are managed by the configuration manager.
122 *
123 * @param this calling object
124 * @param retransmit_count number of times a message was retransmitted so far
125 * @param[out] timeout the new retransmit timeout in milliseconds
126 *
127 * @return
128 * - FAILED, if the message should not be retransmitted
129 * - SUCCESS
130 */
131 status_t (*get_retransmit_timeout) (configuration_manager_t *this, u_int32_t retransmit_count, u_int32_t *timeout);
132
133 /**
134 * @brief Returns the timeout for an half open IKE_SA in ms.
135 *
136 * Half open means that the IKE_SA is still in one of the following states:
137 * - INITIATOR_INIT
138 * - RESPONDER_INIT
139 * - IKE_SA_INIT_REQUESTED
140 * - IKE_SA_INIT_RESPONDED
141 * - IKE_AUTH_REQUESTED
142 *
143 * @param this calling object
144 * @return timeout in milliseconds (ms)
145 */
146 u_int32_t (*get_half_open_ike_sa_timeout) (configuration_manager_t *this);
147
148 /**
149 * @brief Returns the preshared secret of a specific ID.
150 *
151 * The returned preshared secret MUST NOT be destroyed cause it's managed by
152 * this configuration_manager_t object.
153 *
154 * @param this calling object
155 * @param identification identification_t object identifiying the ID.
156 * @param[out] preshared_secret the preshared secret will be written there.
157 *
158 * @return
159 * - NOT_FOUND if no preshared secrets for specific ID could be found
160 * - SUCCESS
161 */
162 status_t (*get_shared_secret) (configuration_manager_t *this, identification_t *identification, chunk_t *preshared_secret);
163
164 /**
165 * @brief Returns the RSA public key of a specific ID.
166 *
167 * The returned rsa_public_key_t object MUST NOT be destroyed cause it's managed by
168 * this configuration_manager_t object.
169 *
170 * @param this calling object
171 * @param identification identification_t object identifiying the ID.
172 * @param[out] public_key the public key will be written there
173 *
174 * @return
175 * - NOT_FOUND if no key is configured for specific id
176 * - SUCCESS
177 */
178 status_t (*get_rsa_public_key) (configuration_manager_t *this, identification_t *identification, rsa_public_key_t **public_key);
179
180 /**
181 * @brief Returns the RSA private key of a specific ID.
182 *
183 * The returned rsa_private_key_t object MUST NOT be destroyed cause it's managed by
184 * this configuration_manager_t object.
185 *
186 * @param this calling object
187 * @param identification identification_t object identifiying the ID.
188 * @param[out] private_key the private key will be written there
189 *
190 * @return
191 * - NOT_FOUND if no key is configured for specific id
192 * - SUCCESS
193 */
194 status_t (*get_rsa_private_key) (configuration_manager_t *this, identification_t *identification, rsa_private_key_t **private_key);
195
196 /**
197 * @brief Destroys a configuration_manager_t object.
198 *
199 * @param this calling object
200 */
201 void (*destroy) (configuration_manager_t *this);
202 };
203
204 /**
205 * @brief Creates the mighty configuration manager.
206 *
207 * @param first_retransmit_timeout first retransmit timeout in milliseconds
208 * @param max_retransmit_count max number of tries to retransmitted a requests (0 for infinite)
209 * @param half_open_ike_sa_timeout timeout after that a half open IKE_SA gets deleted
210 * @return configuration_manager_t object
211 *
212 * @ingroup config
213 */
214 configuration_manager_t *configuration_manager_create(u_int32_t first_retransmit_timeout,u_int32_t max_retransmit_count, u_int32_t half_open_ike_sa_timeout);
215
216 #endif /*CONFIGURATION_MANAGER_H_*/