1 #include "ldb_includes.h"
3 #include "ldb_module.h"
5 /* this private structure is used by the ltdb backend in the
9 unsigned int connect_flags;
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;
15 /* the low level tdb seqnum - used to avoid loading BASEINFO when
20 struct ldb_message *indexlist;
21 struct ldb_message *attributes;
32 struct ltdb_idxptr *idxptr;
36 the async local context
37 holds also internal search state during a full db search
40 struct ldb_module *module;
41 struct ldb_request *req;
46 const struct ldb_parse_tree *tree;
49 const char * const *attrs;
50 struct tevent_timer *timeout_event;
53 /* special record types */
54 #define LTDB_INDEX "@INDEX"
55 #define LTDB_INDEXLIST "@INDEXLIST"
56 #define LTDB_IDX "@IDX"
57 #define LTDB_IDXPTR "@IDXPTR"
58 #define LTDB_IDXATTR "@IDXATTR"
59 #define LTDB_IDXONE "@IDXONE"
60 #define LTDB_BASEINFO "@BASEINFO"
61 #define LTDB_OPTIONS "@OPTIONS"
62 #define LTDB_ATTRIBUTES "@ATTRIBUTES"
64 /* special attribute types */
65 #define LTDB_SEQUENCE_NUMBER "sequenceNumber"
66 #define LTDB_CHECK_BASE "checkBaseOnSearch"
67 #define LTDB_MOD_TIMESTAMP "whenChanged"
68 #define LTDB_OBJECTCLASS "objectClass"
70 /* The following definitions come from lib/ldb/ldb_tdb/ldb_cache.c */
72 int ltdb_cache_reload(struct ldb_module *module);
73 int ltdb_cache_load(struct ldb_module *module);
74 int ltdb_increase_sequence_number(struct ldb_module *module);
75 int ltdb_check_at_attributes_values(const struct ldb_val *value);
77 /* The following definitions come from lib/ldb/ldb_tdb/ldb_index.c */
79 struct ldb_parse_tree;
81 int ltdb_search_indexed(struct ltdb_context *ctx);
82 int ltdb_index_add(struct ldb_module *module, const struct ldb_message *msg);
83 int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg);
84 int ltdb_index_one(struct ldb_module *module, const struct ldb_message *msg, int add);
85 int ltdb_reindex(struct ldb_module *module);
86 int ltdb_index_transaction_start(struct ldb_module *module);
87 int ltdb_index_transaction_commit(struct ldb_module *module);
88 int ltdb_index_transaction_cancel(struct ldb_module *module);
90 /* The following definitions come from lib/ldb/ldb_tdb/ldb_pack.c */
92 int ltdb_pack_data(struct ldb_module *module,
93 const struct ldb_message *message,
94 struct TDB_DATA *data);
95 void ltdb_unpack_data_free(struct ldb_module *module,
96 struct ldb_message *message);
97 int ltdb_unpack_data(struct ldb_module *module,
98 const struct TDB_DATA *data,
99 struct ldb_message *message);
101 /* The following definitions come from lib/ldb/ldb_tdb/ldb_search.c */
103 int ltdb_has_wildcard(struct ldb_module *module, const char *attr_name,
104 const struct ldb_val *val);
105 void ltdb_search_dn1_free(struct ldb_module *module, struct ldb_message *msg);
106 int ltdb_search_dn1(struct ldb_module *module, struct ldb_dn *dn, struct ldb_message *msg);
107 int ltdb_add_attr_results(struct ldb_module *module,
109 struct ldb_message *msg,
110 const char * const attrs[],
112 struct ldb_message ***res);
113 int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs);
114 int ltdb_search(struct ltdb_context *ctx);
116 /* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c */
117 int ltdb_lock_read(struct ldb_module *module);
118 int ltdb_unlock_read(struct ldb_module *module);
119 struct TDB_DATA ltdb_key(struct ldb_module *module, struct ldb_dn *dn);
120 int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flgs);
121 int ltdb_delete_noindex(struct ldb_module *module, struct ldb_dn *dn);
122 int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *msg);
124 int ltdb_index_del_value(struct ldb_module *module, const char *dn,
125 struct ldb_message_element *el, int v_idx);
127 struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
128 const char *path, int hash_size, int tdb_flags,
129 int open_flags, mode_t mode,
130 struct ldb_context *ldb);