]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/proto-bdb.h
NVALUES: fix a couple of value_find_ex() calls
[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  * attribute.c
44  */
45
46 BI_acl_attribute bdb_attribute;
47
48 /*
49  * dbcache.c
50  */
51 int
52 bdb_db_cache(
53     Backend     *be,
54     const char *name,
55         DB **db );
56
57 /*
58  * dn2entry.c
59  */
60 int bdb_dn2entry_rw LDAP_P(( BackendDB *be, DB_TXN *tid,
61         struct berval *dn, Entry **e, Entry **matched, int flags, int rw,
62         u_int32_t locker, DB_LOCK *lock));
63 #define bdb_dn2entry_r(be, tid, dn, e, m, f, locker, lock) \
64         bdb_dn2entry_rw((be), (tid), (dn), (e), (m), (f), 0, locker, lock)
65 #define bdb_dn2entry_w(be, tid, dn, e, m, f, locker, lock) \
66         bdb_dn2entry_rw((be), (tid), (dn), (e), (m), (f), 1, locker, lock)
67
68 /*
69  * dn2id.c
70  */
71 int bdb_dn2id(
72         BackendDB *be,
73         DB_TXN *tid,
74         struct berval *dn,
75         ID *id,
76         int flags );
77
78 int bdb_dn2id_matched(
79         BackendDB *be,
80         DB_TXN *tid,
81         struct berval *dn,
82         ID *id,
83         ID *id2,
84         int flags );
85
86 int bdb_dn2id_add(
87         BackendDB *be,
88         DB_TXN *tid,
89         struct berval *pdn,
90         Entry *e );
91
92 int bdb_dn2id_delete(
93         BackendDB *be,
94         DB_TXN *tid,
95         char *pdn,
96         Entry *e );
97
98 int bdb_dn2id_children(
99         BackendDB *be,
100         DB_TXN *tid,
101         struct berval *dn,
102         int flags );
103
104 int
105 bdb_dn2idl(
106         BackendDB       *be,
107         struct berval   *dn,
108         int prefix,
109         ID *ids );
110
111 /*
112  * entry.c
113  */
114 int bdb_entry_return( Entry *e );
115 BI_entry_release_rw bdb_entry_release;
116
117 /*
118  * error.c
119  */
120 void bdb_errcall( const char *pfx, char * msg );
121
122 /*
123  * filterentry.c
124  */
125 int bdb_filter_candidates(
126         Backend *be,
127         Filter  *f,
128         ID *ids,
129         ID *tmp,
130         ID *stack );
131
132 /*
133  * group.c
134  */
135
136 BI_acl_group bdb_group;
137
138 /*
139  * id2entry.c
140  */
141 int bdb_id2entry_add(
142         BackendDB *be,
143         DB_TXN *tid,
144         Entry *e );
145
146 int bdb_id2entry_update(
147         BackendDB *be,
148         DB_TXN *tid,
149         Entry *e );
150
151 int bdb_id2entry_delete(
152         BackendDB *be,
153         DB_TXN *tid,
154         Entry *e);
155
156 int bdb_id2entry_rw(
157         BackendDB *be,
158         DB_TXN *tid,
159         ID id,
160         Entry **e,
161         int rw,
162         u_int32_t locker,
163         DB_LOCK *lock );
164 #define bdb_id2entry_r(be, tid, id, e, locker, lock) \
165         bdb_id2entry_rw((be), (tid), (id), (e), 0, locker, lock)
166 #define bdb_id2entry_w(be, tid, id, e, locker, lock) \
167         bdb_id2entry_rw((be), (tid), (id), (e), 1, locker, lock)
168
169 void bdb_entry_free ( Entry *e );
170
171 /*
172  * idl.c
173  */
174 #ifdef SLAP_IDL_CACHE
175 int bdb_idl_entry_cmp( const void*, const void* );
176 #endif
177
178 unsigned bdb_idl_search( ID *ids, ID id );
179
180 int bdb_bt_compare(
181         DB *db,
182         const DBT *a,
183         const DBT *b );
184
185 int bdb_idl_fetch_key(
186         BackendDB *be,
187         DB *db,
188         DB_TXN *txn,
189         DBT *key,
190         ID *ids );
191
192 int bdb_idl_insert_key(
193         BackendDB *be,
194         DB *db,
195         DB_TXN *txn,
196         DBT *key,
197         ID id );
198
199 int bdb_idl_delete_key(
200         BackendDB *be,
201         DB *db,
202         DB_TXN *txn,
203         DBT *key,
204         ID id );
205
206 #if 0
207 int
208 bdb_idl_notin(
209     ID  *a,
210     ID  *b,
211         ID      *ids );
212 #endif
213
214 int
215 bdb_idl_intersection(
216         ID *a,
217         ID *b );
218
219 int
220 bdb_idl_union(
221         ID *a,
222         ID *b );
223
224 ID bdb_idl_first( ID *ids, ID *cursor );
225 ID bdb_idl_next( ID *ids, ID *cursor );
226
227
228 /*
229  * index.c
230  */
231 extern int
232 bdb_index_is_indexed LDAP_P((
233         Backend *be,
234         AttributeDescription *desc ));
235
236 extern int
237 bdb_index_param LDAP_P((
238         Backend *be,
239         AttributeDescription *desc,
240         int ftype,
241         DB **db,
242         slap_mask_t *mask,
243         struct berval *prefix ));
244
245 extern int
246 bdb_index_values LDAP_P((
247         Backend *be,
248         DB_TXN *txn,
249         AttributeDescription *desc,
250         BerVarray vals,
251         ID id,
252         int op ));
253
254 int bdb_index_entry LDAP_P(( Backend *be, DB_TXN *t,
255         int r, Entry *e, Attribute *ap ));
256
257 #define bdb_index_entry_add(be,t,e,ap) \
258         bdb_index_entry((be),(t),SLAP_INDEX_ADD_OP,(e),(ap))
259 #define bdb_index_entry_del(be,t,e,ap) \
260         bdb_index_entry((be),(t),SLAP_INDEX_DELETE_OP,(e),(ap))
261
262 /*
263  * init.c
264  */
265 extern struct berval bdb_uuid;
266
267 /*
268  * key.c
269  */
270 extern int
271 bdb_key_read(
272     Backend     *be,
273         DB *db,
274         DB_TXN *txn,
275     struct berval *k,
276         ID *ids );
277
278 extern int
279 bdb_key_change(
280     Backend      *be,
281     DB *db,
282         DB_TXN *txn,
283     struct berval *k,
284     ID id,
285     int op );
286         
287 /*
288  * nextid.c
289  */
290 int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
291 int bdb_last_id( BackendDB *be, DB_TXN *tid );
292
293 /*
294  * modify.c
295  */
296 int bdb_modify_internal(
297         BackendDB *be,
298         Connection *conn,
299         Operation *op,
300         DB_TXN *tid,
301         Modifications *modlist,
302         Entry *e,
303         const char **text,
304         char *textbuf,
305         size_t textlen );
306
307 /*
308  * operational.c
309  */
310 int
311 bdb_hasSubordinates(
312         BackendDB       *be,
313         Connection      *conn, 
314         Operation       *op,
315         Entry           *e,
316         int             *hasSubordinates );
317
318 /*
319  * passwd.c
320  */
321 BI_op_extended bdb_exop_passwd;
322
323
324 /*
325  * cache.c
326  */
327
328 void bdb_cache_entry_commit( Entry *e );
329 void bdb_cache_return_entry_rw( DB_ENV *env, Cache *cache, Entry *e,
330         int rw, DB_LOCK *lock );
331 #define bdb_cache_return_entry_r(env, c, e, l) \
332         bdb_cache_return_entry_rw((env), (c), (e), 0, (l))
333 #define bdb_cache_return_entry_w(env, c, e, l) \
334         bdb_cache_return_entry_rw((env), (c), (e), 1, (l))
335 void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
336 #define bdb_unlocked_cache_return_entry_r( c, e ) \
337         bdb_unlocked_cache_return_entry_rw((c), (e), 0)
338 #define bdb_unlocked_cache_return_entry_w( c, e ) \
339         bdb_unlocked_cache_return_entry_rw((c), (e), 1)
340 int bdb_cache_add_entry_rw(
341         DB_ENV  *env,
342         Cache   *cache,
343         Entry   *e,
344         int     rw,
345         u_int32_t locker,
346         DB_LOCK *lock
347 );
348 int bdb_cache_update_entry(
349        Cache   *cache,
350        Entry   *e
351 );
352 ID bdb_cache_find_entry_ndn2id(
353        Backend *be,
354        Cache   *cache,
355        struct berval   *ndn
356 );
357 Entry* bdb_cache_find_entry_id(
358         DB_ENV          *env,
359         Cache           *cache,
360         ID              id,
361         int             rw,
362         u_int32_t       locker,
363         DB_LOCK         *lock
364 );
365 int bdb_cache_delete_entry(
366        Cache   *cache,
367        Entry   *e
368 );
369 void bdb_cache_release_all( Cache *cache );
370
371 /*
372  * lcup.c
373  */
374
375 int bdb_abandon(
376         BackendDB       *be,
377         Connection      *conn,
378         Operation               *op,
379         ber_int_t       id
380 );
381
382 int bdb_cancel(
383         BackendDB       *be,
384         Connection      *conn,
385         Operation               *op,
386         ber_int_t       id
387 );
388
389 #if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
390 int bdb_add_psearch_spec(
391         BackendDB       *be,
392         Connection      *conn,
393         Operation       *op,
394         struct berval   *base,
395         struct berval   *nbase,
396         int             scope,
397         int             deref,
398         int             slimit,
399         int             tlimit,
400         Filter          *filter,
401         struct berval   *fstr,
402         AttributeName   *attrs,
403         int             attrsonly,
404         int             protocol
405 );
406
407 int bdb_psearch(
408         BackendDB       *be,
409         Connection      *conn,
410         Operation       *op,
411         Operation       *ps_op,
412         Entry           *entry,
413         int             psearch_type
414 );
415 #endif
416
417 /*
418  * search.c
419  */
420
421 #ifdef LDAP_CLIENT_UPDATE
422 int
423 bdb_build_lcup_update_ctrl(
424         Connection      *conn,
425         Operation       *op,
426         Entry           *e,
427         int             entry_count,
428         LDAPControl     **ctrls,
429         int             num_ctrls,
430         struct berval   *latest_entrycsn_bv,
431         int             isdeleted       );
432
433 int
434 bdb_build_lcup_done_ctrl(
435         Connection      *conn,
436         Operation       *op,
437         LDAPControl     **ctrls,
438         int             num_ctrls,
439         struct berval   *latest_entrycsn_bv     );
440 #endif
441
442 #ifdef LDAP_SYNC
443 int
444 bdb_build_sync_state_ctrl(
445         Connection      *conn,
446         Operation       *op,
447         Entry           *e,
448         int             entry_sync_state,
449         LDAPControl     **ctrls,
450         int             num_ctrls,
451         int             send_cookie,
452         struct berval   *latest_entrycsn_bv     );
453
454 int
455 bdb_build_sync_done_ctrl(
456         Connection      *conn,
457         Operation       *op,
458         LDAPControl     **ctrls,
459         int             num_ctrls,
460         int             send_cookie,
461         struct berval   *latest_entrycsn_bv     );
462
463 int
464 bdb_send_ldap_intermediate(
465         Connection  *conn,
466         Operation   *op,
467         ber_int_t   err,
468         const char  *matched,
469         const char  *text,
470         BerVarray   refs,
471         const char  *rspoid,
472         int         state,
473         struct berval *cookie,
474         LDAPControl **ctrls     );
475 #endif
476
477 #ifdef BDB_REUSE_LOCKERS
478
479 int bdb_locker_id( Operation *op, DB_ENV *env, int *locker );
480
481 #endif
482
483 #ifdef HAVE_EBCDIC
484 char *ebcdic_dberror( int rc );
485
486 #define db_strerror(x)  ebcdic_dberror(x)
487 #endif
488
489 LDAP_END_DECL
490
491 #endif /* _PROTO_BDB_H */