summaryrefslogtreecommitdiff
path: root/source4/winbind/wb_async_helpers.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-09-26 11:47:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:57 -0500
commitab4d635b92b116b02b88843b4ec4f5b7517bab1a (patch)
tree63c3ee12153b629071d2ba0209a0a31b134c449e /source4/winbind/wb_async_helpers.c
parent0d46be147a1e755bdd6f21a5ddc83b5c39585529 (diff)
downloadsamba-ab4d635b92b116b02b88843b4ec4f5b7517bab1a.tar.gz
samba-ab4d635b92b116b02b88843b4ec4f5b7517bab1a.tar.bz2
samba-ab4d635b92b116b02b88843b4ec4f5b7517bab1a.zip
r10504: - seperate implementation specific stuff, from the generic composite
stuff. - don't use SMBCLI_REQUEST_* state's in the genreic composite stuff - move monitor_fn to libnet. NOTE: I have maybe found some bugs, in code that is dirrectly in DONE or ERROR state in the _send() function. I haven't fixed this bugs in this commit! We may need some composite_trigger_*() functions or so. And maybe some other generic helper functions... metze (This used to be commit 4527815a0a9b96e460f301cb1f0c0b3964c166fc)
Diffstat (limited to 'source4/winbind/wb_async_helpers.c')
-rw-r--r--source4/winbind/wb_async_helpers.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/source4/winbind/wb_async_helpers.c b/source4/winbind/wb_async_helpers.c
index 17efd06c81..d6f2f1cac4 100644
--- a/source4/winbind/wb_async_helpers.c
+++ b/source4/winbind/wb_async_helpers.c
@@ -22,7 +22,6 @@
*/
#include "includes.h"
-#include "libcli/raw/libcliraw.h"
#include "libcli/composite/composite.h"
#include "winbind/wb_async_helpers.h"
@@ -40,14 +39,14 @@ struct finddcs_state {
struct irpc_request *ireq;
};
-static void finddcs_getdc(struct irpc_request *req)
+static void finddcs_getdc(struct irpc_request *ireq)
{
- struct composite_context *c = talloc_get_type(req->async.private,
+ struct composite_context *c = talloc_get_type(ireq->async.private,
struct composite_context);
- struct finddcs_state *state =
- talloc_get_type(c->private, struct finddcs_state);
+ struct finddcs_state *state = talloc_get_type(c->private_data,
+ struct finddcs_state);
- c->status = irpc_call_recv(req);
+ c->status = irpc_call_recv(ireq);
if (!NT_STATUS_IS_OK(c->status)) {
goto done;
}
@@ -56,14 +55,14 @@ static void finddcs_getdc(struct irpc_request *req)
state->r->out.dcname);
c->status = NT_STATUS_OK;
- c->state = SMBCLI_REQUEST_DONE;
+ c->state = COMPOSITE_STATE_DONE;
done:
if (!NT_STATUS_IS_OK(c->status)) {
- c->state = SMBCLI_REQUEST_ERROR;
+ c->state = COMPOSITE_STATE_ERROR;
}
- if (c->state >= SMBCLI_REQUEST_DONE &&
+ if (c->state >= COMPOSITE_STATE_DONE &&
c->async.fn) {
c->async.fn(c);
}
@@ -74,10 +73,10 @@ static void finddcs_getdc(struct irpc_request *req)
*/
static void finddcs_resolve(struct composite_context *res_ctx)
{
- struct composite_context *c = talloc_get_type(res_ctx->async.private,
+ struct composite_context *c = talloc_get_type(res_ctx->async.private_data,
struct composite_context);
- struct finddcs_state *state =
- talloc_get_type(c->private, struct finddcs_state);
+ struct finddcs_state *state = talloc_get_type(c->private_data,
+ struct finddcs_state);
uint32_t *nbt_servers;
state->io->out.num_dcs = 1;
@@ -141,10 +140,10 @@ static void finddcs_resolve(struct composite_context *res_ctx)
done:
if (!NT_STATUS_IS_OK(c->status)) {
- c->state = SMBCLI_REQUEST_ERROR;
+ c->state = COMPOSITE_STATE_ERROR;
}
- if (c->state >= SMBCLI_REQUEST_DONE &&
+ if (c->state >= COMPOSITE_STATE_DONE &&
c->async.fn) {
c->async.fn(c);
}
@@ -159,7 +158,7 @@ struct composite_context *wb_finddcs_send(struct wb_finddcs *io,
c = talloc_zero(NULL, struct composite_context);
if (c == NULL) goto failed;
- c->state = SMBCLI_REQUEST_SEND;
+ c->state = COMPOSITE_STATE_IN_PROGRESS;
c->event_ctx = event_ctx;
state = talloc(c, struct finddcs_state);
@@ -172,9 +171,9 @@ struct composite_context *wb_finddcs_send(struct wb_finddcs *io,
lp_name_resolve_order());
if (state->creq == NULL) goto failed;
- state->creq->async.private = c;
+ state->creq->async.private_data = c;
state->creq->async.fn = finddcs_resolve;
- c->private = state;
+ c->private_data = state;
return c;
failed:
@@ -189,8 +188,8 @@ NTSTATUS wb_finddcs_recv(struct composite_context *c, TALLOC_CTX *mem_ctx)
status = composite_wait(c);
if (NT_STATUS_IS_OK(status)) {
- struct finddcs_state *state =
- talloc_get_type(c->private, struct finddcs_state);
+ struct finddcs_state *state = talloc_get_type(c->private_data,
+ struct finddcs_state);
talloc_steal(mem_ctx, state->io->out.dcs);
}