]> git.sur5r.net Git - openldap/blob - servers/slapd/back-mdb/proto-mdb.h
back-bdb/back-mdb IDL cleanup.
[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 );
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 int mdb_ad_read( struct mdb_info *mdb, MDB_txn *txn );
50 int mdb_ad_get( struct mdb_info *mdb, MDB_txn *txn, AttributeDescription *ad );
51
52 /*
53  * config.c
54  */
55
56 int mdb_back_init_cf( BackendInfo *bi );
57
58 /*
59  * dn2entry.c
60  */
61
62 int mdb_dn2entry LDAP_P(( Operation *op, MDB_txn *tid,
63         struct berval *dn, Entry **e, int matched ));
64
65 /*
66  * dn2id.c
67  */
68
69 int mdb_dn2id(
70         Operation *op,
71         MDB_txn *txn,
72         struct berval *ndn,
73         ID *id,
74         struct berval *matched,
75         struct berval *nmatched );
76
77 int mdb_dn2id_add(
78         Operation *op,
79         MDB_txn *tid,
80         ID pid,
81         Entry *e );
82
83 int mdb_dn2id_delete(
84         Operation *op,
85         MDB_txn *tid,
86         ID pid,
87         Entry *e );
88
89 int mdb_dn2id_children(
90         Operation *op,
91         MDB_txn *tid,
92         Entry *e );
93
94 int mdb_dn2sups (
95         Operation *op,
96         MDB_txn *tid,
97         struct berval *dn,
98         ID *sups
99         );
100
101 int mdb_dn2idl(
102         Operation *op,
103         MDB_txn *txn,
104         struct berval *ndn,
105         ID eid,
106         ID *ids,
107         ID *stack );
108
109 int mdb_dn2id_parent(
110         Operation *op,
111         MDB_txn *txn,
112         ID eid,
113         ID *idp );
114
115 int mdb_id2name(
116         Operation *op,
117         MDB_txn *txn,
118         MDB_cursor **cursp,
119         ID eid,
120         struct berval *name,
121         struct berval *nname);
122
123 int mdb_idscope(
124         Operation *op,
125         MDB_txn *txn,
126         ID base,
127         ID *ids,
128         ID *res );
129
130 struct IdScopes;
131
132 int mdb_idscopes(
133         Operation *op,
134         struct IdScopes *isc );
135
136 MDB_cmp_func mdb_dup_compare;
137
138 /*
139  * filterentry.c
140  */
141
142 int mdb_filter_candidates(
143         Operation *op,
144         MDB_txn *txn,
145         Filter  *f,
146         ID *ids,
147         ID *tmp,
148         ID *stack );
149
150 /*
151  * id2entry.c
152  */
153
154 int mdb_id2entry_add(
155         Operation *op,
156         MDB_txn *tid,
157         Entry *e );
158
159 int mdb_id2entry_update(
160         Operation *op,
161         MDB_txn *tid,
162         Entry *e );
163
164 int mdb_id2entry_delete(
165         BackendDB *be,
166         MDB_txn *tid,
167         Entry *e);
168
169 int mdb_id2entry(
170         Operation *op,
171         MDB_cursor *mc,
172         ID id,
173         Entry **e);
174
175 int mdb_entry_return( Operation *op, Entry *e );
176 BI_entry_release_rw mdb_entry_release;
177 BI_entry_get_rw mdb_entry_get;
178
179 int mdb_entry_decode( Operation *op, MDB_val *data, Entry **e );
180
181 void mdb_reader_flush( MDB_env *env );
182 int mdb_opinfo_get( Operation *op, struct mdb_info *mdb, int rdonly, mdb_op_info **moi );
183
184 /*
185  * idl.c
186  */
187
188 unsigned mdb_idl_search( ID *ids, ID id );
189
190 int mdb_idl_fetch_key(
191         BackendDB       *be,
192         MDB_txn         *txn,
193         MDB_dbi         dbi,
194         MDB_val         *key,
195         ID                      *ids,
196         MDB_cursor      **saved_cursor,
197         int                     get_flag );
198
199 int mdb_idl_insert( ID *ids, ID id );
200
201 typedef int (mdb_idl_keyfunc)(
202         MDB_cursor *mc,
203         struct berval *key,
204         ID id );
205
206 mdb_idl_keyfunc mdb_idl_insert_keys;
207 mdb_idl_keyfunc mdb_idl_delete_keys;
208
209 int
210 mdb_idl_intersection(
211         ID *a,
212         ID *b );
213
214 int
215 mdb_idl_union(
216         ID *a,
217         ID *b );
218
219 ID mdb_idl_first( ID *ids, ID *cursor );
220 ID mdb_idl_next( ID *ids, ID *cursor );
221
222 void mdb_idl_sort( ID *ids, ID *tmp );
223 int mdb_idl_append( ID *a, ID *b );
224 int mdb_idl_append_one( ID *ids, ID id );
225
226
227 /*
228  * index.c
229  */
230
231 extern AttrInfo *
232 mdb_index_mask LDAP_P((
233         Backend *be,
234         AttributeDescription *desc,
235         struct berval *name ));
236
237 extern int
238 mdb_index_param LDAP_P((
239         Backend *be,
240         AttributeDescription *desc,
241         int ftype,
242         MDB_dbi *dbi,
243         slap_mask_t *mask,
244         struct berval *prefix ));
245
246 extern int
247 mdb_index_values LDAP_P((
248         Operation *op,
249         MDB_txn *txn,
250         AttributeDescription *desc,
251         BerVarray vals,
252         ID id,
253         int opid ));
254
255 extern int
256 mdb_index_recset LDAP_P((
257         struct mdb_info *mdb,
258         Attribute *a,
259         AttributeType *type,
260         struct berval *tags,
261         IndexRec *ir ));
262
263 extern int
264 mdb_index_recrun LDAP_P((
265         Operation *op,
266         struct mdb_info *mdb,
267         IndexRec *ir,
268         ID id,
269         int base ));
270
271 int mdb_index_entry LDAP_P(( Operation *op, MDB_txn *t, int r, Entry *e ));
272
273 #define mdb_index_entry_add(op,t,e) \
274         mdb_index_entry((op),(t),SLAP_INDEX_ADD_OP,(e))
275 #define mdb_index_entry_del(op,t,e) \
276         mdb_index_entry((op),(t),SLAP_INDEX_DELETE_OP,(e))
277
278 /*
279  * key.c
280  */
281
282 extern int
283 mdb_key_read(
284     Backend     *be,
285         MDB_txn *txn,
286         MDB_dbi dbi,
287     struct berval *k,
288         ID *ids,
289     MDB_cursor **saved_cursor,
290         int get_flags );
291
292 /*
293  * nextid.c
294  */
295
296 int mdb_next_id( BackendDB *be, MDB_txn *tid, ID *id );
297
298 /*
299  * modify.c
300  */
301
302 int mdb_modify_internal(
303         Operation *op,
304         MDB_txn *tid,
305         Modifications *modlist,
306         Entry *e,
307         const char **text,
308         char *textbuf,
309         size_t textlen );
310
311 /*
312  * monitor.c
313  */
314
315 int mdb_monitor_db_init( BackendDB *be );
316 int mdb_monitor_db_open( BackendDB *be );
317 int mdb_monitor_db_close( BackendDB *be );
318 int mdb_monitor_db_destroy( BackendDB *be );
319
320 #ifdef MDB_MONITOR_IDX
321 int
322 mdb_monitor_idx_add(
323         struct mdb_info         *mdb,
324         AttributeDescription    *desc,
325         slap_mask_t             type );
326 #endif /* MDB_MONITOR_IDX */
327
328 /*
329  * former external.h
330  */
331
332 extern BI_init                          mdb_back_initialize;
333
334 extern BI_db_config                     mdb_db_config;
335
336 extern BI_op_add                        mdb_add;
337 extern BI_op_bind                       mdb_bind;
338 extern BI_op_compare                    mdb_compare;
339 extern BI_op_delete                     mdb_delete;
340 extern BI_op_modify                     mdb_modify;
341 extern BI_op_modrdn                     mdb_modrdn;
342 extern BI_op_search                     mdb_search;
343 extern BI_op_extended                   mdb_extended;
344
345 extern BI_chk_referrals                 mdb_referrals;
346
347 extern BI_operational                   mdb_operational;
348
349 extern BI_has_subordinates              mdb_hasSubordinates;
350
351 /* tools.c */
352 extern BI_tool_entry_open               mdb_tool_entry_open;
353 extern BI_tool_entry_close              mdb_tool_entry_close;
354 extern BI_tool_entry_first_x            mdb_tool_entry_first_x;
355 extern BI_tool_entry_next               mdb_tool_entry_next;
356 extern BI_tool_entry_get                mdb_tool_entry_get;
357 extern BI_tool_entry_put                mdb_tool_entry_put;
358 extern BI_tool_entry_reindex            mdb_tool_entry_reindex;
359 extern BI_tool_dn2id_get                mdb_tool_dn2id_get;
360 extern BI_tool_entry_modify             mdb_tool_entry_modify;
361
362 LDAP_END_DECL
363
364 #endif /* _PROTO_MDB_H */