]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/proto-bdb.h
ed31f363f5c105b57f44324a1fe1771151c3a0d8
[openldap] / servers / slapd / back-bdb / proto-bdb.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 2000 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         const char *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 int
47 bdb_attribute LDAP_P(( Backend *be, Connection *conn, Operation *op,
48         Entry *target, const char *e_ndn, AttributeDescription *entry_at,
49         struct berval ***vals ));
50
51 /*
52  * dbcache.c
53  */
54 int
55 bdb_db_cache(
56     Backend     *be,
57     const char *name,
58         DB **db );
59
60 /*
61  * dn2entry.c
62  */
63 int bdb_dn2entry LDAP_P(( BackendDB *be, DB_TXN *tid,
64         const char *dn, Entry **e, Entry **matched, int flags ));
65
66 /*
67  * dn2id.c
68  */
69 int bdb_dn2id(
70         BackendDB *be,
71         DB_TXN *tid,
72         const char *dn,
73         ID *id );
74
75 int bdb_dn2id_matched(
76         BackendDB *be,
77         DB_TXN *tid,
78         const char *dn,
79         ID *id,
80         char **matchedDN );
81
82 int bdb_dn2id_add(
83         BackendDB *be,
84         DB_TXN *tid,
85         const char *pdn,
86         Entry *e );
87
88 int bdb_dn2id_delete(
89         BackendDB *be,
90         DB_TXN *tid,
91         const char *pdn,
92         const char *dn,
93         ID id );
94
95 int bdb_dn2id_children(
96         BackendDB *be,
97         DB_TXN *tid,
98         const char *dn );
99
100 int
101 bdb_dn2idl(
102         BackendDB       *be,
103         const char      *dn,
104         int prefix,
105         ID *ids );
106
107 /*
108  * entry.c
109  */
110 int bdb_entry_return( BackendDB *be, Entry *e );
111 int bdb_entry_release( BackendDB *, Connection *, Operation *, Entry *, int );
112
113 /*
114  * error.c
115  */
116 void bdb_errcall( const char *pfx, char * msg );
117
118 /*
119  * filterentry.c
120  */
121 int bdb_filter_candidates(
122         Backend *be,
123         Filter  *f,
124         ID *ids,
125         ID *tmp );
126
127 /*
128  * group.c
129  */
130
131 int bdb_group(
132         Backend *be,
133         Connection *conn,
134         Operation *op,
135         Entry   *target,
136         const char      *gr_ndn,
137         const char      *op_ndn,
138         ObjectClass *group_oc,
139         AttributeDescription *group_at);
140
141 /*
142  * id2entry
143  */
144 int bdb_id2entry_add(
145         BackendDB *be,
146         DB_TXN *tid,
147         Entry *e );
148
149 int bdb_id2entry_update(
150         BackendDB *be,
151         DB_TXN *tid,
152         Entry *e );
153
154 int bdb_id2entry_delete(
155         BackendDB *be,
156         DB_TXN *tid,
157         ID id );
158
159 int bdb_id2entry(
160         BackendDB *be,
161         DB_TXN *tid,
162         ID id,
163         Entry **e );
164
165 /*
166  * idl.c
167  */
168 unsigned bdb_idl_search( ID *ids, ID id );
169
170 int bdb_bt_compare(
171         DB *db,
172         const DBT *a,
173         const DBT *b );
174
175 int bdb_idl_fetch_key(
176         BackendDB *be,
177         DB *db,
178         DB_TXN *txn,
179         DBT *key,
180         ID *ids );
181
182 int bdb_idl_insert_key(
183         BackendDB *be,
184         DB *db,
185         DB_TXN *txn,
186         DBT *key,
187         ID id );
188
189 int bdb_idl_delete_key(
190         BackendDB *be,
191         DB *db,
192         DB_TXN *txn,
193         DBT *key,
194         ID id );
195
196 #if 0
197 int
198 bdb_idl_notin(
199     ID  *a,
200     ID  *b,
201         ID      *ids );
202 #endif
203
204 int
205 bdb_idl_intersection(
206         ID *a,
207         ID *b );
208
209 int
210 bdb_idl_union(
211         ID *a,
212         ID *b );
213
214 ID bdb_idl_first( ID *ids, ID *cursor );
215 ID bdb_idl_next( ID *ids, ID *cursor );
216
217
218 /*
219  * index.c
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         struct berval **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 int
291 bdb_exop_passwd(
292         Backend         *be,
293         Connection              *conn,
294         Operation               *op,
295         const char              *reqoid,
296         struct berval   *reqdata,
297         char                    **rspoid,
298         struct berval   **rspdata,
299         LDAPControl             *** rspctrls,
300         const char              **text,
301         struct berval   *** refs );
302
303 /*
304  * tools.c
305  */
306 int bdb_tool_entry_open( BackendDB *be, int mode );
307 int bdb_tool_entry_close( BackendDB *be );
308 ID bdb_tool_entry_next( BackendDB *be );
309 Entry* bdb_tool_entry_get( BackendDB *be, ID id );
310 ID bdb_tool_entry_put( BackendDB *be, Entry *e );
311 int bdb_tool_entry_reindex( BackendDB *be, ID id );
312
313
314 LDAP_END_DECL
315
316 #endif /* _PROTO_BDB_H */