fixed CHILD_SA proposal selection when not using DH exchange
[strongswan.git] / src / charon / config / cfg_store.h
1 /**
2 * @file cfg_store.h
3 *
4 * @brief Interface cfg_store_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2007 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 CFG_STORE_H_
24 #define CFG_STORE_H_
25
26 typedef struct cfg_store_t cfg_store_t;
27
28 #include <library.h>
29 #include <utils/host.h>
30 #include <utils/identification.h>
31 #include <config/ike_cfg.h>
32 #include <config/peer_cfg.h>
33 #include <config/backends/backend.h>
34
35
36 /**
37 * @brief A multiplexer to use multiple cfg_store backends.
38 *
39 * Charon allows the use of multiple cfg_store backends simultaneously. To
40 * access all this backends by a single call, this class wraps multiple
41 * backends behind a single object.
42 * Backends may be registered and unregister at runtime dynamically.
43 * @verbatim
44
45 +---------+ +-----------+ +--------------+ |
46 | | | | +--------------+ | |
47 | daemon |----->| cfg_store | +--------------+ |-+ <==|==> IPC
48 | core | | |---->| backends |-+ |
49 | |----->| | +--------------+ |
50 | | | | |
51 +---------+ +-----------+ |
52
53 @endverbatim
54 * Configuration lookup is done only when acting as responder. For initating
55 * the corresponding controller is responsible to get a config to initiate.
56 *
57 * @b Constructors:
58 * - cfg_store_create()
59 *
60 * @ingroup config
61 */
62 struct cfg_store_t {
63
64 /**
65 * @brief Get an ike_config identified by two hosts.
66 *
67 * @param this calling object
68 * @param my_host address of own host
69 * @param other_host address of remote host
70 * @return matching ike_config, or NULL if none found
71 */
72 ike_cfg_t *(*get_ike_cfg)(cfg_store_t *this,
73 host_t *my_host, host_t *other_host);
74
75 /**
76 * @brief Get a peer_config identified by two IDs.
77 *
78 * @param this calling object
79 * @param my_id own ID
80 * @param other_id peers ID
81 * @return matching peer_config, or NULL if none found
82 */
83 peer_cfg_t *(*get_peer_cfg)(cfg_store_t *this, identification_t *my_id,
84 identification_t *other_id);
85
86 /**
87 * @brief Register a backend to be queried by the calls above.
88 *
89 * The backend first added is the most preferred.
90 *
91 * @param this calling object
92 */
93 void (*register_backend) (cfg_store_t *this, backend_t *backend);
94
95 /**
96 * @brief Unregister a backend.
97 *
98 * @param this calling object
99 */
100 void (*unregister_backend) (cfg_store_t *this, backend_t *backend);
101
102 /**
103 * @brief Destroys a cfg_store_t object.
104 *
105 * @param this calling object
106 */
107 void (*destroy) (cfg_store_t *this);
108 };
109
110 /**
111 * @brief Create a new instance of the store.
112 *
113 * @return cfg_store instance
114 *
115 * @ingroup config
116 */
117 cfg_store_t *cfg_store_create(void);
118
119 #endif /*CFG_STORE_H_*/