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