2009-05-14 01:21:56 +02:00
# ifndef foopulsecoredatabasehfoo
# define foopulsecoredatabasehfoo
/***
This file is part of PulseAudio .
Copyright 2009 Lennart Poettering
PulseAudio is free software ; you can redistribute it and / or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation ; either version 2.1 of the
License , or ( at your option ) any later version .
PulseAudio is distributed in the hope that it will be useful , but
WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
Lesser General Public License for more details .
You should have received a copy of the GNU Lesser General Public
2014-11-26 14:14:51 +01:00
License along with PulseAudio ; if not , see < http : //www.gnu.org/licenses/>.
2009-05-14 01:21:56 +02:00
* * */
# include <sys/types.h>
# include <pulsecore/macro.h>
/* A little abstraction over simple databases, such as gdbm, tdb, and
* so on . We only make minimal assumptions about the supported
* backend : it does not need to support locking , it does not have to
2011-08-24 18:24:46 +02:00
* be arch independent . */
2009-05-14 01:21:56 +02:00
typedef struct pa_database pa_database ;
typedef struct pa_datum {
void * data ;
size_t size ;
} pa_datum ;
void pa_datum_free ( pa_datum * d ) ;
2020-11-29 11:21:29 +03:00
/* Database implementation; returns non-empty system architecture name string if database file format depends on system architecture, or NULL otherwise. */
const char * pa_database_get_arch_suffix ( void ) ;
/* Database implementation; returns non-empty database filename extension string */
const char * pa_database_get_filename_suffix ( void ) ;
/* This will attempt opening database file matching compiled CANONICAL_HOST identifier.
* If prependmid is true , file name is augmented with machine id prefix . */
pa_database * pa_database_open ( const char * path , const char * fn , bool prependmid , bool for_write ) ;
/* Database implementation; opens specified database file using provided path. */
pa_database * pa_database_open_internal ( const char * path , bool for_write ) ;
2009-05-14 01:21:56 +02:00
void pa_database_close ( pa_database * db ) ;
pa_datum * pa_database_get ( pa_database * db , const pa_datum * key , pa_datum * data ) ;
2013-06-27 19:28:09 +02:00
int pa_database_set ( pa_database * db , const pa_datum * key , const pa_datum * data , bool overwrite ) ;
2009-05-14 01:21:56 +02:00
int pa_database_unset ( pa_database * db , const pa_datum * key ) ;
int pa_database_clear ( pa_database * db ) ;
signed pa_database_size ( pa_database * db ) ;
pa_datum * pa_database_first ( pa_database * db , pa_datum * key , pa_datum * data /* may be NULL */ ) ;
pa_datum * pa_database_next ( pa_database * db , const pa_datum * key , pa_datum * next , pa_datum * data /* may be NULL */ ) ;
int pa_database_sync ( pa_database * db ) ;
# endif