]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/proto-bdb.h
Switch to openldap-data
[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  * key.c
249  */
250 extern int
251 bdb_key_read(
252     Backend     *be,
253         DB *db,
254         DB_TXN *txn,
255     struct berval *k,
256         ID *ids );
257
258 extern int
259 bdb_key_change(
260     Backend      *be,
261     DB *db,
262         DB_TXN *txn,
263     struct berval *k,
264     ID id,
265     int op );
266         
267 /*
268  * nextid.c
269  */
270 int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
271 int bdb_last_id( BackendDB *be, DB_TXN *tid );
272
273 /*
274  * modify.c
275  */
276 int bdb_modify_internal(
277         BackendDB *be,
278         Connection *conn,
279         Operation *op,
280         DB_TXN *tid,
281         Modifications *modlist,
282         Entry *e,
283         const char **text,
284         char *textbuf,
285         size_t textlen );
286
287 /*
288  * passwd.c
289  */
290 BI_op_extended bdb_exop_passwd;
291
292
293 /*
294  * cache.c
295  */
296
297 void bdb_cache_entry_commit( Entry *e );
298 void bdb_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
299 #define bdb_cache_return_entry_r(c, e) bdb_cache_return_entry_rw((c), (e), 0)
300 #define bdb_cache_return_entry_w(c, e) bdb_cache_return_entry_rw((c), (e), 1)
301 int bdb_cache_add_entry_rw(
302        Cache   *cache,
303        Entry   *e,
304        int     rw
305 );
306 int bdb_cache_update_entry(
307        Cache   *cache,
308        Entry   *e
309 );
310 ID bdb_cache_find_entry_ndn2id(
311        Backend *be,
312        Cache   *cache,
313        struct berval   *ndn
314 );
315 Entry* bdb_cache_find_entry_id(
316        Cache   *cache,
317        ID      id,
318        int     rw
319 );
320 int bdb_cache_delete_entry(
321        Cache   *cache,
322        Entry   *e
323 );
324 void bdb_cache_release_all( Cache *cache );
325
326 LDAP_END_DECL
327
328 #endif /* _PROTO_BDB_H */