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 #define bdb_attr_mask_cr BDB_SYMBOL(attr_mask_cr)
40 void bdb_attr_comp_ref( struct bdb_info *bdb,
41 AttributeDescription *desc,
42 ComponentReference **cr );
43 void bdb_attr_mask_cr( struct bdb_info *bdb,
44 AttributeDescription *desc,
45 slap_mask_t *indexmask,
46 ComponentReference **cr );
49 void bdb_attr_mask( struct bdb_info *bdb,
50 AttributeDescription *desc,
51 slap_mask_t *indexmask );
53 int bdb_attr_index_config LDAP_P(( struct bdb_info *bdb,
54 const char *fname, int lineno,
55 int argc, char **argv ));
57 void bdb_attr_index_destroy LDAP_P(( Avlnode *tree ));
62 #define bdb_db_cache BDB_SYMBOL(db_cache)
73 #define bdb_dn2entry BDB_SYMBOL(dn2entry)
75 int bdb_dn2entry LDAP_P(( Operation *op, DB_TXN *tid,
76 struct berval *dn, EntryInfo **e, int matched,
77 u_int32_t locker, DB_LOCK *lock ));
82 #define bdb_dn2id BDB_SYMBOL(dn2id)
83 #define bdb_dn2id_add BDB_SYMBOL(dn2id_add)
84 #define bdb_dn2id_delete BDB_SYMBOL(dn2id_delete)
85 #define bdb_dn2id_children BDB_SYMBOL(dn2id_children)
86 #define bdb_dn2idl BDB_SYMBOL(dn2idl)
100 int bdb_dn2id_delete(
106 int bdb_dn2id_children(
118 #define bdb_dn2id_parent BDB_SYMBOL(dn2id_parent)
119 #define bdb_fix_dn BDB_SYMBOL(fix_dn)
121 int bdb_dn2id_parent(
127 int bdb_fix_dn( Entry *e, int checkit );
134 #define bdb_errcall BDB_SYMBOL(errcall)
136 #if DB_VERSION_FULL < 0x04030000
137 void bdb_errcall( const char *pfx, char * msg );
139 void bdb_errcall( const DB_ENV *env, const char *pfx, const char * msg );
143 #define ebcdic_dberror BDB_SYMBOL(ebcdic_dberror)
145 char *ebcdic_dberror( int rc );
146 #define db_strerror(x) ebcdic_dberror(x)
152 #define bdb_filter_candidates BDB_SYMBOL(filter_candidates)
154 int bdb_filter_candidates(
164 #define bdb_id2entry BDB_SYMBOL(id2entry)
165 #define bdb_id2entry_add BDB_SYMBOL(id2entry_add)
166 #define bdb_id2entry_update BDB_SYMBOL(id2entry_update)
167 #define bdb_id2entry_delete BDB_SYMBOL(id2entry_delete)
169 int bdb_id2entry_add(
174 int bdb_id2entry_update(
179 int bdb_id2entry_delete(
184 #ifdef SLAP_ZONE_ALLOC
193 #define bdb_entry_free BDB_SYMBOL(entry_free)
194 #define bdb_entry_return BDB_SYMBOL(entry_return)
195 #define bdb_entry_release BDB_SYMBOL(entry_release)
196 #define bdb_entry_get BDB_SYMBOL(entry_get)
198 void bdb_entry_free ( Entry *e );
199 #ifdef SLAP_ZONE_ALLOC
200 int bdb_entry_return( struct bdb_info *bdb, Entry *e, int seqno );
202 int bdb_entry_return( Entry *e );
204 BI_entry_release_rw bdb_entry_release;
205 BI_entry_get_rw bdb_entry_get;
212 #define bdb_idl_cache_get BDB_SYMBOL(idl_cache_get)
213 #define bdb_idl_cache_put BDB_SYMBOL(idl_cache_put)
214 #define bdb_idl_cache_del BDB_SYMBOL(idl_cache_del)
216 int bdb_idl_cache_get(
217 struct bdb_info *bdb,
224 struct bdb_info *bdb,
232 struct bdb_info *bdb,
236 #define bdb_idl_first BDB_SYMBOL(idl_first)
237 #define bdb_idl_next BDB_SYMBOL(idl_next)
238 #define bdb_idl_search BDB_SYMBOL(idl_search)
239 #define bdb_idl_insert BDB_SYMBOL(idl_insert)
240 #define bdb_idl_intersection BDB_SYMBOL(idl_intersection)
241 #define bdb_idl_union BDB_SYMBOL(idl_union)
243 #define bdb_idl_fetch_key BDB_SYMBOL(idl_fetch_key)
244 #define bdb_idl_insert_key BDB_SYMBOL(idl_insert_key)
245 #define bdb_idl_delete_key BDB_SYMBOL(idl_delete_key)
247 unsigned bdb_idl_search( ID *ids, ID id );
249 int bdb_idl_fetch_key(
258 int bdb_idl_insert( ID *ids, ID id );
260 int bdb_idl_insert_key(
267 int bdb_idl_delete_key(
275 bdb_idl_intersection(
284 ID bdb_idl_first( ID *ids, ID *cursor );
285 ID bdb_idl_next( ID *ids, ID *cursor );
292 #define bdb_index_is_indexed BDB_SYMBOL(index_is_indexed)
293 #define bdb_index_param BDB_SYMBOL(index_param)
294 #define bdb_index_values BDB_SYMBOL(index_values)
295 #define bdb_index_entry BDB_SYMBOL(index_entry)
298 bdb_index_is_indexed LDAP_P((
300 AttributeDescription *desc ));
303 bdb_index_param LDAP_P((
305 AttributeDescription *desc,
309 struct berval *prefix ));
312 bdb_index_values LDAP_P((
315 AttributeDescription *desc,
320 int bdb_index_entry LDAP_P(( Operation *op, DB_TXN *t, int r, Entry *e ));
322 #define bdb_index_entry_add(op,t,e) \
323 bdb_index_entry((op),(t),SLAP_INDEX_ADD_OP,(e))
324 #define bdb_index_entry_del(op,t,e) \
325 bdb_index_entry((op),(t),SLAP_INDEX_DELETE_OP,(e))
330 #define bdb_uuid BDB_SYMBOL(uuid)
332 extern struct berval bdb_uuid;
337 #define bdb_key_read BDB_SYMBOL(key_read)
338 #define bdb_key_change BDB_SYMBOL(key_change)
362 #define bdb_next_id BDB_SYMBOL(next_id)
363 #define bdb_last_id BDB_SYMBOL(last_id)
365 int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
366 int bdb_last_id( BackendDB *be, DB_TXN *tid );
371 #define bdb_modify_internal BDB_SYMBOL(modify_internal)
373 int bdb_modify_internal(
376 Modifications *modlist,
386 #define bdb_cache_entry_db_unlock BDB_SYMBOL(cache_entry_db_unlock)
388 #define bdb_cache_entryinfo_lock(e) \
389 ldap_pvt_thread_mutex_lock( &(e)->bei_kids_mutex )
390 #define bdb_cache_entryinfo_unlock(e) \
391 ldap_pvt_thread_mutex_unlock( &(e)->bei_kids_mutex )
393 /* What a mess. Hopefully the current cache scheme will stabilize
394 * and we can trim out all of this stuff.
397 void bdb_cache_return_entry_rw( DB_ENV *env, Cache *cache, Entry *e,
398 int rw, DB_LOCK *lock );
400 #define bdb_cache_return_entry_rw( env, cache, e, rw, lock ) \
401 bdb_cache_entry_db_unlock( env, lock )
402 #define bdb_cache_return_entry( env, lock ) \
403 bdb_cache_entry_db_unlock( env, lock )
405 #define bdb_cache_return_entry_r(env, c, e, l) \
406 bdb_cache_return_entry_rw((env), (c), (e), 0, (l))
407 #define bdb_cache_return_entry_w(env, c, e, l) \
408 bdb_cache_return_entry_rw((env), (c), (e), 1, (l))
410 void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
412 #define bdb_unlocked_cache_return_entry_rw( a, b, c )
414 #define bdb_unlocked_cache_return_entry_r( c, e ) \
415 bdb_unlocked_cache_return_entry_rw((c), (e), 0)
416 #define bdb_unlocked_cache_return_entry_w( c, e ) \
417 bdb_unlocked_cache_return_entry_rw((c), (e), 1)
419 #define bdb_cache_add BDB_SYMBOL(cache_add)
420 #define bdb_cache_children BDB_SYMBOL(cache_children)
421 #define bdb_cache_delete BDB_SYMBOL(cache_delete)
422 #define bdb_cache_delete_cleanup BDB_SYMBOL(cache_delete_cleanup)
423 #define bdb_cache_find_id BDB_SYMBOL(cache_find_id)
424 #define bdb_cache_find_info BDB_SYMBOL(cache_find_info)
425 #define bdb_cache_find_ndn BDB_SYMBOL(cache_find_ndn)
426 #define bdb_cache_modify BDB_SYMBOL(cache_modify)
427 #define bdb_cache_modrdn BDB_SYMBOL(cache_modrdn)
428 #define bdb_cache_release_all BDB_SYMBOL(cache_release_all)
429 #define bdb_cache_delete_entry BDB_SYMBOL(cache_delete_entry)
431 int bdb_cache_children(
437 struct bdb_info *bdb,
443 int bdb_cache_modrdn(
452 int bdb_cache_modify(
459 int bdb_cache_find_ndn(
465 EntryInfo * bdb_cache_find_info(
466 struct bdb_info *bdb,
469 int bdb_cache_find_id(
478 int bdb_cache_delete(
485 void bdb_cache_delete_cleanup(
489 void bdb_cache_release_all( Cache *cache );
490 void bdb_cache_delete_entry(
491 struct bdb_info *bdb,
499 struct bdb_info *bdb,
505 #define bdb_cache_entry_db_relock BDB_SYMBOL(cache_entry_db_relock)
506 int bdb_cache_entry_db_relock(
514 int bdb_cache_entry_db_unlock(
518 #ifdef BDB_REUSE_LOCKERS
520 #define bdb_locker_id BDB_SYMBOL(locker_id)
521 int bdb_locker_id( Operation *op, DB_ENV *env, int *locker );
523 #define LOCK_ID_FREE(env, locker)
524 #define LOCK_ID(env, locker) bdb_locker_id(op, env, locker)
528 #define LOCK_ID_FREE(env, locker) XLOCK_ID_FREE(env, locker)
529 #define LOCK_ID(env, locker) XLOCK_ID(env, locker)
536 #define bdb_trans_backoff BDB_SYMBOL(trans_backoff)
539 bdb_trans_backoff( int num_retries );
545 #define bdb_back_initialize BDB_SYMBOL(back_initialize)
546 #define bdb_db_config BDB_SYMBOL(db_config)
547 #define bdb_add BDB_SYMBOL(add)
548 #define bdb_bind BDB_SYMBOL(bind)
549 #define bdb_compare BDB_SYMBOL(compare)
550 #define bdb_delete BDB_SYMBOL(delete)
551 #define bdb_modify BDB_SYMBOL(modify)
552 #define bdb_modrdn BDB_SYMBOL(modrdn)
553 #define bdb_search BDB_SYMBOL(search)
554 #define bdb_extended BDB_SYMBOL(extended)
555 #define bdb_referrals BDB_SYMBOL(referrals)
556 #define bdb_operational BDB_SYMBOL(operational)
557 #define bdb_hasSubordinates BDB_SYMBOL(hasSubordinates)
558 #define bdb_tool_entry_open BDB_SYMBOL(tool_entry_open)
559 #define bdb_tool_entry_close BDB_SYMBOL(tool_entry_close)
560 #define bdb_tool_entry_next BDB_SYMBOL(tool_entry_next)
561 #define bdb_tool_entry_get BDB_SYMBOL(tool_entry_get)
562 #define bdb_tool_entry_put BDB_SYMBOL(tool_entry_put)
563 #define bdb_tool_entry_reindex BDB_SYMBOL(tool_entry_reindex)
564 #define bdb_tool_dn2id_get BDB_SYMBOL(tool_dn2id_get)
565 #define bdb_tool_id2entry_get BDB_SYMBOL(tool_id2entry_get)
566 #define bdb_tool_entry_modify BDB_SYMBOL(tool_entry_modify)
568 extern BI_init bdb_back_initialize;
570 extern BI_db_config bdb_db_config;
572 extern BI_op_add bdb_add;
573 extern BI_op_bind bdb_bind;
574 extern BI_op_compare bdb_compare;
575 extern BI_op_delete bdb_delete;
576 extern BI_op_modify bdb_modify;
577 extern BI_op_modrdn bdb_modrdn;
578 extern BI_op_search bdb_search;
579 extern BI_op_extended bdb_extended;
581 extern BI_chk_referrals bdb_referrals;
583 extern BI_operational bdb_operational;
585 extern BI_has_subordinates bdb_hasSubordinates;
588 extern BI_tool_entry_open bdb_tool_entry_open;
589 extern BI_tool_entry_close bdb_tool_entry_close;
590 extern BI_tool_entry_next bdb_tool_entry_next;
591 extern BI_tool_entry_get bdb_tool_entry_get;
592 extern BI_tool_entry_put bdb_tool_entry_put;
593 extern BI_tool_entry_reindex bdb_tool_entry_reindex;
594 extern BI_tool_dn2id_get bdb_tool_dn2id_get;
595 extern BI_tool_id2entry_get bdb_tool_id2entry_get;
596 extern BI_tool_entry_modify bdb_tool_entry_modify;
600 #endif /* _PROTO_BDB_H */