Use the vararg list constructor in quick mode task
[strongswan.git] / src / libcharon / 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 * @param version IKE version to get a config for
60 * @return matching ike_config, or NULL if none found
61 */
62 ike_cfg_t* (*get_ike_cfg)(backend_manager_t *this,
63 host_t *my_host, host_t *other_host);
64
65 /**
66 * Get a peer_config identified by it's name.
67 *
68 * @param name name of the peer_config
69 * @return matching peer_config, or NULL if none found
70 */
71 peer_cfg_t* (*get_peer_cfg_by_name)(backend_manager_t *this, char *name);
72
73 /**
74 * Create an enumerator over all matching peer configs.
75 *
76 * Pass NULL as parameters to match any. The enumerator enumerates over
77 * peer_cfgs, ordered by priority (best match first).
78 *
79 * @param me local address
80 * @param other remote address
81 * @param my_id IDr in first authentication round
82 * @param other_id IDi in first authentication round
83 * @param version IKE version to get a config for
84 * @return enumerator over peer_cfg_t
85 */
86 enumerator_t* (*create_peer_cfg_enumerator)(backend_manager_t *this,
87 host_t *me, host_t *other, identification_t *my_id,
88 identification_t *other_id, ike_version_t version);
89 /**
90 * Register a backend on the manager.
91 *
92 * @param backend backend to register
93 */
94 void (*add_backend)(backend_manager_t *this, backend_t *backend);
95
96 /**
97 * Unregister a backend.
98 *
99 * @param backend backend to unregister
100 */
101 void (*remove_backend)(backend_manager_t *this, backend_t *backend);
102
103 /**
104 * Destroys a backend_manager_t object.
105 */
106 void (*destroy) (backend_manager_t *this);
107 };
108
109 /**
110 * Create an instance of the backend manager
111 *
112 * @return backend_manager instance
113 */
114 backend_manager_t* backend_manager_create(void);
115
116 #endif /** BACKEND_MANAGER_H_ @}*/