r5126: the composite code is no longer client specific or smb specific, so
authorAndrew Tridgell <tridge@samba.org>
Mon, 31 Jan 2005 08:30:44 +0000 (08:30 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:09:25 +0000 (13:09 -0500)
rename the core structure to composite_context and the wait routine to
composite_wait() (suggestion from metze)
(This used to be commit cf11d05e35179c2c3e51c5ab370cd0a3fb15f24a)

18 files changed:
source4/include/structs.h
source4/libcli/composite/composite.c
source4/libcli/composite/composite.h
source4/libcli/composite/connect.c
source4/libcli/composite/fetchfile.c
source4/libcli/composite/loadfile.c
source4/libcli/composite/savefile.c
source4/libcli/composite/sesssetup.c
source4/libcli/nbt/nameregister.c
source4/libcli/raw/clisocket.c
source4/libcli/resolve/bcast.c
source4/libcli/resolve/host.c
source4/libcli/resolve/nbtlist.c
source4/libcli/resolve/resolve.c
source4/libcli/resolve/wins.c
source4/nbt_server/register.c
source4/ntvfs/cifs/vfs_cifs.c
source4/torture/raw/composite.c

index 0027cf7e61a238aa2d7d5e8c4c36ade863fc3661..774053babd12c55fa06a99f535f32c9d46e0926e 100644 (file)
@@ -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;
index d4eb5a93233f4d5ea273047033a6e7be155f7e7e..998631204d1b68feca2b6ad2c74166314f66c69a 100644 (file)
@@ -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;
 
index cb8cee779c4d7a97570d3750be5c8d68c848f011..bf0fb9ed48a73b7fa63eed8f07996394e4670d89 100644 (file)
@@ -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;
 };
index 8dd7fe39ab420a99da84a9a497d9c6b45d23e3e6..5f5275f7e647bb2aac3e7264b5690b1595c69187 100644 (file)
@@ -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);
 }
index 8178090398d204c555afc5c14d37eabda0ed37f6..4f63f6328f3067af334ef21f3b4209c03fb79675 100644 (file)
@@ -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);
 }
index 37f3608a4b96c9a0617a13c09b22e5ba2e2c3076..69a8219dba027a84f29dfb783ead603704b4a8f8 100644 (file)
@@ -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);
 }
 
index 5da56601270059bd14b46a9979c7160dace541e7..0b08963966a788ed8957093fb8df4eaab4a5723b 100644 (file)
@@ -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);
 }
index 771f85e541863bc11eaab4fd8b10abe5ac7b9a9f..07c718b05b698f30fcdffb7f70cee7b5ffe16e3e 100644 (file)
@@ -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);
 }
index 703210cb4888107fcb76e405a2da4534c48d555b..7e0134c28330c65cd197cb0a1a657f30290ffedb 100644 (file)
@@ -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);
 }
index c9934fa16d9fac7fd3e7c41156d0188d6c63c3b4..78a096fb8fbec466d03ba61cff08f3e9d558a538 100644 (file)
@@ -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) {
index 9aefa32fae7bf014b7e52c70f2e0fcbed277542e..5fb6e6dd5ca60b6889ef173f63e03534001b72ee 100644 (file)
 /*
   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);
 }
 
index 5b28a850fccdf50bdffd3efffead7a52aa2f2992..9bf278154d947f1d91b62eaa2347e650f47c4ca1 100644 (file)
@@ -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);
 }
 
index 08dc90c39d69510c027bfbbb7c6ab1bc4f7f72e6..5a9e31e09da8a475e9f440180a29c03cd6b36140 100644 (file)
@@ -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);
 }
index 054f10d529c775c73ad30ce8ba4ee566029e4845..eb35a7cb996f40dbae5f431082e34a7a8725deda 100644 (file)
 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);
 }
index 5a0e067832de6cac01d0508d8bb7038ac2ca3f0f..aa4ec0cea4535c2edb31829ea8b3f68cc50df677 100644 (file)
@@ -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);
 }
 
index 8890030d5f10eda7946af5668c12e7367228bb08..4f954c189a878f906bf62c776f4acf2bbe59c513 100644 (file)
@@ -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;
index 13b11d8ba2e2641a60217ac7f18056617fa5a7dd..c4ed9c172aee0c994905f152db5dc5534bd15db8 100644 (file)
@@ -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.
index d32c9393c29fb0993755a8ccf6f8bb690c162dc9..98f33bea3e5a382553cdc173d4fed345ccbc7f8d 100644 (file)
@@ -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;i<num_ops;i++) {
                c[i] = smb_composite_loadfile_send(cli->tree, &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<torture_numops; i++) {
                c[i] = smb_composite_fetchfile_send(&io2, event_ctx);