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