added more API documentation to backends/interfaces
[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 for two IDs, the others certificate issuer, and
62 * a AC certificate group. The hosts are just a hint to select the
63 * correct config if multiple configs match.
64 *
65 * @param this calling object
66 * @param my_id own ID
67 * @param other_id peers ID
68 * @param my_host address of own host
69 * @param other_host address of remote host
70 * @return matching peer_config, or NULL if none found
71 */
72 peer_cfg_t *(*get_peer_cfg)(backend_t *this,
73 identification_t *my_id, identification_t *other_id,
74 identification_t *other_ca, char *other_group,
75 host_t *my_host, host_t *other_host);
76
77 /**
78 * @brief Check if a backend is writable and implements writable_backend_t.
79 *
80 * @param this calling object
81 * @return TRUE if backend implements writable_backend_t.
82 */
83 bool (*is_writeable)(backend_t *this);
84
85 /**
86 * @brief Destroy a backend.
87 *
88 * @param this calling object
89 */
90 void (*destroy)(backend_t *this);
91 };
92
93
94 /**
95 * Construction to create a backend.
96 */
97 typedef backend_t*(*backend_constructor_t)(void);
98
99 #endif /* BACKEND_H_ */
100