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 <utils/linked_list.h>
28 #include <network/host.h>
29 #include <encoding/payloads/transform_substructure.h>
30 #include <transforms/prfs/prf.h>
31 #include <transforms/signers/signer.h>
32 #include <transforms/crypters/crypter.h>
35 typedef struct configuration_manager_t configuration_manager_t
;
38 * @brief Manages all configuration aspects of the daemon.
40 * Currently the configuration manager class does not store specific configurations.
41 * It is expected, that in future different configurations are stored in a linked list
42 * or a hash map and are managed by this class.
47 struct configuration_manager_t
{
50 * Gets the remote host information for a specific configuration name.
52 * A host information consist of IP address and UDP port.
54 * @param this calling object
55 * @param name name of the configuration
56 * @param host remote host information gets stored at this location
62 status_t (*get_remote_host
) (configuration_manager_t
*this, char *name
, host_t
**host
);
65 * Gets the local host information for a specific configuration name
67 * A host information consist of IP address and UDP port.
69 * @param this calling object
70 * @param name name of the configuration
71 * @param host local host information gets stored at this location
74 * - NOT_FOUND (not yet implemented)
77 status_t (*get_local_host
) (configuration_manager_t
*this, char *name
, host_t
**host
);
80 * Returns the DH group number to use when initiating a connection.
82 * To make sure that different group numbers are supported in case
83 * a group number is not supported by other peer, a priority has to get defined.
86 * @param this calling object
87 * @param name name of the configuration
88 * @param dh_group_number the DH group number gets stored at this location
89 * @param priority priority to use for selection of DH group number.
90 * Highest priority is 1. All higher values have lower
94 * - FAILED (not yet implemented)
95 * - NOT_FOUND (not yet implemented)
98 status_t (*get_dh_group_number
) (configuration_manager_t
*this, char *name
, u_int16_t
*dh_group_number
, u_int16_t priority
);
101 * Returns the proposals which should be used to initiate a connection with a specific
104 * The proposals of type proposal_substructure_t * are returned over the given iterator
105 * and have to be destroyed by the caller.
108 * @param this calling object
109 * @param host host information used to find the correct proposals
110 * @param list iterator where the proposals are written to
113 * - NOT_FOUND (not yet implemented)
116 status_t (*get_proposals_for_host
) (configuration_manager_t
*this, host_t
*host
, iterator_t
*list
);
119 * Checks the suggested proposals passed as iterator in and selects one proposal to be sent as selection
122 * Currently there is no check implemented. The first suggested proposal is cloned and then as selected returned.
125 * @param this calling object
126 * @param host host information used to find the correct proposals
127 * @param in iterator with suggested proposals of type proposal_substructure_t *
128 * @param out The selected proposals of type proposal_substructure_t * are written to this iterator
132 * - NOT_FOUND (not yet implemented)
135 status_t (*select_proposals_for_host
) (configuration_manager_t
*this, host_t
*host
, iterator_t
*in
, iterator_t
*out
);
138 * Checks if the selected proposals of a remote hosts are valid.
141 * @param this calling object
142 * @param host host information
143 * @param proposals iterator with selected proposals
144 * @param[out] valid TRUE if selected proposals are accepted
148 * - NOT_FOUND (not yet implemented)
151 status_t (*check_selected_proposals_for_host
) (configuration_manager_t
*this,
153 iterator_t
*proposals
,
157 * Checks if a given dh_group number is allowed for a specific host
160 * @param this calling object
161 * @param host host information
162 * @param group DH group number to check if allowed
163 * @param[out] allowed will be set to TRUE if group number is allowed, FALSE otherwise
167 * - NOT_FOUND (not yet implemented)
170 status_t (*is_dh_group_allowed_for_host
) (configuration_manager_t
*this, host_t
*host
, diffie_hellman_group_t group
, bool *allowed
);
173 * Destroys configuration manager
176 * @param this calling object
180 status_t (*destroy
) (configuration_manager_t
*this);
184 * Creates the mighty configuration manager
187 * - pointer to created manager object if succeeded
188 * - NULL if memory allocation failed
192 configuration_manager_t
*configuration_manager_create();
194 #endif /*CONFIGURATION_MANAGER_H_*/