ike-rekey: Add method to check if there was a rekey collision
[strongswan.git] / src / manager / storage.h
1 /*
2 * Copyright (C) 2007 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup storage storage
18 * @{ @ingroup manager
19 */
20
21 #ifndef STORAGE_H_
22 #define STORAGE_H_
23
24 #include <collections/enumerator.h>
25
26
27 typedef struct storage_t storage_t;
28
29 /**
30 * Persistent database storage.
31 */
32 struct storage_t {
33
34 /**
35 * Try to log in using specified credentials.
36 *
37 * @param username username
38 * @param password plaintext password
39 * @return user ID if login good, 0 otherwise
40 */
41 int (*login)(storage_t *this, char *username, char *password);
42
43 /**
44 * Create an enumerator over the gateways.
45 *
46 * enumerate() arguments: int id, char *name, int port, char *address
47 * If port is 0, address is a Unix socket address.
48 *
49 * @param user user Id
50 * @return enumerator
51 */
52 enumerator_t* (*create_gateway_enumerator)(storage_t *this, int user);
53
54 /**
55 * Destroy a storage instance.
56 */
57 void (*destroy)(storage_t *this);
58 };
59
60 /**
61 * Create a storage instance.
62 *
63 * @param uri database connection URI
64 */
65 storage_t *storage_create(char *uri);
66
67 #endif /** STORAGE_H_ @}*/