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)
36 #define bdb_attr_index_unparse BDB_SYMBOL(attr_index_unparse)
38 #ifdef LDAP_COMP_MATCH
39 #define bdb_attr_comp_ref BDB_SYMBOL(attr_comp_ref)
40 #define bdb_attr_mask_cr BDB_SYMBOL(attr_mask_cr)
41 void bdb_attr_comp_ref( struct bdb_info *bdb,
42 AttributeDescription *desc,
43 ComponentReference **cr );
44 void bdb_attr_mask_cr( struct bdb_info *bdb,
45 AttributeDescription *desc,
46 slap_mask_t *indexmask,
47 ComponentReference **cr );
50 void bdb_attr_mask( struct bdb_info *bdb,
51 AttributeDescription *desc,
52 slap_mask_t *indexmask );
54 int bdb_attr_index_config LDAP_P(( struct bdb_info *bdb,
55 const char *fname, int lineno,
56 int argc, char **argv ));
58 void bdb_attr_index_unparse LDAP_P(( struct bdb_info *bdb, BerVarray *bva ));
59 void bdb_attr_index_destroy LDAP_P(( Avlnode *tree ));
65 #define bdb_back_init_cf BDB_SYMBOL(back_init_cf)
67 int bdb_back_init_cf( BackendInfo *bi );
72 #define bdb_db_cache BDB_SYMBOL(db_cache)
83 #define bdb_dn2entry BDB_SYMBOL(dn2entry)
85 int bdb_dn2entry LDAP_P(( Operation *op, DB_TXN *tid,
86 struct berval *dn, EntryInfo **e, int matched,
87 u_int32_t locker, DB_LOCK *lock ));
92 #define bdb_dn2id BDB_SYMBOL(dn2id)
93 #define bdb_dn2id_add BDB_SYMBOL(dn2id_add)
94 #define bdb_dn2id_delete BDB_SYMBOL(dn2id_delete)
95 #define bdb_dn2id_children BDB_SYMBOL(dn2id_children)
96 #define bdb_dn2idl BDB_SYMBOL(dn2idl)
110 int bdb_dn2id_delete(
116 int bdb_dn2id_children(
128 #define bdb_dn2id_parent BDB_SYMBOL(dn2id_parent)
129 #define bdb_fix_dn BDB_SYMBOL(fix_dn)
131 int bdb_dn2id_parent(
137 int bdb_fix_dn( Entry *e, int checkit );
144 #define bdb_errcall BDB_SYMBOL(errcall)
146 #if DB_VERSION_FULL < 0x04030000
147 void bdb_errcall( const char *pfx, char * msg );
149 #define bdb_msgcall BDB_SYMBOL(msgcall)
150 void bdb_errcall( const DB_ENV *env, const char *pfx, const char * msg );
151 void bdb_msgcall( const DB_ENV *env, const char * msg );
155 #define ebcdic_dberror BDB_SYMBOL(ebcdic_dberror)
157 char *ebcdic_dberror( int rc );
158 #define db_strerror(x) ebcdic_dberror(x)
164 #define bdb_filter_candidates BDB_SYMBOL(filter_candidates)
166 int bdb_filter_candidates(
176 #define bdb_id2entry BDB_SYMBOL(id2entry)
177 #define bdb_id2entry_add BDB_SYMBOL(id2entry_add)
178 #define bdb_id2entry_update BDB_SYMBOL(id2entry_update)
179 #define bdb_id2entry_delete BDB_SYMBOL(id2entry_delete)
181 int bdb_id2entry_add(
186 int bdb_id2entry_update(
191 int bdb_id2entry_delete(
196 #ifdef SLAP_ZONE_ALLOC
205 #define bdb_entry_free BDB_SYMBOL(entry_free)
206 #define bdb_entry_return BDB_SYMBOL(entry_return)
207 #define bdb_entry_release BDB_SYMBOL(entry_release)
208 #define bdb_entry_get BDB_SYMBOL(entry_get)
210 void bdb_entry_free ( Entry *e );
211 #ifdef SLAP_ZONE_ALLOC
212 int bdb_entry_return( struct bdb_info *bdb, Entry *e, int seqno );
214 int bdb_entry_return( Entry *e );
216 BI_entry_release_rw bdb_entry_release;
217 BI_entry_get_rw bdb_entry_get;
224 #define bdb_idl_cache_get BDB_SYMBOL(idl_cache_get)
225 #define bdb_idl_cache_put BDB_SYMBOL(idl_cache_put)
226 #define bdb_idl_cache_del BDB_SYMBOL(idl_cache_del)
228 int bdb_idl_cache_get(
229 struct bdb_info *bdb,
236 struct bdb_info *bdb,
244 struct bdb_info *bdb,
248 #define bdb_idl_first BDB_SYMBOL(idl_first)
249 #define bdb_idl_next BDB_SYMBOL(idl_next)
250 #define bdb_idl_search BDB_SYMBOL(idl_search)
251 #define bdb_idl_insert BDB_SYMBOL(idl_insert)
252 #define bdb_idl_intersection BDB_SYMBOL(idl_intersection)
253 #define bdb_idl_union BDB_SYMBOL(idl_union)
254 #define bdb_idl_sort BDB_SYMBOL(idl_sort)
255 #define bdb_idl_append BDB_SYMBOL(idl_append)
256 #define bdb_idl_append_one BDB_SYMBOL(idl_append_one)
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 );
302 void bdb_idl_sort( ID *ids );
303 int bdb_idl_append( ID *a, ID *b );
304 int bdb_idl_append_one( ID *ids, ID id );
310 #define bdb_index_is_indexed BDB_SYMBOL(index_is_indexed)
311 #define bdb_index_param BDB_SYMBOL(index_param)
312 #define bdb_index_values BDB_SYMBOL(index_values)
313 #define bdb_index_entry BDB_SYMBOL(index_entry)
316 bdb_index_is_indexed LDAP_P((
318 AttributeDescription *desc ));
321 bdb_index_param LDAP_P((
323 AttributeDescription *desc,
327 struct berval *prefix ));
330 bdb_index_values LDAP_P((
333 AttributeDescription *desc,
338 int bdb_index_entry LDAP_P(( Operation *op, DB_TXN *t, int r, Entry *e ));
340 #define bdb_index_entry_add(op,t,e) \
341 bdb_index_entry((op),(t),SLAP_INDEX_ADD_OP,(e))
342 #define bdb_index_entry_del(op,t,e) \
343 bdb_index_entry((op),(t),SLAP_INDEX_DELETE_OP,(e))
348 #define bdb_key_read BDB_SYMBOL(key_read)
349 #define bdb_key_change BDB_SYMBOL(key_change)
373 #define bdb_next_id BDB_SYMBOL(next_id)
374 #define bdb_last_id BDB_SYMBOL(last_id)
376 int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
377 int bdb_last_id( BackendDB *be, DB_TXN *tid );
382 #define bdb_modify_internal BDB_SYMBOL(modify_internal)
384 int bdb_modify_internal(
387 Modifications *modlist,
397 #define bdb_cache_entry_db_unlock BDB_SYMBOL(cache_entry_db_unlock)
399 #define bdb_cache_entryinfo_lock(e) \
400 ldap_pvt_thread_mutex_lock( &(e)->bei_kids_mutex )
401 #define bdb_cache_entryinfo_unlock(e) \
402 ldap_pvt_thread_mutex_unlock( &(e)->bei_kids_mutex )
404 /* What a mess. Hopefully the current cache scheme will stabilize
405 * and we can trim out all of this stuff.
408 void bdb_cache_return_entry_rw( DB_ENV *env, Cache *cache, Entry *e,
409 int rw, DB_LOCK *lock );
411 #define bdb_cache_return_entry_rw( env, cache, e, rw, lock ) \
412 bdb_cache_entry_db_unlock( env, lock )
413 #define bdb_cache_return_entry( env, lock ) \
414 bdb_cache_entry_db_unlock( env, lock )
416 #define bdb_cache_return_entry_r(env, c, e, l) \
417 bdb_cache_return_entry_rw((env), (c), (e), 0, (l))
418 #define bdb_cache_return_entry_w(env, c, e, l) \
419 bdb_cache_return_entry_rw((env), (c), (e), 1, (l))
421 void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
423 #define bdb_unlocked_cache_return_entry_rw( a, b, c )
425 #define bdb_unlocked_cache_return_entry_r( c, e ) \
426 bdb_unlocked_cache_return_entry_rw((c), (e), 0)
427 #define bdb_unlocked_cache_return_entry_w( c, e ) \
428 bdb_unlocked_cache_return_entry_rw((c), (e), 1)
430 #define bdb_cache_add BDB_SYMBOL(cache_add)
431 #define bdb_cache_children BDB_SYMBOL(cache_children)
432 #define bdb_cache_delete BDB_SYMBOL(cache_delete)
433 #define bdb_cache_delete_cleanup BDB_SYMBOL(cache_delete_cleanup)
434 #define bdb_cache_find_id BDB_SYMBOL(cache_find_id)
435 #define bdb_cache_find_info BDB_SYMBOL(cache_find_info)
436 #define bdb_cache_find_ndn BDB_SYMBOL(cache_find_ndn)
437 #define bdb_cache_modify BDB_SYMBOL(cache_modify)
438 #define bdb_cache_modrdn BDB_SYMBOL(cache_modrdn)
439 #define bdb_cache_release_all BDB_SYMBOL(cache_release_all)
440 #define bdb_cache_delete_entry BDB_SYMBOL(cache_delete_entry)
442 int bdb_cache_children(
448 struct bdb_info *bdb,
454 int bdb_cache_modrdn(
463 int bdb_cache_modify(
470 int bdb_cache_find_ndn(
476 EntryInfo * bdb_cache_find_info(
477 struct bdb_info *bdb,
480 int bdb_cache_find_id(
489 int bdb_cache_delete(
496 void bdb_cache_delete_cleanup(
500 void bdb_cache_release_all( Cache *cache );
501 void bdb_cache_delete_entry(
502 struct bdb_info *bdb,
510 struct bdb_info *bdb,
516 #define bdb_cache_entry_db_relock BDB_SYMBOL(cache_entry_db_relock)
517 int bdb_cache_entry_db_relock(
525 int bdb_cache_entry_db_unlock(
529 #ifdef BDB_REUSE_LOCKERS
531 #define bdb_locker_id BDB_SYMBOL(locker_id)
532 int bdb_locker_id( Operation *op, DB_ENV *env, int *locker );
534 #define LOCK_ID_FREE(env, locker)
535 #define LOCK_ID(env, locker) bdb_locker_id(op, env, locker)
539 #define LOCK_ID_FREE(env, locker) XLOCK_ID_FREE(env, locker)
540 #define LOCK_ID(env, locker) XLOCK_ID(env, locker)
547 #define bdb_trans_backoff BDB_SYMBOL(trans_backoff)
550 bdb_trans_backoff( int num_retries );
556 #define bdb_back_initialize BDB_SYMBOL(back_initialize)
557 #define bdb_db_config BDB_SYMBOL(db_config)
558 #define bdb_add BDB_SYMBOL(add)
559 #define bdb_bind BDB_SYMBOL(bind)
560 #define bdb_compare BDB_SYMBOL(compare)
561 #define bdb_delete BDB_SYMBOL(delete)
562 #define bdb_modify BDB_SYMBOL(modify)
563 #define bdb_modrdn BDB_SYMBOL(modrdn)
564 #define bdb_search BDB_SYMBOL(search)
565 #define bdb_extended BDB_SYMBOL(extended)
566 #define bdb_referrals BDB_SYMBOL(referrals)
567 #define bdb_operational BDB_SYMBOL(operational)
568 #define bdb_hasSubordinates BDB_SYMBOL(hasSubordinates)
569 #define bdb_tool_entry_open BDB_SYMBOL(tool_entry_open)
570 #define bdb_tool_entry_close BDB_SYMBOL(tool_entry_close)
571 #define bdb_tool_entry_next BDB_SYMBOL(tool_entry_next)
572 #define bdb_tool_entry_get BDB_SYMBOL(tool_entry_get)
573 #define bdb_tool_entry_put BDB_SYMBOL(tool_entry_put)
574 #define bdb_tool_entry_reindex BDB_SYMBOL(tool_entry_reindex)
575 #define bdb_tool_dn2id_get BDB_SYMBOL(tool_dn2id_get)
576 #define bdb_tool_id2entry_get BDB_SYMBOL(tool_id2entry_get)
577 #define bdb_tool_entry_modify BDB_SYMBOL(tool_entry_modify)
579 extern BI_init bdb_back_initialize;
581 extern BI_db_config bdb_db_config;
583 extern BI_op_add bdb_add;
584 extern BI_op_bind bdb_bind;
585 extern BI_op_compare bdb_compare;
586 extern BI_op_delete bdb_delete;
587 extern BI_op_modify bdb_modify;
588 extern BI_op_modrdn bdb_modrdn;
589 extern BI_op_search bdb_search;
590 extern BI_op_extended bdb_extended;
592 extern BI_chk_referrals bdb_referrals;
594 extern BI_operational bdb_operational;
596 extern BI_has_subordinates bdb_hasSubordinates;
599 extern BI_tool_entry_open bdb_tool_entry_open;
600 extern BI_tool_entry_close bdb_tool_entry_close;
601 extern BI_tool_entry_next bdb_tool_entry_next;
602 extern BI_tool_entry_get bdb_tool_entry_get;
603 extern BI_tool_entry_put bdb_tool_entry_put;
604 extern BI_tool_entry_reindex bdb_tool_entry_reindex;
605 extern BI_tool_dn2id_get bdb_tool_dn2id_get;
606 extern BI_tool_id2entry_get bdb_tool_id2entry_get;
607 extern BI_tool_entry_modify bdb_tool_entry_modify;
611 #endif /* _PROTO_BDB_H */