debug info on preshared secrets
[strongswan.git] / src / charon / config / backend_manager.h
1 /**
2 * @file backend_manager.h
3 *
4 * @brief Interface backend_manager_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 BACKEND_MANAGER_H_
24 #define BACKEND_MANAGER_H_
25
26 typedef struct backend_manager_t backend_manager_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 loader and multiplexer to use multiple backends.
38 *
39 * Charon allows the use of multiple configuration backends simultaneously. To
40 * access all this backends by a single call, this class wraps multiple
41 * backends behind a single object. It is also responsible for loading
42 * the backend modules and cleaning them up.
43 * A backend may be writeable or not. All backends implement the backend_t
44 * interface, those who are writeable additionally implement the
45 * writeable_backend_t interface. Adding configs to the backend_manager will
46 * be redirected to the first writeable backend.
47 * @verbatim
48
49 +---------+ +-----------+ +--------------+ |
50 | | | | +--------------+ | |
51 | daemon |----->| backend_- | +--------------+ |-+ <==|==> IPC
52 | core | | manager |---->| backends |-+ |
53 | |----->| | +--------------+ |
54 | | | | |
55 +---------+ +-----------+ |
56
57 @endverbatim
58 *
59 * @b Constructors:
60 * - backend_manager_create()
61 *
62 * @ingroup config
63 */
64 struct backend_manager_t {
65
66 /**
67 * @brief Get an ike_config identified by two hosts.
68 *
69 * @param this calling object
70 * @param my_host address of own host
71 * @param other_host address of remote host
72 * @return matching ike_config, or NULL if none found
73 */
74 ike_cfg_t* (*get_ike_cfg)(backend_manager_t *this,
75 host_t *my_host, host_t *other_host);
76
77 /**
78 * @brief Get a peer_config identified by two IDs and the peer's certificate issuer
79 *
80 * @param this calling object
81 * @param my_id own ID
82 * @param other_id peer ID
83 * @param other_ca_info info record on issuer of peer certificate
84 * @return matching peer_config, or NULL if none found
85 */
86 peer_cfg_t* (*get_peer_cfg)(backend_manager_t *this,
87 identification_t *my_id, identification_t *other_id,
88 ca_info_t *other_ca_info);
89
90 /**
91 * @brief Add a peer_config to the first found writable backend.
92 *
93 * @param this calling object
94 * @param config peer_config to add to the backend
95 */
96 void (*add_peer_cfg)(backend_manager_t *this, peer_cfg_t *config);
97
98 /**
99 * @brief Create an iterator over all peer configs of the writable backend.
100 *
101 * @param this calling object
102 * @return iterator over peer configs
103 */
104 iterator_t* (*create_iterator)(backend_manager_t *this);
105
106 /**
107 * @brief Destroys a backend_manager_t object.
108 *
109 * @param this calling object
110 */
111 void (*destroy) (backend_manager_t *this);
112 };
113
114 /**
115 * @brief Creates a new instance of the manager and loads all backends.
116 *
117 * @return backend_manager instance
118 *
119 * @ingroup config
120 */
121 backend_manager_t* backend_manager_create(void);
122
123 #endif /*BACKEND_MANAGER_H_*/
124