]> git.sur5r.net Git - openldap/blob - servers/slapd/back-mdb/proto-mdb.h
Happy New Year!
[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_entry_return( Operation *op, Entry *e );
179 BI_entry_release_rw mdb_entry_release;
180 BI_entry_get_rw mdb_entry_get;
181
182 int mdb_entry_decode( Operation *op, MDB_val *data, Entry **e );
183
184 void mdb_reader_flush( MDB_env *env );
185 int mdb_opinfo_get( Operation *op, struct mdb_info *mdb, int rdonly, mdb_op_info **moi );
186
187 /*
188  * idl.c
189  */
190
191 unsigned mdb_idl_search( ID *ids, ID id );
192
193 int mdb_idl_fetch_key(
194         BackendDB       *be,
195         MDB_txn         *txn,
196         MDB_dbi         dbi,
197         MDB_val         *key,
198         ID                      *ids,
199         MDB_cursor      **saved_cursor,
200         int                     get_flag );
201
202 int mdb_idl_insert( ID *ids, ID id );
203
204 typedef int (mdb_idl_keyfunc)(
205         MDB_cursor *mc,
206         struct berval *key,
207         ID id );
208
209 mdb_idl_keyfunc mdb_idl_insert_keys;
210 mdb_idl_keyfunc mdb_idl_delete_keys;
211
212 int
213 mdb_idl_intersection(
214         ID *a,
215         ID *b );
216
217 int
218 mdb_idl_union(
219         ID *a,
220         ID *b );
221
222 ID mdb_idl_first( ID *ids, ID *cursor );
223 ID mdb_idl_next( ID *ids, ID *cursor );
224
225 void mdb_idl_sort( ID *ids, ID *tmp );
226 int mdb_idl_append( ID *a, ID *b );
227 int mdb_idl_append_one( ID *ids, ID id );
228
229
230 /*
231  * index.c
232  */
233
234 extern AttrInfo *
235 mdb_index_mask LDAP_P((
236         Backend *be,
237         AttributeDescription *desc,
238         struct berval *name ));
239
240 extern int
241 mdb_index_param LDAP_P((
242         Backend *be,
243         AttributeDescription *desc,
244         int ftype,
245         MDB_dbi *dbi,
246         slap_mask_t *mask,
247         struct berval *prefix ));
248
249 extern int
250 mdb_index_values LDAP_P((
251         Operation *op,
252         MDB_txn *txn,
253         AttributeDescription *desc,
254         BerVarray vals,
255         ID id,
256         int opid ));
257
258 extern int
259 mdb_index_recset LDAP_P((
260         struct mdb_info *mdb,
261         Attribute *a,
262         AttributeType *type,
263         struct berval *tags,
264         IndexRec *ir ));
265
266 extern int
267 mdb_index_recrun LDAP_P((
268         Operation *op,
269         MDB_txn *txn,
270         struct mdb_info *mdb,
271         IndexRec *ir,
272         ID id,
273         int base ));
274
275 int mdb_index_entry LDAP_P(( Operation *op, MDB_txn *t, int r, Entry *e ));
276
277 #define mdb_index_entry_add(op,t,e) \
278         mdb_index_entry((op),(t),SLAP_INDEX_ADD_OP,(e))
279 #define mdb_index_entry_del(op,t,e) \
280         mdb_index_entry((op),(t),SLAP_INDEX_DELETE_OP,(e))
281
282 /*
283  * key.c
284  */
285
286 extern int
287 mdb_key_read(
288     Backend     *be,
289         MDB_txn *txn,
290         MDB_dbi dbi,
291     struct berval *k,
292         ID *ids,
293     MDB_cursor **saved_cursor,
294         int get_flags );
295
296 /*
297  * nextid.c
298  */
299
300 int mdb_next_id( BackendDB *be, MDB_cursor *mc, ID *id );
301
302 /*
303  * modify.c
304  */
305
306 int mdb_modify_internal(
307         Operation *op,
308         MDB_txn *tid,
309         Modifications *modlist,
310         Entry *e,
311         const char **text,
312         char *textbuf,
313         size_t textlen );
314
315 /*
316  * monitor.c
317  */
318
319 int mdb_monitor_db_init( BackendDB *be );
320 int mdb_monitor_db_open( BackendDB *be );
321 int mdb_monitor_db_close( BackendDB *be );
322 int mdb_monitor_db_destroy( BackendDB *be );
323
324 #ifdef MDB_MONITOR_IDX
325 int
326 mdb_monitor_idx_add(
327         struct mdb_info         *mdb,
328         AttributeDescription    *desc,
329         slap_mask_t             type );
330 #endif /* MDB_MONITOR_IDX */
331
332 /*
333  * former external.h
334  */
335
336 extern BI_init                          mdb_back_initialize;
337
338 extern BI_db_config                     mdb_db_config;
339
340 extern BI_op_add                        mdb_add;
341 extern BI_op_bind                       mdb_bind;
342 extern BI_op_compare                    mdb_compare;
343 extern BI_op_delete                     mdb_delete;
344 extern BI_op_modify                     mdb_modify;
345 extern BI_op_modrdn                     mdb_modrdn;
346 extern BI_op_search                     mdb_search;
347 extern BI_op_extended                   mdb_extended;
348
349 extern BI_chk_referrals                 mdb_referrals;
350
351 extern BI_operational                   mdb_operational;
352
353 extern BI_has_subordinates              mdb_hasSubordinates;
354
355 /* tools.c */
356 extern BI_tool_entry_open               mdb_tool_entry_open;
357 extern BI_tool_entry_close              mdb_tool_entry_close;
358 extern BI_tool_entry_first_x            mdb_tool_entry_first_x;
359 extern BI_tool_entry_next               mdb_tool_entry_next;
360 extern BI_tool_entry_get                mdb_tool_entry_get;
361 extern BI_tool_entry_put                mdb_tool_entry_put;
362 extern BI_tool_entry_reindex            mdb_tool_entry_reindex;
363 extern BI_tool_dn2id_get                mdb_tool_dn2id_get;
364 extern BI_tool_entry_modify             mdb_tool_entry_modify;
365
366 int mdb_tool_idl_add(
367         MDB_cursor *mc,
368         struct berval *keys,
369         ID id );
370
371 LDAP_END_DECL
372
373 #endif /* _PROTO_MDB_H */