Remove timeout event once we are calling the callback.
[kai/samba.git] / source4 / lib / ldb / ldb_tdb / ldb_tdb.h
index d4a8ff2fb15ee185cf5f320bd7c3a59953c9f124..c78a8172c72bd4625ffa38ca2e4270324a9819bf 100644 (file)
@@ -1,6 +1,8 @@
 #if (_SAMBA_BUILD_ == 3)
 #include "tdb/include/tdb.h"
 #else
+#include "replace.h"
+#include "system/wait.h"
 #include "tdb.h"
 #endif
 
@@ -27,6 +29,10 @@ struct ltdb_private {
                        int flags;
                } last_attribute;
        } *cache;
+
+       int in_transaction;
+
+       bool check_base;
 };
 
 /*
@@ -35,16 +41,16 @@ struct ltdb_private {
 */
 struct ltdb_context {
        struct ldb_module *module;
+       struct ldb_request *req;
+
+       bool callback_failed;
 
        /* search stuff */
        const struct ldb_parse_tree *tree;
        struct ldb_dn *base;
        enum ldb_scope scope;
        const char * const *attrs;
-
-       /* async stuff */
-       void *context;
-       int (*callback)(struct ldb_context *, void *, struct ldb_reply *);
+       struct timed_event *timeout_event;
 };
 
 /* special record types */
@@ -54,10 +60,12 @@ struct ltdb_context {
 #define LTDB_IDXATTR    "@IDXATTR"
 #define LTDB_IDXONE     "@IDXONE"
 #define LTDB_BASEINFO   "@BASEINFO"
+#define LTDB_OPTIONS    "@OPTIONS"
 #define LTDB_ATTRIBUTES "@ATTRIBUTES"
 
 /* special attribute types */
 #define LTDB_SEQUENCE_NUMBER "sequenceNumber"
+#define LTDB_CHECK_BASE "checkBaseOnSearch"
 #define LTDB_MOD_TIMESTAMP "whenChanged"
 #define LTDB_OBJECTCLASS "objectClass"
 
@@ -72,7 +80,7 @@ int ltdb_check_at_attributes_values(const struct ldb_val *value);
 
 struct ldb_parse_tree;
 
-int ltdb_search_indexed(struct ldb_handle *handle);
+int ltdb_search_indexed(struct ltdb_context *ctx);
 int ltdb_index_add(struct ldb_module *module, const struct ldb_message *msg);
 int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg);
 int ltdb_index_one(struct ldb_module *module, const struct ldb_message *msg, int add);
@@ -102,11 +110,11 @@ int ltdb_add_attr_results(struct ldb_module *module,
                          unsigned int *count, 
                          struct ldb_message ***res);
 int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs);
-int ltdb_search(struct ldb_module *module, struct ldb_request *req);
+int ltdb_search(struct ltdb_context *ctx);
 
 /* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c  */
-struct ldb_handle *init_ltdb_handle(struct ltdb_private *ltdb, struct ldb_module *module,
-                                   struct ldb_request *req);
+int ltdb_lock_read(struct ldb_module *module);
+int ltdb_unlock_read(struct ldb_module *module);
 struct TDB_DATA ltdb_key(struct ldb_module *module, struct ldb_dn *dn);
 int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flgs);
 int ltdb_delete_noindex(struct ldb_module *module, struct ldb_dn *dn);
@@ -119,4 +127,3 @@ struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
                                   const char *path, int hash_size, int tdb_flags,
                                   int open_flags, mode_t mode,
                                   struct ldb_context *ldb);
-