1 /* $OpenLDAP: pkg/ldap/servers/slapd/back-bdb/proto-bdb.h,v 1.137.2.9 2008/02/12 00:34:58 quanah Exp $ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 2000-2008 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_flush BDB_SYMBOL(attr_flush)
35 #define bdb_attr_slot BDB_SYMBOL(attr_slot)
36 #define bdb_attr_index_config BDB_SYMBOL(attr_index_config)
37 #define bdb_attr_index_destroy BDB_SYMBOL(attr_index_destroy)
38 #define bdb_attr_index_free BDB_SYMBOL(attr_index_free)
39 #define bdb_attr_index_unparse BDB_SYMBOL(attr_index_unparse)
40 #define bdb_attr_info_free BDB_SYMBOL(attr_info_free)
42 AttrInfo
*bdb_attr_mask( struct bdb_info
*bdb
,
43 AttributeDescription
*desc
);
45 void bdb_attr_flush( struct bdb_info
*bdb
);
47 int bdb_attr_slot( struct bdb_info
*bdb
,
48 AttributeDescription
*desc
, unsigned *insert
);
50 int bdb_attr_index_config
LDAP_P(( struct bdb_info
*bdb
,
51 const char *fname
, int lineno
,
52 int argc
, char **argv
));
54 void bdb_attr_index_unparse
LDAP_P(( struct bdb_info
*bdb
, BerVarray
*bva
));
55 void bdb_attr_index_destroy
LDAP_P(( struct bdb_info
*bdb
));
56 void bdb_attr_index_free
LDAP_P(( struct bdb_info
*bdb
,
57 AttributeDescription
*ad
));
59 void bdb_attr_info_free( AttrInfo
*ai
);
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 BDB_LOCKER 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)
111 int bdb_dn2id_delete(
117 int bdb_dn2id_children(
131 #define bdb_dn2id_parent BDB_SYMBOL(dn2id_parent)
132 #define bdb_dup_compare BDB_SYMBOL(dup_compare)
133 #define bdb_fix_dn BDB_SYMBOL(fix_dn)
135 int bdb_dn2id_parent(
146 int bdb_fix_dn( Entry
*e
, int checkit
);
153 #define bdb_errcall BDB_SYMBOL(errcall)
155 #if DB_VERSION_FULL < 0x04030000
156 void bdb_errcall( const char *pfx
, char * msg
);
158 #define bdb_msgcall BDB_SYMBOL(msgcall)
159 void bdb_errcall( const DB_ENV
*env
, const char *pfx
, const char * msg
);
160 void bdb_msgcall( const DB_ENV
*env
, const char * msg
);
164 #define ebcdic_dberror BDB_SYMBOL(ebcdic_dberror)
166 char *ebcdic_dberror( int rc
);
167 #define db_strerror(x) ebcdic_dberror(x)
173 #define bdb_filter_candidates BDB_SYMBOL(filter_candidates)
175 int bdb_filter_candidates(
186 #define bdb_id2entry BDB_SYMBOL(id2entry)
187 #define bdb_id2entry_add BDB_SYMBOL(id2entry_add)
188 #define bdb_id2entry_update BDB_SYMBOL(id2entry_update)
189 #define bdb_id2entry_delete BDB_SYMBOL(id2entry_delete)
191 int bdb_id2entry_add(
196 int bdb_id2entry_update(
201 int bdb_id2entry_delete(
206 #ifdef SLAP_ZONE_ALLOC
216 #define bdb_entry_free BDB_SYMBOL(entry_free)
217 #define bdb_entry_return BDB_SYMBOL(entry_return)
218 #define bdb_entry_release BDB_SYMBOL(entry_release)
219 #define bdb_entry_get BDB_SYMBOL(entry_get)
221 void bdb_entry_free ( Entry
*e
);
222 #ifdef SLAP_ZONE_ALLOC
223 int bdb_entry_return( struct bdb_info
*bdb
, Entry
*e
, int seqno
);
225 int bdb_entry_return( Entry
*e
);
227 BI_entry_release_rw bdb_entry_release
;
228 BI_entry_get_rw bdb_entry_get
;
235 #define bdb_idl_cache_get BDB_SYMBOL(idl_cache_get)
236 #define bdb_idl_cache_put BDB_SYMBOL(idl_cache_put)
237 #define bdb_idl_cache_del BDB_SYMBOL(idl_cache_del)
238 #define bdb_idl_cache_add_id BDB_SYMBOL(idl_cache_add_id)
239 #define bdb_idl_cache_del_id BDB_SYMBOL(idl_cache_del_id)
241 int bdb_idl_cache_get(
242 struct bdb_info
*bdb
,
249 struct bdb_info
*bdb
,
257 struct bdb_info
*bdb
,
262 bdb_idl_cache_add_id(
263 struct bdb_info
*bdb
,
269 bdb_idl_cache_del_id(
270 struct bdb_info
*bdb
,
275 #define bdb_idl_first BDB_SYMBOL(idl_first)
276 #define bdb_idl_next BDB_SYMBOL(idl_next)
277 #define bdb_idl_search BDB_SYMBOL(idl_search)
278 #define bdb_idl_insert BDB_SYMBOL(idl_insert)
279 #define bdb_idl_intersection BDB_SYMBOL(idl_intersection)
280 #define bdb_idl_union BDB_SYMBOL(idl_union)
281 #define bdb_idl_sort BDB_SYMBOL(idl_sort)
282 #define bdb_idl_append BDB_SYMBOL(idl_append)
283 #define bdb_idl_append_one BDB_SYMBOL(idl_append_one)
285 #define bdb_idl_fetch_key BDB_SYMBOL(idl_fetch_key)
286 #define bdb_idl_insert_key BDB_SYMBOL(idl_insert_key)
287 #define bdb_idl_delete_key BDB_SYMBOL(idl_delete_key)
289 unsigned bdb_idl_search( ID
*ids
, ID id
);
291 int bdb_idl_fetch_key(
300 int bdb_idl_insert( ID
*ids
, ID id
);
302 int bdb_idl_insert_key(
309 int bdb_idl_delete_key(
317 bdb_idl_intersection(
326 ID
bdb_idl_first( ID
*ids
, ID
*cursor
);
327 ID
bdb_idl_next( ID
*ids
, ID
*cursor
);
329 void bdb_idl_sort( ID
*ids
, ID
*tmp
);
330 int bdb_idl_append( ID
*a
, ID
*b
);
331 int bdb_idl_append_one( ID
*ids
, ID id
);
337 #define bdb_index_mask BDB_SYMBOL(index_mask)
338 #define bdb_index_param BDB_SYMBOL(index_param)
339 #define bdb_index_values BDB_SYMBOL(index_values)
340 #define bdb_index_entry BDB_SYMBOL(index_entry)
341 #define bdb_index_recset BDB_SYMBOL(index_recset)
342 #define bdb_index_recrun BDB_SYMBOL(index_recrun)
345 bdb_index_mask
LDAP_P((
347 AttributeDescription
*desc
,
348 struct berval
*name
));
351 bdb_index_param
LDAP_P((
353 AttributeDescription
*desc
,
357 struct berval
*prefix
));
360 bdb_index_values
LDAP_P((
363 AttributeDescription
*desc
,
369 bdb_index_recset
LDAP_P((
370 struct bdb_info
*bdb
,
377 bdb_index_recrun
LDAP_P((
379 struct bdb_info
*bdb
,
384 int bdb_index_entry
LDAP_P(( Operation
*op
, DB_TXN
*t
, int r
, Entry
*e
));
386 #define bdb_index_entry_add(op,t,e) \
387 bdb_index_entry((op),(t),SLAP_INDEX_ADD_OP,(e))
388 #define bdb_index_entry_del(op,t,e) \
389 bdb_index_entry((op),(t),SLAP_INDEX_DELETE_OP,(e))
394 #define bdb_key_read BDB_SYMBOL(key_read)
395 #define bdb_key_change BDB_SYMBOL(key_change)
419 #define bdb_next_id BDB_SYMBOL(next_id)
420 #define bdb_last_id BDB_SYMBOL(last_id)
422 int bdb_next_id( BackendDB
*be
, ID
*id
);
423 int bdb_last_id( BackendDB
*be
, DB_TXN
*tid
);
428 #define bdb_modify_internal BDB_SYMBOL(modify_internal)
430 int bdb_modify_internal(
433 Modifications
*modlist
,
443 #define bdb_monitor_db_init BDB_SYMBOL(monitor_db_init)
444 #define bdb_monitor_db_open BDB_SYMBOL(monitor_db_open)
445 #define bdb_monitor_db_close BDB_SYMBOL(monitor_db_close)
446 #define bdb_monitor_db_destroy BDB_SYMBOL(monitor_db_destroy)
448 int bdb_monitor_db_init( BackendDB
*be
);
449 int bdb_monitor_db_open( BackendDB
*be
);
450 int bdb_monitor_db_close( BackendDB
*be
);
451 int bdb_monitor_db_destroy( BackendDB
*be
);
453 #ifdef BDB_MONITOR_IDX
454 #define bdb_monitor_idx_add BDB_SYMBOL(monitor_idx_add)
457 struct bdb_info
*bdb
,
458 AttributeDescription
*desc
,
460 #endif /* BDB_MONITOR_IDX */
465 #define bdb_cache_entry_db_unlock BDB_SYMBOL(cache_entry_db_unlock)
466 #define bdb_cache_return_entry_rw BDB_SYMBOL(cache_return_entry_rw)
468 #define bdb_cache_entryinfo_lock(e) \
469 ldap_pvt_thread_mutex_lock( &(e)->bei_kids_mutex )
470 #define bdb_cache_entryinfo_unlock(e) \
471 ldap_pvt_thread_mutex_unlock( &(e)->bei_kids_mutex )
472 #define bdb_cache_entryinfo_trylock(e) \
473 ldap_pvt_thread_mutex_trylock( &(e)->bei_kids_mutex )
475 /* What a mess. Hopefully the current cache scheme will stabilize
476 * and we can trim out all of this stuff.
478 void bdb_cache_return_entry_rw( struct bdb_info
*bdb
, Entry
*e
,
479 int rw
, DB_LOCK
*lock
);
480 #define bdb_cache_return_entry_r(bdb, e, l) \
481 bdb_cache_return_entry_rw((bdb), (e), 0, (l))
482 #define bdb_cache_return_entry_w(bdb, e, l) \
483 bdb_cache_return_entry_rw((bdb), (e), 1, (l))
485 void bdb_unlocked_cache_return_entry_rw( struct bdb_info
*bdb
, Entry
*e
, int rw
);
487 #define bdb_unlocked_cache_return_entry_rw( a, b, c ) ((void)0)
489 #define bdb_unlocked_cache_return_entry_r( c, e ) \
490 bdb_unlocked_cache_return_entry_rw((c), (e), 0)
491 #define bdb_unlocked_cache_return_entry_w( c, e ) \
492 bdb_unlocked_cache_return_entry_rw((c), (e), 1)
494 #define bdb_cache_add BDB_SYMBOL(cache_add)
495 #define bdb_cache_children BDB_SYMBOL(cache_children)
496 #define bdb_cache_delete BDB_SYMBOL(cache_delete)
497 #define bdb_cache_delete_cleanup BDB_SYMBOL(cache_delete_cleanup)
498 #define bdb_cache_find_id BDB_SYMBOL(cache_find_id)
499 #define bdb_cache_find_info BDB_SYMBOL(cache_find_info)
500 #define bdb_cache_find_ndn BDB_SYMBOL(cache_find_ndn)
501 #define bdb_cache_find_parent BDB_SYMBOL(cache_find_parent)
502 #define bdb_cache_modify BDB_SYMBOL(cache_modify)
503 #define bdb_cache_modrdn BDB_SYMBOL(cache_modrdn)
504 #define bdb_cache_release_all BDB_SYMBOL(cache_release_all)
505 #define bdb_cache_delete_entry BDB_SYMBOL(cache_delete_entry)
507 int bdb_cache_children(
513 struct bdb_info
*bdb
,
520 int bdb_cache_modrdn(
521 struct bdb_info
*bdb
,
529 int bdb_cache_modify(
530 struct bdb_info
*bdb
,
536 int bdb_cache_find_ndn(
542 EntryInfo
* bdb_cache_find_info(
543 struct bdb_info
*bdb
,
549 int bdb_cache_find_id(
559 bdb_cache_find_parent(
565 int bdb_cache_delete(
566 struct bdb_info
*bdb
,
571 void bdb_cache_delete_cleanup(
575 void bdb_cache_release_all( Cache
*cache
);
579 struct bdb_info
*bdb
,
585 #define bdb_cache_entry_db_relock BDB_SYMBOL(cache_entry_db_relock)
586 int bdb_cache_entry_db_relock(
587 struct bdb_info
*bdb
,
594 int bdb_cache_entry_db_unlock(
595 struct bdb_info
*bdb
,
598 #ifdef BDB_REUSE_LOCKERS
600 #define bdb_locker_id BDB_SYMBOL(locker_id)
601 #define bdb_locker_flush BDB_SYMBOL(locker_flush)
602 int bdb_locker_id( Operation
*op
, DB_ENV
*env
, BDB_LOCKER
*locker
);
603 void bdb_locker_flush( DB_ENV
*env
);
605 #define LOCK_ID_FREE(env, locker) ((void)0)
606 #define LOCK_ID(env, locker) bdb_locker_id(op, env, locker)
610 #define LOCK_ID_FREE(env, locker) XLOCK_ID_FREE(env, locker)
611 #define LOCK_ID(env, locker) XLOCK_ID(env, locker)
618 #define bdb_trans_backoff BDB_SYMBOL(trans_backoff)
621 bdb_trans_backoff( int num_retries
);
627 #define bdb_back_initialize BDB_SYMBOL(back_initialize)
628 #define bdb_db_config BDB_SYMBOL(db_config)
629 #define bdb_add BDB_SYMBOL(add)
630 #define bdb_bind BDB_SYMBOL(bind)
631 #define bdb_compare BDB_SYMBOL(compare)
632 #define bdb_delete BDB_SYMBOL(delete)
633 #define bdb_modify BDB_SYMBOL(modify)
634 #define bdb_modrdn BDB_SYMBOL(modrdn)
635 #define bdb_search BDB_SYMBOL(search)
636 #define bdb_extended BDB_SYMBOL(extended)
637 #define bdb_referrals BDB_SYMBOL(referrals)
638 #define bdb_operational BDB_SYMBOL(operational)
639 #define bdb_hasSubordinates BDB_SYMBOL(hasSubordinates)
640 #define bdb_tool_entry_open BDB_SYMBOL(tool_entry_open)
641 #define bdb_tool_entry_close BDB_SYMBOL(tool_entry_close)
642 #define bdb_tool_entry_next BDB_SYMBOL(tool_entry_next)
643 #define bdb_tool_entry_get BDB_SYMBOL(tool_entry_get)
644 #define bdb_tool_entry_put BDB_SYMBOL(tool_entry_put)
645 #define bdb_tool_entry_reindex BDB_SYMBOL(tool_entry_reindex)
646 #define bdb_tool_dn2id_get BDB_SYMBOL(tool_dn2id_get)
647 #define bdb_tool_entry_modify BDB_SYMBOL(tool_entry_modify)
648 #define bdb_tool_idl_add BDB_SYMBOL(tool_idl_add)
650 extern BI_init bdb_back_initialize
;
652 extern BI_db_config bdb_db_config
;
654 extern BI_op_add bdb_add
;
655 extern BI_op_bind bdb_bind
;
656 extern BI_op_compare bdb_compare
;
657 extern BI_op_delete bdb_delete
;
658 extern BI_op_modify bdb_modify
;
659 extern BI_op_modrdn bdb_modrdn
;
660 extern BI_op_search bdb_search
;
661 extern BI_op_extended bdb_extended
;
663 extern BI_chk_referrals bdb_referrals
;
665 extern BI_operational bdb_operational
;
667 extern BI_has_subordinates bdb_hasSubordinates
;
670 extern BI_tool_entry_open bdb_tool_entry_open
;
671 extern BI_tool_entry_close bdb_tool_entry_close
;
672 extern BI_tool_entry_next bdb_tool_entry_next
;
673 extern BI_tool_entry_get bdb_tool_entry_get
;
674 extern BI_tool_entry_put bdb_tool_entry_put
;
675 extern BI_tool_entry_reindex bdb_tool_entry_reindex
;
676 extern BI_tool_dn2id_get bdb_tool_dn2id_get
;
677 extern BI_tool_entry_modify bdb_tool_entry_modify
;
679 int bdb_tool_idl_add( BackendDB
*be
, DB
*db
, DB_TXN
*txn
, DBT
*key
, ID id
);
683 #endif /* _PROTO_BDB_H */