Removed strayed code fragment
[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
16 /**
17 * @defgroup backend_manager backend_manager
18 * @{ @ingroup config
19 */
20
21 #ifndef BACKEND_MANAGER_H_
22 #define BACKEND_MANAGER_H_
23
24 typedef struct backend_manager_t backend_manager_t;
25
26 #include <library.h>
27 #include <utils/host.h>
28 #include <utils/identification.h>
29 #include <config/ike_cfg.h>
30 #include <config/peer_cfg.h>
31 #include <config/backend.h>
32
33
34 /**
35 * A loader and multiplexer to use multiple backends.
36 *
37 * Charon allows the use of multiple configuration backends simultaneously. To
38 * access all this backends by a single call, this class wraps multiple
39 * backends behind a single object.
40 * @verbatim
41
42 +---------+ +-----------+ +--------------+ |
43 | | | | +--------------+ | |
44 | daemon |----->| backend_- | +--------------+ |-+ <==|==> IPC
45 | core | | manager |---->| backends |-+ |
46 | |----->| | +--------------+ |
47 | | | | |
48 +---------+ +-----------+ |
49
50 @endverbatim
51 */
52 struct backend_manager_t {
53
54 /**
55 * Get an ike_config identified by two hosts.
56 *
57 * @param my_host address of own host
58 * @param other_host address of remote host
59 * @return matching ike_config, or NULL if none found
60 */
61 ike_cfg_t* (*get_ike_cfg)(backend_manager_t *this,
62 host_t *my_host, host_t *other_host);
63
64 /**
65 * Get a peer_config identified by it's name.
66 *
67 * @param name name of the peer_config
68 * @return matching peer_config, or NULL if none found
69 */
70 peer_cfg_t* (*get_peer_cfg_by_name)(backend_manager_t *this, char *name);
71
72 /**
73 * Create an enumerator over all matching peer configs.
74 *
75 * Pass NULL as parameters to match any. The enumerator enumerates over
76 * peer_cfgs, ordered by priority (best match first).
77 *
78 * @param me local address
79 * @param other remote address
80 * @param my_id IDr in first authentication round
81 * @param other_id IDi in first authentication round
82 * @return enumerator over peer_cfg_t
83 */
84 enumerator_t* (*create_peer_cfg_enumerator)(backend_manager_t *this,
85 host_t *me, host_t *other, identification_t *my_id,
86 identification_t *other_id);
87 /**
88 * Register a backend on the manager.
89 *
90 * @param backend backend to register
91 */
92 void (*add_backend)(backend_manager_t *this, backend_t *backend);
93
94 /**
95 * Unregister a backend.
96 *
97 * @param backend backend to unregister
98 */
99 void (*remove_backend)(backend_manager_t *this, backend_t *backend);
100
101 /**
102 * Destroys a backend_manager_t object.
103 */
104 void (*destroy) (backend_manager_t *this);
105 };
106
107 /**
108 * Create an instance of the backend manager
109 *
110 * @return backend_manager instance
111 */
112 backend_manager_t* backend_manager_create(void);
113
114 #endif /** BACKEND_MANAGER_H_ @}*/