2 * @file configuration_manager.h
4 * @brief Manages all configuration aspects of the daemon.
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
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>.
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
23 #ifndef CONFIGURATION_MANAGER_H_
24 #define CONFIGURATION_MANAGER_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>
33 typedef struct configuration_manager_t configuration_manager_t
;
36 * @brief Manages all configuration aspects of the daemon.
41 struct configuration_manager_t
{
44 * Get the configuration information needed for IKE_SA_INIT exchange
45 * for a specific configuration name.
47 * The returned init_config_t object MUST NOT be destroyed cause it's the original one.
49 * @param this calling object
50 * @param name name of the configuration
51 * @param[out] init_config the configuration is stored at this place
57 status_t (*get_init_config_for_name
) (configuration_manager_t
*this, char *name
, init_config_t
**init_config
);
60 * Get the configuration information needed for IKE_SA_INIT exchange
61 * for specific host informations.
63 * The returned init_config_t object MUST NOT be destroyed cause it's the original one.
65 * @param this calling object
66 * @param my_host my host informations
67 * @param other_host other host informations
68 * @param[out] init_config the configuration is stored at this place
74 status_t (*get_init_config_for_host
) (configuration_manager_t
*this, host_t
*my_host
, host_t
*other_host
,init_config_t
**init_config
);
77 * Get the configuration information needed after IKE_SA_INIT exchange.
79 * The returned sa_config_t object MUST not be destroyed cause it's the original one.
81 * @param this calling object
82 * @param name name of the configuration
83 * @param[out] sa_config the configuration is stored at this place
89 status_t (*get_sa_config_for_name
) (configuration_manager_t
*this, char *name
, sa_config_t
**sa_config
);
92 * Get the configuration information needed after IKE_SA_INIT exchange
93 * for specific init_config_t and ID data.
95 * The returned sa_config_t object MUST NOT be destroyed cause it's the original one.
97 * @param this calling object
98 * @param init_config init_config_t object
99 * @param other_id identification of other one
100 * @param my_id my identification (can be NULL)
101 * @param[out] sa_config the configuration is stored at this place
107 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
);
110 * Get the retransmit timeout.
112 * The timeout values are managed by the configuration manager.
114 * @param this calling object
115 * @param retransmit_count number of times a message was allready retransmitted
116 * @param[out] timeout the new retransmit timeout in milliseconds
119 * - FAILED, if the message should not be resent again
122 status_t (*get_retransmit_timeout
) (configuration_manager_t
*this, u_int32_t retransmit_count
, u_int32_t
*timeout
);
125 * Get the preshared secret of a specific ID.
127 * The preshared secret gets not cloned.
129 * @param this calling object
130 * @param identification identification_t object identifiying the ID.
131 * @param[out] preshared_secret the preshared secret will be written there
134 * - NOT_FOUND if no preshared secrets is configured for specific id
137 status_t (*get_shared_secret
) (configuration_manager_t
*this, identification_t
*identification
, chunk_t
*preshared_secret
);
140 * Get the RSA public key of a specific ID.
142 * Object is not cloned and shuld not be destroyed.
144 * @param this calling object
145 * @param identification identification_t object identifiying the ID.
146 * @param[out] public_key the public key will be written there
149 * - NOT_FOUND if no key is configured for specific id
152 status_t (*get_rsa_public_key
) (configuration_manager_t
*this, identification_t
*identification
, rsa_public_key_t
**public_key
);
155 * Get the RSA public key of a specific ID.
157 * Object is not cloned and shuld not be destroyed.
159 * @param this calling object
160 * @param identification identification_t object identifiying the ID.
161 * @param[out] private_key the private key will be written there
164 * - NOT_FOUND if no key is configured for specific id
167 status_t (*get_rsa_private_key
) (configuration_manager_t
*this, identification_t
*identification
, rsa_private_key_t
**private_key
);
170 * Destroys configuration manager
173 * @param this calling object
177 void (*destroy
) (configuration_manager_t
*this);
181 * Creates the mighty configuration manager
183 * @param first_retransmit_timeout first retransmit timeout in milliseconds
184 * @param max_retransmit_count max number of retransmitted requests (0 for infinite)
186 * - pointer to created manager object if succeeded
187 * - NULL if memory allocation failed
191 configuration_manager_t
*configuration_manager_create(u_int32_t first_retransmit_timeout
,u_int32_t max_retransmit_count
);
193 #endif /*CONFIGURATION_MANAGER_H_*/