1 #ifndef foopulsecoredatabasehfoo
2 #define foopulsecoredatabasehfoo
5 This file is part of PulseAudio.
7 Copyright 2009 Lennart Poettering
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.
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.
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
25 #include <sys/types.h>
27 #include <pulsecore/macro.h>
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 independant. */
34 typedef struct pa_database pa_database
;
36 typedef struct pa_datum
{
41 void pa_datum_free(pa_datum
*d
);
43 /* This will append a suffix to the filename */
44 pa_database
* pa_database_open(const char *fn
, pa_bool_t for_write
);
45 void pa_database_close(pa_database
*db
);
47 pa_datum
* pa_database_get(pa_database
*db
, const pa_datum
*key
, pa_datum
* data
);
49 int pa_database_set(pa_database
*db
, const pa_datum
*key
, const pa_datum
* data
, pa_bool_t overwrite
);
50 int pa_database_unset(pa_database
*db
, const pa_datum
*key
);
52 int pa_database_clear(pa_database
*db
);
54 signed pa_database_size(pa_database
*db
);
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 */);
59 int pa_database_sync(pa_database
*db
);