From 9a70f446fc4abc2bd1278772810c0e8132f4bea4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 31 Jan 2005 08:30:44 +0000 Subject: r5126: the composite code is no longer client specific or smb specific, so rename the core structure to composite_context and the wait routine to composite_wait() (suggestion from metze) (This used to be commit cf11d05e35179c2c3e51c5ab370cd0a3fb15f24a) --- source4/include/structs.h | 2 +- source4/libcli/composite/composite.c | 2 +- source4/libcli/composite/composite.h | 4 ++-- source4/libcli/composite/connect.c | 42 ++++++++++++++++++------------------ source4/libcli/composite/fetchfile.c | 28 ++++++++++++------------ source4/libcli/composite/loadfile.c | 22 +++++++++---------- source4/libcli/composite/savefile.c | 22 +++++++++---------- source4/libcli/composite/sesssetup.c | 20 ++++++++--------- source4/libcli/nbt/nameregister.c | 14 ++++++------ source4/libcli/raw/clisocket.c | 14 ++++++------ source4/libcli/resolve/bcast.c | 8 +++---- source4/libcli/resolve/host.c | 16 +++++++------- source4/libcli/resolve/nbtlist.c | 16 +++++++------- source4/libcli/resolve/resolve.c | 28 ++++++++++++------------ source4/libcli/resolve/wins.c | 6 +++--- source4/nbt_server/register.c | 4 ++-- source4/ntvfs/cifs/vfs_cifs.c | 2 +- source4/torture/raw/composite.c | 10 ++++----- 18 files changed, 130 insertions(+), 130 deletions(-) (limited to 'source4') diff --git a/source4/include/structs.h b/source4/include/structs.h index 0027cf7e61..774053babd 100644 --- a/source4/include/structs.h +++ b/source4/include/structs.h @@ -138,7 +138,7 @@ struct lsa_RightSet; struct ldb_val; -struct smbcli_composite; +struct composite_context; struct smb_composite_loadfile; struct smb_composite_savefile; struct smb_composite_connect; diff --git a/source4/libcli/composite/composite.c b/source4/libcli/composite/composite.c index d4eb5a9323..998631204d 100644 --- a/source4/libcli/composite/composite.c +++ b/source4/libcli/composite/composite.c @@ -29,7 +29,7 @@ /* block until a composite function has completed, then return the status */ -NTSTATUS smb_composite_wait(struct smbcli_composite *c) +NTSTATUS composite_wait(struct composite_context *c) { if (c == NULL) return NT_STATUS_NO_MEMORY; diff --git a/source4/libcli/composite/composite.h b/source4/libcli/composite/composite.h index cb8cee779c..bf0fb9ed48 100644 --- a/source4/libcli/composite/composite.h +++ b/source4/libcli/composite/composite.h @@ -29,7 +29,7 @@ */ -struct smbcli_composite { +struct composite_context { /* the external state - will be queried by the caller */ enum smbcli_request_state state; @@ -45,7 +45,7 @@ struct smbcli_composite { /* information on what to do on completion */ struct { - void (*fn)(struct smbcli_composite *); + void (*fn)(struct composite_context *); void *private; } async; }; diff --git a/source4/libcli/composite/connect.c b/source4/libcli/composite/connect.c index 8dd7fe39ab..5f5275f7e6 100644 --- a/source4/libcli/composite/connect.c +++ b/source4/libcli/composite/connect.c @@ -42,17 +42,17 @@ struct connect_state { union smb_tcon *io_tcon; struct smb_composite_sesssetup *io_setup; struct smbcli_request *req; - struct smbcli_composite *creq; + struct composite_context *creq; }; static void request_handler(struct smbcli_request *); -static void composite_handler(struct smbcli_composite *); +static void composite_handler(struct composite_context *); /* setup a negprot send */ -static NTSTATUS connect_send_negprot(struct smbcli_composite *c, +static NTSTATUS connect_send_negprot(struct composite_context *c, struct smb_composite_connect *io) { struct connect_state *state = talloc_get_type(c->private, struct connect_state); @@ -71,7 +71,7 @@ static NTSTATUS connect_send_negprot(struct smbcli_composite *c, /* a tree connect request has competed */ -static NTSTATUS connect_tcon(struct smbcli_composite *c, +static NTSTATUS connect_tcon(struct composite_context *c, struct smb_composite_connect *io) { struct connect_state *state = talloc_get_type(c->private, struct connect_state); @@ -100,7 +100,7 @@ static NTSTATUS connect_tcon(struct smbcli_composite *c, /* a session setup request has competed */ -static NTSTATUS connect_session_setup(struct smbcli_composite *c, +static NTSTATUS connect_session_setup(struct composite_context *c, struct smb_composite_connect *io) { struct connect_state *state = talloc_get_type(c->private, struct connect_state); @@ -147,7 +147,7 @@ static NTSTATUS connect_session_setup(struct smbcli_composite *c, /* a negprot request has competed */ -static NTSTATUS connect_negprot(struct smbcli_composite *c, +static NTSTATUS connect_negprot(struct composite_context *c, struct smb_composite_connect *io) { struct connect_state *state = talloc_get_type(c->private, struct connect_state); @@ -184,7 +184,7 @@ static NTSTATUS connect_negprot(struct smbcli_composite *c, /* a session request operation has competed */ -static NTSTATUS connect_session_request(struct smbcli_composite *c, +static NTSTATUS connect_session_request(struct composite_context *c, struct smb_composite_connect *io) { struct connect_state *state = talloc_get_type(c->private, struct connect_state); @@ -200,7 +200,7 @@ static NTSTATUS connect_session_request(struct smbcli_composite *c, /* a socket connection operation has competed */ -static NTSTATUS connect_socket(struct smbcli_composite *c, +static NTSTATUS connect_socket(struct composite_context *c, struct smb_composite_connect *io) { struct connect_state *state = talloc_get_type(c->private, struct connect_state); @@ -244,7 +244,7 @@ static NTSTATUS connect_socket(struct smbcli_composite *c, /* called when name resolution is finished */ -static NTSTATUS connect_resolve(struct smbcli_composite *c, +static NTSTATUS connect_resolve(struct composite_context *c, struct smb_composite_connect *io) { struct connect_state *state = talloc_get_type(c->private, struct connect_state); @@ -268,7 +268,7 @@ static NTSTATUS connect_resolve(struct smbcli_composite *c, /* handle and dispatch state transitions */ -static void state_handler(struct smbcli_composite *c) +static void state_handler(struct composite_context *c) { struct connect_state *state = talloc_get_type(c->private, struct connect_state); @@ -309,32 +309,32 @@ static void state_handler(struct smbcli_composite *c) */ static void request_handler(struct smbcli_request *req) { - struct smbcli_composite *c = talloc_get_type(req->async.private, - struct smbcli_composite); + struct composite_context *c = talloc_get_type(req->async.private, + struct composite_context); return state_handler(c); } /* handler for completion of a smbcli_composite sub-request */ -static void composite_handler(struct smbcli_composite *req) +static void composite_handler(struct composite_context *req) { - struct smbcli_composite *c = talloc_get_type(req->async.private, - struct smbcli_composite); + struct composite_context *c = talloc_get_type(req->async.private, + struct composite_context); return state_handler(c); } /* a function to establish a smbcli_tree from scratch */ -struct smbcli_composite *smb_composite_connect_send(struct smb_composite_connect *io, +struct composite_context *smb_composite_connect_send(struct smb_composite_connect *io, struct event_context *event_ctx) { - struct smbcli_composite *c; + struct composite_context *c; struct connect_state *state; struct nbt_name name; - c = talloc_zero(NULL, struct smbcli_composite); + c = talloc_zero(NULL, struct composite_context); if (c == NULL) goto failed; state = talloc(c, struct connect_state); @@ -369,11 +369,11 @@ failed: /* recv half of async composite connect code */ -NTSTATUS smb_composite_connect_recv(struct smbcli_composite *c, TALLOC_CTX *mem_ctx) +NTSTATUS smb_composite_connect_recv(struct composite_context *c, TALLOC_CTX *mem_ctx) { NTSTATUS status; - status = smb_composite_wait(c); + status = composite_wait(c); if (NT_STATUS_IS_OK(status)) { struct connect_state *state = talloc_get_type(c->private, struct connect_state); @@ -389,6 +389,6 @@ NTSTATUS smb_composite_connect_recv(struct smbcli_composite *c, TALLOC_CTX *mem_ */ NTSTATUS smb_composite_connect(struct smb_composite_connect *io, TALLOC_CTX *mem_ctx) { - struct smbcli_composite *c = smb_composite_connect_send(io, NULL); + struct composite_context *c = smb_composite_connect_send(io, NULL); return smb_composite_connect_recv(c, mem_ctx); } diff --git a/source4/libcli/composite/fetchfile.c b/source4/libcli/composite/fetchfile.c index 8178090398..4f63f6328f 100644 --- a/source4/libcli/composite/fetchfile.c +++ b/source4/libcli/composite/fetchfile.c @@ -32,14 +32,14 @@ enum fetchfile_stage {FETCHFILE_CONNECT, struct fetchfile_state { enum fetchfile_stage stage; struct smb_composite_fetchfile *io; - struct smbcli_composite *req; + struct composite_context *req; struct smb_composite_connect *connect; struct smb_composite_loadfile *loadfile; }; -static void fetchfile_composite_handler(struct smbcli_composite *req); +static void fetchfile_composite_handler(struct composite_context *req); -static NTSTATUS fetchfile_connect(struct smbcli_composite *c, +static NTSTATUS fetchfile_connect(struct composite_context *c, struct smb_composite_fetchfile *io) { NTSTATUS status; @@ -67,7 +67,7 @@ static NTSTATUS fetchfile_connect(struct smbcli_composite *c, return NT_STATUS_OK; } -static NTSTATUS fetchfile_read(struct smbcli_composite *c, +static NTSTATUS fetchfile_read(struct composite_context *c, struct smb_composite_fetchfile *io) { NTSTATUS status; @@ -87,7 +87,7 @@ static NTSTATUS fetchfile_read(struct smbcli_composite *c, return NT_STATUS_OK; } -static void fetchfile_state_handler(struct smbcli_composite *c) +static void fetchfile_state_handler(struct composite_context *c) { struct fetchfile_state *state; NTSTATUS status; @@ -114,20 +114,20 @@ static void fetchfile_state_handler(struct smbcli_composite *c) } } -static void fetchfile_composite_handler(struct smbcli_composite *req) +static void fetchfile_composite_handler(struct composite_context *req) { - struct smbcli_composite *c = talloc_get_type(req->async.private, - struct smbcli_composite); + struct composite_context *c = talloc_get_type(req->async.private, + struct composite_context); return fetchfile_state_handler(c); } -struct smbcli_composite *smb_composite_fetchfile_send(struct smb_composite_fetchfile *io, +struct composite_context *smb_composite_fetchfile_send(struct smb_composite_fetchfile *io, struct event_context *event_ctx) { - struct smbcli_composite *c; + struct composite_context *c; struct fetchfile_state *state; - c = talloc_zero(NULL, struct smbcli_composite); + c = talloc_zero(NULL, struct composite_context); if (c == NULL) goto failed; state = talloc(c, struct fetchfile_state); @@ -165,12 +165,12 @@ struct smbcli_composite *smb_composite_fetchfile_send(struct smb_composite_fetch return NULL; } -NTSTATUS smb_composite_fetchfile_recv(struct smbcli_composite *c, +NTSTATUS smb_composite_fetchfile_recv(struct composite_context *c, TALLOC_CTX *mem_ctx) { NTSTATUS status; - status = smb_composite_wait(c); + status = composite_wait(c); if (NT_STATUS_IS_OK(status)) { struct fetchfile_state *state = talloc_get_type(c->private, struct fetchfile_state); @@ -184,6 +184,6 @@ NTSTATUS smb_composite_fetchfile_recv(struct smbcli_composite *c, NTSTATUS smb_composite_fetchfile(struct smb_composite_fetchfile *io, TALLOC_CTX *mem_ctx) { - struct smbcli_composite *c = smb_composite_fetchfile_send(io, NULL); + struct composite_context *c = smb_composite_fetchfile_send(io, NULL); return smb_composite_fetchfile_recv(c, mem_ctx); } diff --git a/source4/libcli/composite/loadfile.c b/source4/libcli/composite/loadfile.c index 37f3608a4b..69a8219dba 100644 --- a/source4/libcli/composite/loadfile.c +++ b/source4/libcli/composite/loadfile.c @@ -43,7 +43,7 @@ struct loadfile_state { /* setup for the close */ -static NTSTATUS setup_close(struct smbcli_composite *c, +static NTSTATUS setup_close(struct composite_context *c, struct smbcli_tree *tree, uint16_t fnum) { struct loadfile_state *state = talloc_get_type(c->private, struct loadfile_state); @@ -72,7 +72,7 @@ static NTSTATUS setup_close(struct smbcli_composite *c, called when the open is done - pull the results and setup for the first readx, or close if the file is zero size */ -static NTSTATUS loadfile_open(struct smbcli_composite *c, +static NTSTATUS loadfile_open(struct composite_context *c, struct smb_composite_loadfile *io) { struct loadfile_state *state = talloc_get_type(c->private, struct loadfile_state); @@ -126,7 +126,7 @@ static NTSTATUS loadfile_open(struct smbcli_composite *c, called when a read is done - pull the results and setup for the next read, or close if the file is all done */ -static NTSTATUS loadfile_read(struct smbcli_composite *c, +static NTSTATUS loadfile_read(struct composite_context *c, struct smb_composite_loadfile *io) { struct loadfile_state *state = talloc_get_type(c->private, struct loadfile_state); @@ -160,7 +160,7 @@ static NTSTATUS loadfile_read(struct smbcli_composite *c, /* called when the close is done, check the status and cleanup */ -static NTSTATUS loadfile_close(struct smbcli_composite *c, +static NTSTATUS loadfile_close(struct composite_context *c, struct smb_composite_loadfile *io) { struct loadfile_state *state = talloc_get_type(c->private, struct loadfile_state); @@ -180,7 +180,7 @@ static NTSTATUS loadfile_close(struct smbcli_composite *c, */ static void loadfile_handler(struct smbcli_request *req) { - struct smbcli_composite *c = req->async.private; + struct composite_context *c = req->async.private; struct loadfile_state *state = talloc_get_type(c->private, struct loadfile_state); /* when this handler is called, the stage indicates what @@ -213,13 +213,13 @@ static void loadfile_handler(struct smbcli_request *req) composite loadfile call - does an openx followed by a number of readx calls, followed by a close */ -struct smbcli_composite *smb_composite_loadfile_send(struct smbcli_tree *tree, +struct composite_context *smb_composite_loadfile_send(struct smbcli_tree *tree, struct smb_composite_loadfile *io) { - struct smbcli_composite *c; + struct composite_context *c; struct loadfile_state *state; - c = talloc_zero(tree, struct smbcli_composite); + c = talloc_zero(tree, struct composite_context); if (c == NULL) goto failed; state = talloc(c, struct loadfile_state); @@ -264,11 +264,11 @@ failed: /* composite loadfile call - recv side */ -NTSTATUS smb_composite_loadfile_recv(struct smbcli_composite *c, TALLOC_CTX *mem_ctx) +NTSTATUS smb_composite_loadfile_recv(struct composite_context *c, TALLOC_CTX *mem_ctx) { NTSTATUS status; - status = smb_composite_wait(c); + status = composite_wait(c); if (NT_STATUS_IS_OK(status)) { struct loadfile_state *state = talloc_get_type(c->private, struct loadfile_state); @@ -287,7 +287,7 @@ NTSTATUS smb_composite_loadfile(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, struct smb_composite_loadfile *io) { - struct smbcli_composite *c = smb_composite_loadfile_send(tree, io); + struct composite_context *c = smb_composite_loadfile_send(tree, io); return smb_composite_loadfile_recv(c, mem_ctx); } diff --git a/source4/libcli/composite/savefile.c b/source4/libcli/composite/savefile.c index 5da5660127..0b08963966 100644 --- a/source4/libcli/composite/savefile.c +++ b/source4/libcli/composite/savefile.c @@ -44,7 +44,7 @@ struct savefile_state { /* setup for the close */ -static NTSTATUS setup_close(struct smbcli_composite *c, +static NTSTATUS setup_close(struct composite_context *c, struct smbcli_tree *tree, uint16_t fnum) { struct savefile_state *state = talloc_get_type(c->private, struct savefile_state); @@ -73,7 +73,7 @@ static NTSTATUS setup_close(struct smbcli_composite *c, called when the open is done - pull the results and setup for the first writex, or close if the file is zero size */ -static NTSTATUS savefile_open(struct smbcli_composite *c, +static NTSTATUS savefile_open(struct composite_context *c, struct smb_composite_savefile *io) { struct savefile_state *state = talloc_get_type(c->private, struct savefile_state); @@ -119,7 +119,7 @@ static NTSTATUS savefile_open(struct smbcli_composite *c, called when a write is done - pull the results and setup for the next write, or close if the file is all done */ -static NTSTATUS savefile_write(struct smbcli_composite *c, +static NTSTATUS savefile_write(struct composite_context *c, struct smb_composite_savefile *io) { struct savefile_state *state = talloc_get_type(c->private, struct savefile_state); @@ -157,7 +157,7 @@ static NTSTATUS savefile_write(struct smbcli_composite *c, /* called when the close is done, check the status and cleanup */ -static NTSTATUS savefile_close(struct smbcli_composite *c, +static NTSTATUS savefile_close(struct composite_context *c, struct smb_composite_savefile *io) { struct savefile_state *state = talloc_get_type(c->private, struct savefile_state); @@ -181,7 +181,7 @@ static NTSTATUS savefile_close(struct smbcli_composite *c, */ static void savefile_handler(struct smbcli_request *req) { - struct smbcli_composite *c = req->async.private; + struct composite_context *c = req->async.private; struct savefile_state *state = talloc_get_type(c->private, struct savefile_state); /* when this handler is called, the stage indicates what @@ -214,14 +214,14 @@ static void savefile_handler(struct smbcli_request *req) composite savefile call - does an openx followed by a number of writex calls, followed by a close */ -struct smbcli_composite *smb_composite_savefile_send(struct smbcli_tree *tree, +struct composite_context *smb_composite_savefile_send(struct smbcli_tree *tree, struct smb_composite_savefile *io) { - struct smbcli_composite *c; + struct composite_context *c; struct savefile_state *state; union smb_open *io_open; - c = talloc_zero(tree, struct smbcli_composite); + c = talloc_zero(tree, struct composite_context); if (c == NULL) goto failed; c->state = SMBCLI_REQUEST_SEND; @@ -268,10 +268,10 @@ failed: /* composite savefile call - recv side */ -NTSTATUS smb_composite_savefile_recv(struct smbcli_composite *c) +NTSTATUS smb_composite_savefile_recv(struct composite_context *c) { NTSTATUS status; - status = smb_composite_wait(c); + status = composite_wait(c); talloc_free(c); return status; } @@ -283,6 +283,6 @@ NTSTATUS smb_composite_savefile_recv(struct smbcli_composite *c) NTSTATUS smb_composite_savefile(struct smbcli_tree *tree, struct smb_composite_savefile *io) { - struct smbcli_composite *c = smb_composite_savefile_send(tree, io); + struct composite_context *c = smb_composite_savefile_send(tree, io); return smb_composite_savefile_recv(c); } diff --git a/source4/libcli/composite/sesssetup.c b/source4/libcli/composite/sesssetup.c index 771f85e541..07c718b05b 100644 --- a/source4/libcli/composite/sesssetup.c +++ b/source4/libcli/composite/sesssetup.c @@ -93,7 +93,7 @@ static void use_nt1_session_keys(struct smbcli_session *session, */ static void request_handler(struct smbcli_request *req) { - struct smbcli_composite *c = req->async.private; + struct composite_context *c = req->async.private; struct sesssetup_state *state = talloc_get_type(c->private, struct sesssetup_state); struct smbcli_session *session = req->session; DATA_BLOB session_key = data_blob(NULL, 0); @@ -164,7 +164,7 @@ static void request_handler(struct smbcli_request *req) /* send a nt1 style session setup */ -static struct smbcli_request *session_setup_nt1(struct smbcli_composite *c, +static struct smbcli_request *session_setup_nt1(struct composite_context *c, struct smbcli_session *session, struct smb_composite_sesssetup *io) { @@ -203,7 +203,7 @@ static struct smbcli_request *session_setup_nt1(struct smbcli_composite *c, /* old style session setup (pre NT1 protocol level) */ -static struct smbcli_request *session_setup_old(struct smbcli_composite *c, +static struct smbcli_request *session_setup_old(struct composite_context *c, struct smbcli_session *session, struct smb_composite_sesssetup *io) { @@ -237,7 +237,7 @@ static struct smbcli_request *session_setup_old(struct smbcli_composite *c, /* old style session setup (pre NT1 protocol level) */ -static struct smbcli_request *session_setup_spnego(struct smbcli_composite *c, +static struct smbcli_request *session_setup_spnego(struct composite_context *c, struct smbcli_session *session, struct smb_composite_sesssetup *io) { @@ -333,13 +333,13 @@ static struct smbcli_request *session_setup_spnego(struct smbcli_composite *c, different session setup varients, including the multi-pass nature of the spnego varient */ -struct smbcli_composite *smb_composite_sesssetup_send(struct smbcli_session *session, +struct composite_context *smb_composite_sesssetup_send(struct smbcli_session *session, struct smb_composite_sesssetup *io) { - struct smbcli_composite *c; + struct composite_context *c; struct sesssetup_state *state; - c = talloc_zero(session, struct smbcli_composite); + c = talloc_zero(session, struct composite_context); if (c == NULL) goto failed; state = talloc(c, struct sesssetup_state); @@ -384,10 +384,10 @@ failed: /* receive a composite session setup reply */ -NTSTATUS smb_composite_sesssetup_recv(struct smbcli_composite *c) +NTSTATUS smb_composite_sesssetup_recv(struct composite_context *c) { NTSTATUS status; - status = smb_composite_wait(c); + status = composite_wait(c); talloc_free(c); return status; } @@ -397,6 +397,6 @@ NTSTATUS smb_composite_sesssetup_recv(struct smbcli_composite *c) */ NTSTATUS smb_composite_sesssetup(struct smbcli_session *session, struct smb_composite_sesssetup *io) { - struct smbcli_composite *c = smb_composite_sesssetup_send(session, io); + struct composite_context *c = smb_composite_sesssetup_send(session, io); return smb_composite_sesssetup_recv(c); } diff --git a/source4/libcli/nbt/nameregister.c b/source4/libcli/nbt/nameregister.c index 703210cb48..7e0134c283 100644 --- a/source4/libcli/nbt/nameregister.c +++ b/source4/libcli/nbt/nameregister.c @@ -158,7 +158,7 @@ struct register_bcast_state { */ static void name_register_handler(struct nbt_name_request *req) { - struct smbcli_composite *c = talloc_get_type(req->async.private, struct smbcli_composite); + struct composite_context *c = talloc_get_type(req->async.private, struct composite_context); struct register_bcast_state *state = talloc_get_type(c->private, struct register_bcast_state); NTSTATUS status; @@ -207,13 +207,13 @@ done: /* the async send call for a 4 stage name registration */ -struct smbcli_composite *nbt_name_register_bcast_send(struct nbt_name_socket *nbtsock, +struct composite_context *nbt_name_register_bcast_send(struct nbt_name_socket *nbtsock, struct nbt_name_register_bcast *io) { - struct smbcli_composite *c; + struct composite_context *c; struct register_bcast_state *state; - c = talloc_zero(nbtsock, struct smbcli_composite); + c = talloc_zero(nbtsock, struct composite_context); if (c == NULL) goto failed; state = talloc(c, struct register_bcast_state); @@ -254,10 +254,10 @@ failed: /* broadcast 4 part name register - recv */ -NTSTATUS nbt_name_register_bcast_recv(struct smbcli_composite *c) +NTSTATUS nbt_name_register_bcast_recv(struct composite_context *c) { NTSTATUS status; - status = smb_composite_wait(c); + status = composite_wait(c); talloc_free(c); return status; } @@ -268,6 +268,6 @@ NTSTATUS nbt_name_register_bcast_recv(struct smbcli_composite *c) NTSTATUS nbt_name_register_bcast(struct nbt_name_socket *nbtsock, struct nbt_name_register_bcast *io) { - struct smbcli_composite *c = nbt_name_register_bcast_send(nbtsock, io); + struct composite_context *c = nbt_name_register_bcast_send(nbtsock, io); return nbt_name_register_bcast_recv(c); } diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c index c9934fa16d..78a096fb8f 100644 --- a/source4/libcli/raw/clisocket.c +++ b/source4/libcli/raw/clisocket.c @@ -74,7 +74,7 @@ static NTSTATUS smbcli_sock_connect_one(struct smbcli_socket *sock, static void smbcli_sock_connect_handler(struct event_context *ev, struct fd_event *fde, struct timeval t, uint16_t flags) { - struct smbcli_composite *c = talloc_get_type(fde->private, struct smbcli_composite); + struct composite_context *c = talloc_get_type(fde->private, struct composite_context); struct clisocket_connect *conn = talloc_get_type(c->private, struct clisocket_connect); int i; @@ -153,14 +153,14 @@ static NTSTATUS smbcli_sock_connect_one(struct smbcli_socket *sock, this is the async send side of the interface */ -struct smbcli_composite *smbcli_sock_connect_send(struct smbcli_socket *sock, +struct composite_context *smbcli_sock_connect_send(struct smbcli_socket *sock, const char *host_addr, int port) { - struct smbcli_composite *c; + struct composite_context *c; struct clisocket_connect *conn; int i; - c = talloc_zero(sock, struct smbcli_composite); + c = talloc_zero(sock, struct composite_context); if (c == NULL) return NULL; c->event_ctx = sock->event.ctx; @@ -219,10 +219,10 @@ failed: /* finish a smbcli_sock_connect_send() operation */ -NTSTATUS smbcli_sock_connect_recv(struct smbcli_composite *c) +NTSTATUS smbcli_sock_connect_recv(struct composite_context *c) { NTSTATUS status; - status = smb_composite_wait(c); + status = composite_wait(c); talloc_free(c); return status; } @@ -235,7 +235,7 @@ NTSTATUS smbcli_sock_connect_recv(struct smbcli_composite *c) */ NTSTATUS smbcli_sock_connect(struct smbcli_socket *sock, const char *host_addr, int port) { - struct smbcli_composite *c; + struct composite_context *c; c = smbcli_sock_connect_send(sock, host_addr, port); if (c == NULL) { diff --git a/source4/libcli/resolve/bcast.c b/source4/libcli/resolve/bcast.c index 9aefa32fae..5fb6e6dd5c 100644 --- a/source4/libcli/resolve/bcast.c +++ b/source4/libcli/resolve/bcast.c @@ -28,12 +28,12 @@ /* broadcast name resolution method - async send */ -struct smbcli_composite *resolve_name_bcast_send(struct nbt_name *name, +struct composite_context *resolve_name_bcast_send(struct nbt_name *name, struct event_context *event_ctx) { int num_interfaces = iface_count(); const char **address_list; - struct smbcli_composite *c; + struct composite_context *c; int i; address_list = talloc_array(NULL, const char *, num_interfaces+1); @@ -58,7 +58,7 @@ struct smbcli_composite *resolve_name_bcast_send(struct nbt_name *name, /* broadcast name resolution method - recv side */ -NTSTATUS resolve_name_bcast_recv(struct smbcli_composite *c, +NTSTATUS resolve_name_bcast_recv(struct composite_context *c, TALLOC_CTX *mem_ctx, const char **reply_addr) { return resolve_name_nbtlist_recv(c, mem_ctx, reply_addr); @@ -71,7 +71,7 @@ NTSTATUS resolve_name_bcast(struct nbt_name *name, TALLOC_CTX *mem_ctx, const char **reply_addr) { - struct smbcli_composite *c = resolve_name_bcast_send(name, NULL); + struct composite_context *c = resolve_name_bcast_send(name, NULL); return resolve_name_bcast_recv(c, mem_ctx, reply_addr); } diff --git a/source4/libcli/resolve/host.c b/source4/libcli/resolve/host.c index 5b28a850fc..9bf278154d 100644 --- a/source4/libcli/resolve/host.c +++ b/source4/libcli/resolve/host.c @@ -63,7 +63,7 @@ static int host_destructor(void *ptr) /* the blocking child */ -static void run_child(struct smbcli_composite *c, int fd) +static void run_child(struct composite_context *c, int fd) { struct host_state *state = talloc_get_type(c->private, struct host_state); struct ipv4_addr ip; @@ -85,7 +85,7 @@ static void run_child(struct smbcli_composite *c, int fd) static void pipe_handler(struct event_context *ev, struct fd_event *fde, struct timeval t, uint16_t flags) { - struct smbcli_composite *c = talloc_get_type(fde->private, struct smbcli_composite); + struct composite_context *c = talloc_get_type(fde->private, struct composite_context); struct host_state *state = talloc_get_type(c->private, struct host_state); char address[128]; int ret; @@ -129,17 +129,17 @@ failed: /* gethostbyname name resolution method - async send */ -struct smbcli_composite *resolve_name_host_send(struct nbt_name *name, +struct composite_context *resolve_name_host_send(struct nbt_name *name, struct event_context *event_ctx) { - struct smbcli_composite *c; + struct composite_context *c; struct host_state *state; NTSTATUS status; int fd[2] = { -1, -1 }; struct fd_event fde; int ret; - c = talloc_zero(NULL, struct smbcli_composite); + c = talloc_zero(NULL, struct composite_context); if (c == NULL) goto failed; state = talloc(c, struct host_state); @@ -201,12 +201,12 @@ failed: /* gethostbyname name resolution method - recv side */ -NTSTATUS resolve_name_host_recv(struct smbcli_composite *c, +NTSTATUS resolve_name_host_recv(struct composite_context *c, TALLOC_CTX *mem_ctx, const char **reply_addr) { NTSTATUS status; - status = smb_composite_wait(c); + status = composite_wait(c); if (NT_STATUS_IS_OK(status)) { struct host_state *state = talloc_get_type(c->private, struct host_state); @@ -224,7 +224,7 @@ NTSTATUS resolve_name_host(struct nbt_name *name, TALLOC_CTX *mem_ctx, const char **reply_addr) { - struct smbcli_composite *c = resolve_name_host_send(name, NULL); + struct composite_context *c = resolve_name_host_send(name, NULL); return resolve_name_host_recv(c, mem_ctx, reply_addr); } diff --git a/source4/libcli/resolve/nbtlist.c b/source4/libcli/resolve/nbtlist.c index 08dc90c39d..5a9e31e09d 100644 --- a/source4/libcli/resolve/nbtlist.c +++ b/source4/libcli/resolve/nbtlist.c @@ -43,8 +43,8 @@ struct nbtlist_state { */ static void nbtlist_handler(struct nbt_name_request *req) { - struct smbcli_composite *c = talloc_get_type(req->async.private, - struct smbcli_composite); + struct composite_context *c = talloc_get_type(req->async.private, + struct composite_context); struct nbtlist_state *state = talloc_get_type(c->private, struct nbtlist_state); int i; @@ -81,18 +81,18 @@ done: /* nbtlist name resolution method - async send */ -struct smbcli_composite *resolve_name_nbtlist_send(struct nbt_name *name, +struct composite_context *resolve_name_nbtlist_send(struct nbt_name *name, struct event_context *event_ctx, const char **address_list, BOOL broadcast, BOOL wins_lookup) { - struct smbcli_composite *c; + struct composite_context *c; struct nbtlist_state *state; int i; NTSTATUS status; - c = talloc_zero(NULL, struct smbcli_composite); + c = talloc_zero(NULL, struct composite_context); if (c == NULL) goto failed; state = talloc(c, struct nbtlist_state); @@ -143,12 +143,12 @@ failed: /* nbt list of addresses name resolution method - recv side */ -NTSTATUS resolve_name_nbtlist_recv(struct smbcli_composite *c, +NTSTATUS resolve_name_nbtlist_recv(struct composite_context *c, TALLOC_CTX *mem_ctx, const char **reply_addr) { NTSTATUS status; - status = smb_composite_wait(c); + status = composite_wait(c); if (NT_STATUS_IS_OK(status)) { struct nbtlist_state *state = talloc_get_type(c->private, struct nbtlist_state); @@ -168,7 +168,7 @@ NTSTATUS resolve_name_nbtlist(struct nbt_name *name, BOOL broadcast, BOOL wins_lookup, const char **reply_addr) { - struct smbcli_composite *c = resolve_name_nbtlist_send(name, NULL, address_list, + struct composite_context *c = resolve_name_nbtlist_send(name, NULL, address_list, broadcast, wins_lookup); return resolve_name_nbtlist_recv(c, mem_ctx, reply_addr); } diff --git a/source4/libcli/resolve/resolve.c b/source4/libcli/resolve/resolve.c index 054f10d529..eb35a7cb99 100644 --- a/source4/libcli/resolve/resolve.c +++ b/source4/libcli/resolve/resolve.c @@ -27,17 +27,17 @@ struct resolve_state { struct nbt_name name; const char **methods; - struct smbcli_composite *req; + struct composite_context *req; const char *reply_addr; }; -static struct smbcli_composite *setup_next_method(struct smbcli_composite *c); +static struct composite_context *setup_next_method(struct composite_context *c); /* pointers to the resolver backends */ static const struct resolve_method { const char *name; - struct smbcli_composite *(*send_fn)(struct nbt_name *, struct event_context *); - NTSTATUS (*recv_fn)(struct smbcli_composite *, TALLOC_CTX *, const char **); + struct composite_context *(*send_fn)(struct nbt_name *, struct event_context *); + NTSTATUS (*recv_fn)(struct composite_context *, TALLOC_CTX *, const char **); } methods[] = { { "bcast", resolve_name_bcast_send, resolve_name_bcast_recv }, { "wins", resolve_name_wins_send, resolve_name_wins_recv }, @@ -63,9 +63,9 @@ static const struct resolve_method *find_method(const char *name) /* handle completion of one name resolve method */ -static void resolve_handler(struct smbcli_composite *req) +static void resolve_handler(struct composite_context *req) { - struct smbcli_composite *c = req->async.private; + struct composite_context *c = req->async.private; struct resolve_state *state = talloc_get_type(c->private, struct resolve_state); const struct resolve_method *method = find_method(state->methods[0]); @@ -90,10 +90,10 @@ static void resolve_handler(struct smbcli_composite *req) } -static struct smbcli_composite *setup_next_method(struct smbcli_composite *c) +static struct composite_context *setup_next_method(struct composite_context *c) { struct resolve_state *state = talloc_get_type(c->private, struct resolve_state); - struct smbcli_composite *req = NULL; + struct composite_context *req = NULL; do { const struct resolve_method *method = find_method(state->methods[0]); @@ -114,13 +114,13 @@ static struct smbcli_composite *setup_next_method(struct smbcli_composite *c) /* general name resolution - async send */ -struct smbcli_composite *resolve_name_send(struct nbt_name *name, struct event_context *event_ctx) +struct composite_context *resolve_name_send(struct nbt_name *name, struct event_context *event_ctx) { - struct smbcli_composite *c; + struct composite_context *c; struct resolve_state *state; NTSTATUS status; - c = talloc_zero(NULL, struct smbcli_composite); + c = talloc_zero(NULL, struct composite_context); if (c == NULL) goto failed; state = talloc(c, struct resolve_state); @@ -156,12 +156,12 @@ failed: /* general name resolution method - recv side */ -NTSTATUS resolve_name_recv(struct smbcli_composite *c, +NTSTATUS resolve_name_recv(struct composite_context *c, TALLOC_CTX *mem_ctx, const char **reply_addr) { NTSTATUS status; - status = smb_composite_wait(c); + status = composite_wait(c); if (NT_STATUS_IS_OK(status)) { struct resolve_state *state = talloc_get_type(c->private, struct resolve_state); @@ -177,6 +177,6 @@ NTSTATUS resolve_name_recv(struct smbcli_composite *c, */ NTSTATUS resolve_name(struct nbt_name *name, TALLOC_CTX *mem_ctx, const char **reply_addr) { - struct smbcli_composite *c = resolve_name_send(name, NULL); + struct composite_context *c = resolve_name_send(name, NULL); return resolve_name_recv(c, mem_ctx, reply_addr); } diff --git a/source4/libcli/resolve/wins.c b/source4/libcli/resolve/wins.c index 5a0e067832..aa4ec0cea4 100644 --- a/source4/libcli/resolve/wins.c +++ b/source4/libcli/resolve/wins.c @@ -28,7 +28,7 @@ /* wins name resolution method - async send */ -struct smbcli_composite *resolve_name_wins_send(struct nbt_name *name, +struct composite_context *resolve_name_wins_send(struct nbt_name *name, struct event_context *event_ctx) { const char **address_list = lp_wins_server_list(); @@ -39,7 +39,7 @@ struct smbcli_composite *resolve_name_wins_send(struct nbt_name *name, /* wins name resolution method - recv side */ -NTSTATUS resolve_name_wins_recv(struct smbcli_composite *c, +NTSTATUS resolve_name_wins_recv(struct composite_context *c, TALLOC_CTX *mem_ctx, const char **reply_addr) { return resolve_name_nbtlist_recv(c, mem_ctx, reply_addr); @@ -52,7 +52,7 @@ NTSTATUS resolve_name_wins(struct nbt_name *name, TALLOC_CTX *mem_ctx, const char **reply_addr) { - struct smbcli_composite *c = resolve_name_wins_send(name, NULL); + struct composite_context *c = resolve_name_wins_send(name, NULL); return resolve_name_wins_recv(c, mem_ctx, reply_addr); } diff --git a/source4/nbt_server/register.c b/source4/nbt_server/register.c index 8890030d5f..4f954c189a 100644 --- a/source4/nbt_server/register.c +++ b/source4/nbt_server/register.c @@ -118,7 +118,7 @@ static void nbt_start_refresh_timer(struct nbt_iface_name *iname) /* a name registration has completed */ -static void nbt_register_handler(struct smbcli_composite *req) +static void nbt_register_handler(struct composite_context *req) { struct nbt_iface_name *iname = talloc_get_type(req->async.private, struct nbt_iface_name); NTSTATUS status; @@ -153,7 +153,7 @@ static void nbt_register_name_iface(struct nbt_interface *iface, struct nbt_iface_name *iname; const char *scope = lp_netbios_scope(); struct nbt_name_register_bcast io; - struct smbcli_composite *req; + struct composite_context *req; iname = talloc(iface, struct nbt_iface_name); if (!iname) return; diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c index 13b11d8ba2..c4ed9c172a 100644 --- a/source4/ntvfs/cifs/vfs_cifs.c +++ b/source4/ntvfs/cifs/vfs_cifs.c @@ -89,7 +89,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs, struct cvfs_private *private; const char *host, *user, *pass, *domain, *remote_share; struct smb_composite_connect io; - struct smbcli_composite *creq; + struct composite_context *creq; /* Here we need to determine which server to connect to. * For now we use parametric options, type cifs. diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c index d32c9393c2..98f33bea3e 100644 --- a/source4/torture/raw/composite.c +++ b/source4/torture/raw/composite.c @@ -26,7 +26,7 @@ #define BASEDIR "\\composite" -static void loadfile_complete(struct smbcli_composite *c) +static void loadfile_complete(struct composite_context *c) { int *count = talloc_get_type(c->async.private, int); (*count)++; @@ -41,7 +41,7 @@ static BOOL test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) NTSTATUS status; struct smb_composite_savefile io1; struct smb_composite_loadfile io2; - struct smbcli_composite **c; + struct composite_context **c; char *data; size_t len = random() % 100000; const int num_ops = 50; @@ -68,7 +68,7 @@ static BOOL test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("testing parallel loadfile with %d ops\n", num_ops); - c = talloc_array(mem_ctx, struct smbcli_composite *, num_ops); + c = talloc_array(mem_ctx, struct composite_context *, num_ops); for (i=0;itree, &io2); @@ -117,7 +117,7 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) NTSTATUS status; struct smb_composite_savefile io1; struct smb_composite_fetchfile io2; - struct smbcli_composite **c; + struct composite_context **c; char *data; int i; size_t len = random() % 10000; @@ -156,7 +156,7 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("testing parallel fetchfile with %d ops\n", torture_numops); event_ctx = event_context_init(mem_ctx); - c = talloc_array(mem_ctx, struct smbcli_composite *, torture_numops); + c = talloc_array(mem_ctx, struct composite_context *, torture_numops); for (i=0; i