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