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