]>
Commit | Line | Data |
---|---|---|
965e99b5 MW |
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. | |
552cc11b MW |
14 | */ |
15 | ||
16 | /** | |
17 | * @defgroup storage storage | |
18 | * @{ @ingroup manager | |
965e99b5 MW |
19 | */ |
20 | ||
552cc11b MW |
21 | #ifndef STORAGE_H_ |
22 | #define STORAGE_H_ | |
965e99b5 | 23 | |
12642a68 | 24 | #include <collections/enumerator.h> |
965e99b5 MW |
25 | |
26 | ||
552cc11b | 27 | typedef struct storage_t storage_t; |
965e99b5 MW |
28 | |
29 | /** | |
552cc11b | 30 | * Persistent database storage. |
965e99b5 | 31 | */ |
552cc11b | 32 | struct storage_t { |
965e99b5 MW |
33 | |
34 | /** | |
552cc11b | 35 | * Try to log in using specified credentials. |
965e99b5 MW |
36 | * |
37 | * @param username username | |
38 | * @param password plaintext password | |
39 | * @return user ID if login good, 0 otherwise | |
40 | */ | |
552cc11b | 41 | int (*login)(storage_t *this, char *username, char *password); |
7daf5226 | 42 | |
965e99b5 | 43 | /** |
e2630434 | 44 | * Create an enumerator over the gateways. |
965e99b5 MW |
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 | */ | |
7daf5226 | 52 | enumerator_t* (*create_gateway_enumerator)(storage_t *this, int user); |
965e99b5 MW |
53 | |
54 | /** | |
323f9f99 MW |
55 | * Destroy a storage instance. |
56 | */ | |
57 | void (*destroy)(storage_t *this); | |
965e99b5 MW |
58 | }; |
59 | ||
60 | /** | |
552cc11b | 61 | * Create a storage instance. |
965e99b5 | 62 | * |
552cc11b | 63 | * @param uri database connection URI |
965e99b5 | 64 | */ |
552cc11b | 65 | storage_t *storage_create(char *uri); |
965e99b5 | 66 | |
1490ff4d | 67 | #endif /** STORAGE_H_ @}*/ |