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