Moving charon to libcharon.
[strongswan.git] / src / libcharon / config / backend.h
1 /*
2 * Copyright (C) 2007-2008 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 backend
18 * @{ @ingroup config
19 */
20
21 #ifndef BACKEND_H_
22 #define BACKEND_H_
23
24 typedef struct backend_t backend_t;
25
26 #include <library.h>
27 #include <config/ike_cfg.h>
28 #include <config/peer_cfg.h>
29 #include <utils/linked_list.h>
30
31 /**
32 * The interface for a configuration backend.
33 *
34 * A configuration backend is loaded into the backend_manager. It does the actual
35 * configuration lookup for the method it implements. See backend_manager_t for
36 * more information.
37 */
38 struct backend_t {
39
40 /**
41 * Create an enumerator over all IKE configs matching two hosts.
42 *
43 * Hosts may be NULL to get all.
44 *
45 * There is no requirement for the backend to filter the configurations
46 * using the supplied hosts; but it may do so if it increases lookup times
47 * (e.g. include hosts in SQL query).
48 *
49 * @param me address of local host
50 * @param other address of remote host
51 * @return enumerator over ike_cfg_t's
52 */
53 enumerator_t* (*create_ike_cfg_enumerator)(backend_t *this,
54 host_t *me, host_t *other);
55 /**
56 * Create an enumerator over all peer configs matching two identities.
57 *
58 * IDs may be NULL to get all.
59 *
60 * As configurations are looked up in the first authentication round (when
61 * multiple authentication), the backend implementation should compare
62 * the identities to the first auth_cfgs only.
63 * There is no requirement for the backend to filter the configurations
64 * using the supplied identities; but it may do so if it increases lookup
65 * times (e.g. include hosts in SQL query).
66 *
67 * @param me identity of ourself
68 * @param other identity of remote host
69 * @return enumerator over peer_cfg_t
70 */
71 enumerator_t* (*create_peer_cfg_enumerator)(backend_t *this,
72 identification_t *me,
73 identification_t *other);
74 /**
75 * Get a peer_cfg identified by it's name, or a name of its children.
76 *
77 * @param name name of peer/child cfg
78 * @return matching peer_config, or NULL if none found
79 */
80 peer_cfg_t *(*get_peer_cfg_by_name)(backend_t *this, char *name);
81 };
82
83 #endif /** BACKEND_H_ @}*/