proto-mdb.h revision 1.1 1 1.1 tron /* $NetBSD: proto-mdb.h,v 1.1 2014/05/28 09:58:50 tron Exp $ */
2 1.1 tron
3 1.1 tron /* $OpenLDAP$ */
4 1.1 tron /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 1.1 tron *
6 1.1 tron * Copyright 2000-2014 The OpenLDAP Foundation.
7 1.1 tron * All rights reserved.
8 1.1 tron *
9 1.1 tron * Redistribution and use in source and binary forms, with or without
10 1.1 tron * modification, are permitted only as authorized by the OpenLDAP
11 1.1 tron * Public License.
12 1.1 tron *
13 1.1 tron * A copy of this license is available in the file LICENSE in the
14 1.1 tron * top-level directory of the distribution or, alternatively, at
15 1.1 tron * <http://www.OpenLDAP.org/license.html>.
16 1.1 tron */
17 1.1 tron
18 1.1 tron #ifndef _PROTO_MDB_H
19 1.1 tron #define _PROTO_MDB_H
20 1.1 tron
21 1.1 tron LDAP_BEGIN_DECL
22 1.1 tron
23 1.1 tron #define MDB_UCTYPE "MDB"
24 1.1 tron
25 1.1 tron /*
26 1.1 tron * attr.c
27 1.1 tron */
28 1.1 tron
29 1.1 tron AttrInfo *mdb_attr_mask( struct mdb_info *mdb,
30 1.1 tron AttributeDescription *desc );
31 1.1 tron
32 1.1 tron void mdb_attr_flush( struct mdb_info *mdb );
33 1.1 tron
34 1.1 tron int mdb_attr_slot( struct mdb_info *mdb,
35 1.1 tron AttributeDescription *desc, int *insert );
36 1.1 tron
37 1.1 tron int mdb_attr_dbs_open( BackendDB *be, MDB_txn *txn, struct config_reply_s *cr );
38 1.1 tron void mdb_attr_dbs_close( struct mdb_info *mdb );
39 1.1 tron
40 1.1 tron int mdb_attr_index_config LDAP_P(( struct mdb_info *mdb,
41 1.1 tron const char *fname, int lineno,
42 1.1 tron int argc, char **argv, struct config_reply_s *cr ));
43 1.1 tron
44 1.1 tron void mdb_attr_index_unparse LDAP_P(( struct mdb_info *mdb, BerVarray *bva ));
45 1.1 tron void mdb_attr_index_destroy LDAP_P(( struct mdb_info *mdb ));
46 1.1 tron void mdb_attr_index_free LDAP_P(( struct mdb_info *mdb,
47 1.1 tron AttributeDescription *ad ));
48 1.1 tron
49 1.1 tron void mdb_attr_info_free( AttrInfo *ai );
50 1.1 tron
51 1.1 tron int mdb_ad_read( struct mdb_info *mdb, MDB_txn *txn );
52 1.1 tron int mdb_ad_get( struct mdb_info *mdb, MDB_txn *txn, AttributeDescription *ad );
53 1.1 tron
54 1.1 tron /*
55 1.1 tron * config.c
56 1.1 tron */
57 1.1 tron
58 1.1 tron int mdb_back_init_cf( BackendInfo *bi );
59 1.1 tron
60 1.1 tron /*
61 1.1 tron * dn2entry.c
62 1.1 tron */
63 1.1 tron
64 1.1 tron int mdb_dn2entry LDAP_P(( Operation *op, MDB_txn *tid, MDB_cursor *mc,
65 1.1 tron struct berval *dn, Entry **e, ID *nsubs, int matched ));
66 1.1 tron
67 1.1 tron /*
68 1.1 tron * dn2id.c
69 1.1 tron */
70 1.1 tron
71 1.1 tron int mdb_dn2id(
72 1.1 tron Operation *op,
73 1.1 tron MDB_txn *txn,
74 1.1 tron MDB_cursor *mc,
75 1.1 tron struct berval *ndn,
76 1.1 tron ID *id,
77 1.1 tron ID *nsubs,
78 1.1 tron struct berval *matched,
79 1.1 tron struct berval *nmatched );
80 1.1 tron
81 1.1 tron int mdb_dn2id_add(
82 1.1 tron Operation *op,
83 1.1 tron MDB_cursor *mcp,
84 1.1 tron MDB_cursor *mcd,
85 1.1 tron ID pid,
86 1.1 tron ID nsubs,
87 1.1 tron int upsub,
88 1.1 tron Entry *e );
89 1.1 tron
90 1.1 tron int mdb_dn2id_delete(
91 1.1 tron Operation *op,
92 1.1 tron MDB_cursor *mc,
93 1.1 tron ID id,
94 1.1 tron ID nsubs );
95 1.1 tron
96 1.1 tron int mdb_dn2id_children(
97 1.1 tron Operation *op,
98 1.1 tron MDB_txn *tid,
99 1.1 tron Entry *e );
100 1.1 tron
101 1.1 tron int mdb_dn2sups (
102 1.1 tron Operation *op,
103 1.1 tron MDB_txn *tid,
104 1.1 tron struct berval *dn,
105 1.1 tron ID *sups
106 1.1 tron );
107 1.1 tron
108 1.1 tron int mdb_dn2idl(
109 1.1 tron Operation *op,
110 1.1 tron MDB_txn *txn,
111 1.1 tron struct berval *ndn,
112 1.1 tron ID eid,
113 1.1 tron ID *ids,
114 1.1 tron ID *stack );
115 1.1 tron
116 1.1 tron int mdb_dn2id_parent(
117 1.1 tron Operation *op,
118 1.1 tron MDB_txn *txn,
119 1.1 tron ID eid,
120 1.1 tron ID *idp );
121 1.1 tron
122 1.1 tron int mdb_id2name(
123 1.1 tron Operation *op,
124 1.1 tron MDB_txn *txn,
125 1.1 tron MDB_cursor **cursp,
126 1.1 tron ID eid,
127 1.1 tron struct berval *name,
128 1.1 tron struct berval *nname);
129 1.1 tron
130 1.1 tron int mdb_idscope(
131 1.1 tron Operation *op,
132 1.1 tron MDB_txn *txn,
133 1.1 tron ID base,
134 1.1 tron ID *ids,
135 1.1 tron ID *res );
136 1.1 tron
137 1.1 tron struct IdScopes;
138 1.1 tron
139 1.1 tron int mdb_idscopes(
140 1.1 tron Operation *op,
141 1.1 tron struct IdScopes *isc );
142 1.1 tron
143 1.1 tron int mdb_dn2id_walk(
144 1.1 tron Operation *op,
145 1.1 tron struct IdScopes *isc );
146 1.1 tron
147 1.1 tron MDB_cmp_func mdb_dup_compare;
148 1.1 tron
149 1.1 tron /*
150 1.1 tron * filterentry.c
151 1.1 tron */
152 1.1 tron
153 1.1 tron int mdb_filter_candidates(
154 1.1 tron Operation *op,
155 1.1 tron MDB_txn *txn,
156 1.1 tron Filter *f,
157 1.1 tron ID *ids,
158 1.1 tron ID *tmp,
159 1.1 tron ID *stack );
160 1.1 tron
161 1.1 tron /*
162 1.1 tron * id2entry.c
163 1.1 tron */
164 1.1 tron
165 1.1 tron int mdb_id2entry_add(
166 1.1 tron Operation *op,
167 1.1 tron MDB_txn *tid,
168 1.1 tron MDB_cursor *mc,
169 1.1 tron Entry *e );
170 1.1 tron
171 1.1 tron int mdb_id2entry_update(
172 1.1 tron Operation *op,
173 1.1 tron MDB_txn *tid,
174 1.1 tron MDB_cursor *mc,
175 1.1 tron Entry *e );
176 1.1 tron
177 1.1 tron int mdb_id2entry_delete(
178 1.1 tron BackendDB *be,
179 1.1 tron MDB_txn *tid,
180 1.1 tron Entry *e);
181 1.1 tron
182 1.1 tron int mdb_id2entry(
183 1.1 tron Operation *op,
184 1.1 tron MDB_cursor *mc,
185 1.1 tron ID id,
186 1.1 tron Entry **e);
187 1.1 tron
188 1.1 tron int mdb_id2edata(
189 1.1 tron Operation *op,
190 1.1 tron MDB_cursor *mc,
191 1.1 tron ID id,
192 1.1 tron MDB_val *data);
193 1.1 tron
194 1.1 tron int mdb_entry_return( Operation *op, Entry *e );
195 1.1 tron BI_entry_release_rw mdb_entry_release;
196 1.1 tron BI_entry_get_rw mdb_entry_get;
197 1.1 tron
198 1.1 tron int mdb_entry_decode( Operation *op, MDB_val *data, Entry **e );
199 1.1 tron
200 1.1 tron void mdb_reader_flush( MDB_env *env );
201 1.1 tron int mdb_opinfo_get( Operation *op, struct mdb_info *mdb, int rdonly, mdb_op_info **moi );
202 1.1 tron
203 1.1 tron /*
204 1.1 tron * idl.c
205 1.1 tron */
206 1.1 tron
207 1.1 tron unsigned mdb_idl_search( ID *ids, ID id );
208 1.1 tron
209 1.1 tron int mdb_idl_fetch_key(
210 1.1 tron BackendDB *be,
211 1.1 tron MDB_txn *txn,
212 1.1 tron MDB_dbi dbi,
213 1.1 tron MDB_val *key,
214 1.1 tron ID *ids,
215 1.1 tron MDB_cursor **saved_cursor,
216 1.1 tron int get_flag );
217 1.1 tron
218 1.1 tron int mdb_idl_insert( ID *ids, ID id );
219 1.1 tron
220 1.1 tron typedef int (mdb_idl_keyfunc)(
221 1.1 tron BackendDB *be,
222 1.1 tron MDB_cursor *mc,
223 1.1 tron struct berval *key,
224 1.1 tron ID id );
225 1.1 tron
226 1.1 tron mdb_idl_keyfunc mdb_idl_insert_keys;
227 1.1 tron mdb_idl_keyfunc mdb_idl_delete_keys;
228 1.1 tron
229 1.1 tron int
230 1.1 tron mdb_idl_intersection(
231 1.1 tron ID *a,
232 1.1 tron ID *b );
233 1.1 tron
234 1.1 tron int
235 1.1 tron mdb_idl_union(
236 1.1 tron ID *a,
237 1.1 tron ID *b );
238 1.1 tron
239 1.1 tron ID mdb_idl_first( ID *ids, ID *cursor );
240 1.1 tron ID mdb_idl_next( ID *ids, ID *cursor );
241 1.1 tron
242 1.1 tron void mdb_idl_sort( ID *ids, ID *tmp );
243 1.1 tron int mdb_idl_append( ID *a, ID *b );
244 1.1 tron int mdb_idl_append_one( ID *ids, ID id );
245 1.1 tron
246 1.1 tron
247 1.1 tron /*
248 1.1 tron * index.c
249 1.1 tron */
250 1.1 tron
251 1.1 tron extern AttrInfo *
252 1.1 tron mdb_index_mask LDAP_P((
253 1.1 tron Backend *be,
254 1.1 tron AttributeDescription *desc,
255 1.1 tron struct berval *name ));
256 1.1 tron
257 1.1 tron extern int
258 1.1 tron mdb_index_param LDAP_P((
259 1.1 tron Backend *be,
260 1.1 tron AttributeDescription *desc,
261 1.1 tron int ftype,
262 1.1 tron MDB_dbi *dbi,
263 1.1 tron slap_mask_t *mask,
264 1.1 tron struct berval *prefix ));
265 1.1 tron
266 1.1 tron extern int
267 1.1 tron mdb_index_values LDAP_P((
268 1.1 tron Operation *op,
269 1.1 tron MDB_txn *txn,
270 1.1 tron AttributeDescription *desc,
271 1.1 tron BerVarray vals,
272 1.1 tron ID id,
273 1.1 tron int opid ));
274 1.1 tron
275 1.1 tron extern int
276 1.1 tron mdb_index_recset LDAP_P((
277 1.1 tron struct mdb_info *mdb,
278 1.1 tron Attribute *a,
279 1.1 tron AttributeType *type,
280 1.1 tron struct berval *tags,
281 1.1 tron IndexRec *ir ));
282 1.1 tron
283 1.1 tron extern int
284 1.1 tron mdb_index_recrun LDAP_P((
285 1.1 tron Operation *op,
286 1.1 tron MDB_txn *txn,
287 1.1 tron struct mdb_info *mdb,
288 1.1 tron IndexRec *ir,
289 1.1 tron ID id,
290 1.1 tron int base ));
291 1.1 tron
292 1.1 tron int mdb_index_entry LDAP_P(( Operation *op, MDB_txn *t, int r, Entry *e ));
293 1.1 tron
294 1.1 tron #define mdb_index_entry_add(op,t,e) \
295 1.1 tron mdb_index_entry((op),(t),SLAP_INDEX_ADD_OP,(e))
296 1.1 tron #define mdb_index_entry_del(op,t,e) \
297 1.1 tron mdb_index_entry((op),(t),SLAP_INDEX_DELETE_OP,(e))
298 1.1 tron
299 1.1 tron /*
300 1.1 tron * key.c
301 1.1 tron */
302 1.1 tron
303 1.1 tron extern int
304 1.1 tron mdb_key_read(
305 1.1 tron Backend *be,
306 1.1 tron MDB_txn *txn,
307 1.1 tron MDB_dbi dbi,
308 1.1 tron struct berval *k,
309 1.1 tron ID *ids,
310 1.1 tron MDB_cursor **saved_cursor,
311 1.1 tron int get_flags );
312 1.1 tron
313 1.1 tron /*
314 1.1 tron * nextid.c
315 1.1 tron */
316 1.1 tron
317 1.1 tron int mdb_next_id( BackendDB *be, MDB_cursor *mc, ID *id );
318 1.1 tron
319 1.1 tron /*
320 1.1 tron * modify.c
321 1.1 tron */
322 1.1 tron
323 1.1 tron int mdb_modify_internal(
324 1.1 tron Operation *op,
325 1.1 tron MDB_txn *tid,
326 1.1 tron Modifications *modlist,
327 1.1 tron Entry *e,
328 1.1 tron const char **text,
329 1.1 tron char *textbuf,
330 1.1 tron size_t textlen );
331 1.1 tron
332 1.1 tron /*
333 1.1 tron * monitor.c
334 1.1 tron */
335 1.1 tron
336 1.1 tron int mdb_monitor_db_init( BackendDB *be );
337 1.1 tron int mdb_monitor_db_open( BackendDB *be );
338 1.1 tron int mdb_monitor_db_close( BackendDB *be );
339 1.1 tron int mdb_monitor_db_destroy( BackendDB *be );
340 1.1 tron
341 1.1 tron #ifdef MDB_MONITOR_IDX
342 1.1 tron int
343 1.1 tron mdb_monitor_idx_add(
344 1.1 tron struct mdb_info *mdb,
345 1.1 tron AttributeDescription *desc,
346 1.1 tron slap_mask_t type );
347 1.1 tron #endif /* MDB_MONITOR_IDX */
348 1.1 tron
349 1.1 tron /*
350 1.1 tron * former external.h
351 1.1 tron */
352 1.1 tron
353 1.1 tron extern BI_init mdb_back_initialize;
354 1.1 tron
355 1.1 tron extern BI_db_config mdb_db_config;
356 1.1 tron
357 1.1 tron extern BI_op_add mdb_add;
358 1.1 tron extern BI_op_bind mdb_bind;
359 1.1 tron extern BI_op_compare mdb_compare;
360 1.1 tron extern BI_op_delete mdb_delete;
361 1.1 tron extern BI_op_modify mdb_modify;
362 1.1 tron extern BI_op_modrdn mdb_modrdn;
363 1.1 tron extern BI_op_search mdb_search;
364 1.1 tron extern BI_op_extended mdb_extended;
365 1.1 tron
366 1.1 tron extern BI_chk_referrals mdb_referrals;
367 1.1 tron
368 1.1 tron extern BI_operational mdb_operational;
369 1.1 tron
370 1.1 tron extern BI_has_subordinates mdb_hasSubordinates;
371 1.1 tron
372 1.1 tron /* tools.c */
373 1.1 tron extern BI_tool_entry_open mdb_tool_entry_open;
374 1.1 tron extern BI_tool_entry_close mdb_tool_entry_close;
375 1.1 tron extern BI_tool_entry_first_x mdb_tool_entry_first_x;
376 1.1 tron extern BI_tool_entry_next mdb_tool_entry_next;
377 1.1 tron extern BI_tool_entry_get mdb_tool_entry_get;
378 1.1 tron extern BI_tool_entry_put mdb_tool_entry_put;
379 1.1 tron extern BI_tool_entry_reindex mdb_tool_entry_reindex;
380 1.1 tron extern BI_tool_dn2id_get mdb_tool_dn2id_get;
381 1.1 tron extern BI_tool_entry_modify mdb_tool_entry_modify;
382 1.1 tron
383 1.1 tron extern mdb_idl_keyfunc mdb_tool_idl_add;
384 1.1 tron
385 1.1 tron LDAP_END_DECL
386 1.1 tron
387 1.1 tron #endif /* _PROTO_MDB_H */
388