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