]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/proto-bdb.h
Never let ldif_parse_line() return a NULL value with success.
[openldap] / servers / slapd / back-bdb / proto-bdb.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 2000-2002 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 #ifdef LDAP_CLIENT_UPDATE
368 int bdb_abandon(
369         BackendDB       *be,
370         Connection      *conn,
371         ber_int_t       id
372 );
373
374 int bdb_add_psearch_spec(
375         BackendDB       *be,
376         Connection      *conn,
377         Operation       *op,
378         struct berval   *base,
379         struct berval   *nbase,
380         int             scope,
381         int             deref,
382         int             slimit,
383         int             tlimit,
384         Filter          *filter,
385         struct berval   *fstr,
386         AttributeName   *attrs,
387         int             attrsonly
388 );
389
390 int bdb_psearch(
391         BackendDB       *be,
392         Connection      *conn,
393         Operation       *op,
394         Operation       *ps_op,
395         Entry           *entry,
396         int             psearch_type
397 );
398
399 #endif
400
401 #ifdef BDB_REUSE_LOCKERS
402
403 int bdb_locker_id( Operation *op, DB_ENV *env, int *locker );
404
405 #endif
406
407 #ifdef HAVE_EBCDIC
408 char *ebcdic_dberror( int rc );
409
410 #define db_strerror(x)  ebcdic_dberror(x)
411 #endif
412
413 LDAP_END_DECL
414
415 #endif /* _PROTO_BDB_H */