]> git.sur5r.net Git - openldap/blob - servers/slapd/back-mdb/proto-mdb.h
Cursor updates
[openldap] / servers / slapd / back-mdb / proto-mdb.h
1 /* $OpenLDAP$ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3  *
4  * Copyright 2000-2011 The OpenLDAP Foundation.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted only as authorized by the OpenLDAP
9  * Public License.
10  *
11  * A copy of this license is available in the file LICENSE in the
12  * top-level directory of the distribution or, alternatively, at
13  * <http://www.OpenLDAP.org/license.html>.
14  */
15
16 #ifndef _PROTO_MDB_H
17 #define _PROTO_MDB_H
18
19 LDAP_BEGIN_DECL
20
21 #define MDB_UCTYPE      "MDB"
22
23 /*
24  * attr.c
25  */
26
27 AttrInfo *mdb_attr_mask( struct mdb_info *mdb,
28         AttributeDescription *desc );
29
30 void mdb_attr_flush( struct mdb_info *mdb );
31
32 int mdb_attr_slot( struct mdb_info *mdb,
33         AttributeDescription *desc, int *insert );
34
35 int mdb_attr_dbs_open( BackendDB *be, MDB_txn *txn, struct config_reply_s *cr );
36 void mdb_attr_dbs_close( struct mdb_info *mdb, MDB_txn *txn );
37
38 int mdb_attr_index_config LDAP_P(( struct mdb_info *mdb,
39         const char *fname, int lineno,
40         int argc, char **argv, struct config_reply_s *cr ));
41
42 void mdb_attr_index_unparse LDAP_P(( struct mdb_info *mdb, BerVarray *bva ));
43 void mdb_attr_index_destroy LDAP_P(( struct mdb_info *mdb ));
44 void mdb_attr_index_free LDAP_P(( struct mdb_info *mdb,
45         AttributeDescription *ad ));
46
47 void mdb_attr_info_free( AttrInfo *ai );
48
49 /*
50  * config.c
51  */
52
53 int mdb_back_init_cf( BackendInfo *bi );
54
55 /*
56  * dn2entry.c
57  */
58
59 int mdb_dn2entry LDAP_P(( Operation *op, MDB_txn *tid,
60         struct berval *dn, Entry **e, int matched ));
61
62 /*
63  * dn2id.c
64  */
65
66 int mdb_dn2id(
67         Operation *op,
68         MDB_txn *txn,
69         struct berval *ndn,
70         ID *id,
71         struct berval *matched,
72         struct berval *nmatched );
73
74 int mdb_dn2id_add(
75         Operation *op,
76         MDB_txn *tid,
77         ID pid,
78         Entry *e );
79
80 int mdb_dn2id_delete(
81         Operation *op,
82         MDB_txn *tid,
83         ID pid,
84         Entry *e );
85
86 int mdb_dn2id_children(
87         Operation *op,
88         MDB_txn *tid,
89         Entry *e );
90
91 int mdb_dn2sups (
92         Operation *op,
93         MDB_txn *tid,
94         struct berval *dn,
95         ID *sups
96         );
97
98 int mdb_dn2idl(
99         Operation *op,
100         MDB_txn *txn,
101         struct berval *ndn,
102         ID eid,
103         ID *ids,
104         ID *stack );
105
106 int mdb_dn2id_parent(
107         Operation *op,
108         MDB_txn *txn,
109         ID eid,
110         ID *idp );
111
112 int mdb_id2name(
113         Operation *op,
114         MDB_txn *txn,
115         MDB_cursor **cursp,
116         ID eid,
117         struct berval *name,
118         struct berval *nname);
119
120 int mdb_idscope(
121         Operation *op,
122         MDB_txn *txn,
123         ID base,
124         ID *ids,
125         ID *res );
126
127 int mdb_idscopes(
128         Operation *op,
129         MDB_txn *txn,
130         MDB_cursor **cursp,
131         ID base,
132         ID *scopes );
133
134 MDB_cmp_func mdb_dup_compare;
135
136 /*
137  * filterentry.c
138  */
139
140 int mdb_filter_candidates(
141         Operation *op,
142         MDB_txn *txn,
143         Filter  *f,
144         ID *ids,
145         ID *tmp,
146         ID *stack );
147
148 /*
149  * id2entry.c
150  */
151
152 int mdb_id2entry_add(
153         Operation *op,
154         MDB_txn *tid,
155         Entry *e );
156
157 int mdb_id2entry_update(
158         Operation *op,
159         MDB_txn *tid,
160         Entry *e );
161
162 int mdb_id2entry_delete(
163         BackendDB *be,
164         MDB_txn *tid,
165         Entry *e);
166
167 int mdb_id2entry(
168         Operation *op,
169         MDB_txn *tid,
170         ID id,
171         Entry **e);
172
173 void mdb_entry_free ( Entry *e );
174 int mdb_entry_return( Entry *e );
175 BI_entry_release_rw mdb_entry_release;
176 BI_entry_get_rw mdb_entry_get;
177
178 void mdb_reader_flush( MDB_env *env );
179 int mdb_opinfo_get( Operation *op, struct mdb_info *mdb, int rdonly, mdb_op_info **moi );
180
181 /*
182  * idl.c
183  */
184
185 unsigned mdb_idl_search( ID *ids, ID id );
186
187 int mdb_idl_fetch_key(
188         BackendDB       *be,
189         MDB_txn         *txn,
190         MDB_dbi         dbi,
191         MDB_val         *key,
192         ID                      *ids,
193         MDB_cursor      **saved_cursor,
194         int                     get_flag );
195
196 int mdb_idl_insert( ID *ids, ID id );
197
198 typedef int (mdb_idl_keyfunc)(
199         MDB_cursor *mc,
200         MDB_val *key,
201         ID id );
202
203 mdb_idl_keyfunc mdb_idl_insert_keys;
204 mdb_idl_keyfunc mdb_idl_delete_keys;
205
206 int
207 mdb_idl_intersection(
208         ID *a,
209         ID *b );
210
211 int
212 mdb_idl_union(
213         ID *a,
214         ID *b );
215
216 ID mdb_idl_first( ID *ids, ID *cursor );
217 ID mdb_idl_next( ID *ids, ID *cursor );
218
219 void mdb_idl_sort( ID *ids, ID *tmp );
220 int mdb_idl_append( ID *a, ID *b );
221 int mdb_idl_append_one( ID *ids, ID id );
222
223
224 /*
225  * index.c
226  */
227
228 extern AttrInfo *
229 mdb_index_mask LDAP_P((
230         Backend *be,
231         AttributeDescription *desc,
232         struct berval *name ));
233
234 extern int
235 mdb_index_param LDAP_P((
236         Backend *be,
237         AttributeDescription *desc,
238         int ftype,
239         MDB_dbi *dbi,
240         slap_mask_t *mask,
241         struct berval *prefix ));
242
243 extern int
244 mdb_index_values LDAP_P((
245         Operation *op,
246         MDB_txn *txn,
247         AttributeDescription *desc,
248         BerVarray vals,
249         ID id,
250         int opid ));
251
252 extern int
253 mdb_index_recset LDAP_P((
254         struct mdb_info *mdb,
255         Attribute *a,
256         AttributeType *type,
257         struct berval *tags,
258         IndexRec *ir ));
259
260 extern int
261 mdb_index_recrun LDAP_P((
262         Operation *op,
263         struct mdb_info *mdb,
264         IndexRec *ir,
265         ID id,
266         int base ));
267
268 int mdb_index_entry LDAP_P(( Operation *op, MDB_txn *t, int r, Entry *e ));
269
270 #define mdb_index_entry_add(op,t,e) \
271         mdb_index_entry((op),(t),SLAP_INDEX_ADD_OP,(e))
272 #define mdb_index_entry_del(op,t,e) \
273         mdb_index_entry((op),(t),SLAP_INDEX_DELETE_OP,(e))
274
275 /*
276  * key.c
277  */
278
279 extern int
280 mdb_key_read(
281     Backend     *be,
282         MDB_txn *txn,
283         MDB_dbi dbi,
284     struct berval *k,
285         ID *ids,
286     MDB_cursor **saved_cursor,
287         int get_flags );
288
289 /*
290  * nextid.c
291  */
292
293 int mdb_next_id( BackendDB *be, MDB_txn *tid, ID *id );
294
295 /*
296  * modify.c
297  */
298
299 int mdb_modify_internal(
300         Operation *op,
301         MDB_txn *tid,
302         Modifications *modlist,
303         Entry *e,
304         const char **text,
305         char *textbuf,
306         size_t textlen );
307
308 /*
309  * monitor.c
310  */
311
312 int mdb_monitor_db_init( BackendDB *be );
313 int mdb_monitor_db_open( BackendDB *be );
314 int mdb_monitor_db_close( BackendDB *be );
315 int mdb_monitor_db_destroy( BackendDB *be );
316
317 #ifdef MDB_MONITOR_IDX
318 int
319 mdb_monitor_idx_add(
320         struct mdb_info         *mdb,
321         AttributeDescription    *desc,
322         slap_mask_t             type );
323 #endif /* MDB_MONITOR_IDX */
324
325 /*
326  * former external.h
327  */
328
329 extern BI_init                          mdb_back_initialize;
330
331 extern BI_db_config                     mdb_db_config;
332
333 extern BI_op_add                        mdb_add;
334 extern BI_op_bind                       mdb_bind;
335 extern BI_op_compare                    mdb_compare;
336 extern BI_op_delete                     mdb_delete;
337 extern BI_op_modify                     mdb_modify;
338 extern BI_op_modrdn                     mdb_modrdn;
339 extern BI_op_search                     mdb_search;
340 extern BI_op_extended                   mdb_extended;
341
342 extern BI_chk_referrals                 mdb_referrals;
343
344 extern BI_operational                   mdb_operational;
345
346 extern BI_has_subordinates              mdb_hasSubordinates;
347
348 /* tools.c */
349 extern BI_tool_entry_open               mdb_tool_entry_open;
350 extern BI_tool_entry_close              mdb_tool_entry_close;
351 extern BI_tool_entry_first_x            mdb_tool_entry_first_x;
352 extern BI_tool_entry_next               mdb_tool_entry_next;
353 extern BI_tool_entry_get                mdb_tool_entry_get;
354 extern BI_tool_entry_put                mdb_tool_entry_put;
355 extern BI_tool_entry_reindex            mdb_tool_entry_reindex;
356 extern BI_tool_dn2id_get                mdb_tool_dn2id_get;
357 extern BI_tool_entry_modify             mdb_tool_entry_modify;
358
359 LDAP_END_DECL
360
361 #endif /* _PROTO_MDB_H */