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