]> code.delx.au - pulseaudio/blob - src/pulsecore/database.h
remap: Change remapping function argument type from void to int16_t / float as approp...
[pulseaudio] / src / pulsecore / database.h
1 #ifndef foopulsecoredatabasehfoo
2 #define foopulsecoredatabasehfoo
3
4 /***
5 This file is part of PulseAudio.
6
7 Copyright 2009 Lennart Poettering
8
9 PulseAudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as
11 published by the Free Software Foundation; either version 2.1 of the
12 License, or (at your option) any later version.
13
14 PulseAudio is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with PulseAudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 USA.
23 ***/
24
25 #include <sys/types.h>
26
27 #include <pulsecore/macro.h>
28
29 /* A little abstraction over simple databases, such as gdbm, tdb, and
30 * so on. We only make minimal assumptions about the supported
31 * backend: it does not need to support locking, it does not have to
32 * be arch independent. */
33
34 typedef struct pa_database pa_database;
35
36 typedef struct pa_datum {
37 void *data;
38 size_t size;
39 } pa_datum;
40
41 void pa_datum_free(pa_datum *d);
42
43 /* This will append a suffix to the filename */
44 pa_database* pa_database_open(const char *fn, bool for_write);
45 void pa_database_close(pa_database *db);
46
47 pa_datum* pa_database_get(pa_database *db, const pa_datum *key, pa_datum* data);
48
49 int pa_database_set(pa_database *db, const pa_datum *key, const pa_datum* data, bool overwrite);
50 int pa_database_unset(pa_database *db, const pa_datum *key);
51
52 int pa_database_clear(pa_database *db);
53
54 signed pa_database_size(pa_database *db);
55
56 pa_datum* pa_database_first(pa_database *db, pa_datum *key, pa_datum *data /* may be NULL */);
57 pa_datum* pa_database_next(pa_database *db, const pa_datum *key, pa_datum *next, pa_datum *data /* may be NULL */);
58
59 int pa_database_sync(pa_database *db);
60
61 #endif