Back to index

openldap  2.4.31
proto-mdb.h
Go to the documentation of this file.
00001 /* $OpenLDAP$ */
00002 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00003  *
00004  * Copyright 2000-2012 The OpenLDAP Foundation.
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted only as authorized by the OpenLDAP
00009  * Public License.
00010  *
00011  * A copy of this license is available in the file LICENSE in the
00012  * top-level directory of the distribution or, alternatively, at
00013  * <http://www.OpenLDAP.org/license.html>.
00014  */
00015 
00016 #ifndef _PROTO_MDB_H
00017 #define _PROTO_MDB_H
00018 
00019 LDAP_BEGIN_DECL
00020 
00021 #define MDB_UCTYPE   "MDB"
00022 
00023 /*
00024  * attr.c
00025  */
00026 
00027 AttrInfo *mdb_attr_mask( struct mdb_info *mdb,
00028        AttributeDescription *desc );
00029 
00030 void mdb_attr_flush( struct mdb_info *mdb );
00031 
00032 int mdb_attr_slot( struct mdb_info *mdb,
00033        AttributeDescription *desc, int *insert );
00034 
00035 int mdb_attr_dbs_open( BackendDB *be, MDB_txn *txn, struct config_reply_s *cr );
00036 void mdb_attr_dbs_close( struct mdb_info *mdb );
00037 
00038 int mdb_attr_index_config LDAP_P(( struct mdb_info *mdb,
00039        const char *fname, int lineno,
00040        int argc, char **argv, struct config_reply_s *cr ));
00041 
00042 void mdb_attr_index_unparse LDAP_P(( struct mdb_info *mdb, BerVarray *bva ));
00043 void mdb_attr_index_destroy LDAP_P(( struct mdb_info *mdb ));
00044 void mdb_attr_index_free LDAP_P(( struct mdb_info *mdb,
00045        AttributeDescription *ad ));
00046 
00047 void mdb_attr_info_free( AttrInfo *ai );
00048 
00049 int mdb_ad_read( struct mdb_info *mdb, MDB_txn *txn );
00050 int mdb_ad_get( struct mdb_info *mdb, MDB_txn *txn, AttributeDescription *ad );
00051 
00052 /*
00053  * config.c
00054  */
00055 
00056 int mdb_back_init_cf( BackendInfo *bi );
00057 
00058 /*
00059  * dn2entry.c
00060  */
00061 
00062 int mdb_dn2entry LDAP_P(( Operation *op, MDB_txn *tid, MDB_cursor *mc,
00063        struct berval *dn, Entry **e, int matched ));
00064 
00065 /*
00066  * dn2id.c
00067  */
00068 
00069 int mdb_dn2id(
00070        Operation *op,
00071        MDB_txn *txn,
00072        MDB_cursor *mc,
00073        struct berval *ndn,
00074        ID *id,
00075        struct berval *matched,
00076        struct berval *nmatched );
00077 
00078 int mdb_dn2id_add(
00079        Operation *op,
00080        MDB_cursor *mcp,
00081        MDB_cursor *mcd,
00082        ID pid,
00083        Entry *e );
00084 
00085 int mdb_dn2id_delete(
00086        Operation *op,
00087        MDB_cursor *mc,
00088        ID id );
00089 
00090 int mdb_dn2id_children(
00091        Operation *op,
00092        MDB_txn *tid,
00093        Entry *e );
00094 
00095 int mdb_dn2sups (
00096        Operation *op,
00097        MDB_txn *tid,
00098        struct berval *dn,
00099        ID *sups
00100        );
00101 
00102 int mdb_dn2idl(
00103        Operation *op,
00104        MDB_txn *txn,
00105        struct berval *ndn,
00106        ID eid,
00107        ID *ids,
00108        ID *stack );
00109 
00110 int mdb_dn2id_parent(
00111        Operation *op,
00112        MDB_txn *txn,
00113        ID eid,
00114        ID *idp );
00115 
00116 int mdb_id2name(
00117        Operation *op,
00118        MDB_txn *txn,
00119        MDB_cursor **cursp,
00120        ID eid,
00121        struct berval *name,
00122        struct berval *nname);
00123 
00124 int mdb_idscope(
00125        Operation *op,
00126        MDB_txn *txn,
00127        ID base,
00128        ID *ids,
00129        ID *res );
00130 
00131 struct IdScopes;
00132 
00133 int mdb_idscopes(
00134        Operation *op,
00135        struct IdScopes *isc );
00136 
00137 MDB_cmp_func mdb_dup_compare;
00138 
00139 /*
00140  * filterentry.c
00141  */
00142 
00143 int mdb_filter_candidates(
00144        Operation *op,
00145        MDB_txn *txn,
00146        Filter *f,
00147        ID *ids,
00148        ID *tmp,
00149        ID *stack );
00150 
00151 /*
00152  * id2entry.c
00153  */
00154 
00155 int mdb_id2entry_add(
00156        Operation *op,
00157        MDB_txn *tid,
00158        MDB_cursor *mc,
00159        Entry *e );
00160 
00161 int mdb_id2entry_update(
00162        Operation *op,
00163        MDB_txn *tid,
00164        MDB_cursor *mc,
00165        Entry *e );
00166 
00167 int mdb_id2entry_delete(
00168        BackendDB *be,
00169        MDB_txn *tid,
00170        Entry *e);
00171 
00172 int mdb_id2entry(
00173        Operation *op,
00174        MDB_cursor *mc,
00175        ID id,
00176        Entry **e);
00177 
00178 int mdb_entry_return( Operation *op, Entry *e );
00179 BI_entry_release_rw mdb_entry_release;
00180 BI_entry_get_rw mdb_entry_get;
00181 
00182 int mdb_entry_decode( Operation *op, MDB_val *data, Entry **e );
00183 
00184 void mdb_reader_flush( MDB_env *env );
00185 int mdb_opinfo_get( Operation *op, struct mdb_info *mdb, int rdonly, mdb_op_info **moi );
00186 
00187 /*
00188  * idl.c
00189  */
00190 
00191 unsigned mdb_idl_search( ID *ids, ID id );
00192 
00193 int mdb_idl_fetch_key(
00194        BackendDB     *be,
00195        MDB_txn              *txn,
00196        MDB_dbi              dbi,
00197        MDB_val              *key,
00198        ID                   *ids,
00199        MDB_cursor    **saved_cursor,
00200        int                     get_flag );
00201 
00202 int mdb_idl_insert( ID *ids, ID id );
00203 
00204 typedef int (mdb_idl_keyfunc)(
00205        MDB_cursor *mc,
00206        struct berval *key,
00207        ID id );
00208 
00209 mdb_idl_keyfunc mdb_idl_insert_keys;
00210 mdb_idl_keyfunc mdb_idl_delete_keys;
00211 
00212 int
00213 mdb_idl_intersection(
00214        ID *a,
00215        ID *b );
00216 
00217 int
00218 mdb_idl_union(
00219        ID *a,
00220        ID *b );
00221 
00222 ID mdb_idl_first( ID *ids, ID *cursor );
00223 ID mdb_idl_next( ID *ids, ID *cursor );
00224 
00225 void mdb_idl_sort( ID *ids, ID *tmp );
00226 int mdb_idl_append( ID *a, ID *b );
00227 int mdb_idl_append_one( ID *ids, ID id );
00228 
00229 
00230 /*
00231  * index.c
00232  */
00233 
00234 extern AttrInfo *
00235 mdb_index_mask LDAP_P((
00236        Backend *be,
00237        AttributeDescription *desc,
00238        struct berval *name ));
00239 
00240 extern int
00241 mdb_index_param LDAP_P((
00242        Backend *be,
00243        AttributeDescription *desc,
00244        int ftype,
00245        MDB_dbi *dbi,
00246        slap_mask_t *mask,
00247        struct berval *prefix ));
00248 
00249 extern int
00250 mdb_index_values LDAP_P((
00251        Operation *op,
00252        MDB_txn *txn,
00253        AttributeDescription *desc,
00254        BerVarray vals,
00255        ID id,
00256        int opid ));
00257 
00258 extern int
00259 mdb_index_recset LDAP_P((
00260        struct mdb_info *mdb,
00261        Attribute *a,
00262        AttributeType *type,
00263        struct berval *tags,
00264        IndexRec *ir ));
00265 
00266 extern int
00267 mdb_index_recrun LDAP_P((
00268        Operation *op,
00269        MDB_txn *txn,
00270        struct mdb_info *mdb,
00271        IndexRec *ir,
00272        ID id,
00273        int base ));
00274 
00275 int mdb_index_entry LDAP_P(( Operation *op, MDB_txn *t, int r, Entry *e ));
00276 
00277 #define mdb_index_entry_add(op,t,e) \
00278        mdb_index_entry((op),(t),SLAP_INDEX_ADD_OP,(e))
00279 #define mdb_index_entry_del(op,t,e) \
00280        mdb_index_entry((op),(t),SLAP_INDEX_DELETE_OP,(e))
00281 
00282 /*
00283  * key.c
00284  */
00285 
00286 extern int
00287 mdb_key_read(
00288     Backend   *be,
00289        MDB_txn *txn,
00290        MDB_dbi dbi,
00291     struct berval *k,
00292        ID *ids,
00293     MDB_cursor **saved_cursor,
00294         int get_flags );
00295 
00296 /*
00297  * nextid.c
00298  */
00299 
00300 int mdb_next_id( BackendDB *be, MDB_cursor *mc, ID *id );
00301 
00302 /*
00303  * modify.c
00304  */
00305 
00306 int mdb_modify_internal(
00307        Operation *op,
00308        MDB_txn *tid,
00309        Modifications *modlist,
00310        Entry *e,
00311        const char **text,
00312        char *textbuf,
00313        size_t textlen );
00314 
00315 /*
00316  * monitor.c
00317  */
00318 
00319 int mdb_monitor_db_init( BackendDB *be );
00320 int mdb_monitor_db_open( BackendDB *be );
00321 int mdb_monitor_db_close( BackendDB *be );
00322 int mdb_monitor_db_destroy( BackendDB *be );
00323 
00324 #ifdef MDB_MONITOR_IDX
00325 int
00326 mdb_monitor_idx_add(
00327        struct mdb_info             *mdb,
00328        AttributeDescription *desc,
00329        slap_mask_t          type );
00330 #endif /* MDB_MONITOR_IDX */
00331 
00332 /*
00333  * former external.h
00334  */
00335 
00336 extern BI_init                            mdb_back_initialize;
00337 
00338 extern BI_db_config                mdb_db_config;
00339 
00340 extern BI_op_add                   mdb_add;
00341 extern BI_op_bind                  mdb_bind;
00342 extern BI_op_compare               mdb_compare;
00343 extern BI_op_delete                mdb_delete;
00344 extern BI_op_modify                mdb_modify;
00345 extern BI_op_modrdn                mdb_modrdn;
00346 extern BI_op_search                mdb_search;
00347 extern BI_op_extended                     mdb_extended;
00348 
00349 extern BI_chk_referrals                   mdb_referrals;
00350 
00351 extern BI_operational                     mdb_operational;
00352 
00353 extern BI_has_subordinates         mdb_hasSubordinates;
00354 
00355 /* tools.c */
00356 extern BI_tool_entry_open          mdb_tool_entry_open;
00357 extern BI_tool_entry_close         mdb_tool_entry_close;
00358 extern BI_tool_entry_first_x              mdb_tool_entry_first_x;
00359 extern BI_tool_entry_next          mdb_tool_entry_next;
00360 extern BI_tool_entry_get           mdb_tool_entry_get;
00361 extern BI_tool_entry_put           mdb_tool_entry_put;
00362 extern BI_tool_entry_reindex              mdb_tool_entry_reindex;
00363 extern BI_tool_dn2id_get           mdb_tool_dn2id_get;
00364 extern BI_tool_entry_modify        mdb_tool_entry_modify;
00365 
00366 int mdb_tool_idl_add(
00367        MDB_cursor *mc,
00368        struct berval *keys,
00369        ID id );
00370 
00371 LDAP_END_DECL
00372 
00373 #endif /* _PROTO_MDB_H */