]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/proto-bdb.h
Clean up unused bt_compare references
[openldap] / servers / slapd / back-bdb / proto-bdb.h
1 /* $OpenLDAP$ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3  *
4  * Copyright 2000-2005 The OpenLDAP Foundation.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted only as authorized by the OpenLDAP
9  * Public License.
10  *
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>.
14  */
15
16 #ifndef _PROTO_BDB_H
17 #define _PROTO_BDB_H
18
19 LDAP_BEGIN_DECL
20
21 #ifdef BDB_HIER
22 #define BDB_SYMBOL(x)   LDAP_CONCAT(hdb_,x)
23 #define BDB_UCTYPE      "HDB"
24 #else
25 #define BDB_SYMBOL(x)   LDAP_CONCAT(bdb_,x)
26 #define BDB_UCTYPE      "BDB"
27 #endif
28
29 /*
30  * attr.c
31  */
32
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
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 );
42 #endif
43
44 void bdb_attr_mask( struct bdb_info *bdb,
45         AttributeDescription *desc,
46         slap_mask_t *indexmask );
47
48 int bdb_attr_index_config LDAP_P(( struct bdb_info *bdb,
49         const char *fname, int lineno,
50         int argc, char **argv ));
51
52 void bdb_attr_index_destroy LDAP_P(( Avlnode *tree ));
53
54 /*
55  * ctxcsn.c
56  */
57 #define bdb_csn_commit                          BDB_SYMBOL(csn_commit)
58 #define bdb_get_commit_csn                      BDB_SYMBOL(get_commit_csn)
59
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 ));
63
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 ));
67
68 /*
69  * dbcache.c
70  */
71 #define bdb_db_cache                            BDB_SYMBOL(db_cache)
72
73 int
74 bdb_db_cache(
75     Backend     *be,
76     const char *name,
77         DB **db );
78
79 /*
80  * dn2entry.c
81  */
82 #define bdb_dn2entry                            BDB_SYMBOL(dn2entry)
83
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 ));
87
88 /*
89  * dn2id.c
90  */
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)
96
97 int bdb_dn2id(
98         Operation *op,
99         DB_TXN *tid,
100         struct berval *dn,
101         EntryInfo *ei );
102
103 int bdb_dn2id_add(
104         Operation *op,
105         DB_TXN *tid,
106         EntryInfo *eip,
107         Entry *e );
108
109 int bdb_dn2id_delete(
110         Operation *op,
111         DB_TXN *tid,
112         EntryInfo *eip,
113         Entry *e );
114
115 int bdb_dn2id_children(
116         Operation *op,
117         DB_TXN *tid,
118         Entry *e );
119
120 int bdb_dn2idl(
121         Operation *op,
122         Entry *e,
123         ID *ids,
124         ID *stack );
125
126 #ifdef BDB_HIER
127 #define bdb_dn2id_parent                        BDB_SYMBOL(dn2id_parent)
128 #define bdb_fix_dn                                      BDB_SYMBOL(fix_dn)
129
130 int bdb_dn2id_parent(
131         Operation *op,
132         DB_TXN *txn,
133         EntryInfo *ei,
134         ID *idp );
135
136 int bdb_fix_dn( Entry *e, int checkit );
137 #endif
138
139
140 /*
141  * error.c
142  */
143 #define bdb_errcall                                     BDB_SYMBOL(errcall)
144
145 #if DB_VERSION_FULL < 0x04030000
146 void bdb_errcall( const char *pfx, char * msg );
147 #else
148 void bdb_errcall( const DB_ENV *env, const char *pfx, const char * msg );
149 #endif
150
151 #ifdef HAVE_EBCDIC
152 #define ebcdic_dberror                          BDB_SYMBOL(ebcdic_dberror)
153
154 char *ebcdic_dberror( int rc );
155 #define db_strerror(x)  ebcdic_dberror(x)
156 #endif
157
158 /*
159  * filterentry.c
160  */
161 #define bdb_filter_candidates           BDB_SYMBOL(filter_candidates)
162
163 int bdb_filter_candidates(
164         Operation *op,
165         Filter  *f,
166         ID *ids,
167         ID *tmp,
168         ID *stack );
169
170 /*
171  * id2entry.c
172  */
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)
177
178 int bdb_id2entry_add(
179         BackendDB *be,
180         DB_TXN *tid,
181         Entry *e );
182
183 int bdb_id2entry_update(
184         BackendDB *be,
185         DB_TXN *tid,
186         Entry *e );
187
188 int bdb_id2entry_delete(
189         BackendDB *be,
190         DB_TXN *tid,
191         Entry *e);
192
193 #ifdef SLAP_ZONE_ALLOC
194 #else
195 int bdb_id2entry(
196         BackendDB *be,
197         DB_TXN *tid,
198         ID id,
199         Entry **e);
200 #endif
201
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)
206
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 );
210 #else
211 int bdb_entry_return( Entry *e );
212 #endif
213 BI_entry_release_rw bdb_entry_release;
214 BI_entry_get_rw bdb_entry_get;
215
216
217 /*
218  * idl.c
219  */
220
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)
224
225 int bdb_idl_cache_get(
226         struct bdb_info *bdb,
227         DB *db,
228         DBT *key,
229         ID *ids );
230
231 void
232 bdb_idl_cache_put(
233         struct bdb_info *bdb,
234         DB              *db,
235         DBT             *key,
236         ID              *ids,
237         int             rc );
238
239 void
240 bdb_idl_cache_del(
241         struct bdb_info *bdb,
242         DB              *db,
243         DBT             *key );
244
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)
251
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)
255
256 unsigned bdb_idl_search( ID *ids, ID id );
257
258 int bdb_idl_fetch_key(
259         BackendDB       *be,
260         DB                      *db,
261         DB_TXN          *tid,
262         DBT                     *key,
263         ID                      *ids,
264         DBC                     **saved_cursor,
265         int                     get_flag );
266
267 int bdb_idl_insert( ID *ids, ID id );
268
269 int bdb_idl_insert_key(
270         BackendDB *be,
271         DB *db,
272         DB_TXN *txn,
273         DBT *key,
274         ID id );
275
276 int bdb_idl_delete_key(
277         BackendDB *be,
278         DB *db,
279         DB_TXN *txn,
280         DBT *key,
281         ID id );
282
283 int
284 bdb_idl_intersection(
285         ID *a,
286         ID *b );
287
288 int
289 bdb_idl_union(
290         ID *a,
291         ID *b );
292
293 ID bdb_idl_first( ID *ids, ID *cursor );
294 ID bdb_idl_next( ID *ids, ID *cursor );
295
296
297
298 /*
299  * index.c
300  */
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)
305
306 extern int
307 bdb_index_is_indexed LDAP_P((
308         Backend *be,
309         AttributeDescription *desc ));
310
311 extern int
312 bdb_index_param LDAP_P((
313         Backend *be,
314         AttributeDescription *desc,
315         int ftype,
316         DB **db,
317         slap_mask_t *mask,
318         struct berval *prefix ));
319
320 extern int
321 bdb_index_values LDAP_P((
322         Operation *op,
323         DB_TXN *txn,
324         AttributeDescription *desc,
325         BerVarray vals,
326         ID id,
327         int opid ));
328
329 int bdb_index_entry LDAP_P(( Operation *op, DB_TXN *t, int r, Entry *e ));
330
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))
335
336 /*
337  * init.c
338  */
339 #define bdb_uuid                                        BDB_SYMBOL(uuid)
340
341 extern struct berval bdb_uuid;
342
343 /*
344  * key.c
345  */
346 #define bdb_key_read                            BDB_SYMBOL(key_read)
347 #define bdb_key_change                          BDB_SYMBOL(key_change)
348
349 extern int
350 bdb_key_read(
351     Backend     *be,
352         DB *db,
353         DB_TXN *txn,
354     struct berval *k,
355         ID *ids,
356     DBC **saved_cursor,
357         int get_flags );
358
359 extern int
360 bdb_key_change(
361     Backend      *be,
362     DB *db,
363         DB_TXN *txn,
364     struct berval *k,
365     ID id,
366     int op );
367         
368 /*
369  * nextid.c
370  */
371 #define bdb_next_id                                     BDB_SYMBOL(next_id)
372 #define bdb_last_id                                     BDB_SYMBOL(last_id)
373
374 int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
375 int bdb_last_id( BackendDB *be, DB_TXN *tid );
376
377 /*
378  * modify.c
379  */
380 #define bdb_modify_internal                     BDB_SYMBOL(modify_internal)
381
382 int bdb_modify_internal(
383         Operation *op,
384         DB_TXN *tid,
385         Modifications *modlist,
386         Entry *e,
387         const char **text,
388         char *textbuf,
389         size_t textlen );
390
391
392 /*
393  * cache.c
394  */
395 #define bdb_cache_entry_db_unlock       BDB_SYMBOL(cache_entry_db_unlock)
396
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 )
401
402 /* What a mess. Hopefully the current cache scheme will stabilize
403  * and we can trim out all of this stuff.
404  */
405 #if 0
406 void bdb_cache_return_entry_rw( DB_ENV *env, Cache *cache, Entry *e,
407         int rw, DB_LOCK *lock );
408 #else
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 )
413 #endif
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))
418 #if 0
419 void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
420 #else
421 #define bdb_unlocked_cache_return_entry_rw( a, b, c )
422 #endif
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)
427
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)
439
440 int bdb_cache_children(
441         Operation *op,
442         DB_TXN *txn,
443         Entry *e
444 );
445 int bdb_cache_add(
446         struct bdb_info *bdb,
447         EntryInfo *pei,
448         Entry   *e,
449         struct berval *nrdn,
450         u_int32_t locker
451 );
452 int bdb_cache_modrdn(
453         Entry   *e,
454         struct berval *nrdn,
455         Entry   *new,
456         EntryInfo *ein,
457         DB_ENV *env,
458         u_int32_t locker,
459         DB_LOCK *lock
460 );
461 int bdb_cache_modify(
462         Entry *e,
463         Attribute *newAttrs,
464         DB_ENV *env,
465         u_int32_t locker,
466         DB_LOCK *lock
467 );
468 int bdb_cache_find_ndn(
469         Operation *op,
470         DB_TXN  *txn,
471         struct berval   *ndn,
472         EntryInfo       **res
473 );
474 EntryInfo * bdb_cache_find_info(
475         struct bdb_info *bdb,
476         ID id
477 );
478 int bdb_cache_find_id(
479         Operation *op,
480         DB_TXN  *tid,
481         ID              id,
482         EntryInfo **eip,
483         int     islocked,
484         u_int32_t       locker,
485         DB_LOCK         *lock
486 );
487 int bdb_cache_delete(
488         Cache   *cache,
489         Entry   *e,
490         DB_ENV  *env,
491         u_int32_t locker,
492         DB_LOCK *lock
493 );
494 void bdb_cache_delete_cleanup(
495         Cache   *cache,
496         EntryInfo *ei
497 );
498 void bdb_cache_release_all( Cache *cache );
499 void bdb_cache_delete_entry(
500         struct bdb_info *bdb,
501         EntryInfo *ei,
502         u_int32_t locker,
503         DB_LOCK *lock
504 );
505
506 #ifdef BDB_HIER
507 int hdb_cache_load(
508         struct bdb_info *bdb,
509         EntryInfo *ei,
510         EntryInfo **res
511 );
512 #endif
513
514 #define bdb_cache_entry_db_relock               BDB_SYMBOL(cache_entry_db_relock)
515 int bdb_cache_entry_db_relock(
516         DB_ENV *env,
517         u_int32_t locker,
518         EntryInfo *ei,
519         int rw,
520         int tryOnly,
521         DB_LOCK *lock );
522
523 int bdb_cache_entry_db_unlock(
524         DB_ENV *env,
525         DB_LOCK *lock );
526
527 #ifdef BDB_REUSE_LOCKERS
528
529 #define bdb_locker_id                           BDB_SYMBOL(locker_id)
530 int bdb_locker_id( Operation *op, DB_ENV *env, int *locker );
531
532 #define LOCK_ID_FREE(env, locker)
533 #define LOCK_ID(env, locker)    bdb_locker_id(op, env, locker)
534
535 #else
536
537 #define LOCK_ID_FREE(env, locker)       XLOCK_ID_FREE(env, locker)
538 #define LOCK_ID(env, locker)            XLOCK_ID(env, locker)
539
540 #endif
541
542 /*
543  * search.c
544  */
545
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)
550
551 BI_op_abandon bdb_abandon;
552 BI_op_cancel bdb_cancel;
553
554 int bdb_psearch(
555         Operation       *op,
556         SlapReply       *rs,
557         Operation       *ps_op,
558         Entry           *entry,
559         int             psearch_type
560 );
561
562 int bdb_do_search(
563         Operation       *op,
564         SlapReply       *rs,
565         Operation       *ps_op,
566         Entry           *entry,
567         int             psearch_type
568 );
569
570 /*
571  * trans.c
572  */
573 #define bdb_trans_backoff                       BDB_SYMBOL(trans_backoff)
574
575 void
576 bdb_trans_backoff( int num_retries );
577
578 /*
579  * former external.h
580  */
581
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)
604
605 extern BI_init                          bdb_back_initialize;
606
607 extern BI_db_config                     bdb_db_config;
608
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;
617
618 extern BI_chk_referrals                 bdb_referrals;
619
620 extern BI_operational                   bdb_operational;
621
622 extern BI_has_subordinates              bdb_hasSubordinates;
623
624 /* tools.c */
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;
634
635 LDAP_END_DECL
636
637 #endif /* _PROTO_BDB_H */