]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/proto-bdb.h
Cancel exop updates
[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 unsigned bdb_idl_search( ID *ids, ID id );
175
176 int bdb_bt_compare(
177         DB *db,
178         const DBT *a,
179         const DBT *b );
180
181 int bdb_idl_fetch_key(
182         BackendDB *be,
183         DB *db,
184         DB_TXN *txn,
185         DBT *key,
186         ID *ids );
187
188 int bdb_idl_insert_key(
189         BackendDB *be,
190         DB *db,
191         DB_TXN *txn,
192         DBT *key,
193         ID id );
194
195 int bdb_idl_delete_key(
196         BackendDB *be,
197         DB *db,
198         DB_TXN *txn,
199         DBT *key,
200         ID id );
201
202 #if 0
203 int
204 bdb_idl_notin(
205     ID  *a,
206     ID  *b,
207         ID      *ids );
208 #endif
209
210 int
211 bdb_idl_intersection(
212         ID *a,
213         ID *b );
214
215 int
216 bdb_idl_union(
217         ID *a,
218         ID *b );
219
220 ID bdb_idl_first( ID *ids, ID *cursor );
221 ID bdb_idl_next( ID *ids, ID *cursor );
222
223
224 /*
225  * index.c
226  */
227 extern int
228 bdb_index_is_indexed LDAP_P((
229         Backend *be,
230         AttributeDescription *desc ));
231
232 extern int
233 bdb_index_param LDAP_P((
234         Backend *be,
235         AttributeDescription *desc,
236         int ftype,
237         DB **db,
238         slap_mask_t *mask,
239         struct berval *prefix ));
240
241 extern int
242 bdb_index_values LDAP_P((
243         Backend *be,
244         DB_TXN *txn,
245         AttributeDescription *desc,
246         BerVarray vals,
247         ID id,
248         int op ));
249
250 int bdb_index_entry LDAP_P(( Backend *be, DB_TXN *t,
251         int r, Entry *e, Attribute *ap ));
252
253 #define bdb_index_entry_add(be,t,e,ap) \
254         bdb_index_entry((be),(t),SLAP_INDEX_ADD_OP,(e),(ap))
255 #define bdb_index_entry_del(be,t,e,ap) \
256         bdb_index_entry((be),(t),SLAP_INDEX_DELETE_OP,(e),(ap))
257
258 /*
259  * init.c
260  */
261 extern struct berval bdb_uuid;
262
263 /*
264  * key.c
265  */
266 extern int
267 bdb_key_read(
268     Backend     *be,
269         DB *db,
270         DB_TXN *txn,
271     struct berval *k,
272         ID *ids );
273
274 extern int
275 bdb_key_change(
276     Backend      *be,
277     DB *db,
278         DB_TXN *txn,
279     struct berval *k,
280     ID id,
281     int op );
282         
283 /*
284  * nextid.c
285  */
286 int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
287 int bdb_last_id( BackendDB *be, DB_TXN *tid );
288
289 /*
290  * modify.c
291  */
292 int bdb_modify_internal(
293         BackendDB *be,
294         Connection *conn,
295         Operation *op,
296         DB_TXN *tid,
297         Modifications *modlist,
298         Entry *e,
299         const char **text,
300         char *textbuf,
301         size_t textlen );
302
303 /*
304  * operational.c
305  */
306 int
307 bdb_hasSubordinates(
308         BackendDB       *be,
309         Connection      *conn, 
310         Operation       *op,
311         Entry           *e,
312         int             *hasSubordinates );
313
314 /*
315  * passwd.c
316  */
317 BI_op_extended bdb_exop_passwd;
318
319
320 /*
321  * cache.c
322  */
323
324 void bdb_cache_entry_commit( Entry *e );
325 void bdb_cache_return_entry_rw( DB_ENV *env, Cache *cache, Entry *e,
326         int rw, DB_LOCK *lock );
327 #define bdb_cache_return_entry_r(env, c, e, l) \
328         bdb_cache_return_entry_rw((env), (c), (e), 0, (l))
329 #define bdb_cache_return_entry_w(env, c, e, l) \
330         bdb_cache_return_entry_rw((env), (c), (e), 1, (l))
331 void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
332 #define bdb_unlocked_cache_return_entry_r( c, e ) \
333         bdb_unlocked_cache_return_entry_rw((c), (e), 0)
334 #define bdb_unlocked_cache_return_entry_w( c, e ) \
335         bdb_unlocked_cache_return_entry_rw((c), (e), 1)
336 int bdb_cache_add_entry_rw(
337         DB_ENV  *env,
338         Cache   *cache,
339         Entry   *e,
340         int     rw,
341         u_int32_t locker,
342         DB_LOCK *lock
343 );
344 int bdb_cache_update_entry(
345        Cache   *cache,
346        Entry   *e
347 );
348 ID bdb_cache_find_entry_ndn2id(
349        Backend *be,
350        Cache   *cache,
351        struct berval   *ndn
352 );
353 Entry* bdb_cache_find_entry_id(
354         DB_ENV          *env,
355         Cache           *cache,
356         ID              id,
357         int             rw,
358         u_int32_t       locker,
359         DB_LOCK         *lock
360 );
361 int bdb_cache_delete_entry(
362        Cache   *cache,
363        Entry   *e
364 );
365 void bdb_cache_release_all( Cache *cache );
366
367 /*
368  * lcup.c
369  */
370
371 #ifdef LDAP_CLIENT_UPDATE
372 int bdb_abandon(
373         BackendDB       *be,
374         Connection      *conn,
375         ber_int_t       id
376 );
377 #endif
378
379 #if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
380 int bdb_add_psearch_spec(
381         BackendDB       *be,
382         Connection      *conn,
383         Operation       *op,
384         struct berval   *base,
385         struct berval   *nbase,
386         int             scope,
387         int             deref,
388         int             slimit,
389         int             tlimit,
390         Filter          *filter,
391         struct berval   *fstr,
392         AttributeName   *attrs,
393         int             attrsonly,
394         int             protocol
395 );
396
397 int bdb_psearch(
398         BackendDB       *be,
399         Connection      *conn,
400         Operation       *op,
401         Operation       *ps_op,
402         Entry           *entry,
403         int             psearch_type
404 );
405 #endif
406
407 /*
408  * search.c
409  */
410
411 #ifdef LDAP_CLIENT_UPDATE
412 int
413 bdb_build_lcup_update_ctrl(
414         Connection      *conn,
415         Operation       *op,
416         Entry           *e,
417         int             entry_count,
418         LDAPControl     **ctrls,
419         int             num_ctrls,
420         struct berval   *latest_entrycsn_bv,
421         int             isdeleted       );
422
423 int
424 bdb_build_lcup_done_ctrl(
425         Connection      *conn,
426         Operation       *op,
427         LDAPControl     **ctrls,
428         int             num_ctrls,
429         struct berval   *latest_entrycsn_bv     );
430 #endif
431
432 #ifdef LDAP_SYNC
433 int
434 bdb_build_sync_state_ctrl(
435         Connection      *conn,
436         Operation       *op,
437         Entry           *e,
438         int             entry_sync_state,
439         LDAPControl     **ctrls,
440         int             num_ctrls,
441         int             send_cookie,
442         struct berval   *latest_entrycsn_bv     );
443
444 int
445 bdb_build_sync_done_ctrl(
446         Connection      *conn,
447         Operation       *op,
448         LDAPControl     **ctrls,
449         int             num_ctrls,
450         int             send_cookie,
451         struct berval   *latest_entrycsn_bv     );
452
453 int
454 bdb_send_ldap_intermediate(
455         Connection  *conn,
456         Operation   *op,
457         ber_int_t   err,
458         const char  *matched,
459         const char  *text,
460         BerVarray   refs,
461         const char  *rspoid,
462         int         state,
463         struct berval *cookie,
464         LDAPControl **ctrls     );
465 #endif
466
467 #ifdef BDB_REUSE_LOCKERS
468
469 int bdb_locker_id( Operation *op, DB_ENV *env, int *locker );
470
471 #endif
472
473 #ifdef HAVE_EBCDIC
474 char *ebcdic_dberror( int rc );
475
476 #define db_strerror(x)  ebcdic_dberror(x)
477 #endif
478
479 LDAP_END_DECL
480
481 #endif /* _PROTO_BDB_H */