2 * @file connection_store.h
4 * @brief Interface connection_store_t.
9 * Copyright (C) 2006 Martin Willi
10 * Hochschule fuer Technik Rapperswil
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>.
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
23 #ifndef CONNECTION_STORE_H_
24 #define CONNECTION_STORE_H_
27 #include <config/connections/connection.h>
30 typedef struct connection_store_t connection_store_t
;
33 * @brief The interface for a store of connection_t's.
40 struct connection_store_t
{
43 * @brief Returns a connection definition identified by two IDs.
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.
50 * @param this calling object
51 * @param my_id own ID of connection
52 * @param other_id others ID of connection
54 * - connection_t, if found
57 connection_t
*(*get_connection_by_ids
) (connection_store_t
*this, identification_t
*my_id
, identification_t
*other_id
);
60 * @brief Returns a connection definition identified by two hosts.
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.
67 * @param this calling object
68 * @param my_id own address of connection
69 * @param other_id others address of connection
71 * - connection_t, if found
74 connection_t
*(*get_connection_by_hosts
) (connection_store_t
*this, host_t
*my_host
, host_t
*other_host
);
77 * @brief Returns a connection identified by its name.
79 * This call is usefull to get a connection identified its
80 * name, as on an connection setup.
82 * @param this calling object
83 * @param name name of the connection to get
85 * - connection_t, if found
88 connection_t
*(*get_connection_by_name
) (connection_store_t
*this, char *name
);
91 * @brief Add a connection to the store.
93 * After a successful call, the connection is owned by the store and may
94 * not be manipulated nor destroyed.
96 * @param this calling object
97 * @param connection connection to add
102 status_t (*add_connection
) (connection_store_t
*this, connection_t
*connection
);
105 * @brief Destroys a connection_store_t object.
107 * @param this calling object
109 void (*destroy
) (connection_store_t
*this);
112 #endif /* CONNECTION_STORE_H_ */