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_db_cache BDB_SYMBOL(db_cache)
68 #define bdb_dn2entry BDB_SYMBOL(dn2entry)
70 int bdb_dn2entry LDAP_P(( Operation *op, DB_TXN *tid,
71 struct berval *dn, EntryInfo **e, int matched,
72 u_int32_t locker, DB_LOCK *lock ));
77 #define bdb_dn2id BDB_SYMBOL(dn2id)
78 #define bdb_dn2id_add BDB_SYMBOL(dn2id_add)
79 #define bdb_dn2id_delete BDB_SYMBOL(dn2id_delete)
80 #define bdb_dn2id_children BDB_SYMBOL(dn2id_children)
81 #define bdb_dn2idl BDB_SYMBOL(dn2idl)
101 int bdb_dn2id_children(
113 #define bdb_dn2id_parent BDB_SYMBOL(dn2id_parent)
114 #define bdb_fix_dn BDB_SYMBOL(fix_dn)
116 int bdb_dn2id_parent(
122 int bdb_fix_dn( Entry *e, int checkit );
129 #define bdb_errcall BDB_SYMBOL(errcall)
131 #if DB_VERSION_FULL < 0x04030000
132 void bdb_errcall( const char *pfx, char * msg );
134 void bdb_errcall( const DB_ENV *env, const char *pfx, const char * msg );
138 #define ebcdic_dberror BDB_SYMBOL(ebcdic_dberror)
140 char *ebcdic_dberror( int rc );
141 #define db_strerror(x) ebcdic_dberror(x)
147 #define bdb_filter_candidates BDB_SYMBOL(filter_candidates)
149 int bdb_filter_candidates(
159 #define bdb_id2entry BDB_SYMBOL(id2entry)
160 #define bdb_id2entry_add BDB_SYMBOL(id2entry_add)
161 #define bdb_id2entry_update BDB_SYMBOL(id2entry_update)
162 #define bdb_id2entry_delete BDB_SYMBOL(id2entry_delete)
164 int bdb_id2entry_add(
169 int bdb_id2entry_update(
174 int bdb_id2entry_delete(
179 #ifdef SLAP_ZONE_ALLOC
188 #define bdb_entry_free BDB_SYMBOL(entry_free)
189 #define bdb_entry_return BDB_SYMBOL(entry_return)
190 #define bdb_entry_release BDB_SYMBOL(entry_release)
191 #define bdb_entry_get BDB_SYMBOL(entry_get)
193 void bdb_entry_free ( Entry *e );
194 #ifdef SLAP_ZONE_ALLOC
195 int bdb_entry_return( struct bdb_info *bdb, Entry *e, int seqno );
197 int bdb_entry_return( Entry *e );
199 BI_entry_release_rw bdb_entry_release;
200 BI_entry_get_rw bdb_entry_get;
207 #define bdb_idl_cache_get BDB_SYMBOL(idl_cache_get)
208 #define bdb_idl_cache_put BDB_SYMBOL(idl_cache_put)
209 #define bdb_idl_cache_del BDB_SYMBOL(idl_cache_del)
211 int bdb_idl_cache_get(
212 struct bdb_info *bdb,
219 struct bdb_info *bdb,
227 struct bdb_info *bdb,
231 #define bdb_idl_first BDB_SYMBOL(idl_first)
232 #define bdb_idl_next BDB_SYMBOL(idl_next)
233 #define bdb_idl_search BDB_SYMBOL(idl_search)
234 #define bdb_idl_insert BDB_SYMBOL(idl_insert)
235 #define bdb_idl_intersection BDB_SYMBOL(idl_intersection)
236 #define bdb_idl_union BDB_SYMBOL(idl_union)
238 #define bdb_idl_fetch_key BDB_SYMBOL(idl_fetch_key)
239 #define bdb_idl_insert_key BDB_SYMBOL(idl_insert_key)
240 #define bdb_idl_delete_key BDB_SYMBOL(idl_delete_key)
242 unsigned bdb_idl_search( ID *ids, ID id );
244 int bdb_idl_fetch_key(
253 int bdb_idl_insert( ID *ids, ID id );
255 int bdb_idl_insert_key(
262 int bdb_idl_delete_key(
270 bdb_idl_intersection(
279 ID bdb_idl_first( ID *ids, ID *cursor );
280 ID bdb_idl_next( ID *ids, ID *cursor );
287 #define bdb_index_is_indexed BDB_SYMBOL(index_is_indexed)
288 #define bdb_index_param BDB_SYMBOL(index_param)
289 #define bdb_index_values BDB_SYMBOL(index_values)
290 #define bdb_index_entry BDB_SYMBOL(index_entry)
293 bdb_index_is_indexed LDAP_P((
295 AttributeDescription *desc ));
298 bdb_index_param LDAP_P((
300 AttributeDescription *desc,
304 struct berval *prefix ));
307 bdb_index_values LDAP_P((
310 AttributeDescription *desc,
315 int bdb_index_entry LDAP_P(( Operation *op, DB_TXN *t, int r, Entry *e ));
317 #define bdb_index_entry_add(op,t,e) \
318 bdb_index_entry((op),(t),SLAP_INDEX_ADD_OP,(e))
319 #define bdb_index_entry_del(op,t,e) \
320 bdb_index_entry((op),(t),SLAP_INDEX_DELETE_OP,(e))
325 #define bdb_uuid BDB_SYMBOL(uuid)
327 extern struct berval bdb_uuid;
332 #define bdb_key_read BDB_SYMBOL(key_read)
333 #define bdb_key_change BDB_SYMBOL(key_change)
357 #define bdb_next_id BDB_SYMBOL(next_id)
358 #define bdb_last_id BDB_SYMBOL(last_id)
360 int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
361 int bdb_last_id( BackendDB *be, DB_TXN *tid );
366 #define bdb_modify_internal BDB_SYMBOL(modify_internal)
368 int bdb_modify_internal(
371 Modifications *modlist,
381 #define bdb_cache_entry_db_unlock BDB_SYMBOL(cache_entry_db_unlock)
383 #define bdb_cache_entryinfo_lock(e) \
384 ldap_pvt_thread_mutex_lock( &(e)->bei_kids_mutex )
385 #define bdb_cache_entryinfo_unlock(e) \
386 ldap_pvt_thread_mutex_unlock( &(e)->bei_kids_mutex )
388 /* What a mess. Hopefully the current cache scheme will stabilize
389 * and we can trim out all of this stuff.
392 void bdb_cache_return_entry_rw( DB_ENV *env, Cache *cache, Entry *e,
393 int rw, DB_LOCK *lock );
395 #define bdb_cache_return_entry_rw( env, cache, e, rw, lock ) \
396 bdb_cache_entry_db_unlock( env, lock )
397 #define bdb_cache_return_entry( env, lock ) \
398 bdb_cache_entry_db_unlock( env, lock )
400 #define bdb_cache_return_entry_r(env, c, e, l) \
401 bdb_cache_return_entry_rw((env), (c), (e), 0, (l))
402 #define bdb_cache_return_entry_w(env, c, e, l) \
403 bdb_cache_return_entry_rw((env), (c), (e), 1, (l))
405 void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
407 #define bdb_unlocked_cache_return_entry_rw( a, b, c )
409 #define bdb_unlocked_cache_return_entry_r( c, e ) \
410 bdb_unlocked_cache_return_entry_rw((c), (e), 0)
411 #define bdb_unlocked_cache_return_entry_w( c, e ) \
412 bdb_unlocked_cache_return_entry_rw((c), (e), 1)
414 #define bdb_cache_add BDB_SYMBOL(cache_add)
415 #define bdb_cache_children BDB_SYMBOL(cache_children)
416 #define bdb_cache_delete BDB_SYMBOL(cache_delete)
417 #define bdb_cache_delete_cleanup BDB_SYMBOL(cache_delete_cleanup)
418 #define bdb_cache_find_id BDB_SYMBOL(cache_find_id)
419 #define bdb_cache_find_info BDB_SYMBOL(cache_find_info)
420 #define bdb_cache_find_ndn BDB_SYMBOL(cache_find_ndn)
421 #define bdb_cache_modify BDB_SYMBOL(cache_modify)
422 #define bdb_cache_modrdn BDB_SYMBOL(cache_modrdn)
423 #define bdb_cache_release_all BDB_SYMBOL(cache_release_all)
424 #define bdb_cache_delete_entry BDB_SYMBOL(cache_delete_entry)
426 int bdb_cache_children(
432 struct bdb_info *bdb,
438 int bdb_cache_modrdn(
447 int bdb_cache_modify(
454 int bdb_cache_find_ndn(
460 EntryInfo * bdb_cache_find_info(
461 struct bdb_info *bdb,
464 int bdb_cache_find_id(
473 int bdb_cache_delete(
480 void bdb_cache_delete_cleanup(
484 void bdb_cache_release_all( Cache *cache );
485 void bdb_cache_delete_entry(
486 struct bdb_info *bdb,
494 struct bdb_info *bdb,
500 #define bdb_cache_entry_db_relock BDB_SYMBOL(cache_entry_db_relock)
501 int bdb_cache_entry_db_relock(
509 int bdb_cache_entry_db_unlock(
513 #ifdef BDB_REUSE_LOCKERS
515 #define bdb_locker_id BDB_SYMBOL(locker_id)
516 int bdb_locker_id( Operation *op, DB_ENV *env, int *locker );
518 #define LOCK_ID_FREE(env, locker)
519 #define LOCK_ID(env, locker) bdb_locker_id(op, env, locker)
523 #define LOCK_ID_FREE(env, locker) XLOCK_ID_FREE(env, locker)
524 #define LOCK_ID(env, locker) XLOCK_ID(env, locker)
531 #define bdb_trans_backoff BDB_SYMBOL(trans_backoff)
534 bdb_trans_backoff( int num_retries );
540 #define bdb_back_initialize BDB_SYMBOL(back_initialize)
541 #define bdb_db_config BDB_SYMBOL(db_config)
542 #define bdb_add BDB_SYMBOL(add)
543 #define bdb_bind BDB_SYMBOL(bind)
544 #define bdb_compare BDB_SYMBOL(compare)
545 #define bdb_delete BDB_SYMBOL(delete)
546 #define bdb_modify BDB_SYMBOL(modify)
547 #define bdb_modrdn BDB_SYMBOL(modrdn)
548 #define bdb_search BDB_SYMBOL(search)
549 #define bdb_extended BDB_SYMBOL(extended)
550 #define bdb_referrals BDB_SYMBOL(referrals)
551 #define bdb_operational BDB_SYMBOL(operational)
552 #define bdb_hasSubordinates BDB_SYMBOL(hasSubordinates)
553 #define bdb_tool_entry_open BDB_SYMBOL(tool_entry_open)
554 #define bdb_tool_entry_close BDB_SYMBOL(tool_entry_close)
555 #define bdb_tool_entry_next BDB_SYMBOL(tool_entry_next)
556 #define bdb_tool_entry_get BDB_SYMBOL(tool_entry_get)
557 #define bdb_tool_entry_put BDB_SYMBOL(tool_entry_put)
558 #define bdb_tool_entry_reindex BDB_SYMBOL(tool_entry_reindex)
559 #define bdb_tool_dn2id_get BDB_SYMBOL(tool_dn2id_get)
560 #define bdb_tool_id2entry_get BDB_SYMBOL(tool_id2entry_get)
561 #define bdb_tool_entry_modify BDB_SYMBOL(tool_entry_modify)
563 extern BI_init bdb_back_initialize;
565 extern BI_db_config bdb_db_config;
567 extern BI_op_add bdb_add;
568 extern BI_op_bind bdb_bind;
569 extern BI_op_compare bdb_compare;
570 extern BI_op_delete bdb_delete;
571 extern BI_op_modify bdb_modify;
572 extern BI_op_modrdn bdb_modrdn;
573 extern BI_op_search bdb_search;
574 extern BI_op_extended bdb_extended;
576 extern BI_chk_referrals bdb_referrals;
578 extern BI_operational bdb_operational;
580 extern BI_has_subordinates bdb_hasSubordinates;
583 extern BI_tool_entry_open bdb_tool_entry_open;
584 extern BI_tool_entry_close bdb_tool_entry_close;
585 extern BI_tool_entry_next bdb_tool_entry_next;
586 extern BI_tool_entry_get bdb_tool_entry_get;
587 extern BI_tool_entry_put bdb_tool_entry_put;
588 extern BI_tool_entry_reindex bdb_tool_entry_reindex;
589 extern BI_tool_dn2id_get bdb_tool_dn2id_get;
590 extern BI_tool_id2entry_get bdb_tool_id2entry_get;
591 extern BI_tool_entry_modify bdb_tool_entry_modify;
595 #endif /* _PROTO_BDB_H */