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 void bdb_attr_mask( struct bdb_info *bdb,
38 AttributeDescription *desc,
39 slap_mask_t *indexmask );
41 int bdb_attr_index_config LDAP_P(( struct bdb_info *bdb,
42 const char *fname, int lineno,
43 int argc, char **argv ));
45 void bdb_attr_index_destroy LDAP_P(( Avlnode *tree ));
50 #define bdb_csn_commit BDB_SYMBOL(csn_commit)
51 #define bdb_get_commit_csn BDB_SYMBOL(get_commit_csn)
53 int bdb_csn_commit LDAP_P(( Operation *op, SlapReply *rs, DB_TXN *tid,
54 EntryInfo *ei, EntryInfo **suffix_ei, Entry **ctxcsn_e,
55 int *ctxcsn_added, u_int32_t locker ));
57 int bdb_get_commit_csn LDAP_P(( Operation *op, SlapReply *rs,
58 struct berval **search_context_csn,
59 u_int32_t locker, DB_LOCK *ctxcsn_lock ));
64 #define bdb_db_cache BDB_SYMBOL(db_cache)
75 #define bdb_dn2entry BDB_SYMBOL(dn2entry)
77 int bdb_dn2entry LDAP_P(( Operation *op, DB_TXN *tid,
78 struct berval *dn, EntryInfo **e, int matched,
79 u_int32_t locker, DB_LOCK *lock ));
84 #define bdb_dn2id BDB_SYMBOL(dn2id)
85 #define bdb_dn2id_add BDB_SYMBOL(dn2id_add)
86 #define bdb_dn2id_delete BDB_SYMBOL(dn2id_delete)
87 #define bdb_dn2id_children BDB_SYMBOL(dn2id_children)
88 #define bdb_dn2idl BDB_SYMBOL(dn2idl)
102 int bdb_dn2id_delete(
108 int bdb_dn2id_children(
120 #define bdb_dn2id_parent BDB_SYMBOL(dn2id_parent)
121 #define bdb_dup_compare BDB_SYMBOL(dup_compare)
122 #define bdb_fix_dn BDB_SYMBOL(fix_dn)
124 int bdb_dn2id_parent(
135 int bdb_fix_dn( Entry *e, int checkit );
142 #define bdb_errcall BDB_SYMBOL(errcall)
144 #if DB_VERSION_FULL < 0x04030000
145 void bdb_errcall( const char *pfx, char * msg );
147 void bdb_errcall( const DB_ENV *env, const char *pfx, const char * msg );
151 #define ebcdic_dberror BDB_SYMBOL(ebcdic_dberror)
153 char *ebcdic_dberror( int rc );
154 #define db_strerror(x) ebcdic_dberror(x)
160 #define bdb_filter_candidates BDB_SYMBOL(filter_candidates)
162 int bdb_filter_candidates(
172 #define bdb_id2entry BDB_SYMBOL(id2entry)
173 #define bdb_id2entry_add BDB_SYMBOL(id2entry_add)
174 #define bdb_id2entry_update BDB_SYMBOL(id2entry_update)
175 #define bdb_id2entry_delete BDB_SYMBOL(id2entry_delete)
177 int bdb_id2entry_add(
182 int bdb_id2entry_update(
187 int bdb_id2entry_delete(
192 #ifdef SLAP_ZONE_ALLOC
201 #define bdb_entry_free BDB_SYMBOL(entry_free)
202 #define bdb_entry_return BDB_SYMBOL(entry_return)
203 #define bdb_entry_release BDB_SYMBOL(entry_release)
204 #define bdb_entry_get BDB_SYMBOL(entry_get)
206 void bdb_entry_free ( Entry *e );
207 #ifdef SLAP_ZONE_ALLOC
208 int bdb_entry_return( struct bdb_info *bdb, Entry *e, int seqno );
210 int bdb_entry_return( Entry *e );
212 BI_entry_release_rw bdb_entry_release;
213 BI_entry_get_rw bdb_entry_get;
220 #define bdb_idl_cache_get BDB_SYMBOL(idl_cache_get)
221 #define bdb_idl_cache_put BDB_SYMBOL(idl_cache_put)
222 #define bdb_idl_cache_del BDB_SYMBOL(idl_cache_del)
224 int bdb_idl_cache_get(
225 struct bdb_info *bdb,
232 struct bdb_info *bdb,
240 struct bdb_info *bdb,
244 #define bdb_idl_first BDB_SYMBOL(idl_first)
245 #define bdb_idl_next BDB_SYMBOL(idl_next)
246 #define bdb_idl_search BDB_SYMBOL(idl_search)
247 #define bdb_idl_insert BDB_SYMBOL(idl_insert)
248 #define bdb_idl_intersection BDB_SYMBOL(idl_intersection)
249 #define bdb_idl_union BDB_SYMBOL(idl_union)
251 #define bdb_idl_fetch_key BDB_SYMBOL(idl_fetch_key)
252 #define bdb_idl_insert_key BDB_SYMBOL(idl_insert_key)
253 #define bdb_idl_delete_key BDB_SYMBOL(idl_delete_key)
255 unsigned bdb_idl_search( ID *ids, ID id );
257 int bdb_idl_fetch_key(
266 int bdb_idl_insert( ID *ids, ID id );
268 int bdb_idl_insert_key(
275 int bdb_idl_delete_key(
283 bdb_idl_intersection(
292 ID bdb_idl_first( ID *ids, ID *cursor );
293 ID bdb_idl_next( ID *ids, ID *cursor );
296 #define bdb_bt_compare BDB_SYMBOL(bt_compare)
307 #define bdb_index_is_indexed BDB_SYMBOL(index_is_indexed)
308 #define bdb_index_param BDB_SYMBOL(index_param)
309 #define bdb_index_values BDB_SYMBOL(index_values)
310 #define bdb_index_entry BDB_SYMBOL(index_entry)
313 bdb_index_is_indexed LDAP_P((
315 AttributeDescription *desc ));
318 bdb_index_param LDAP_P((
320 AttributeDescription *desc,
324 struct berval *prefix ));
327 bdb_index_values LDAP_P((
330 AttributeDescription *desc,
335 int bdb_index_entry LDAP_P(( Operation *op, DB_TXN *t, int r, Entry *e ));
337 #define bdb_index_entry_add(op,t,e) \
338 bdb_index_entry((op),(t),SLAP_INDEX_ADD_OP,(e))
339 #define bdb_index_entry_del(op,t,e) \
340 bdb_index_entry((op),(t),SLAP_INDEX_DELETE_OP,(e))
345 #define bdb_uuid BDB_SYMBOL(uuid)
347 extern struct berval bdb_uuid;
352 #define bdb_key_read BDB_SYMBOL(key_read)
353 #define bdb_key_change BDB_SYMBOL(key_change)
377 #define bdb_next_id BDB_SYMBOL(next_id)
378 #define bdb_last_id BDB_SYMBOL(last_id)
380 int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
381 int bdb_last_id( BackendDB *be, DB_TXN *tid );
386 #define bdb_modify_internal BDB_SYMBOL(modify_internal)
388 int bdb_modify_internal(
391 Modifications *modlist,
401 #define bdb_cache_entry_db_unlock BDB_SYMBOL(cache_entry_db_unlock)
403 #define bdb_cache_entryinfo_lock(e) \
404 ldap_pvt_thread_mutex_lock( &(e)->bei_kids_mutex )
405 #define bdb_cache_entryinfo_unlock(e) \
406 ldap_pvt_thread_mutex_unlock( &(e)->bei_kids_mutex )
408 /* What a mess. Hopefully the current cache scheme will stabilize
409 * and we can trim out all of this stuff.
412 void bdb_cache_return_entry_rw( DB_ENV *env, Cache *cache, Entry *e,
413 int rw, DB_LOCK *lock );
415 #define bdb_cache_return_entry_rw( env, cache, e, rw, lock ) \
416 bdb_cache_entry_db_unlock( env, lock )
417 #define bdb_cache_return_entry( env, lock ) \
418 bdb_cache_entry_db_unlock( env, lock )
420 #define bdb_cache_return_entry_r(env, c, e, l) \
421 bdb_cache_return_entry_rw((env), (c), (e), 0, (l))
422 #define bdb_cache_return_entry_w(env, c, e, l) \
423 bdb_cache_return_entry_rw((env), (c), (e), 1, (l))
425 void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
427 #define bdb_unlocked_cache_return_entry_rw( a, b, c )
429 #define bdb_unlocked_cache_return_entry_r( c, e ) \
430 bdb_unlocked_cache_return_entry_rw((c), (e), 0)
431 #define bdb_unlocked_cache_return_entry_w( c, e ) \
432 bdb_unlocked_cache_return_entry_rw((c), (e), 1)
434 #define bdb_cache_add BDB_SYMBOL(cache_add)
435 #define bdb_cache_children BDB_SYMBOL(cache_children)
436 #define bdb_cache_delete BDB_SYMBOL(cache_delete)
437 #define bdb_cache_delete_cleanup BDB_SYMBOL(cache_delete_cleanup)
438 #define bdb_cache_find_id BDB_SYMBOL(cache_find_id)
439 #define bdb_cache_find_info BDB_SYMBOL(cache_find_info)
440 #define bdb_cache_find_ndn BDB_SYMBOL(cache_find_ndn)
441 #define bdb_cache_modify BDB_SYMBOL(cache_modify)
442 #define bdb_cache_modrdn BDB_SYMBOL(cache_modrdn)
443 #define bdb_cache_release_all BDB_SYMBOL(cache_release_all)
444 #define bdb_cache_delete_entry BDB_SYMBOL(cache_delete_entry)
446 int bdb_cache_children(
452 struct bdb_info *bdb,
458 int bdb_cache_modrdn(
467 int bdb_cache_modify(
474 int bdb_cache_find_ndn(
480 EntryInfo * bdb_cache_find_info(
481 struct bdb_info *bdb,
484 int bdb_cache_find_id(
493 int bdb_cache_delete(
500 void bdb_cache_delete_cleanup(
504 void bdb_cache_release_all( Cache *cache );
505 void bdb_cache_delete_entry(
506 struct bdb_info *bdb,
514 struct bdb_info *bdb,
520 #define bdb_cache_entry_db_relock BDB_SYMBOL(cache_entry_db_relock)
521 int bdb_cache_entry_db_relock(
529 int bdb_cache_entry_db_unlock(
533 #ifdef BDB_REUSE_LOCKERS
535 #define bdb_locker_id BDB_SYMBOL(locker_id)
536 int bdb_locker_id( Operation *op, DB_ENV *env, int *locker );
538 #define LOCK_ID_FREE(env, locker)
539 #define LOCK_ID(env, locker) bdb_locker_id(op, env, locker)
543 #define LOCK_ID_FREE(env, locker) XLOCK_ID_FREE(env, locker)
544 #define LOCK_ID(env, locker) XLOCK_ID(env, locker)
552 #define bdb_abandon BDB_SYMBOL(abandon)
553 #define bdb_cancel BDB_SYMBOL(cancel)
554 #define bdb_do_search BDB_SYMBOL(do_search)
555 #define bdb_psearch BDB_SYMBOL(psearch)
557 BI_op_abandon bdb_abandon;
558 BI_op_cancel bdb_cancel;
579 #define bdb_trans_backoff BDB_SYMBOL(trans_backoff)
582 bdb_trans_backoff( int num_retries );
588 #define bdb_back_initialize BDB_SYMBOL(back_initialize)
589 #define bdb_db_config BDB_SYMBOL(db_config)
590 #define bdb_add BDB_SYMBOL(add)
591 #define bdb_bind BDB_SYMBOL(bind)
592 #define bdb_compare BDB_SYMBOL(compare)
593 #define bdb_delete BDB_SYMBOL(delete)
594 #define bdb_modify BDB_SYMBOL(modify)
595 #define bdb_modrdn BDB_SYMBOL(modrdn)
596 #define bdb_search BDB_SYMBOL(search)
597 #define bdb_extended BDB_SYMBOL(extended)
598 #define bdb_referrals BDB_SYMBOL(referrals)
599 #define bdb_operational BDB_SYMBOL(operational)
600 #define bdb_hasSubordinates BDB_SYMBOL(hasSubordinates)
601 #define bdb_tool_entry_open BDB_SYMBOL(tool_entry_open)
602 #define bdb_tool_entry_close BDB_SYMBOL(tool_entry_close)
603 #define bdb_tool_entry_next BDB_SYMBOL(tool_entry_next)
604 #define bdb_tool_entry_get BDB_SYMBOL(tool_entry_get)
605 #define bdb_tool_entry_put BDB_SYMBOL(tool_entry_put)
606 #define bdb_tool_entry_reindex BDB_SYMBOL(tool_entry_reindex)
607 #define bdb_tool_dn2id_get BDB_SYMBOL(tool_dn2id_get)
608 #define bdb_tool_id2entry_get BDB_SYMBOL(tool_id2entry_get)
609 #define bdb_tool_entry_modify BDB_SYMBOL(tool_entry_modify)
611 extern BI_init bdb_back_initialize;
613 extern BI_db_config bdb_db_config;
615 extern BI_op_add bdb_add;
616 extern BI_op_bind bdb_bind;
617 extern BI_op_compare bdb_compare;
618 extern BI_op_delete bdb_delete;
619 extern BI_op_modify bdb_modify;
620 extern BI_op_modrdn bdb_modrdn;
621 extern BI_op_search bdb_search;
622 extern BI_op_extended bdb_extended;
624 extern BI_chk_referrals bdb_referrals;
626 extern BI_operational bdb_operational;
628 extern BI_has_subordinates bdb_hasSubordinates;
631 extern BI_tool_entry_open bdb_tool_entry_open;
632 extern BI_tool_entry_close bdb_tool_entry_close;
633 extern BI_tool_entry_next bdb_tool_entry_next;
634 extern BI_tool_entry_get bdb_tool_entry_get;
635 extern BI_tool_entry_put bdb_tool_entry_put;
636 extern BI_tool_entry_reindex bdb_tool_entry_reindex;
637 extern BI_tool_dn2id_get bdb_tool_dn2id_get;
638 extern BI_tool_id2entry_get bdb_tool_id2entry_get;
639 extern BI_tool_entry_modify bdb_tool_entry_modify;
643 #endif /* _PROTO_BDB_H */