prototype implemementation of an sqlite configuration backend
[strongswan.git] / src / charon / config / backends / backend.h
1 /**
2 * @file backend.h
3 *
4 * @brief Interface backend_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_H_
24 #define BACKEND_H_
25
26 typedef struct backend_t backend_t;
27
28 #include <library.h>
29 #include <config/ike_cfg.h>
30 #include <config/peer_cfg.h>
31 #include <utils/linked_list.h>
32
33 /**
34 * @brief The interface for a configuration backend.
35 *
36 * A configuration backend is loaded by the backend_manager. It does the actual
37 * configuration lookup for the method it implements. See backend_manager_t for
38 * more information.
39 *
40 * @b Constructors:
41 * - implementations constructors
42 *
43 * @ingroup backends
44 */
45 struct backend_t {
46
47 /**
48 * @brief Get an ike_cfg identified by two hosts.
49 *
50 * @param this calling object
51 * @param my_host address of own host
52 * @param other_host address of remote host
53 * @return matching ike_config, or NULL if none found
54 */
55 ike_cfg_t *(*get_ike_cfg)(backend_t *this,
56 host_t *my_host, host_t *other_host);
57
58 /**
59 * @brief Get a peer_cfg identified by two IDs.
60 *
61 * Select a config based on the two IDs and the other's certificate issuer
62 *
63 * @param this calling object
64 * @param my_id own ID
65 * @param other_id peer ID
66 * @param other_ca_info info record on issuer of peer certificate
67 * @return matching peer_config, or NULL if none found
68 */
69 peer_cfg_t *(*get_peer_cfg)(backend_t *this,
70 identification_t *my_id, identification_t *other_id,
71 ca_info_t *other_ca_info);
72
73 /**
74 * @brief Get a peer_cfg identified by it's name, or a name of its child.
75 *
76 * @param this calling object
77 * @param name
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 * @brief Check if a backend is writable and implements writable_backend_t.
84 *
85 * @param this calling object
86 * @return TRUE if backend implements writable_backend_t.
87 */
88 bool (*is_writeable)(backend_t *this);
89
90 /**
91 * @brief Destroy a backend.
92 *
93 * @param this calling object
94 */
95 void (*destroy)(backend_t *this);
96 };
97
98
99 /**
100 * Construction to create a backend.
101 */
102 typedef backend_t*(*backend_constructor_t)(void);
103
104 #endif /* BACKEND_H_ */
105