2 * @file configuration_manager.h
4 * @brief Interface of configuration_manager_t.
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.
39 * - configuration_manager_create()
44 struct configuration_manager_t
{
47 * @brief Returns the configuration information needed for IKE_SA_INIT exchange
48 * for a specific configuration name.
50 * The returned init_config_t object MUST NOT be destroyed cause it's managed by
51 * this configuration_manager_t object.
53 * @param this calling object
54 * @param name name of the configuration
55 * @param[out] init_config the init_config_t object is stored at this location
61 status_t (*get_init_config_for_name
) (configuration_manager_t
*this, char *name
, init_config_t
**init_config
);
64 * @brief Returns the configuration information needed for IKE_SA_INIT exchange
65 * for specific host informations.
67 * The returned init_config_t object MUST NOT be destroyed cause it's managed by
68 * this configuration_manager_t object.
70 * @param this calling object
71 * @param my_host my host informations
72 * @param other_host other host informations
73 * @param[out] init_config the init_config_t object is stored at this location
79 status_t (*get_init_config_for_host
) (configuration_manager_t
*this, host_t
*my_host
, host_t
*other_host
,init_config_t
**init_config
);
82 * @brief Returns the configuration information needed after IKE_SA_INIT exchange
83 * for a specific configuration name.
85 * The returned sa_config_t object MUST NOT be destroyed cause it's managed by
86 * this configuration_manager_t object.
88 * @param this calling object
89 * @param name name of the configuration
90 * @param[out] sa_config the sa_config_t object is stored at this location
96 status_t (*get_sa_config_for_name
) (configuration_manager_t
*this, char *name
, sa_config_t
**sa_config
);
99 * @brief Returns the configuration information needed after IKE_SA_INIT exchange
100 * for specific init_config_t and ID data.
102 * The returned sa_config_t object MUST NOT be destroyed cause it's managed by
103 * this configuration_manager_t object.
105 * @param this calling object
106 * @param init_config init_config_t object
107 * @param other_id identification of other one
108 * @param my_id my identification (can be NULL)
109 * @param[out] sa_config the sa_config_t object is stored at this location
115 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
);
118 * @brief Returns the retransmit timeout.
120 * The timeout values are managed by the configuration manager.
122 * @param this calling object
123 * @param retransmit_count number of times a message was retransmitted so far
124 * @param[out] timeout the new retransmit timeout in milliseconds
127 * - FAILED, if the message should not be retransmitted
130 status_t (*get_retransmit_timeout
) (configuration_manager_t
*this, u_int32_t retransmit_count
, u_int32_t
*timeout
);
133 * @brief Returns the preshared secret of a specific ID.
135 * The returned preshared secret MUST NOT be destroyed cause it's managed by
136 * this configuration_manager_t object.
138 * @param this calling object
139 * @param identification identification_t object identifiying the ID.
140 * @param[out] preshared_secret the preshared secret will be written there.
143 * - NOT_FOUND if no preshared secrets for specific ID could be found
146 status_t (*get_shared_secret
) (configuration_manager_t
*this, identification_t
*identification
, chunk_t
*preshared_secret
);
149 * @brief Returns the RSA public key of a specific ID.
151 * The returned rsa_public_key_t object MUST NOT be destroyed cause it's managed by
152 * this configuration_manager_t object.
154 * @param this calling object
155 * @param identification identification_t object identifiying the ID.
156 * @param[out] public_key the public key will be written there
159 * - NOT_FOUND if no key is configured for specific id
162 status_t (*get_rsa_public_key
) (configuration_manager_t
*this, identification_t
*identification
, rsa_public_key_t
**public_key
);
165 * @brief Returns the RSA private key of a specific ID.
167 * The returned rsa_private_key_t object MUST NOT be destroyed cause it's managed by
168 * this configuration_manager_t object.
170 * @param this calling object
171 * @param identification identification_t object identifiying the ID.
172 * @param[out] private_key the private key will be written there
175 * - NOT_FOUND if no key is configured for specific id
178 status_t (*get_rsa_private_key
) (configuration_manager_t
*this, identification_t
*identification
, rsa_private_key_t
**private_key
);
181 * Destroys a configuration_manager_t object.
183 * @param this calling object
187 void (*destroy
) (configuration_manager_t
*this);
191 * @brief Creates the mighty configuration manager.
193 * @param first_retransmit_timeout first retransmit timeout in milliseconds
194 * @param max_retransmit_count max number of tries to retransmitted a requests (0 for infinite)
196 * - pointer to created configuration_manager_t object
199 configuration_manager_t
*configuration_manager_create(u_int32_t first_retransmit_timeout
,u_int32_t max_retransmit_count
);
201 #endif /*CONFIGURATION_MANAGER_H_*/