2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 2000-2005 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_fix_dn BDB_SYMBOL(fix_dn)
130 int bdb_dn2id_parent(
136 int bdb_fix_dn( Entry *e, int checkit );
143 #define bdb_errcall BDB_SYMBOL(errcall)
145 #if DB_VERSION_FULL < 0x04030000
146 void bdb_errcall( const char *pfx, char * msg );
148 void bdb_errcall( const DB_ENV *env, const char *pfx, const char * msg );
152 #define ebcdic_dberror BDB_SYMBOL(ebcdic_dberror)
154 char *ebcdic_dberror( int rc );
155 #define db_strerror(x) ebcdic_dberror(x)
161 #define bdb_filter_candidates BDB_SYMBOL(filter_candidates)
163 int bdb_filter_candidates(
173 #define bdb_id2entry BDB_SYMBOL(id2entry)
174 #define bdb_id2entry_add BDB_SYMBOL(id2entry_add)
175 #define bdb_id2entry_update BDB_SYMBOL(id2entry_update)
176 #define bdb_id2entry_delete BDB_SYMBOL(id2entry_delete)
178 int bdb_id2entry_add(
183 int bdb_id2entry_update(
188 int bdb_id2entry_delete(
193 #ifdef SLAP_ZONE_ALLOC
202 #define bdb_entry_free BDB_SYMBOL(entry_free)
203 #define bdb_entry_return BDB_SYMBOL(entry_return)
204 #define bdb_entry_release BDB_SYMBOL(entry_release)
205 #define bdb_entry_get BDB_SYMBOL(entry_get)
207 void bdb_entry_free ( Entry *e );
208 #ifdef SLAP_ZONE_ALLOC
209 int bdb_entry_return( struct bdb_info *bdb, Entry *e, int seqno );
211 int bdb_entry_return( Entry *e );
213 BI_entry_release_rw bdb_entry_release;
214 BI_entry_get_rw bdb_entry_get;
221 #define bdb_idl_cache_get BDB_SYMBOL(idl_cache_get)
222 #define bdb_idl_cache_put BDB_SYMBOL(idl_cache_put)
223 #define bdb_idl_cache_del BDB_SYMBOL(idl_cache_del)
225 int bdb_idl_cache_get(
226 struct bdb_info *bdb,
233 struct bdb_info *bdb,
241 struct bdb_info *bdb,
245 #define bdb_idl_first BDB_SYMBOL(idl_first)
246 #define bdb_idl_next BDB_SYMBOL(idl_next)
247 #define bdb_idl_search BDB_SYMBOL(idl_search)
248 #define bdb_idl_insert BDB_SYMBOL(idl_insert)
249 #define bdb_idl_intersection BDB_SYMBOL(idl_intersection)
250 #define bdb_idl_union BDB_SYMBOL(idl_union)
252 #define bdb_idl_fetch_key BDB_SYMBOL(idl_fetch_key)
253 #define bdb_idl_insert_key BDB_SYMBOL(idl_insert_key)
254 #define bdb_idl_delete_key BDB_SYMBOL(idl_delete_key)
256 unsigned bdb_idl_search( ID *ids, ID id );
258 int bdb_idl_fetch_key(
267 int bdb_idl_insert( ID *ids, ID id );
269 int bdb_idl_insert_key(
276 int bdb_idl_delete_key(
284 bdb_idl_intersection(
293 ID bdb_idl_first( ID *ids, ID *cursor );
294 ID bdb_idl_next( ID *ids, ID *cursor );
301 #define bdb_index_is_indexed BDB_SYMBOL(index_is_indexed)
302 #define bdb_index_param BDB_SYMBOL(index_param)
303 #define bdb_index_values BDB_SYMBOL(index_values)
304 #define bdb_index_entry BDB_SYMBOL(index_entry)
307 bdb_index_is_indexed LDAP_P((
309 AttributeDescription *desc ));
312 bdb_index_param LDAP_P((
314 AttributeDescription *desc,
318 struct berval *prefix ));
321 bdb_index_values LDAP_P((
324 AttributeDescription *desc,
329 int bdb_index_entry LDAP_P(( Operation *op, DB_TXN *t, int r, Entry *e ));
331 #define bdb_index_entry_add(op,t,e) \
332 bdb_index_entry((op),(t),SLAP_INDEX_ADD_OP,(e))
333 #define bdb_index_entry_del(op,t,e) \
334 bdb_index_entry((op),(t),SLAP_INDEX_DELETE_OP,(e))
339 #define bdb_uuid BDB_SYMBOL(uuid)
341 extern struct berval bdb_uuid;
346 #define bdb_key_read BDB_SYMBOL(key_read)
347 #define bdb_key_change BDB_SYMBOL(key_change)
371 #define bdb_next_id BDB_SYMBOL(next_id)
372 #define bdb_last_id BDB_SYMBOL(last_id)
374 int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
375 int bdb_last_id( BackendDB *be, DB_TXN *tid );
380 #define bdb_modify_internal BDB_SYMBOL(modify_internal)
382 int bdb_modify_internal(
385 Modifications *modlist,
395 #define bdb_cache_entry_db_unlock BDB_SYMBOL(cache_entry_db_unlock)
397 #define bdb_cache_entryinfo_lock(e) \
398 ldap_pvt_thread_mutex_lock( &(e)->bei_kids_mutex )
399 #define bdb_cache_entryinfo_unlock(e) \
400 ldap_pvt_thread_mutex_unlock( &(e)->bei_kids_mutex )
402 /* What a mess. Hopefully the current cache scheme will stabilize
403 * and we can trim out all of this stuff.
406 void bdb_cache_return_entry_rw( DB_ENV *env, Cache *cache, Entry *e,
407 int rw, DB_LOCK *lock );
409 #define bdb_cache_return_entry_rw( env, cache, e, rw, lock ) \
410 bdb_cache_entry_db_unlock( env, lock )
411 #define bdb_cache_return_entry( env, lock ) \
412 bdb_cache_entry_db_unlock( env, lock )
414 #define bdb_cache_return_entry_r(env, c, e, l) \
415 bdb_cache_return_entry_rw((env), (c), (e), 0, (l))
416 #define bdb_cache_return_entry_w(env, c, e, l) \
417 bdb_cache_return_entry_rw((env), (c), (e), 1, (l))
419 void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
421 #define bdb_unlocked_cache_return_entry_rw( a, b, c )
423 #define bdb_unlocked_cache_return_entry_r( c, e ) \
424 bdb_unlocked_cache_return_entry_rw((c), (e), 0)
425 #define bdb_unlocked_cache_return_entry_w( c, e ) \
426 bdb_unlocked_cache_return_entry_rw((c), (e), 1)
428 #define bdb_cache_add BDB_SYMBOL(cache_add)
429 #define bdb_cache_children BDB_SYMBOL(cache_children)
430 #define bdb_cache_delete BDB_SYMBOL(cache_delete)
431 #define bdb_cache_delete_cleanup BDB_SYMBOL(cache_delete_cleanup)
432 #define bdb_cache_find_id BDB_SYMBOL(cache_find_id)
433 #define bdb_cache_find_info BDB_SYMBOL(cache_find_info)
434 #define bdb_cache_find_ndn BDB_SYMBOL(cache_find_ndn)
435 #define bdb_cache_modify BDB_SYMBOL(cache_modify)
436 #define bdb_cache_modrdn BDB_SYMBOL(cache_modrdn)
437 #define bdb_cache_release_all BDB_SYMBOL(cache_release_all)
438 #define bdb_cache_delete_entry BDB_SYMBOL(cache_delete_entry)
440 int bdb_cache_children(
446 struct bdb_info *bdb,
452 int bdb_cache_modrdn(
461 int bdb_cache_modify(
468 int bdb_cache_find_ndn(
474 EntryInfo * bdb_cache_find_info(
475 struct bdb_info *bdb,
478 int bdb_cache_find_id(
487 int bdb_cache_delete(
494 void bdb_cache_delete_cleanup(
498 void bdb_cache_release_all( Cache *cache );
499 void bdb_cache_delete_entry(
500 struct bdb_info *bdb,
508 struct bdb_info *bdb,
514 #define bdb_cache_entry_db_relock BDB_SYMBOL(cache_entry_db_relock)
515 int bdb_cache_entry_db_relock(
523 int bdb_cache_entry_db_unlock(
527 #ifdef BDB_REUSE_LOCKERS
529 #define bdb_locker_id BDB_SYMBOL(locker_id)
530 int bdb_locker_id( Operation *op, DB_ENV *env, int *locker );
532 #define LOCK_ID_FREE(env, locker)
533 #define LOCK_ID(env, locker) bdb_locker_id(op, env, locker)
537 #define LOCK_ID_FREE(env, locker) XLOCK_ID_FREE(env, locker)
538 #define LOCK_ID(env, locker) XLOCK_ID(env, locker)
546 #define bdb_abandon BDB_SYMBOL(abandon)
547 #define bdb_cancel BDB_SYMBOL(cancel)
548 #define bdb_do_search BDB_SYMBOL(do_search)
549 #define bdb_psearch BDB_SYMBOL(psearch)
551 BI_op_abandon bdb_abandon;
552 BI_op_cancel bdb_cancel;
573 #define bdb_trans_backoff BDB_SYMBOL(trans_backoff)
576 bdb_trans_backoff( int num_retries );
582 #define bdb_back_initialize BDB_SYMBOL(back_initialize)
583 #define bdb_db_config BDB_SYMBOL(db_config)
584 #define bdb_add BDB_SYMBOL(add)
585 #define bdb_bind BDB_SYMBOL(bind)
586 #define bdb_compare BDB_SYMBOL(compare)
587 #define bdb_delete BDB_SYMBOL(delete)
588 #define bdb_modify BDB_SYMBOL(modify)
589 #define bdb_modrdn BDB_SYMBOL(modrdn)
590 #define bdb_search BDB_SYMBOL(search)
591 #define bdb_extended BDB_SYMBOL(extended)
592 #define bdb_referrals BDB_SYMBOL(referrals)
593 #define bdb_operational BDB_SYMBOL(operational)
594 #define bdb_hasSubordinates BDB_SYMBOL(hasSubordinates)
595 #define bdb_tool_entry_open BDB_SYMBOL(tool_entry_open)
596 #define bdb_tool_entry_close BDB_SYMBOL(tool_entry_close)
597 #define bdb_tool_entry_next BDB_SYMBOL(tool_entry_next)
598 #define bdb_tool_entry_get BDB_SYMBOL(tool_entry_get)
599 #define bdb_tool_entry_put BDB_SYMBOL(tool_entry_put)
600 #define bdb_tool_entry_reindex BDB_SYMBOL(tool_entry_reindex)
601 #define bdb_tool_dn2id_get BDB_SYMBOL(tool_dn2id_get)
602 #define bdb_tool_id2entry_get BDB_SYMBOL(tool_id2entry_get)
603 #define bdb_tool_entry_modify BDB_SYMBOL(tool_entry_modify)
605 extern BI_init bdb_back_initialize;
607 extern BI_db_config bdb_db_config;
609 extern BI_op_add bdb_add;
610 extern BI_op_bind bdb_bind;
611 extern BI_op_compare bdb_compare;
612 extern BI_op_delete bdb_delete;
613 extern BI_op_modify bdb_modify;
614 extern BI_op_modrdn bdb_modrdn;
615 extern BI_op_search bdb_search;
616 extern BI_op_extended bdb_extended;
618 extern BI_chk_referrals bdb_referrals;
620 extern BI_operational bdb_operational;
622 extern BI_has_subordinates bdb_hasSubordinates;
625 extern BI_tool_entry_open bdb_tool_entry_open;
626 extern BI_tool_entry_close bdb_tool_entry_close;
627 extern BI_tool_entry_next bdb_tool_entry_next;
628 extern BI_tool_entry_get bdb_tool_entry_get;
629 extern BI_tool_entry_put bdb_tool_entry_put;
630 extern BI_tool_entry_reindex bdb_tool_entry_reindex;
631 extern BI_tool_dn2id_get bdb_tool_dn2id_get;
632 extern BI_tool_id2entry_get bdb_tool_id2entry_get;
633 extern BI_tool_entry_modify bdb_tool_entry_modify;
637 #endif /* _PROTO_BDB_H */