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