1 /* 2 LibRCC - interface to BerkleyDB 3 4 Copyright (C) 2005-2008 Suren A. Chilingaryan <csa@dside.dyndns.org> 5 6 This library is free software; you can redistribute it and/or modify it 7 under the terms of the GNU Lesser General Public License version 2.1 or later 8 as published by the Free Software Foundation. 9 10 This library is distributed in the hope that it will be useful, but WITHOUT 11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 13 for more details. 14 15 You should have received a copy of the GNU Lesser General Public License 16 along with this program; if not, write to the Free Software Foundation, Inc., 17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 */ 19 20 #ifndef _RCC_DB4_H 21 #define _RCC_DB4_H 22 23 #include "librcc.h" 24 25 #include "../config.h" 26 27 #ifdef HAVE_DB_H 28 # include <db.h> 29 #endif /* HAVE_DB_H */ 30 31 struct db4_context_t { 32 #ifdef HAVE_DB_H 33 DB_ENV *dbe; 34 DB *db; 35 #endif /* HAVE_DB_H */ 36 37 int initialized; 38 char *dbpath; 39 rcc_db4_flags flags; 40 }; 41 42 typedef struct db4_context_t db4_context_s; 43 typedef struct db4_context_t *db4_context; 44 45 db4_context rccDb4CreateContext(const char *dbpath, rcc_db4_flags flags); 46 void rccDb4FreeContext(db4_context ctx); 47 48 int rccDb4SetKey(db4_context ctx, const char *orig, size_t olen, const char *string); 49 char *rccDb4GetKey(db4_context ctx, const char *orig, size_t olen); 50 51 #endif /* _RCC_DB4_H */ 52