]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/proto-bdb.h
6cef37e39c57fa2b7433f4b9a0ef2ccb2d5b2405
[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 , u_int32_t locker, DB_LOCK *lock));
62 #define bdb_dn2entry_r(be, tid, dn, e, m, f, locker, lock) bdb_dn2entry_rw((be), (tid), (dn), (e), (m), (f), 0, locker, lock)
63 #define bdb_dn2entry_w(be, tid, dn, e, m, f, locker, lock) bdb_dn2entry_rw((be), (tid), (dn), (e), (m), (f), 1, locker, lock)
64
65 /*
66  * dn2id.c
67  */
68 int bdb_dn2id(
69         BackendDB *be,
70         DB_TXN *tid,
71         struct berval *dn,
72         ID *id,
73         int flags );
74
75 int bdb_dn2id_matched(
76         BackendDB *be,
77         DB_TXN *tid,
78         struct berval *dn,
79         ID *id,
80         ID *id2,
81         int flags );
82
83 int bdb_dn2id_add(
84         BackendDB *be,
85         DB_TXN *tid,
86         struct berval *pdn,
87         Entry *e );
88
89 int bdb_dn2id_delete(
90         BackendDB *be,
91         DB_TXN *tid,
92         char *pdn,
93         Entry *e );
94
95 int bdb_dn2id_children(
96         BackendDB *be,
97         DB_TXN *tid,
98         struct berval *dn,
99         int flags );
100
101 int
102 bdb_dn2idl(
103         BackendDB       *be,
104         struct berval   *dn,
105         int prefix,
106         ID *ids );
107
108 /*
109  * entry.c
110  */
111 int bdb_entry_return( Entry *e );
112 BI_entry_release_rw bdb_entry_release;
113
114 /*
115  * error.c
116  */
117 void bdb_errcall( const char *pfx, char * msg );
118
119 /*
120  * filterentry.c
121  */
122 int bdb_filter_candidates(
123         Backend *be,
124         Filter  *f,
125         ID *ids,
126         ID *tmp,
127         ID *stack );
128
129 /*
130  * group.c
131  */
132
133 BI_acl_group bdb_group;
134
135 /*
136  * id2entry.c
137  */
138 int bdb_id2entry_add(
139         BackendDB *be,
140         DB_TXN *tid,
141         Entry *e );
142
143 int bdb_id2entry_update(
144         BackendDB *be,
145         DB_TXN *tid,
146         Entry *e );
147
148 int bdb_id2entry_delete(
149         BackendDB *be,
150         DB_TXN *tid,
151         Entry *e);
152
153 int bdb_id2entry_rw(
154         BackendDB *be,
155         DB_TXN *tid,
156         ID id,
157         Entry **e,
158         int rw,
159         u_int32_t locker,
160         DB_LOCK *lock );
161 #define bdb_id2entry_r(be, tid, id, e, locker, lock)      bdb_id2entry_rw((be), (tid), (id), (e), 0, locker, lock)
162 #define bdb_id2entry_w(be, tid, id, e, locker, lock)      bdb_id2entry_rw((be), (tid), (id), (e), 1, locker, lock)
163
164 void bdb_entry_free ( Entry *e );
165
166 /*
167  * idl.c
168  */
169 unsigned bdb_idl_search( ID *ids, ID id );
170
171 int bdb_bt_compare(
172         DB *db,
173         const DBT *a,
174         const DBT *b );
175
176 int bdb_idl_fetch_key(
177         BackendDB *be,
178         DB *db,
179         DB_TXN *txn,
180         DBT *key,
181         ID *ids );
182
183 int bdb_idl_insert_key(
184         BackendDB *be,
185         DB *db,
186         DB_TXN *txn,
187         DBT *key,
188         ID id );
189
190 int bdb_idl_delete_key(
191         BackendDB *be,
192         DB *db,
193         DB_TXN *txn,
194         DBT *key,
195         ID id );
196
197 #if 0
198 int
199 bdb_idl_notin(
200     ID  *a,
201     ID  *b,
202         ID      *ids );
203 #endif
204
205 int
206 bdb_idl_intersection(
207         ID *a,
208         ID *b );
209
210 int
211 bdb_idl_union(
212         ID *a,
213         ID *b );
214
215 ID bdb_idl_first( ID *ids, ID *cursor );
216 ID bdb_idl_next( ID *ids, ID *cursor );
217
218
219 /*
220  * index.c
221  */
222 extern int
223 bdb_index_is_indexed LDAP_P((
224         Backend *be,
225         AttributeDescription *desc ));
226
227 extern int
228 bdb_index_param LDAP_P((
229         Backend *be,
230         AttributeDescription *desc,
231         int ftype,
232         DB **db,
233         slap_mask_t *mask,
234         struct berval *prefix ));
235
236 extern int
237 bdb_index_values LDAP_P((
238         Backend *be,
239         DB_TXN *txn,
240         AttributeDescription *desc,
241         BerVarray vals,
242         ID id,
243         int op ));
244
245 int bdb_index_entry LDAP_P(( Backend *be, DB_TXN *t,
246         int r, Entry *e, Attribute *ap ));
247
248 #define bdb_index_entry_add(be,t,e,ap) \
249         bdb_index_entry((be),(t),SLAP_INDEX_ADD_OP,(e),(ap))
250 #define bdb_index_entry_del(be,t,e,ap) \
251         bdb_index_entry((be),(t),SLAP_INDEX_DELETE_OP,(e),(ap))
252
253 /*
254  * init.c
255  */
256 extern struct berval bdb_uuid;
257
258 /*
259  * key.c
260  */
261 extern int
262 bdb_key_read(
263     Backend     *be,
264         DB *db,
265         DB_TXN *txn,
266     struct berval *k,
267         ID *ids );
268
269 extern int
270 bdb_key_change(
271     Backend      *be,
272     DB *db,
273         DB_TXN *txn,
274     struct berval *k,
275     ID id,
276     int op );
277         
278 /*
279  * nextid.c
280  */
281 int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
282 int bdb_last_id( BackendDB *be, DB_TXN *tid );
283
284 /*
285  * modify.c
286  */
287 int bdb_modify_internal(
288         BackendDB *be,
289         Connection *conn,
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 void bdb_cache_entry_commit( Entry *e );
309 void bdb_cache_return_entry_rw( DB_ENV *env, Cache *cache, Entry *e, int rw, DB_LOCK *lock );
310 #define bdb_cache_return_entry_r(env, c, e, l) bdb_cache_return_entry_rw((env), (c), (e), 0, (l))
311 #define bdb_cache_return_entry_w(env, c, e, l) bdb_cache_return_entry_rw((env), (c), (e), 1, (l))
312 void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
313 #define bdb_unlocked_cache_return_entry_r( c, e ) bdb_unlocked_cache_return_entry_rw((c), (e), 0)
314 #define bdb_unlocked_cache_return_entry_w( c, e ) bdb_unlocked_cache_return_entry_rw((c), (e), 1)
315 int bdb_cache_add_entry_rw(
316         DB_ENV  *env,
317         Cache   *cache,
318         Entry   *e,
319         int     rw,
320         u_int32_t locker,
321         DB_LOCK *lock
322 );
323 int bdb_cache_update_entry(
324        Cache   *cache,
325        Entry   *e
326 );
327 ID bdb_cache_find_entry_ndn2id(
328        Backend *be,
329        Cache   *cache,
330        struct berval   *ndn
331 );
332 Entry* bdb_cache_find_entry_id(
333         DB_ENV          *env,
334         Cache           *cache,
335         ID              id,
336         int             rw,
337         u_int32_t       locker,
338         DB_LOCK         *lock
339 );
340 int bdb_cache_delete_entry(
341        Cache   *cache,
342        Entry   *e
343 );
344 void bdb_cache_release_all( Cache *cache );
345
346 #ifdef HAVE_EBCDIC
347 char *ebcdic_dberror( int rc );
348
349 #define db_strerror(x)  ebcdic_dberror(x)
350 #endif
351
352 LDAP_END_DECL
353
354 #endif /* _PROTO_BDB_H */