root/source4/lib/ldb/ldb_tdb/ldb_tdb.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 #include "ldb_includes.h"
   2 #include "tdb.h"
   3 #include "ldb_module.h"
   4 
   5 /* this private structure is used by the ltdb backend in the
   6    ldb_context */
   7 struct ltdb_private {
   8         TDB_CONTEXT *tdb;
   9         unsigned int connect_flags;
  10         
  11         /* a double is used for portability and ease of string
  12            handling. It has plenty of digits of precision */
  13         unsigned long long sequence_number;
  14 
  15         /* the low level tdb seqnum - used to avoid loading BASEINFO when
  16            possible */
  17         int tdb_seqnum;
  18 
  19         struct ltdb_cache {
  20                 struct ldb_message *indexlist;
  21                 struct ldb_message *attributes;
  22 
  23                 struct {
  24                         char *name;
  25                         int flags;
  26                 } last_attribute;
  27         } *cache;
  28 
  29         int in_transaction;
  30 
  31         bool check_base;
  32         struct ltdb_idxptr *idxptr;
  33 };
  34 
  35 /*
  36   the async local context
  37   holds also internal search state during a full db search
  38 */
  39 struct ltdb_req_spy {
  40         struct ltdb_context *ctx;
  41 };
  42 
  43 struct ltdb_context {
  44         struct ldb_module *module;
  45         struct ldb_request *req;
  46 
  47         bool request_terminated;
  48         struct ltdb_req_spy *spy;
  49 
  50         /* search stuff */
  51         const struct ldb_parse_tree *tree;
  52         struct ldb_dn *base;
  53         enum ldb_scope scope;
  54         const char * const *attrs;
  55         struct tevent_timer *timeout_event;
  56 };
  57 
  58 /* special record types */
  59 #define LTDB_INDEX      "@INDEX"
  60 #define LTDB_INDEXLIST  "@INDEXLIST"
  61 #define LTDB_IDX        "@IDX"
  62 #define LTDB_IDXPTR     "@IDXPTR"
  63 #define LTDB_IDXATTR    "@IDXATTR"
  64 #define LTDB_IDXONE     "@IDXONE"
  65 #define LTDB_BASEINFO   "@BASEINFO"
  66 #define LTDB_OPTIONS    "@OPTIONS"
  67 #define LTDB_ATTRIBUTES "@ATTRIBUTES"
  68 
  69 /* special attribute types */
  70 #define LTDB_SEQUENCE_NUMBER "sequenceNumber"
  71 #define LTDB_CHECK_BASE "checkBaseOnSearch"
  72 #define LTDB_MOD_TIMESTAMP "whenChanged"
  73 #define LTDB_OBJECTCLASS "objectClass"
  74 
  75 /* The following definitions come from lib/ldb/ldb_tdb/ldb_cache.c  */
  76 
  77 int ltdb_cache_reload(struct ldb_module *module);
  78 int ltdb_cache_load(struct ldb_module *module);
  79 int ltdb_increase_sequence_number(struct ldb_module *module);
  80 int ltdb_check_at_attributes_values(const struct ldb_val *value);
  81 
  82 /* The following definitions come from lib/ldb/ldb_tdb/ldb_index.c  */
  83 
  84 struct ldb_parse_tree;
  85 
  86 int ltdb_search_indexed(struct ltdb_context *ctx);
  87 int ltdb_index_add(struct ldb_module *module, const struct ldb_message *msg);
  88 int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg);
  89 int ltdb_index_one(struct ldb_module *module, const struct ldb_message *msg, int add);
  90 int ltdb_reindex(struct ldb_module *module);
  91 int ltdb_index_transaction_start(struct ldb_module *module);
  92 int ltdb_index_transaction_commit(struct ldb_module *module);
  93 int ltdb_index_transaction_cancel(struct ldb_module *module);
  94 
  95 /* The following definitions come from lib/ldb/ldb_tdb/ldb_pack.c  */
  96 
  97 int ltdb_pack_data(struct ldb_module *module,
  98                    const struct ldb_message *message,
  99                    struct TDB_DATA *data);
 100 void ltdb_unpack_data_free(struct ldb_module *module,
 101                            struct ldb_message *message);
 102 int ltdb_unpack_data(struct ldb_module *module,
 103                      const struct TDB_DATA *data,
 104                      struct ldb_message *message);
 105 
 106 /* The following definitions come from lib/ldb/ldb_tdb/ldb_search.c  */
 107 
 108 int ltdb_has_wildcard(struct ldb_module *module, const char *attr_name, 
 109                       const struct ldb_val *val);
 110 void ltdb_search_dn1_free(struct ldb_module *module, struct ldb_message *msg);
 111 int ltdb_search_dn1(struct ldb_module *module, struct ldb_dn *dn, struct ldb_message *msg);
 112 int ltdb_add_attr_results(struct ldb_module *module,
 113                           TALLOC_CTX *mem_ctx, 
 114                           struct ldb_message *msg,
 115                           const char * const attrs[], 
 116                           unsigned int *count, 
 117                           struct ldb_message ***res);
 118 int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs);
 119 int ltdb_search(struct ltdb_context *ctx);
 120 
 121 /* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c  */
 122 int ltdb_lock_read(struct ldb_module *module);
 123 int ltdb_unlock_read(struct ldb_module *module);
 124 struct TDB_DATA ltdb_key(struct ldb_module *module, struct ldb_dn *dn);
 125 int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flgs);
 126 int ltdb_delete_noindex(struct ldb_module *module, struct ldb_dn *dn);
 127 int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *msg);
 128 
 129 int ltdb_index_del_value(struct ldb_module *module, const char *dn, 
 130                          struct ldb_message_element *el, int v_idx);
 131 
 132 struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
 133                                    const char *path, int hash_size, int tdb_flags,
 134                                    int open_flags, mode_t mode,
 135                                    struct ldb_context *ldb);

/* [<][>][^][v][top][bottom][index][help] */