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