fixed crash if crl fetching fails
[strongswan.git] / src / charon / config / backend_manager.h
1 /*
2 * Copyright (C) 2007 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * $Id$
16 */
17
18 /**
19 * @defgroup backend_manager backend_manager
20 * @{ @ingroup config
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/backend.h>
34
35
36 /**
37 * 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.
42 * @verbatim
43
44 +---------+ +-----------+ +--------------+ |
45 | | | | +--------------+ | |
46 | daemon |----->| backend_- | +--------------+ |-+ <==|==> IPC
47 | core | | manager |---->| backends |-+ |
48 | |----->| | +--------------+ |
49 | | | | |
50 +---------+ +-----------+ |
51
52 @endverbatim
53 */
54 struct backend_manager_t {
55
56 /**
57 * Get an ike_config identified by two hosts.
58 *
59 * @param my_host address of own host
60 * @param other_host address of remote host
61 * @return matching ike_config, or NULL if none found
62 */
63 ike_cfg_t* (*get_ike_cfg)(backend_manager_t *this,
64 host_t *my_host, host_t *other_host);
65
66 /**
67 * Get a peer_config identified by two IDs and authorization info.
68 *
69 * @param my_id own ID
70 * @param other_id peer ID
71 * @param auth_info authorization info
72 * @return matching peer_config, or NULL if none found
73 */
74 peer_cfg_t* (*get_peer_cfg)(backend_manager_t *this, identification_t *my_id,
75 identification_t *other_id, auth_info_t *auth);
76
77 /**
78 * Get a peer_config identified by it's name.
79 *
80 * @param name name of the peer_config
81 * @return matching peer_config, or NULL if none found
82 */
83 peer_cfg_t* (*get_peer_cfg_by_name)(backend_manager_t *this, char *name);
84
85 /**
86 * Create an enumerator over all peer configs.
87 *
88 * @return enumerator over peer configs
89 */
90 enumerator_t* (*create_peer_cfg_enumerator)(backend_manager_t *this);
91
92 /**
93 * Register a backend on the manager.
94 *
95 * @param backend backend to register
96 */
97 void (*add_backend)(backend_manager_t *this, backend_t *backend);
98
99 /**
100 * Unregister a backend.
101 *
102 * @param backend backend to unregister
103 */
104 void (*remove_backend)(backend_manager_t *this, backend_t *backend);
105
106 /**
107 * Destroys a backend_manager_t object.
108 */
109 void (*destroy) (backend_manager_t *this);
110 };
111
112 /**
113 * Create an instance of the backend manager
114 *
115 * @return backend_manager instance
116 */
117 backend_manager_t* backend_manager_create(void);
118
119 #endif /*BACKEND_MANAGER_H_ @} */
120