]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/proto-bdb.h
Fix typo in prev commit
[openldap] / servers / slapd / back-bdb / proto-bdb.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6
7 #ifndef _PROTO_BDB_H
8 #define _PROTO_BDB_H
9
10 LDAP_BEGIN_DECL
11
12 /*
13  * alias.c
14  */
15 Entry *bdb_deref_internal_r LDAP_P((
16         BackendDB *be,
17         Entry *e,
18         struct berval *dn,
19         int *err,
20         Entry **matched,
21         const char **text ));
22
23 #define deref_entry_r( be, e, err, matched, text ) \
24         bdb_deref_internal_r( be, e, NULL, err, matched, text )
25 #define deref_dn_r( be, dn, err, matched, text ) \
26         bdb_deref_internal_r( be, NULL, dn, err, matched, text)
27
28 /*
29  * attr.c
30  */
31
32 void bdb_attr_mask( struct bdb_info *bdb,
33         AttributeDescription *desc,
34         slap_mask_t *indexmask );
35
36 int bdb_attr_index_config LDAP_P(( struct bdb_info *bdb,
37         const char *fname, int lineno,
38         int argc, char **argv ));
39
40 void bdb_attr_index_destroy LDAP_P(( Avlnode *tree ));
41
42 /*
43  * dbcache.c
44  */
45 int
46 bdb_db_cache(
47     Backend     *be,
48     DB_TXN *tid,
49     const char *name,
50         DB **db );
51
52 /*
53  * dn2entry.c
54  */
55 int bdb_dn2entry LDAP_P(( BackendDB *be, DB_TXN *tid,
56         struct berval *dn, EntryInfo **e, int matched,
57         u_int32_t locker, DB_LOCK *lock, void *ctx));
58
59 /*
60  * dn2id.c
61  */
62 int bdb_dn2id(
63         BackendDB *be,
64         DB_TXN *tid,
65         struct berval *dn,
66         EntryInfo *ei,
67         void *ctx );
68
69 int bdb_dn2id_add(
70         BackendDB *be,
71         DB_TXN *tid,
72         EntryInfo *eip,
73         Entry *e,
74         void *ctx );
75
76 int bdb_dn2id_delete(
77         BackendDB *be,
78         DB_TXN *tid,
79         EntryInfo *eip,
80         Entry *e,
81         void *ctx );
82
83 int bdb_dn2id_children(
84         Operation *op,
85         DB_TXN *tid,
86         Entry *e );
87
88 int
89 bdb_dn2idl(
90         BackendDB       *be,
91         struct berval   *dn,
92         int prefix,
93         ID *ids );
94
95 /*
96  * entry.c
97  */
98 int bdb_entry_return( Entry *e );
99 BI_entry_release_rw bdb_entry_release;
100 BI_entry_get_rw bdb_entry_get;
101
102 /*
103  * error.c
104  */
105 void bdb_errcall( const char *pfx, char * msg );
106
107 /*
108  * filterentry.c
109  */
110 int bdb_filter_candidates(
111         Operation *op,
112         Filter  *f,
113         ID *ids,
114         ID *tmp,
115         ID *stack );
116
117 /*
118  * id2entry.c
119  */
120 int bdb_id2entry_add(
121         BackendDB *be,
122         DB_TXN *tid,
123         Entry *e );
124
125 int bdb_id2entry_update(
126         BackendDB *be,
127         DB_TXN *tid,
128         Entry *e );
129
130 int bdb_id2entry_delete(
131         BackendDB *be,
132         DB_TXN *tid,
133         Entry *e);
134
135 int bdb_id2entry(
136         BackendDB *be,
137         DB_TXN *tid,
138         ID id,
139         Entry **e);
140
141 void bdb_entry_free ( Entry *e );
142
143 /*
144  * idl.c
145  */
146 #ifdef SLAP_IDL_CACHE
147 int bdb_idl_entry_cmp( const void*, const void* );
148
149 int bdb_idl_cache_get(
150         struct bdb_info *bdb,
151         DB *db,
152         DBT *key,
153         ID *ids );
154
155 void
156 bdb_idl_cache_put(
157         struct bdb_info *bdb,
158         DB              *db,
159         DBT             *key,
160         ID              *ids,
161         int             rc );
162
163 void
164 bdb_idl_cache_del(
165         struct bdb_info *bdb,
166         DB              *db,
167         DBT             *key );
168 #endif
169
170 unsigned bdb_idl_search( ID *ids, ID id );
171
172 int bdb_bt_compare(
173         DB *db,
174         const DBT *a,
175         const DBT *b );
176
177 int bdb_idl_fetch_key(
178         BackendDB *be,
179         DB *db,
180         DB_TXN *txn,
181         DBT *key,
182         ID *ids );
183
184 int bdb_idl_insert( ID *ids, ID id );
185
186 int bdb_idl_insert_key(
187         BackendDB *be,
188         DB *db,
189         DB_TXN *txn,
190         DBT *key,
191         ID id );
192
193 int bdb_idl_delete_key(
194         BackendDB *be,
195         DB *db,
196         DB_TXN *txn,
197         DBT *key,
198         ID id );
199
200 #if 0
201 int
202 bdb_idl_notin(
203     ID  *a,
204     ID  *b,
205         ID      *ids );
206 #endif
207
208 int
209 bdb_idl_intersection(
210         ID *a,
211         ID *b );
212
213 int
214 bdb_idl_union(
215         ID *a,
216         ID *b );
217
218 ID bdb_idl_first( ID *ids, ID *cursor );
219 ID bdb_idl_next( ID *ids, ID *cursor );
220
221
222 /*
223  * index.c
224  */
225 extern int
226 bdb_index_is_indexed LDAP_P((
227         Backend *be,
228         AttributeDescription *desc ));
229
230 extern int
231 bdb_index_param LDAP_P((
232         Backend *be,
233         AttributeDescription *desc,
234         int ftype,
235         DB **db,
236         slap_mask_t *mask,
237         struct berval *prefix ));
238
239 extern int
240 bdb_index_values LDAP_P((
241         Operation *op,
242         DB_TXN *txn,
243         AttributeDescription *desc,
244         BerVarray vals,
245         ID id,
246         int opid ));
247
248 int bdb_index_entry LDAP_P(( Operation *op, DB_TXN *t, int r, Entry *e ));
249
250 #define bdb_index_entry_add(be,t,e) \
251         bdb_index_entry((be),(t),SLAP_INDEX_ADD_OP,(e))
252 #define bdb_index_entry_del(be,t,e) \
253         bdb_index_entry((be),(t),SLAP_INDEX_DELETE_OP,(e))
254
255 /*
256  * init.c
257  */
258 extern struct berval bdb_uuid;
259
260 /*
261  * key.c
262  */
263 extern int
264 bdb_key_read(
265     Backend     *be,
266         DB *db,
267         DB_TXN *txn,
268     struct berval *k,
269         ID *ids );
270
271 extern int
272 bdb_key_change(
273     Backend      *be,
274     DB *db,
275         DB_TXN *txn,
276     struct berval *k,
277     ID id,
278     int op );
279         
280 /*
281  * nextid.c
282  */
283 int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
284 int bdb_last_id( BackendDB *be, DB_TXN *tid );
285
286 /*
287  * modify.c
288  */
289 int bdb_modify_internal(
290         Operation *op,
291         DB_TXN *tid,
292         Modifications *modlist,
293         Entry *e,
294         const char **text,
295         char *textbuf,
296         size_t textlen );
297
298 /*
299  * passwd.c
300  */
301 BI_op_extended bdb_exop_passwd;
302
303
304 /*
305  * cache.c
306  */
307
308 #define bdb_cache_entryinfo_lock(e) \
309         ldap_pvt_thread_mutex_lock( &(e)->bei_kids_mutex )
310 #define bdb_cache_entryinfo_unlock(e) \
311         ldap_pvt_thread_mutex_unlock( &(e)->bei_kids_mutex )
312
313 #if 0
314 void bdb_cache_return_entry_rw( DB_ENV *env, Cache *cache, Entry *e,
315         int rw, DB_LOCK *lock );
316 #else
317 #define bdb_cache_return_entry_rw( env, cache, e, rw, lock ) \
318         bdb_cache_entry_db_unlock( env, lock )
319 #define bdb_cache_return_entry( env, lock ) \
320         bdb_cache_entry_db_unlock( env, lock )
321 #endif
322 #define bdb_cache_return_entry_r(env, c, e, l) \
323         bdb_cache_return_entry_rw((env), (c), (e), 0, (l))
324 #define bdb_cache_return_entry_w(env, c, e, l) \
325         bdb_cache_return_entry_rw((env), (c), (e), 1, (l))
326 #if 0
327 void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
328 #else
329 #define bdb_unlocked_cache_return_entry_rw( a, b, c )
330 #endif
331 #define bdb_unlocked_cache_return_entry_r( c, e ) \
332         bdb_unlocked_cache_return_entry_rw((c), (e), 0)
333 #define bdb_unlocked_cache_return_entry_w( c, e ) \
334         bdb_unlocked_cache_return_entry_rw((c), (e), 1)
335
336 int bdb_cache_children(
337         Operation *op,
338         DB_TXN *txn,
339         Entry *e
340 );
341 int bdb_cache_add(
342         struct bdb_info *bdb,
343         EntryInfo *pei,
344         Entry   *e,
345         struct berval *nrdn,
346         u_int32_t locker
347 );
348 int bdb_cache_modrdn(
349         Entry   *e,
350         struct berval *nrdn,
351         Entry   *new,
352         EntryInfo *ein,
353         DB_ENV *env,
354         u_int32_t locker,
355         DB_LOCK *lock
356 );
357 int bdb_cache_modify(
358         Entry *e,
359         Attribute *newAttrs,
360         DB_ENV *env,
361         u_int32_t locker,
362         DB_LOCK *lock
363 );
364 int bdb_cache_update_entry(
365        Cache   *cache,
366        Entry   *e
367 );
368 int bdb_cache_find_entry_ndn2id(
369         Backend *be,
370         DB_TXN  *txn,
371         struct berval   *ndn,
372         EntryInfo       **res,
373         u_int32_t       locker,
374         void    *ctx
375 );
376 int bdb_cache_find_entry_id(
377         Backend *be,
378         DB_TXN  *tid,
379         ID              id,
380         EntryInfo **eip,
381         int     islocked,
382         u_int32_t       locker,
383         DB_LOCK         *lock,
384         void    *ctx
385 );
386 int bdb_cache_delete_entry(
387         Cache   *cache,
388         Entry   *e,
389         DB_ENV  *env,
390         u_int32_t locker,
391         DB_LOCK *lock
392 );
393 void bdb_cache_release_all( Cache *cache );
394
395 /*
396  * lcup.c
397  */
398
399 BI_op_abandon bdb_abandon;
400
401 BI_op_cancel bdb_cancel;
402
403 #if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
404 int bdb_do_search(
405         Operation       *op,
406         SlapReply       *rs,
407         Operation       *ps_op,
408         Entry           *entry,
409         int             psearch_type
410 );
411 #define bdb_psearch(op, rs, sop, e, ps_type)    bdb_do_search(op, rs, sop, e, ps_type)
412 #endif
413
414 /*
415  * search.c
416  */
417
418 #ifdef LDAP_CLIENT_UPDATE
419 int
420 bdb_build_lcup_update_ctrl(
421         Operation       *op,
422         SlapReply       *rs,
423         Entry           *e,
424         int             entry_count,
425         LDAPControl     **ctrls,
426         int             num_ctrls,
427         struct berval   *latest_entrycsn_bv,
428         int             isdeleted       );
429
430 int
431 bdb_build_lcup_done_ctrl(
432         Operation       *op,
433         SlapReply       *rs,
434         LDAPControl     **ctrls,
435         int             num_ctrls,
436         struct berval   *latest_entrycsn_bv     );
437 #endif
438
439 #ifdef LDAP_SYNC
440 int
441 bdb_build_sync_state_ctrl(
442         Operation       *op,
443         SlapReply       *rs,
444         Entry           *e,
445         int             entry_sync_state,
446         LDAPControl     **ctrls,
447         int             num_ctrls,
448         int             send_cookie,
449         struct berval   *latest_entrycsn_bv     );
450
451 int
452 bdb_build_sync_done_ctrl(
453         Operation       *op,
454         SlapReply       *rs,
455         LDAPControl     **ctrls,
456         int             num_ctrls,
457         int             send_cookie,
458         struct berval   *latest_entrycsn_bv     );
459
460 int
461 bdb_send_ldap_intermediate(
462         Operation   *op,
463         SlapReply       *rs,
464         int         state,
465         struct berval *cookie );
466 #endif
467
468 #ifdef BDB_REUSE_LOCKERS
469
470 int bdb_locker_id( Operation *op, DB_ENV *env, int *locker );
471
472 #endif
473
474 #ifdef HAVE_EBCDIC
475 char *ebcdic_dberror( int rc );
476
477 #define db_strerror(x)  ebcdic_dberror(x)
478 #endif
479
480 LDAP_END_DECL
481
482 #endif /* _PROTO_BDB_H */