]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/proto-bdb.h
Clean up bdb_entry_release / bdb_entry_return
[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         char *pdn,
86         Entry *e );
87
88 int bdb_dn2id_delete(
89         BackendDB *be,
90         DB_TXN *tid,
91         char *pdn,
92         Entry *e );
93
94 int bdb_dn2id_children(
95         BackendDB *be,
96         DB_TXN *tid,
97         const char *dn );
98
99 int
100 bdb_dn2idl(
101         BackendDB       *be,
102         const char      *dn,
103         int prefix,
104         ID *ids );
105
106 /*
107  * entry.c
108  */
109 int bdb_entry_return( BackendDB *be, Entry *e );
110 int bdb_entry_release( BackendDB *, Connection *, Operation *, Entry *, int );
111
112 /*
113  * error.c
114  */
115 void bdb_errcall( const char *pfx, char * msg );
116
117 /*
118  * filterentry.c
119  */
120 int bdb_filter_candidates(
121         Backend *be,
122         Filter  *f,
123         ID *ids,
124         ID *tmp );
125
126 /*
127  * group.c
128  */
129
130 int bdb_group(
131         Backend *be,
132         Connection *conn,
133         Operation *op,
134         Entry   *target,
135         const char      *gr_ndn,
136         const char      *op_ndn,
137         ObjectClass *group_oc,
138         AttributeDescription *group_at);
139
140 /*
141  * id2entry
142  */
143 int bdb_id2entry_add(
144         BackendDB *be,
145         DB_TXN *tid,
146         Entry *e );
147
148 int bdb_id2entry_update(
149         BackendDB *be,
150         DB_TXN *tid,
151         Entry *e );
152
153 int bdb_id2entry_delete(
154         BackendDB *be,
155         DB_TXN *tid,
156         ID id );
157
158 int bdb_id2entry(
159         BackendDB *be,
160         DB_TXN *tid,
161         ID id,
162         Entry **e );
163
164 /*
165  * idl.c
166  */
167 unsigned bdb_idl_search( ID *ids, ID id );
168
169 int bdb_bt_compare(
170         DB *db,
171         const DBT *a,
172         const DBT *b );
173
174 int bdb_idl_fetch_key(
175         BackendDB *be,
176         DB *db,
177         DB_TXN *txn,
178         DBT *key,
179         ID *ids );
180
181 int bdb_idl_insert_key(
182         BackendDB *be,
183         DB *db,
184         DB_TXN *txn,
185         DBT *key,
186         ID id );
187
188 int bdb_idl_delete_key(
189         BackendDB *be,
190         DB *db,
191         DB_TXN *txn,
192         DBT *key,
193         ID id );
194
195 #if 0
196 int
197 bdb_idl_notin(
198     ID  *a,
199     ID  *b,
200         ID      *ids );
201 #endif
202
203 int
204 bdb_idl_intersection(
205         ID *a,
206         ID *b );
207
208 int
209 bdb_idl_union(
210         ID *a,
211         ID *b );
212
213 ID bdb_idl_first( ID *ids, ID *cursor );
214 ID bdb_idl_next( ID *ids, ID *cursor );
215
216
217 /*
218  * index.c
219  */
220 extern int
221 bdb_index_param LDAP_P((
222         Backend *be,
223         AttributeDescription *desc,
224         int ftype,
225         DB **db,
226         slap_mask_t *mask,
227         struct berval *prefix ));
228
229 extern int
230 bdb_index_values LDAP_P((
231         Backend *be,
232         DB_TXN *txn,
233         AttributeDescription *desc,
234         struct berval **vals,
235         ID id,
236         int op ));
237
238 int bdb_index_entry LDAP_P(( Backend *be, DB_TXN *t,
239         int r, Entry *e, Attribute *ap ));
240
241 #define bdb_index_entry_add(be,t,e,ap) \
242         bdb_index_entry((be),(t),SLAP_INDEX_ADD_OP,(e),(ap))
243 #define bdb_index_entry_del(be,t,e,ap) \
244         bdb_index_entry((be),(t),SLAP_INDEX_DELETE_OP,(e),(ap))
245
246 /*
247  * key.c
248  */
249 extern int
250 bdb_key_read(
251     Backend     *be,
252         DB *db,
253         DB_TXN *txn,
254     struct berval *k,
255         ID *ids );
256
257 extern int
258 bdb_key_change(
259     Backend      *be,
260     DB *db,
261         DB_TXN *txn,
262     struct berval *k,
263     ID id,
264     int op );
265         
266 /*
267  * nextid.c
268  */
269 int bdb_next_id( BackendDB *be, DB_TXN *tid, ID *id );
270 int bdb_last_id( BackendDB *be, DB_TXN *tid );
271
272 /*
273  * modify.c
274  */
275 int bdb_modify_internal(
276         BackendDB *be,
277         Connection *conn,
278         Operation *op,
279         DB_TXN *tid,
280         Modifications *modlist,
281         Entry *e,
282         const char **text,
283         char *textbuf,
284         size_t textlen );
285
286 /*
287  * passwd.c
288  */
289 int
290 bdb_exop_passwd(
291         Backend         *be,
292         Connection              *conn,
293         Operation               *op,
294         const char              *reqoid,
295         struct berval   *reqdata,
296         char                    **rspoid,
297         struct berval   **rspdata,
298         LDAPControl             *** rspctrls,
299         const char              **text,
300         struct berval   *** refs );
301
302 /*
303  * tools.c
304  */
305 int bdb_tool_entry_open( BackendDB *be, int mode );
306 int bdb_tool_entry_close( BackendDB *be );
307 ID bdb_tool_entry_next( BackendDB *be );
308 Entry* bdb_tool_entry_get( BackendDB *be, ID id );
309 ID bdb_tool_entry_put( BackendDB *be, Entry *e );
310 int bdb_tool_entry_reindex( BackendDB *be, ID id );
311
312
313 LDAP_END_DECL
314
315 #endif /* _PROTO_BDB_H */