- retransmitting of requests implemented
[strongswan.git] / Source / charon / config / configuration_manager.h
1 /**
2 * @file configuration_manager.h
3 *
4 * @brief Manages all configuration aspects of the daemon.
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
30
31 typedef struct configuration_manager_t configuration_manager_t;
32
33 /**
34 * @brief Manages all configuration aspects of the daemon.
35 *
36 * @ingroup config
37 *
38 */
39 struct configuration_manager_t {
40
41 /**
42 * Get the configuration information needed for IKE_SA_INIT exchange
43 * for a specific configuration name.
44 *
45 * The returned init_config_t object MUST NOT be destroyed cause it's the original one.
46 *
47 * @param this calling object
48 * @param name name of the configuration
49 * @param[out] init_config the configuration is stored at this place
50 *
51 * @return
52 * - NOT_FOUND
53 * - SUCCESS
54 */
55 status_t (*get_init_config_for_name) (configuration_manager_t *this, char *name, init_config_t **init_config);
56
57 /**
58 * Get the configuration information needed for IKE_SA_INIT exchange
59 * for specific host informations.
60 *
61 * The returned init_config_t object MUST NOT be destroyed cause it's the original one.
62 *
63 * @param this calling object
64 * @param my_host my host informations
65 * @param other_host other host informations
66 * @param[out] init_config the configuration is stored at this place
67 *
68 * @return
69 * - NOT_FOUND
70 * - SUCCESS
71 */
72 status_t (*get_init_config_for_host) (configuration_manager_t *this, host_t *my_host, host_t *other_host,init_config_t **init_config);
73
74 /**
75 * Get the configuration information needed after IKE_SA_INIT exchange.
76 *
77 * The returned sa_config_t object MUST not be destroyed cause it's the original one.
78 *
79 * @param this calling object
80 * @param name name of the configuration
81 * @param[out] sa_config the configuration is stored at this place
82 *
83 * @return
84 * - NOT_FOUND
85 * - SUCCESS
86 */
87 status_t (*get_sa_config_for_name) (configuration_manager_t *this, char *name, sa_config_t **sa_config);
88
89 /**
90 * Get the configuration information needed after IKE_SA_INIT exchange
91 * for specific init_config_t and ID data.
92 *
93 * The returned sa_config_t object MUST NOT be destroyed cause it's the original one.
94 *
95 * @param this calling object
96 * @param init_config init_config_t object
97 * @param other_id identification of other one
98 * @param my_id my identification (can be NULL)
99 * @param[out] sa_config the configuration is stored at this place
100 *
101 * @return
102 * - NOT_FOUND
103 * - SUCCESS
104 */
105 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);
106
107 /**
108 * Get the retransmit timeout.
109 *
110 * The timeout values are managed by the configuration manager.
111 *
112 * @param this calling object
113 * @param retransmit_count number of times a message was allready retransmitted
114 * @param[out] timeout the new retransmit timeout in milliseconds
115 *
116 * @return
117 * - FAILED if the message should not be resent again
118 * - SUCCESS
119 */
120 status_t (*get_retransmit_timeout) (configuration_manager_t *this, u_int32_t retransmit_count, u_int32_t *timeout);
121
122 /**
123 * Destroys configuration manager
124 *
125 *
126 * @param this calling object
127 * @return
128 * - SUCCESS
129 */
130 void (*destroy) (configuration_manager_t *this);
131 };
132
133 /**
134 * Creates the mighty configuration manager
135 *
136 * @param first_retransmit_timeout first retransmit timeout in milliseconds
137 * @param max_retransmit_count max number of retransmitted requests (0 for infinite)
138 * @return
139 * - pointer to created manager object if succeeded
140 * - NULL if memory allocation failed
141 *
142 * @ingroup config
143 */
144 configuration_manager_t *configuration_manager_create(u_int32_t first_retransmit_timeout,u_int32_t max_retransmit_count);
145
146 #endif /*CONFIGURATION_MANAGER_H_*/