struct ldb_val;
-struct smbcli_composite;
+struct composite_context;
struct smb_composite_loadfile;
struct smb_composite_savefile;
struct smb_composite_connect;
/*
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;
*/
-struct smbcli_composite {
+struct composite_context {
/* the external state - will be queried by the caller */
enum smbcli_request_state state;
/* information on what to do on completion */
struct {
- void (*fn)(struct smbcli_composite *);
+ void (*fn)(struct composite_context *);
void *private;
} async;
};
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);
/*
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);
/*
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);
/*
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);
/*
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);
/*
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);
/*
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);
/*
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);
*/
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);
/*
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);
*/
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);
}
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;
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;
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;
}
}
-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);
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);
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);
}
/*
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);
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);
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);
/*
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);
*/
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
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);
/*
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);
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);
}
/*
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);
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);
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);
/*
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);
*/
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
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;
/*
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;
}
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);
}
*/
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);
/*
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)
{
/*
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)
{
/*
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)
{
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);
/*
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;
}
*/
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);
}
*/
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;
/*
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);
/*
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;
}
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);
}
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;
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;
/*
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;
}
*/
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) {
/*
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);
/*
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);
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);
}
/*
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;
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;
/*
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);
/*
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);
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);
}
*/
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;
/*
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);
/*
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);
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);
}
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 },
/*
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]);
}
-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]);
/*
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);
/*
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);
*/
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);
}
/*
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();
/*
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);
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);
}
/*
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;
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;
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.
#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)++;
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;
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);
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;
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);