summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/include
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-02-22 01:31:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:51:59 -0500
commit00fe70e5b917769418f68eaa255d3a06a9a08ce7 (patch)
tree7fe1d0d71e1771a3365a5dfda3ec4058b1bb2de1 /source4/lib/ldb/include
parentf490434c0f1f8e63de478c6d65f264277257968a (diff)
downloadsamba-00fe70e5b917769418f68eaa255d3a06a9a08ce7.tar.gz
samba-00fe70e5b917769418f68eaa255d3a06a9a08ce7.tar.bz2
samba-00fe70e5b917769418f68eaa255d3a06a9a08ce7.zip
r13609: Get in the initial work on making ldb async
Currently only ldb_ildap is async, the plan is to first make all backend support the async calls, and then remove the sync functions from backends and keep the only in the API. Modules will need to be transformed along the way. Simo (This used to be commit 1e2c13b2d52de7c534493dd79a2c0596a3e8c1f5)
Diffstat (limited to 'source4/lib/ldb/include')
-rw-r--r--source4/lib/ldb/include/ldb.h46
-rw-r--r--source4/lib/ldb/include/ldb_private.h3
2 files changed, 49 insertions, 0 deletions
diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h
index a6cec7f774..4a40e34363 100644
--- a/source4/lib/ldb/include/ldb.h
+++ b/source4/lib/ldb/include/ldb.h
@@ -560,15 +560,51 @@ enum ldb_request_type {
LDB_REQ_MODIFY,
LDB_REQ_DELETE,
LDB_REQ_RENAME,
+ LDB_ASYNC_SEARCH,
+ LDB_ASYNC_ADD,
+ LDB_ASYNC_MODIFY,
+ LDB_ASYNC_DELETE,
+ LDB_ASYNC_RENAME,
+
LDB_REQ_REGISTER
};
+enum ldb_reply_type {
+ LDB_REPLY_ENTRY,
+ LDB_REPLY_REFERRAL,
+ LDB_REPLY_DONE
+};
+
+enum ldb_async_wait_type {
+ LDB_WAIT_ALL,
+ LDB_WAIT_NONE
+};
+
+enum ldb_async_state {
+ LDB_ASYNC_PENDING,
+ LDB_ASYNC_DONE
+};
+
struct ldb_result {
unsigned int count;
struct ldb_message **msgs;
+ char **refs;
struct ldb_control **controls;
};
+struct ldb_async_result {
+ enum ldb_reply_type type;
+ struct ldb_message *message;
+ char *referral;
+ struct ldb_control **controls;
+};
+
+struct ldb_async_handle {
+ int status;
+ enum ldb_async_state state;
+ void *private_data;
+};
+
struct ldb_search {
const struct ldb_dn *base;
enum ldb_scope scope;
@@ -613,10 +649,20 @@ struct ldb_request {
struct ldb_control **controls;
struct ldb_credentials *creds;
+
+ struct {
+ void *context;
+ int (*callback)(struct ldb_context *, void *, struct ldb_async_result *);
+
+ time_t timeout;
+ struct ldb_async_handle *handle;
+ } async;
};
int ldb_request(struct ldb_context *ldb, struct ldb_request *request);
+int ldb_async_wait(struct ldb_context *ldb, struct ldb_async_handle *handle, enum ldb_async_wait_type type);
+
/**
Initialise an ldb context
diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h
index 90632744ed..db34b58858 100644
--- a/source4/lib/ldb/include/ldb_private.h
+++ b/source4/lib/ldb/include/ldb_private.h
@@ -105,6 +105,8 @@ struct ldb_context {
char *err_string;
int transaction_active;
+
+ int (*async_wait)(struct ldb_async_handle *, enum ldb_async_wait_type);
};
/* the modules init function */
@@ -132,6 +134,7 @@ int ldb_next_del_trans(struct ldb_module *module);
int ldb_next_second_stage_init(struct ldb_module *module);
void ldb_set_errstring(struct ldb_module *module, char *err_string);
+void ldb_reset_err_string(struct ldb_context *ldb);
/* The following definitions come from lib/ldb/common/ldb_debug.c */
void ldb_debug(struct ldb_context *ldb, enum ldb_debug_level level, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4);