2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 2000-2004 The OpenLDAP Foundation.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted only as authorized by the OpenLDAP
11 * A copy of this license is available in the file LICENSE in the
12 * top-level directory of the distribution or, alternatively, at
13 * <http://www.OpenLDAP.org/license.html>.
22 #define BDB_SYMBOL(x) LDAP_CONCAT(hdb_,x)
23 #define BDB_UCTYPE "HDB"
25 #define BDB_SYMBOL(x) LDAP_CONCAT(bdb_,x)
26 #define BDB_UCTYPE "BDB"
33 #define bdb_attr_mask BDB_SYMBOL(attr_mask)
34 #define bdb_attr_index_config BDB_SYMBOL(attr_index_config)
35 #define bdb_attr_index_destroy BDB_SYMBOL(attr_index_destroy)
37 #ifdef LDAP_COMP_MATCH
38 #define bdb_attr_comp_ref BDB_SYMBOL(attr_comp_ref)
39 void bdb_attr_comp_ref( struct bdb_info *bdb,
40 AttributeDescription *desc,
41 ComponentReference **cr );
44 void bdb_attr_mask( struct bdb_info *bdb,
45 AttributeDescription *desc,
46 slap_mask_t *indexmask );
48 int bdb_attr_index_config LDAP_P(( struct bdb_info *bdb,
49 const char *fname, int lineno,
50 int argc, char **argv ));
52 void bdb_attr_index_destroy LDAP_P(( Avlnode *tree ));
57 #define bdb_csn_commit BDB_SYMBOL(csn_commit)
58 #define bdb_get_commit_csn BDB_SYMBOL(get_commit_csn)
60 int bdb_csn_commit LDAP_P(( Operation *op, SlapReply *rs, DB_TXN *tid,
61 EntryInfo *ei, EntryInfo **suffix_ei, Entry **ctxcsn_e,
62 int *ctxcsn_added, u_int32_t locker ));
64 int bdb_get_commit_csn LDAP_P(( Operation *op, SlapReply *rs,
65 struct berval **search_context_csn,
66 u_int32_t locker, DB_LOCK *ctxcsn_lock ));
71 #define bdb_db_cache BDB_SYMBOL(db_cache)
82 #define bdb_dn2entry BDB_SYMBOL(dn2entry)
84 int bdb_dn2entry LDAP_P(( Operation *op, DB_TXN *tid,
85 struct berval *dn, EntryInfo **e, int matched,
86 u_int32_t locker, DB_LOCK *lock ));
91 #define bdb_dn2id BDB_SYMBOL(dn2id)
92 #define bdb_dn2id_add BDB_SYMBOL(dn2id_add)
93 #define bdb_dn2id_delete BDB_SYMBOL(dn2id_delete)
94 #define bdb_dn2id_children BDB_SYMBOL(dn2id_children)
95 #define bdb_dn2idl BDB_SYMBOL(dn2idl)
109 int bdb_dn2id_delete(
115 int bdb_dn2id_children(
127 #define bdb_dn2id_parent BDB_SYMBOL(dn2id_parent)
128 #define bdb_dup_compare BDB_SYMBOL(dup_compare)
129 #define bdb_fix_dn BDB_SYMBOL(fix_dn)
131 int bdb_dn2id_parent(
142 int bdb_fix_dn( Entry *e, int checkit );
149 #define bdb_errcall BDB_SYMBOL(errcall)
151 #if DB_VERSION_FULL < 0x04030000
152 void bdb_errcall( const char *pfx, char * msg );
154 void bdb_errcall( const DB_ENV *env, const char *pfx, const char * msg );
158 #define ebcdic_dberror BDB_SYMBOL(ebcdic_dberror)
160 char *ebcdic_dberror( int rc );
161 #define db_strerror(x) ebcdic_dberror(x)
167 #define bdb_filter_candidates BDB_SYMBOL(filter_candidates)
169 int bdb_filter_candidates(
179 #define bdb_id2entry BDB_SYMBOL(id2entry)
180 #define bdb_id2entry_add BDB_SYMBOL(id2entry_add)
181 #define bdb_id2entry_update BDB_SYMBOL(id2entry_update)
182 #define bdb_id2entry_delete BDB_SYMBOL(id2entry_delete)
184 int bdb_id2entry_add(
189 int bdb_id2entry_update(
194 int bdb_id2entry_delete(
199 #ifdef SLAP_ZONE_ALLOC
208 #define bdb_entry_free BDB_SYMBOL(entry_free)
209 #define bdb_entry_return BDB_SYMBOL(entry_return)
210 #define bdb_entry_release BDB_SYMBOL(entry_release)
211 #define bdb_entry_get BDB_SYMBOL(entry_get)
213 void bdb_entry_free ( Entry *e );
214 #ifdef SLAP_ZONE_ALLOC
215 int bdb_entry_return( struct bdb_info *bdb, Entry *e, int seqno );
217 int bdb_entry_return( Entry *e );
219 BI_entry_release_rw bdb_entry_release;
220 BI_entry_get_rw bdb_entry_get;
227 #define bdb_idl_cache_get BDB_SYMBOL(idl_cache_get)
228 #define bdb_idl_cache_put BDB_SYMBOL(idl_cache_put)
229 #define bdb_idl_cache_del BDB_SYMBOL(idl_cache_del)
231 int bdb_idl_cache_get(
232 struct bdb_info *bdb,
239 struct bdb_info *bdb,
247 struct bdb_info *bdb,
251 #define bdb_idl_first BDB_SYMBOL(idl_first)
252 #define bdb_idl_next BDB_SYMBOL(idl_next)
253 #define bdb_idl_search BDB_SYMBOL(idl_search)
254 #define bdb_idl_insert BDB_SYMBOL(idl_insert)
255 #define bdb_idl_intersection BDB_SYMBOL(idl_intersection)
256 #define bdb_idl_union BDB_SYMBOL(idl_union)
258 #define bdb_idl_fetch_key BDB_SYMBOL(idl_fetch_key)
259 #define bdb_idl_insert_key BDB_SYMBOL(idl_insert_key)
260 #define bdb_idl_delete_key BDB_SYMBOL(idl_delete_key)
262 unsigned bdb_idl_search( ID *ids, ID id );
264 int bdb_idl_fetch_key(
273 int bdb_idl_insert( ID *ids, ID id );
275 int bdb_idl_insert_key(
282 int bdb_idl_delete_key(
290 bdb_idl_intersection(
299 ID bdb_idl_first( ID *ids, ID *cursor );
300 ID bdb_idl_next( ID *ids, ID *cursor );
303 #define bdb_bt_compare BDB_SYMBOL(bt_compare)
314 #define bdb_index_is_indexed BDB_SYMBOL(index_is_indexed)
315 #define bdb_index_param BDB_SYMBOL(index_param)
316 #define bdb_index_values BDB_SYMBOL(index_values)
317 #define bdb_index_entry BDB_SYMBOL(index_entry)
320 bdb_index_is_indexed LDAP_P((
322 AttributeDescription *desc ));
325 bdb_index_param LDAP_P((
327 AttributeDescription *desc,
331 struct berval *prefix ));
334 bdb_index_values LDAP_P((
337 AttributeDescription *desc,
342 int bdb_index_entry LDAP_P(( Operation *op, DB_TXN *t, int r, Entry *e ));
344 #define bdb_index_entry_add(op,t,e) \
345 bdb_index_entry((op),(t),SLAP_INDEX_ADD_OP,(e))
346 #define bdb_index_entry_del(op,t,e) \
347 bdb_index_entry((op),(t),SLAP_INDEX_DELETE_OP,(e))
352 #define bdb_uuid BDB_SYMBOL(uuid)
354 extern struct berval bdb_uuid;
359 #define bdb_key_read BDB_SYMBOL(key_read)
360 #define bdb_key_change BDB_SYMBOL(key_change)
384 #define bdb_next_id BDB_SYMBOL(next_id)
385 #define bdb_last_id BDB_SYMBOL(last_id)
387 int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
388 int bdb_last_id( BackendDB *be, DB_TXN *tid );
393 #define bdb_modify_internal BDB_SYMBOL(modify_internal)
395 int bdb_modify_internal(
398 Modifications *modlist,
408 #define bdb_cache_entry_db_unlock BDB_SYMBOL(cache_entry_db_unlock)
410 #define bdb_cache_entryinfo_lock(e) \
411 ldap_pvt_thread_mutex_lock( &(e)->bei_kids_mutex )
412 #define bdb_cache_entryinfo_unlock(e) \
413 ldap_pvt_thread_mutex_unlock( &(e)->bei_kids_mutex )
415 /* What a mess. Hopefully the current cache scheme will stabilize
416 * and we can trim out all of this stuff.
419 void bdb_cache_return_entry_rw( DB_ENV *env, Cache *cache, Entry *e,
420 int rw, DB_LOCK *lock );
422 #define bdb_cache_return_entry_rw( env, cache, e, rw, lock ) \
423 bdb_cache_entry_db_unlock( env, lock )
424 #define bdb_cache_return_entry( env, lock ) \
425 bdb_cache_entry_db_unlock( env, lock )
427 #define bdb_cache_return_entry_r(env, c, e, l) \
428 bdb_cache_return_entry_rw((env), (c), (e), 0, (l))
429 #define bdb_cache_return_entry_w(env, c, e, l) \
430 bdb_cache_return_entry_rw((env), (c), (e), 1, (l))
432 void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
434 #define bdb_unlocked_cache_return_entry_rw( a, b, c )
436 #define bdb_unlocked_cache_return_entry_r( c, e ) \
437 bdb_unlocked_cache_return_entry_rw((c), (e), 0)
438 #define bdb_unlocked_cache_return_entry_w( c, e ) \
439 bdb_unlocked_cache_return_entry_rw((c), (e), 1)
441 #define bdb_cache_add BDB_SYMBOL(cache_add)
442 #define bdb_cache_children BDB_SYMBOL(cache_children)
443 #define bdb_cache_delete BDB_SYMBOL(cache_delete)
444 #define bdb_cache_delete_cleanup BDB_SYMBOL(cache_delete_cleanup)
445 #define bdb_cache_find_id BDB_SYMBOL(cache_find_id)
446 #define bdb_cache_find_info BDB_SYMBOL(cache_find_info)
447 #define bdb_cache_find_ndn BDB_SYMBOL(cache_find_ndn)
448 #define bdb_cache_modify BDB_SYMBOL(cache_modify)
449 #define bdb_cache_modrdn BDB_SYMBOL(cache_modrdn)
450 #define bdb_cache_release_all BDB_SYMBOL(cache_release_all)
451 #define bdb_cache_delete_entry BDB_SYMBOL(cache_delete_entry)
453 int bdb_cache_children(
459 struct bdb_info *bdb,
465 int bdb_cache_modrdn(
474 int bdb_cache_modify(
481 int bdb_cache_find_ndn(
487 EntryInfo * bdb_cache_find_info(
488 struct bdb_info *bdb,
491 int bdb_cache_find_id(
500 int bdb_cache_delete(
507 void bdb_cache_delete_cleanup(
511 void bdb_cache_release_all( Cache *cache );
512 void bdb_cache_delete_entry(
513 struct bdb_info *bdb,
521 struct bdb_info *bdb,
527 #define bdb_cache_entry_db_relock BDB_SYMBOL(cache_entry_db_relock)
528 int bdb_cache_entry_db_relock(
536 int bdb_cache_entry_db_unlock(
540 #ifdef BDB_REUSE_LOCKERS
542 #define bdb_locker_id BDB_SYMBOL(locker_id)
543 int bdb_locker_id( Operation *op, DB_ENV *env, int *locker );
545 #define LOCK_ID_FREE(env, locker)
546 #define LOCK_ID(env, locker) bdb_locker_id(op, env, locker)
550 #define LOCK_ID_FREE(env, locker) XLOCK_ID_FREE(env, locker)
551 #define LOCK_ID(env, locker) XLOCK_ID(env, locker)
559 #define bdb_abandon BDB_SYMBOL(abandon)
560 #define bdb_cancel BDB_SYMBOL(cancel)
561 #define bdb_do_search BDB_SYMBOL(do_search)
562 #define bdb_psearch BDB_SYMBOL(psearch)
564 BI_op_abandon bdb_abandon;
565 BI_op_cancel bdb_cancel;
586 #define bdb_trans_backoff BDB_SYMBOL(trans_backoff)
589 bdb_trans_backoff( int num_retries );
595 #define bdb_back_initialize BDB_SYMBOL(back_initialize)
596 #define bdb_db_config BDB_SYMBOL(db_config)
597 #define bdb_add BDB_SYMBOL(add)
598 #define bdb_bind BDB_SYMBOL(bind)
599 #define bdb_compare BDB_SYMBOL(compare)
600 #define bdb_delete BDB_SYMBOL(delete)
601 #define bdb_modify BDB_SYMBOL(modify)
602 #define bdb_modrdn BDB_SYMBOL(modrdn)
603 #define bdb_search BDB_SYMBOL(search)
604 #define bdb_extended BDB_SYMBOL(extended)
605 #define bdb_referrals BDB_SYMBOL(referrals)
606 #define bdb_operational BDB_SYMBOL(operational)
607 #define bdb_hasSubordinates BDB_SYMBOL(hasSubordinates)
608 #define bdb_tool_entry_open BDB_SYMBOL(tool_entry_open)
609 #define bdb_tool_entry_close BDB_SYMBOL(tool_entry_close)
610 #define bdb_tool_entry_next BDB_SYMBOL(tool_entry_next)
611 #define bdb_tool_entry_get BDB_SYMBOL(tool_entry_get)
612 #define bdb_tool_entry_put BDB_SYMBOL(tool_entry_put)
613 #define bdb_tool_entry_reindex BDB_SYMBOL(tool_entry_reindex)
614 #define bdb_tool_dn2id_get BDB_SYMBOL(tool_dn2id_get)
615 #define bdb_tool_id2entry_get BDB_SYMBOL(tool_id2entry_get)
616 #define bdb_tool_entry_modify BDB_SYMBOL(tool_entry_modify)
618 extern BI_init bdb_back_initialize;
620 extern BI_db_config bdb_db_config;
622 extern BI_op_add bdb_add;
623 extern BI_op_bind bdb_bind;
624 extern BI_op_compare bdb_compare;
625 extern BI_op_delete bdb_delete;
626 extern BI_op_modify bdb_modify;
627 extern BI_op_modrdn bdb_modrdn;
628 extern BI_op_search bdb_search;
629 extern BI_op_extended bdb_extended;
631 extern BI_chk_referrals bdb_referrals;
633 extern BI_operational bdb_operational;
635 extern BI_has_subordinates bdb_hasSubordinates;
638 extern BI_tool_entry_open bdb_tool_entry_open;
639 extern BI_tool_entry_close bdb_tool_entry_close;
640 extern BI_tool_entry_next bdb_tool_entry_next;
641 extern BI_tool_entry_get bdb_tool_entry_get;
642 extern BI_tool_entry_put bdb_tool_entry_put;
643 extern BI_tool_entry_reindex bdb_tool_entry_reindex;
644 extern BI_tool_dn2id_get bdb_tool_dn2id_get;
645 extern BI_tool_id2entry_get bdb_tool_id2entry_get;
646 extern BI_tool_entry_modify bdb_tool_entry_modify;
650 #endif /* _PROTO_BDB_H */