X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Fldbm.h;h=56e92829835f1cd9194a342a5dd40282af4e1103;hb=a8437c203858e579c4d6c96d4feedb4647d8aca2;hp=e57fa341c65bb5886b027128cee8e8569b2716a8;hpb=780d4737afa2ff0fe42883ef160a0c66645ca2ac;p=openldap diff --git a/include/ldbm.h b/include/ldbm.h index e57fa341c6..56e9282983 100644 --- a/include/ldbm.h +++ b/include/ldbm.h @@ -1,12 +1,13 @@ /* $OpenLDAP$ */ /* - * Copyright 1998-2000 The OpenLDAP Foundation, Redwood City, California, USA + * Copyright 1998-2001 The OpenLDAP Foundation, Redwood City, California, USA * All rights reserved. * - * Redistribution and use in source and binary forms are permitted only - * as authorized by the OpenLDAP Public License. A copy of this - * license is available at http://www.OpenLDAP.org/license.html or - * in file LICENSE in the top-level directory of the distribution. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. A copy of this license is available at + * http://www.OpenLDAP.org/license.html or in file LICENSE in the + * top-level directory of the distribution. */ /* ldbm.h - ldap dbm compatibility routine header file */ @@ -15,6 +16,11 @@ #include +/* dummy DB_ENV for non Berkeley DB */ +#if !defined( LDBM_USE_DBBTREE ) && !defined( LDBM_USE_DBHASH ) +# define DB_ENV void +#endif + #if defined( LDBM_USE_DBBTREE ) || defined( LDBM_USE_DBHASH ) /***************************************************************** @@ -28,24 +34,28 @@ #ifdef HAVE_DB_185_H # include -#ifndef DB_VERSION_MAJOR -# define DB_VERSION_MAJOR 1 -#endif -#ifndef DB_VERSION_MINOR -# define DB_VERSION_MINOR 85 -#endif #else # ifdef HAVE_DB1_DB_H # include # else # include # endif -# if DB_VERSION_MAJOR >= 2 -# define R_NOOVERWRITE DB_NOOVERWRITE -# ifndef DEFAULT_DB_PAGE_SIZE -# define DEFAULT_DB_PAGE_SIZE 4096 -# endif +#endif + +#ifndef DB_VERSION_MAJOR +# define DB_VERSION_MAJOR 1 +#endif +#ifndef DB_VERSION_MINOR +# define DB_VERSION_MINOR 85 +#endif + +#if DB_VERSION_MAJOR >= 2 +# define R_NOOVERWRITE DB_NOOVERWRITE +# ifndef DEFAULT_DB_PAGE_SIZE +# define DEFAULT_DB_PAGE_SIZE 4096 # endif +#else +# define DB_ENV void #endif @@ -234,26 +244,29 @@ LDAP_END_DECL LDAP_BEGIN_DECL -LIBLDBM_F (int) ldbm_initialize( void ); -LIBLDBM_F (int) ldbm_shutdown( void ); +LDAP_LDBM_F (int) ldbm_initialize( const char * ); +LDAP_LDBM_F (int) ldbm_shutdown( void ); + +LDAP_LDBM_F (DB_ENV*) ldbm_initialize_env(const char *, int dbcachesize, int *envdirok); +LDAP_LDBM_F (void) ldbm_shutdown_env(DB_ENV *); -LIBLDBM_F (int) ldbm_errno( LDBM ldbm ); -LIBLDBM_F (LDBM) ldbm_open( char *name, int rw, int mode, int dbcachesize ); -LIBLDBM_F (void) ldbm_close( LDBM ldbm ); -LIBLDBM_F (void) ldbm_sync( LDBM ldbm ); -LIBLDBM_F (void) ldbm_datum_free( LDBM ldbm, Datum data ); -LIBLDBM_F (Datum) ldbm_datum_dup( LDBM ldbm, Datum data ); -LIBLDBM_F (Datum) ldbm_fetch( LDBM ldbm, Datum key ); -LIBLDBM_F (int) ldbm_store( LDBM ldbm, Datum key, Datum data, int flags ); -LIBLDBM_F (int) ldbm_delete( LDBM ldbm, Datum key ); +LDAP_LDBM_F (int) ldbm_errno( LDBM ldbm ); +LDAP_LDBM_F (LDBM) ldbm_open( DB_ENV *env, char *name, int rw, int mode, int dbcachesize ); +LDAP_LDBM_F (void) ldbm_close( LDBM ldbm ); +LDAP_LDBM_F (void) ldbm_sync( LDBM ldbm ); +LDAP_LDBM_F (void) ldbm_datum_free( LDBM ldbm, Datum data ); +LDAP_LDBM_F (Datum) ldbm_datum_dup( LDBM ldbm, Datum data ); +LDAP_LDBM_F (Datum) ldbm_fetch( LDBM ldbm, Datum key ); +LDAP_LDBM_F (int) ldbm_store( LDBM ldbm, Datum key, Datum data, int flags ); +LDAP_LDBM_F (int) ldbm_delete( LDBM ldbm, Datum key ); -LIBLDBM_F (Datum) ldbm_firstkey( LDBM ldbm, LDBMCursor **cursor ); -LIBLDBM_F (Datum) ldbm_nextkey( LDBM ldbm, Datum key, LDBMCursor *cursor ); +LDAP_LDBM_F (Datum) ldbm_firstkey( LDBM ldbm, LDBMCursor **cursor ); +LDAP_LDBM_F (Datum) ldbm_nextkey( LDBM ldbm, Datum key, LDBMCursor *cursor ); /* initialization of Datum structures */ #if defined( HAVE_BERKELEY_DB ) && (DB_VERSION_MAJOR >= 2) - LIBLDBM_F (void *) ldbm_malloc( size_t size ); -# define ldbm_datum_init(d) ((void)memset(&(d), 0, sizeof(Datum))) + LDAP_LDBM_F (void *) ldbm_malloc( size_t size ); +# define ldbm_datum_init(d) ((void)memset(&(d), '\0', sizeof(Datum))) #else # define ldbm_datum_init(d) ((void)0) #endif /* HAVE_BERKELEY_DB */