summaryrefslogtreecommitdiff
path: root/source4/libcli/composite
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-31 08:30:44 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:09:25 -0500
commit9a70f446fc4abc2bd1278772810c0e8132f4bea4 (patch)
treeb9baaa7b19c88afaa26f0cd0a35201fb5c433a3d /source4/libcli/composite
parent58d6c73e946d11574a6220f37887e1cdfe05f525 (diff)
downloadsamba-9a70f446fc4abc2bd1278772810c0e8132f4bea4.tar.gz
samba-9a70f446fc4abc2bd1278772810c0e8132f4bea4.tar.bz2
samba-9a70f446fc4abc2bd1278772810c0e8132f4bea4.zip
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)
Diffstat (limited to 'source4/libcli/composite')
-rw-r--r--source4/libcli/composite/composite.c2
-rw-r--r--source4/libcli/composite/composite.h4
-rw-r--r--source4/libcli/composite/connect.c42
-rw-r--r--source4/libcli/composite/fetchfile.c28
-rw-r--r--source4/libcli/composite/loadfile.c22
-rw-r--r--source4/libcli/composite/savefile.c22
-rw-r--r--source4/libcli/composite/sesssetup.c20
7 files changed, 70 insertions, 70 deletions
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);
}