4 * @brief Interface of database_t.
9 * Copyright (C) 2007 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
26 #include <utils/enumerator.h>
29 typedef struct database_t database_t
;
32 * @brief Persistent database.
37 * @brief Try to log in using specified credentials.
39 * @param username username
40 * @param password plaintext password
41 * @return user ID if login good, 0 otherwise
43 int (*login
)(database_t
*this, char *username
, char *password
);
46 * @brief Create an iterator over the gateways.
48 * enumerate() arguments: int id, char *name, int port, char *address
49 * If port is 0, address is a Unix socket address.
54 enumerator_t
* (*create_gateway_enumerator
)(database_t
*this, int user
);
57 * @brief Destroy a database instance.
59 void (*destroy
)(database_t
*this);
63 * @brief Create a database instance.
65 * @param dbfile SQLite database file
67 database_t
*database_create(char *dbfile
);
69 #endif /* DATABASE_H_ */