]> git.ipfire.org Git - people/ms/strongswan.git/blame - Source/charon/config/connections/connection_store.h
- added separate implementation for connection_store, credential_store, policy_store
[people/ms/strongswan.git] / Source / charon / config / connections / connection_store.h
CommitLineData
16b9a73c
MW
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>
13e4a62f 27#include <config/connections/connection.h>
16b9a73c
MW
28
29
30typedef struct connection_store_t connection_store_t;
31
32/**
33 * @brief The interface for a store of connection_t's.
34 *
35 * @b Constructors:
13e4a62f 36 * - stroke_create()
16b9a73c
MW
37 *
38 * @ingroup config
39 */
13e4a62f 40struct connection_store_t {
16b9a73c
MW
41
42 /**
43 * @brief Returns a connection definition identified by two IDs.
44 *
13e4a62f
MW
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.
16b9a73c
MW
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 *
13e4a62f
MW
62 * This call is usefull to get a connection identified by addresses.
63 * It may be used after kernel request for traffic protection.
16b9a73c
MW
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
13e4a62f
MW
76 /**
77 * @brief Add a connection to the store.
78 *
79 * After a successful call, the connection is owned by the store and may
80 * not be manipulated nor destroyed.
81 *
82 * @param this calling object
83 * @param connection connection to add
84 * @return
85 * - SUCCESS, or
86 * - FAILED
87 */
88 status_t (*add_connection) (connection_store_t *this, connection_t *connection);
89
16b9a73c
MW
90 /**
91 * @brief Destroys a connection_store_t object.
92 *
93 * @param this calling object
94 */
95 void (*destroy) (connection_store_t *this);
96};
97
13e4a62f 98#endif /* CONNECTION_STORE_H_ */