summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source3/include/client.h10
-rw-r--r--source3/rpc_client/cli_pipe.c37
-rw-r--r--source3/rpc_client/rpc_transport_np.c43
-rw-r--r--source3/rpc_client/rpc_transport_smbd.c47
-rw-r--r--source3/rpc_client/rpc_transport_sock.c41
5 files changed, 85 insertions, 93 deletions
diff --git a/source3/include/client.h b/source3/include/client.h
index db19f34a9de..6510a14b153 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -71,14 +71,14 @@ struct rpc_cli_transport {
/**
* Trigger an async read from the server. May return a short read.
*/
- struct async_req *(*read_send)(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
- uint8_t *data, size_t size,
- void *priv);
+ struct tevent_req *(*read_send)(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
+ uint8_t *data, size_t size,
+ void *priv);
/**
* Get the result from the read_send operation.
*/
- NTSTATUS (*read_recv)(struct async_req *req, ssize_t *preceived);
+ NTSTATUS (*read_recv)(struct tevent_req *req, ssize_t *preceived);
/**
* Trigger an async write to the server. May return a short write.
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index 8fc05e233e3..d4abe3c4fd1 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -207,15 +207,14 @@ struct rpc_read_state {
size_t num_read;
};
-static void rpc_read_done(struct async_req *subreq);
+static void rpc_read_done(struct tevent_req *subreq);
static struct tevent_req *rpc_read_send(TALLOC_CTX *mem_ctx,
struct event_context *ev,
struct rpc_cli_transport *transport,
uint8_t *data, size_t size)
{
- struct tevent_req *req;
- struct async_req *subreq;
+ struct tevent_req *req, *subreq;
struct rpc_read_state *state;
req = tevent_req_create(mem_ctx, &state, struct rpc_read_state);
@@ -235,8 +234,7 @@ static struct tevent_req *rpc_read_send(TALLOC_CTX *mem_ctx,
if (subreq == NULL) {
goto fail;
}
- subreq->async.fn = rpc_read_done;
- subreq->async.priv = req;
+ tevent_req_set_callback(subreq, rpc_read_done, req);
return req;
fail:
@@ -244,10 +242,10 @@ static struct tevent_req *rpc_read_send(TALLOC_CTX *mem_ctx,
return NULL;
}
-static void rpc_read_done(struct async_req *subreq)
+static void rpc_read_done(struct tevent_req *subreq)
{
- struct tevent_req *req = talloc_get_type_abort(
- subreq->async.priv, struct tevent_req);
+ struct tevent_req *req = tevent_req_callback_data(
+ subreq, struct tevent_req);
struct rpc_read_state *state = tevent_req_data(
req, struct rpc_read_state);
NTSTATUS status;
@@ -273,8 +271,7 @@ static void rpc_read_done(struct async_req *subreq)
if (tevent_req_nomem(subreq, req)) {
return;
}
- subreq->async.fn = rpc_read_done;
- subreq->async.priv = req;
+ tevent_req_set_callback(subreq, rpc_read_done, req);
}
static NTSTATUS rpc_read_recv(struct tevent_req *req)
@@ -1042,7 +1039,7 @@ struct cli_api_pipe_state {
static void cli_api_pipe_trans_done(struct async_req *subreq);
static void cli_api_pipe_write_done(struct tevent_req *subreq);
-static void cli_api_pipe_read_done(struct async_req *subreq);
+static void cli_api_pipe_read_done(struct tevent_req *subreq);
static struct tevent_req *cli_api_pipe_send(TALLOC_CTX *mem_ctx,
struct event_context *ev,
@@ -1135,7 +1132,6 @@ static void cli_api_pipe_write_done(struct tevent_req *subreq)
subreq, struct tevent_req);
struct cli_api_pipe_state *state = tevent_req_data(
req, struct cli_api_pipe_state);
- struct async_req *subreq2;
NTSTATUS status;
status = rpc_write_recv(subreq);
@@ -1155,20 +1151,19 @@ static void cli_api_pipe_write_done(struct tevent_req *subreq)
* with a short read, transport->trans_send could also return less
* than state->max_rdata_len.
*/
- subreq2 = state->transport->read_send(state, state->ev, state->rdata,
- RPC_HEADER_LEN,
- state->transport->priv);
- if (tevent_req_nomem(subreq2, req)) {
+ subreq = state->transport->read_send(state, state->ev, state->rdata,
+ RPC_HEADER_LEN,
+ state->transport->priv);
+ if (tevent_req_nomem(subreq, req)) {
return;
}
- subreq2->async.fn = cli_api_pipe_read_done;
- subreq2->async.priv = req;
+ tevent_req_set_callback(subreq, cli_api_pipe_read_done, req);
}
-static void cli_api_pipe_read_done(struct async_req *subreq)
+static void cli_api_pipe_read_done(struct tevent_req *subreq)
{
- struct tevent_req *req = talloc_get_type_abort(
- subreq->async.priv, struct tevent_req);
+ struct tevent_req *req = tevent_req_callback_data(
+ subreq, struct tevent_req);
struct cli_api_pipe_state *state = tevent_req_data(
req, struct cli_api_pipe_state);
NTSTATUS status;
diff --git a/source3/rpc_client/rpc_transport_np.c b/source3/rpc_client/rpc_transport_np.c
index 80ff3840462..7da44213291 100644
--- a/source3/rpc_client/rpc_transport_np.c
+++ b/source3/rpc_client/rpc_transport_np.c
@@ -120,18 +120,19 @@ struct rpc_np_read_state {
static void rpc_np_read_done(struct async_req *subreq);
-static struct async_req *rpc_np_read_send(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
- uint8_t *data, size_t size,
- void *priv)
+static struct tevent_req *rpc_np_read_send(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
+ uint8_t *data, size_t size,
+ void *priv)
{
struct rpc_transport_np_state *np_transport = talloc_get_type_abort(
priv, struct rpc_transport_np_state);
- struct async_req *result, *subreq;
+ struct tevent_req *req;
+ struct async_req *subreq;
struct rpc_np_read_state *state;
- if (!async_req_setup(mem_ctx, &result, &state,
- struct rpc_np_read_state)) {
+ req = tevent_req_create(mem_ctx, &state, struct rpc_np_read_state);
+ if (req == NULL) {
return NULL;
}
state->data = data;
@@ -143,19 +144,19 @@ static struct async_req *rpc_np_read_send(TALLOC_CTX *mem_ctx,
goto fail;
}
subreq->async.fn = rpc_np_read_done;
- subreq->async.priv = result;
- return result;
+ subreq->async.priv = req;
+ return req;
fail:
- TALLOC_FREE(result);
+ TALLOC_FREE(req);
return NULL;
}
static void rpc_np_read_done(struct async_req *subreq)
{
- struct async_req *req = talloc_get_type_abort(
- subreq->async.priv, struct async_req);
- struct rpc_np_read_state *state = talloc_get_type_abort(
- req->private_data, struct rpc_np_read_state);
+ struct tevent_req *req = talloc_get_type_abort(
+ subreq->async.priv, struct tevent_req);
+ struct rpc_np_read_state *state = tevent_req_data(
+ req, struct rpc_np_read_state);
NTSTATUS status;
uint8_t *rcvbuf;
@@ -169,27 +170,27 @@ static void rpc_np_read_done(struct async_req *subreq)
}
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(subreq);
- async_req_nterror(req, status);
+ tevent_req_nterror(req, status);
return;
}
if (state->received > state->size) {
TALLOC_FREE(subreq);
- async_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
+ tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
return;
}
memcpy(state->data, rcvbuf, state->received);
- async_req_done(req);
+ tevent_req_done(req);
}
-static NTSTATUS rpc_np_read_recv(struct async_req *req, ssize_t *preceived)
+static NTSTATUS rpc_np_read_recv(struct tevent_req *req, ssize_t *preceived)
{
- struct rpc_np_read_state *state = talloc_get_type_abort(
- req->private_data, struct rpc_np_read_state);
+ struct rpc_np_read_state *state = tevent_req_data(
+ req, struct rpc_np_read_state);
NTSTATUS status;
- if (async_req_is_nterror(req, &status)) {
+ if (tevent_req_is_nterror(req, &status)) {
return status;
}
*preceived = state->received;
diff --git a/source3/rpc_client/rpc_transport_smbd.c b/source3/rpc_client/rpc_transport_smbd.c
index bf4aa65daec..85fe3d86cef 100644
--- a/source3/rpc_client/rpc_transport_smbd.c
+++ b/source3/rpc_client/rpc_transport_smbd.c
@@ -505,20 +505,20 @@ struct rpc_smbd_read_state {
ssize_t received;
};
-static void rpc_smbd_read_done(struct async_req *subreq);
+static void rpc_smbd_read_done(struct tevent_req *subreq);
-static struct async_req *rpc_smbd_read_send(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
- uint8_t *data, size_t size,
- void *priv)
+static struct tevent_req *rpc_smbd_read_send(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
+ uint8_t *data, size_t size,
+ void *priv)
{
struct rpc_transport_smbd_state *transp = talloc_get_type_abort(
priv, struct rpc_transport_smbd_state);
- struct async_req *result, *subreq;
+ struct tevent_req *req, *subreq;
struct rpc_smbd_read_state *state;
- if (!async_req_setup(mem_ctx, &result, &state,
- struct rpc_smbd_read_state)) {
+ req = tevent_req_create(mem_ctx, &state, struct rpc_smbd_read_state);
+ if (req == NULL) {
return NULL;
}
state->sub_transp = transp->sub_transp;
@@ -533,40 +533,37 @@ static struct async_req *rpc_smbd_read_send(TALLOC_CTX *mem_ctx,
rpc_cli_smbd_stdout_reader, transp->conn) == NULL) {
goto fail;
}
-
- subreq->async.fn = rpc_smbd_read_done;
- subreq->async.priv = result;
- return result;
-
+ tevent_req_set_callback(subreq, rpc_smbd_read_done, req);
+ return req;
fail:
- TALLOC_FREE(result);
+ TALLOC_FREE(req);
return NULL;
}
-static void rpc_smbd_read_done(struct async_req *subreq)
+static void rpc_smbd_read_done(struct tevent_req *subreq)
{
- struct async_req *req = talloc_get_type_abort(
- subreq->async.priv, struct async_req);
- struct rpc_smbd_read_state *state = talloc_get_type_abort(
- req->private_data, struct rpc_smbd_read_state);
+ struct tevent_req *req = tevent_req_callback_data(
+ subreq, struct tevent_req);
+ struct rpc_smbd_read_state *state = tevent_req_data(
+ req, struct rpc_smbd_read_state);
NTSTATUS status;
status = state->sub_transp->read_recv(subreq, &state->received);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- async_req_nterror(req, status);
+ tevent_req_nterror(req, status);
return;
}
- async_req_done(req);
+ tevent_req_done(req);
}
-static NTSTATUS rpc_smbd_read_recv(struct async_req *req, ssize_t *preceived)
+static NTSTATUS rpc_smbd_read_recv(struct tevent_req *req, ssize_t *preceived)
{
- struct rpc_smbd_read_state *state = talloc_get_type_abort(
- req->private_data, struct rpc_smbd_read_state);
+ struct rpc_smbd_read_state *state = tevent_req_data(
+ req, struct rpc_smbd_read_state);
NTSTATUS status;
- if (async_req_is_nterror(req, &status)) {
+ if (tevent_req_is_nterror(req, &status)) {
return status;
}
*preceived = state->received;
diff --git a/source3/rpc_client/rpc_transport_sock.c b/source3/rpc_client/rpc_transport_sock.c
index b1d9d8fbe13..c9fcbcc07e9 100644
--- a/source3/rpc_client/rpc_transport_sock.c
+++ b/source3/rpc_client/rpc_transport_sock.c
@@ -41,19 +41,18 @@ struct rpc_sock_read_state {
static void rpc_sock_read_done(struct tevent_req *subreq);
-static struct async_req *rpc_sock_read_send(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
- uint8_t *data, size_t size,
- void *priv)
+static struct tevent_req *rpc_sock_read_send(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
+ uint8_t *data, size_t size,
+ void *priv)
{
struct rpc_transport_sock_state *sock_transp = talloc_get_type_abort(
priv, struct rpc_transport_sock_state);
- struct async_req *result;
- struct tevent_req *subreq;
+ struct tevent_req *req, *subreq;
struct rpc_sock_read_state *state;
- if (!async_req_setup(mem_ctx, &result, &state,
- struct rpc_sock_read_state)) {
+ req = tevent_req_create(mem_ctx, &state, struct rpc_sock_read_state);
+ if (req == NULL) {
return NULL;
}
@@ -61,36 +60,36 @@ static struct async_req *rpc_sock_read_send(TALLOC_CTX *mem_ctx,
if (subreq == NULL) {
goto fail;
}
- tevent_req_set_callback(subreq, rpc_sock_read_done, result);
- return result;
+ tevent_req_set_callback(subreq, rpc_sock_read_done, req);
+ return req;
fail:
- TALLOC_FREE(result);
+ TALLOC_FREE(req);
return NULL;
}
static void rpc_sock_read_done(struct tevent_req *subreq)
{
- struct async_req *req =
- tevent_req_callback_data(subreq, struct async_req);
- struct rpc_sock_read_state *state = talloc_get_type_abort(
- req->private_data, struct rpc_sock_read_state);
+ struct tevent_req *req = tevent_req_callback_data(
+ subreq, struct tevent_req);
+ struct rpc_sock_read_state *state = tevent_req_data(
+ req, struct rpc_sock_read_state);
int err;
state->received = async_recv_recv(subreq, &err);
if (state->received == -1) {
- async_req_nterror(req, map_nt_error_from_unix(err));
+ tevent_req_nterror(req, map_nt_error_from_unix(err));
return;
}
- async_req_done(req);
+ tevent_req_done(req);
}
-static NTSTATUS rpc_sock_read_recv(struct async_req *req, ssize_t *preceived)
+static NTSTATUS rpc_sock_read_recv(struct tevent_req *req, ssize_t *preceived)
{
- struct rpc_sock_read_state *state = talloc_get_type_abort(
- req->private_data, struct rpc_sock_read_state);
+ struct rpc_sock_read_state *state = tevent_req_data(
+ req, struct rpc_sock_read_state);
NTSTATUS status;
- if (async_req_is_nterror(req, &status)) {
+ if (tevent_req_is_nterror(req, &status)) {
return status;
}
*preceived = state->received;