/* $OpenLDAP$ */
-/*
- * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2000-2005 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * 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 in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
*/
#ifndef _PROTO_BDB_H
#ifdef BDB_HIER
#define BDB_SYMBOL(x) LDAP_CONCAT(hdb_,x)
+#define BDB_UCTYPE "HDB"
#else
#define BDB_SYMBOL(x) LDAP_CONCAT(bdb_,x)
+#define BDB_UCTYPE "BDB"
#endif
/*
*/
#define bdb_attr_mask BDB_SYMBOL(attr_mask)
+#define bdb_attr_flush BDB_SYMBOL(attr_flush)
#define bdb_attr_index_config BDB_SYMBOL(attr_index_config)
#define bdb_attr_index_destroy BDB_SYMBOL(attr_index_destroy)
+#define bdb_attr_index_free BDB_SYMBOL(attr_index_free)
+#define bdb_attr_index_unparse BDB_SYMBOL(attr_index_unparse)
-void bdb_attr_mask( struct bdb_info *bdb,
- AttributeDescription *desc,
- slap_mask_t *indexmask );
+AttrInfo *bdb_attr_mask( struct bdb_info *bdb,
+ AttributeDescription *desc );
+
+void bdb_attr_flush( struct bdb_info *bdb );
int bdb_attr_index_config LDAP_P(( struct bdb_info *bdb,
const char *fname, int lineno,
int argc, char **argv ));
+void bdb_attr_index_unparse LDAP_P(( struct bdb_info *bdb, BerVarray *bva ));
void bdb_attr_index_destroy LDAP_P(( Avlnode *tree ));
+void bdb_attr_index_free LDAP_P(( struct bdb_info *bdb,
+ AttributeDescription *ad ));
/*
- * ctxcsn.c
+ * config.c
*/
-#define bdb_csn_commit BDB_SYMBOL(csn_commit)
-#define bdb_get_commit_csn BDB_SYMBOL(get_commit_csn)
-int bdb_csn_commit LDAP_P(( Operation *op, SlapReply *rs, DB_TXN *tid,
- EntryInfo *ei, EntryInfo **suffix_ei, Entry **ctxcsn_e,
- int *ctxcsn_added, u_int32_t locker ));
+#define bdb_back_init_cf BDB_SYMBOL(back_init_cf)
-int bdb_get_commit_csn LDAP_P(( Operation *op, SlapReply *rs,
- struct berval **search_context_csn,
- u_int32_t locker, DB_LOCK *ctxcsn_lock ));
+int bdb_back_init_cf( BackendInfo *bi );
/*
* dbcache.c
int
bdb_db_cache(
Backend *be,
- DB_TXN *tid,
const char *name,
DB **db );
#ifdef BDB_HIER
#define bdb_dn2id_parent BDB_SYMBOL(dn2id_parent)
-#define bdb_dup_compare BDB_SYMBOL(dup_compare)
#define bdb_fix_dn BDB_SYMBOL(fix_dn)
int bdb_dn2id_parent(
EntryInfo *ei,
ID *idp );
-int bdb_dup_compare(
- DB *db,
- const DBT *usrkey,
- const DBT *curkey );
-
int bdb_fix_dn( Entry *e, int checkit );
#endif
*/
#define bdb_errcall BDB_SYMBOL(errcall)
+#if DB_VERSION_FULL < 0x04030000
void bdb_errcall( const char *pfx, char * msg );
+#else
+#define bdb_msgcall BDB_SYMBOL(msgcall)
+void bdb_errcall( const DB_ENV *env, const char *pfx, const char * msg );
+void bdb_msgcall( const DB_ENV *env, const char * msg );
+#endif
#ifdef HAVE_EBCDIC
#define ebcdic_dberror BDB_SYMBOL(ebcdic_dberror)
DB_TXN *tid,
Entry *e);
+#ifdef SLAP_ZONE_ALLOC
+#else
int bdb_id2entry(
BackendDB *be,
DB_TXN *tid,
ID id,
Entry **e);
+#endif
#define bdb_entry_free BDB_SYMBOL(entry_free)
#define bdb_entry_return BDB_SYMBOL(entry_return)
#define bdb_entry_get BDB_SYMBOL(entry_get)
void bdb_entry_free ( Entry *e );
+#ifdef SLAP_ZONE_ALLOC
+int bdb_entry_return( struct bdb_info *bdb, Entry *e, int seqno );
+#else
int bdb_entry_return( Entry *e );
+#endif
BI_entry_release_rw bdb_entry_release;
BI_entry_get_rw bdb_entry_get;
/*
* idl.c
*/
-#ifdef SLAP_IDL_CACHE
#define bdb_idl_cache_get BDB_SYMBOL(idl_cache_get)
#define bdb_idl_cache_put BDB_SYMBOL(idl_cache_put)
struct bdb_info *bdb,
DB *db,
DBT *key );
-#endif
#define bdb_idl_first BDB_SYMBOL(idl_first)
#define bdb_idl_next BDB_SYMBOL(idl_next)
#define bdb_idl_insert BDB_SYMBOL(idl_insert)
#define bdb_idl_intersection BDB_SYMBOL(idl_intersection)
#define bdb_idl_union BDB_SYMBOL(idl_union)
+#define bdb_idl_sort BDB_SYMBOL(idl_sort)
+#define bdb_idl_append BDB_SYMBOL(idl_append)
+#define bdb_idl_append_one BDB_SYMBOL(idl_append_one)
#define bdb_idl_fetch_key BDB_SYMBOL(idl_fetch_key)
#define bdb_idl_insert_key BDB_SYMBOL(idl_insert_key)
unsigned bdb_idl_search( ID *ids, ID id );
int bdb_idl_fetch_key(
- BackendDB *be,
- DB *db,
- DB_TXN *txn,
- DBT *key,
- ID *ids );
+ BackendDB *be,
+ DB *db,
+ DB_TXN *tid,
+ DBT *key,
+ ID *ids,
+ DBC **saved_cursor,
+ int get_flag );
int bdb_idl_insert( ID *ids, ID id );
ID bdb_idl_first( ID *ids, ID *cursor );
ID bdb_idl_next( ID *ids, ID *cursor );
-
-#define bdb_bt_compare BDB_SYMBOL(bt_compare)
-
-int bdb_bt_compare(
- DB *db,
- const DBT *a,
- const DBT *b );
+void bdb_idl_sort( ID *ids, ID *tmp );
+int bdb_idl_append( ID *a, ID *b );
+int bdb_idl_append_one( ID *ids, ID id );
/*
#define bdb_index_entry_del(op,t,e) \
bdb_index_entry((op),(t),SLAP_INDEX_DELETE_OP,(e))
-/*
- * init.c
- */
-#define bdb_uuid BDB_SYMBOL(uuid)
-
-extern struct berval bdb_uuid;
-
/*
* key.c
*/
DB *db,
DB_TXN *txn,
struct berval *k,
- ID *ids );
+ ID *ids,
+ DBC **saved_cursor,
+ int get_flags );
extern int
bdb_key_change(
char *textbuf,
size_t textlen );
-/*
- * passwd.c
- */
-#define bdb_exop_passwd BDB_SYMBOL(exop_passwd)
-
-BI_op_extended bdb_exop_passwd;
-
/*
* cache.c
#if 0
void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
#else
-#define bdb_unlocked_cache_return_entry_rw( a, b, c )
+#define bdb_unlocked_cache_return_entry_rw( a, b, c ) ((void)0)
#endif
#define bdb_unlocked_cache_return_entry_r( c, e ) \
bdb_unlocked_cache_return_entry_rw((c), (e), 0)
#define bdb_cache_add BDB_SYMBOL(cache_add)
#define bdb_cache_children BDB_SYMBOL(cache_children)
#define bdb_cache_delete BDB_SYMBOL(cache_delete)
-#define bdb_cache_delete_cleanup BDB_SYMBOL(cache_delete_cleanup)
+#define bdb_cache_delete_cleanup BDB_SYMBOL(cache_delete_cleanup)
#define bdb_cache_find_id BDB_SYMBOL(cache_find_id)
+#define bdb_cache_find_info BDB_SYMBOL(cache_find_info)
#define bdb_cache_find_ndn BDB_SYMBOL(cache_find_ndn)
#define bdb_cache_modify BDB_SYMBOL(cache_modify)
#define bdb_cache_modrdn BDB_SYMBOL(cache_modrdn)
#define bdb_cache_release_all BDB_SYMBOL(cache_release_all)
+#define bdb_cache_delete_entry BDB_SYMBOL(cache_delete_entry)
int bdb_cache_children(
Operation *op,
u_int32_t locker
);
int bdb_cache_modrdn(
+ struct bdb_info *bdb,
Entry *e,
struct berval *nrdn,
Entry *new,
EntryInfo *ein,
- DB_ENV *env,
u_int32_t locker,
DB_LOCK *lock
);
struct berval *ndn,
EntryInfo **res
);
+EntryInfo * bdb_cache_find_info(
+ struct bdb_info *bdb,
+ ID id
+);
int bdb_cache_find_id(
Operation *op,
DB_TXN *tid,
DB_LOCK *lock
);
void bdb_cache_delete_cleanup(
- Entry *e
+ Cache *cache,
+ EntryInfo *ei
);
void bdb_cache_release_all( Cache *cache );
+void bdb_cache_delete_entry(
+ struct bdb_info *bdb,
+ EntryInfo *ei,
+ u_int32_t locker,
+ DB_LOCK *lock
+);
+
+#ifdef BDB_HIER
+int hdb_cache_load(
+ struct bdb_info *bdb,
+ EntryInfo *ei,
+ EntryInfo **res
+);
+#endif
#define bdb_cache_entry_db_relock BDB_SYMBOL(cache_entry_db_relock)
int bdb_cache_entry_db_relock(
int tryOnly,
DB_LOCK *lock );
+int bdb_cache_entry_db_unlock(
+ DB_ENV *env,
+ DB_LOCK *lock );
+
#ifdef BDB_REUSE_LOCKERS
#define bdb_locker_id BDB_SYMBOL(locker_id)
-int bdb_locker_id( Operation *op, DB_ENV *env, int *locker );
+int bdb_locker_id( Operation *op, DB_ENV *env, u_int32_t *locker );
-#define LOCK_ID_FREE(env, locker)
+#define LOCK_ID_FREE(env, locker) ((void)0)
#define LOCK_ID(env, locker) bdb_locker_id(op, env, locker)
#else
#endif
-/*
- * search.c
- */
-
-#define bdb_abandon BDB_SYMBOL(abandon)
-#define bdb_cancel BDB_SYMBOL(cancel)
-#define bdb_do_search BDB_SYMBOL(do_search)
-
-BI_op_abandon bdb_abandon;
-BI_op_cancel bdb_cancel;
-
-int bdb_do_search(
- Operation *op,
- SlapReply *rs,
- Operation *ps_op,
- Entry *entry,
- int psearch_type
-);
-#define bdb_psearch(op, rs, sop, e, ps_type) bdb_do_search(op, rs, sop, e, ps_type)
-
-#define bdb_build_sync_state_ctrl BDB_SYMBOL(build_sync_state_ctrl)
-#define bdb_build_sync_done_ctrl BDB_SYMBOL(build_sync_done_ctrl)
-#define bdb_send_ldap_intermediate BDB_SYMBOL(send_ldap_intermediate)
-
-int
-bdb_build_sync_state_ctrl(
- Operation *op,
- SlapReply *rs,
- Entry *e,
- int entry_sync_state,
- LDAPControl **ctrls,
- int num_ctrls,
- int send_cookie,
- struct berval *csn );
-
-int
-bdb_build_sync_done_ctrl(
- Operation *op,
- SlapReply *rs,
- LDAPControl **ctrls,
- int num_ctrls,
- int send_cookie,
- struct berval *latest_entrycsn_bv );
-
-int
-bdb_send_ldap_intermediate(
- Operation *op,
- SlapReply *rs,
- int state,
- struct berval *cookie );
-
/*
* trans.c
*/
void
bdb_trans_backoff( int num_retries );
+/*
+ * former external.h
+ */
+
+#define bdb_back_initialize BDB_SYMBOL(back_initialize)
+#define bdb_db_config BDB_SYMBOL(db_config)
+#define bdb_add BDB_SYMBOL(add)
+#define bdb_bind BDB_SYMBOL(bind)
+#define bdb_compare BDB_SYMBOL(compare)
+#define bdb_delete BDB_SYMBOL(delete)
+#define bdb_modify BDB_SYMBOL(modify)
+#define bdb_modrdn BDB_SYMBOL(modrdn)
+#define bdb_search BDB_SYMBOL(search)
+#define bdb_extended BDB_SYMBOL(extended)
+#define bdb_referrals BDB_SYMBOL(referrals)
+#define bdb_operational BDB_SYMBOL(operational)
+#define bdb_hasSubordinates BDB_SYMBOL(hasSubordinates)
+#define bdb_tool_entry_open BDB_SYMBOL(tool_entry_open)
+#define bdb_tool_entry_close BDB_SYMBOL(tool_entry_close)
+#define bdb_tool_entry_next BDB_SYMBOL(tool_entry_next)
+#define bdb_tool_entry_get BDB_SYMBOL(tool_entry_get)
+#define bdb_tool_entry_put BDB_SYMBOL(tool_entry_put)
+#define bdb_tool_entry_reindex BDB_SYMBOL(tool_entry_reindex)
+#define bdb_tool_dn2id_get BDB_SYMBOL(tool_dn2id_get)
+#define bdb_tool_id2entry_get BDB_SYMBOL(tool_id2entry_get)
+#define bdb_tool_entry_modify BDB_SYMBOL(tool_entry_modify)
+
+extern BI_init bdb_back_initialize;
+
+extern BI_db_config bdb_db_config;
+
+extern BI_op_add bdb_add;
+extern BI_op_bind bdb_bind;
+extern BI_op_compare bdb_compare;
+extern BI_op_delete bdb_delete;
+extern BI_op_modify bdb_modify;
+extern BI_op_modrdn bdb_modrdn;
+extern BI_op_search bdb_search;
+extern BI_op_extended bdb_extended;
+
+extern BI_chk_referrals bdb_referrals;
+
+extern BI_operational bdb_operational;
+
+extern BI_has_subordinates bdb_hasSubordinates;
+
+/* tools.c */
+extern BI_tool_entry_open bdb_tool_entry_open;
+extern BI_tool_entry_close bdb_tool_entry_close;
+extern BI_tool_entry_next bdb_tool_entry_next;
+extern BI_tool_entry_get bdb_tool_entry_get;
+extern BI_tool_entry_put bdb_tool_entry_put;
+extern BI_tool_entry_reindex bdb_tool_entry_reindex;
+extern BI_tool_dn2id_get bdb_tool_dn2id_get;
+extern BI_tool_id2entry_get bdb_tool_id2entry_get;
+extern BI_tool_entry_modify bdb_tool_entry_modify;
+
LDAP_END_DECL
#endif /* _PROTO_BDB_H */