]> git.ipfire.org Git - people/ms/strongswan.git/blob - programs/charon/charon/config/connections/connection_store.h
- import of strongswan-2.7.0
[people/ms/strongswan.git] / programs / charon / charon / config / connections / connection_store.h
1 /**
2 * @file connection_store.h
3 *
4 * @brief Interface connection_store_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2006 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 CONNECTION_STORE_H_
24 #define CONNECTION_STORE_H_
25
26 #include <types.h>
27 #include <config/connections/connection.h>
28
29
30 typedef struct connection_store_t connection_store_t;
31
32 /**
33 * @brief The interface for a store of connection_t's.
34 *
35 * @b Constructors:
36 * - stroke_create()
37 *
38 * @ingroup config
39 */
40 struct connection_store_t {
41
42 /**
43 * @brief Returns a connection definition identified by two IDs.
44 *
45 * This call is useful to get a connection which is identified by IDs
46 * rather than addresses, e.g. for connection setup on user request.
47 * The returned connection gets created/cloned and therefore must
48 * be destroyed after usage.
49 *
50 * @param this calling object
51 * @param my_id own ID of connection
52 * @param other_id others ID of connection
53 * @return
54 * - connection_t, if found
55 * - NULL otherwise
56 */
57 connection_t *(*get_connection_by_ids) (connection_store_t *this, identification_t *my_id, identification_t *other_id);
58
59 /**
60 * @brief Returns a connection definition identified by two hosts.
61 *
62 * This call is usefull to get a connection identified by addresses.
63 * It may be used after kernel request for traffic protection.
64 * The returned connection gets created/cloned and therefore must
65 * be destroyed after usage.
66 *
67 * @param this calling object
68 * @param my_id own address of connection
69 * @param other_id others address of connection
70 * @return
71 * - connection_t, if found
72 * - NULL otherwise
73 */
74 connection_t *(*get_connection_by_hosts) (connection_store_t *this, host_t *my_host, host_t *other_host);
75
76 /**
77 * @brief Returns a connection identified by its name.
78 *
79 * This call is usefull to get a connection identified its
80 * name, as on an connection setup.
81 *
82 * @param this calling object
83 * @param name name of the connection to get
84 * @return
85 * - connection_t, if found
86 * - NULL otherwise
87 */
88 connection_t *(*get_connection_by_name) (connection_store_t *this, char *name);
89
90 /**
91 * @brief Add a connection to the store.
92 *
93 * After a successful call, the connection is owned by the store and may
94 * not be manipulated nor destroyed.
95 *
96 * @param this calling object
97 * @param connection connection to add
98 * @return
99 * - SUCCESS, or
100 * - FAILED
101 */
102 status_t (*add_connection) (connection_store_t *this, connection_t *connection);
103
104 /**
105 * @brief Destroys a connection_store_t object.
106 *
107 * @param this calling object
108 */
109 void (*destroy) (connection_store_t *this);
110 };
111
112 #endif /* CONNECTION_STORE_H_ */