2 #include "system/filesys.h"
3 #include "system/time.h"
5 #include "ldb_module.h"
7 /* this private structure is used by the ltdb backend in the
11 unsigned int connect_flags;
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;
22 bool one_level_indexes;
23 bool attribute_indexes;
34 struct ltdb_idxptr *idxptr;
42 the async local context
43 holds also internal search state during a full db search
46 struct ltdb_context *ctx;
50 struct ldb_module *module;
51 struct ldb_request *req;
53 bool request_terminated;
54 struct ltdb_req_spy *spy;
57 const struct ldb_parse_tree *tree;
60 const char * const *attrs;
61 struct tevent_timer *timeout_event;
64 /* special record types */
65 #define LTDB_INDEX "@INDEX"
66 #define LTDB_INDEXLIST "@INDEXLIST"
67 #define LTDB_IDX "@IDX"
68 #define LTDB_IDXVERSION "@IDXVERSION"
69 #define LTDB_IDXATTR "@IDXATTR"
70 #define LTDB_IDXONE "@IDXONE"
71 #define LTDB_BASEINFO "@BASEINFO"
72 #define LTDB_OPTIONS "@OPTIONS"
73 #define LTDB_ATTRIBUTES "@ATTRIBUTES"
75 /* special attribute types */
76 #define LTDB_SEQUENCE_NUMBER "sequenceNumber"
77 #define LTDB_CHECK_BASE "checkBaseOnSearch"
78 #define LTDB_MOD_TIMESTAMP "whenChanged"
79 #define LTDB_OBJECTCLASS "objectClass"
81 /* The following definitions come from lib/ldb/ldb_tdb/ldb_cache.c */
83 int ltdb_cache_reload(struct ldb_module *module);
84 int ltdb_cache_load(struct ldb_module *module);
85 int ltdb_increase_sequence_number(struct ldb_module *module);
86 int ltdb_check_at_attributes_values(const struct ldb_val *value);
88 /* The following definitions come from lib/ldb/ldb_tdb/ldb_index.c */
90 struct ldb_parse_tree;
92 int ltdb_search_indexed(struct ltdb_context *ctx, uint32_t *);
93 int ltdb_index_add_new(struct ldb_module *module, const struct ldb_message *msg);
94 int ltdb_index_delete(struct ldb_module *module, const struct ldb_message *msg);
95 int ltdb_index_del_element(struct ldb_module *module, struct ldb_dn *dn,
96 struct ldb_message_element *el);
97 int ltdb_index_add_element(struct ldb_module *module, struct ldb_dn *dn,
98 struct ldb_message_element *el);
99 int ltdb_index_del_value(struct ldb_module *module, struct ldb_dn *dn,
100 struct ldb_message_element *el, unsigned int v_idx);
101 int ltdb_reindex(struct ldb_module *module);
102 int ltdb_index_transaction_start(struct ldb_module *module);
103 int ltdb_index_transaction_commit(struct ldb_module *module);
104 int ltdb_index_transaction_cancel(struct ldb_module *module);
106 /* The following definitions come from lib/ldb/ldb_tdb/ldb_pack.c */
108 int ltdb_pack_data(struct ldb_module *module,
109 const struct ldb_message *message,
110 struct TDB_DATA *data);
111 void ltdb_unpack_data_free(struct ldb_module *module,
112 struct ldb_message *message);
113 int ltdb_unpack_data(struct ldb_module *module,
114 const struct TDB_DATA *data,
115 struct ldb_message *message);
117 /* The following definitions come from lib/ldb/ldb_tdb/ldb_search.c */
119 int ltdb_has_wildcard(struct ldb_module *module, const char *attr_name,
120 const struct ldb_val *val);
121 void ltdb_search_dn1_free(struct ldb_module *module, struct ldb_message *msg);
122 int ltdb_search_dn1(struct ldb_module *module, struct ldb_dn *dn, struct ldb_message *msg);
123 int ltdb_add_attr_results(struct ldb_module *module,
125 struct ldb_message *msg,
126 const char * const attrs[],
128 struct ldb_message ***res);
129 int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs);
130 int ltdb_search(struct ltdb_context *ctx);
132 /* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c */
133 int ltdb_lock_read(struct ldb_module *module);
134 int ltdb_unlock_read(struct ldb_module *module);
135 struct TDB_DATA ltdb_key(struct ldb_module *module, struct ldb_dn *dn);
136 int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flgs);
137 int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *msg, struct ldb_request *req);
138 int ltdb_delete_noindex(struct ldb_module *module, struct ldb_dn *dn);
139 int ltdb_err_map(enum TDB_ERROR tdb_code);
141 struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
142 const char *path, int hash_size, int tdb_flags,
143 int open_flags, mode_t mode,
144 struct ldb_context *ldb);