]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/proto-bdb.h
Latest changes from HEAD.
[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 #define bdb_dn2entry_r(be, tid, dn, e, m, f) bdb_dn2entry_rw((be), (tid), (dn), (e), (m), (f), 0)
63 #define bdb_dn2entry_w(be, tid, dn, e, m, f) bdb_dn2entry_rw((be), (tid), (dn), (e), (m), (f), 1)
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 #define bdb_id2entry_r(be, tid, id, e)      bdb_id2entry_rw((be), (tid), (id), (e), 0)
157 #define bdb_id2entry_w(be, tid, id, e)      bdb_id2entry_rw((be), (tid), (id), (e), 1)
158
159 void bdb_entry_free ( Entry *e );
160
161 /*
162  * idl.c
163  */
164 unsigned bdb_idl_search( ID *ids, ID id );
165
166 int bdb_bt_compare(
167         DB *db,
168         const DBT *a,
169         const DBT *b );
170
171 int bdb_idl_fetch_key(
172         BackendDB *be,
173         DB *db,
174         DB_TXN *txn,
175         DBT *key,
176         ID *ids );
177
178 int bdb_idl_insert_key(
179         BackendDB *be,
180         DB *db,
181         DB_TXN *txn,
182         DBT *key,
183         ID id );
184
185 int bdb_idl_delete_key(
186         BackendDB *be,
187         DB *db,
188         DB_TXN *txn,
189         DBT *key,
190         ID id );
191
192 #if 0
193 int
194 bdb_idl_notin(
195     ID  *a,
196     ID  *b,
197         ID      *ids );
198 #endif
199
200 int
201 bdb_idl_intersection(
202         ID *a,
203         ID *b );
204
205 int
206 bdb_idl_union(
207         ID *a,
208         ID *b );
209
210 ID bdb_idl_first( ID *ids, ID *cursor );
211 ID bdb_idl_next( ID *ids, ID *cursor );
212
213
214 /*
215  * index.c
216  */
217 extern int
218 bdb_index_is_indexed LDAP_P((
219         Backend *be,
220         AttributeDescription *desc ));
221
222 extern int
223 bdb_index_param LDAP_P((
224         Backend *be,
225         AttributeDescription *desc,
226         int ftype,
227         DB **db,
228         slap_mask_t *mask,
229         struct berval *prefix ));
230
231 extern int
232 bdb_index_values LDAP_P((
233         Backend *be,
234         DB_TXN *txn,
235         AttributeDescription *desc,
236         BerVarray vals,
237         ID id,
238         int op ));
239
240 int bdb_index_entry LDAP_P(( Backend *be, DB_TXN *t,
241         int r, Entry *e, Attribute *ap ));
242
243 #define bdb_index_entry_add(be,t,e,ap) \
244         bdb_index_entry((be),(t),SLAP_INDEX_ADD_OP,(e),(ap))
245 #define bdb_index_entry_del(be,t,e,ap) \
246         bdb_index_entry((be),(t),SLAP_INDEX_DELETE_OP,(e),(ap))
247
248 /*
249  * init.c
250  */
251 extern struct berval bdb_uuid;
252
253 /*
254  * key.c
255  */
256 extern int
257 bdb_key_read(
258     Backend     *be,
259         DB *db,
260         DB_TXN *txn,
261     struct berval *k,
262         ID *ids );
263
264 extern int
265 bdb_key_change(
266     Backend      *be,
267     DB *db,
268         DB_TXN *txn,
269     struct berval *k,
270     ID id,
271     int op );
272         
273 /*
274  * nextid.c
275  */
276 int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
277 int bdb_last_id( BackendDB *be, DB_TXN *tid );
278
279 /*
280  * modify.c
281  */
282 int bdb_modify_internal(
283         BackendDB *be,
284         Connection *conn,
285         Operation *op,
286         DB_TXN *tid,
287         Modifications *modlist,
288         Entry *e,
289         const char **text,
290         char *textbuf,
291         size_t textlen );
292
293 /*
294  * passwd.c
295  */
296 BI_op_extended bdb_exop_passwd;
297
298
299 /*
300  * cache.c
301  */
302
303 void bdb_cache_entry_commit( Entry *e );
304 void bdb_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
305 #define bdb_cache_return_entry_r(c, e) bdb_cache_return_entry_rw((c), (e), 0)
306 #define bdb_cache_return_entry_w(c, e) bdb_cache_return_entry_rw((c), (e), 1)
307 int bdb_cache_add_entry_rw(
308        Cache   *cache,
309        Entry   *e,
310        int     rw
311 );
312 int bdb_cache_update_entry(
313        Cache   *cache,
314        Entry   *e
315 );
316 ID bdb_cache_find_entry_ndn2id(
317        Backend *be,
318        Cache   *cache,
319        struct berval   *ndn
320 );
321 Entry* bdb_cache_find_entry_id(
322        Cache   *cache,
323        ID      id,
324        int     rw
325 );
326 int bdb_cache_delete_entry(
327        Cache   *cache,
328        Entry   *e
329 );
330 void bdb_cache_release_all( Cache *cache );
331
332 LDAP_END_DECL
333
334 #endif /* _PROTO_BDB_H */