summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/client.h12
-rw-r--r--source3/rpc_client/cli_pipe.c30
-rw-r--r--source3/rpc_client/rpc_transport_np.c43
3 files changed, 39 insertions, 46 deletions
diff --git a/source3/include/client.h b/source3/include/client.h
index f0c8ecc9dd..73a1d7b554 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -98,15 +98,15 @@ struct rpc_cli_transport {
* trip. The transport implementation is free to set this to NULL,
* cli_pipe.c will fall back to the explicit write/read routines.
*/
- struct async_req *(*trans_send)(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
- uint8_t *data, size_t data_len,
- uint32_t max_rdata_len,
- void *priv);
+ struct tevent_req *(*trans_send)(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
+ uint8_t *data, size_t data_len,
+ uint32_t max_rdata_len,
+ void *priv);
/**
* Get the result from the trans_send operation.
*/
- NTSTATUS (*trans_recv)(struct async_req *req, TALLOC_CTX *mem_ctx,
+ NTSTATUS (*trans_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx,
uint8_t **prdata, uint32_t *prdata_len);
void *priv;
};
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index dbd6930718..98278e02d9 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -1034,7 +1034,7 @@ struct cli_api_pipe_state {
uint32_t rdata_len;
};
-static void cli_api_pipe_trans_done(struct async_req *subreq);
+static void cli_api_pipe_trans_done(struct tevent_req *subreq);
static void cli_api_pipe_write_done(struct tevent_req *subreq);
static void cli_api_pipe_read_done(struct tevent_req *subreq);
@@ -1044,9 +1044,7 @@ static struct tevent_req *cli_api_pipe_send(TALLOC_CTX *mem_ctx,
uint8_t *data, size_t data_len,
uint32_t max_rdata_len)
{
- struct tevent_req *req;
- struct async_req *subreq;
- struct tevent_req *subreq2;
+ struct tevent_req *req, *subreq;
struct cli_api_pipe_state *state;
NTSTATUS status;
@@ -1071,11 +1069,9 @@ static struct tevent_req *cli_api_pipe_send(TALLOC_CTX *mem_ctx,
subreq = transport->trans_send(state, ev, data, data_len,
max_rdata_len, transport->priv);
if (subreq == NULL) {
- status = NT_STATUS_NO_MEMORY;
- goto post_status;
+ goto fail;
}
- subreq->async.fn = cli_api_pipe_trans_done;
- subreq->async.priv = req;
+ tevent_req_set_callback(subreq, cli_api_pipe_trans_done, req);
return req;
}
@@ -1084,31 +1080,27 @@ static struct tevent_req *cli_api_pipe_send(TALLOC_CTX *mem_ctx,
* example the ncacn_ip_tcp transport, do the write/read step here.
*/
- subreq2 = rpc_write_send(state, ev, transport, data, data_len);
- if (subreq2 == NULL) {
+ subreq = rpc_write_send(state, ev, transport, data, data_len);
+ if (subreq == NULL) {
goto fail;
}
- tevent_req_set_callback(subreq2, cli_api_pipe_write_done, req);
+ tevent_req_set_callback(subreq, cli_api_pipe_write_done, req);
return req;
status = NT_STATUS_INVALID_PARAMETER;
post_status:
- if (NT_STATUS_IS_OK(status)) {
- tevent_req_done(req);
- } else {
- tevent_req_nterror(req, status);
- }
+ tevent_req_nterror(req, status);
return tevent_req_post(req, ev);
fail:
TALLOC_FREE(req);
return NULL;
}
-static void cli_api_pipe_trans_done(struct async_req *subreq)
+static void cli_api_pipe_trans_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 620910060a..8b45cb4e9c 100644
--- a/source3/rpc_client/rpc_transport_np.c
+++ b/source3/rpc_client/rpc_transport_np.c
@@ -206,19 +206,20 @@ struct rpc_np_trans_state {
static void rpc_np_trans_done(struct async_req *subreq);
-static struct async_req *rpc_np_trans_send(TALLOC_CTX *mem_ctx,
- struct event_context *ev,
- uint8_t *data, size_t data_len,
- uint32_t max_rdata_len,
- void *priv)
+static struct tevent_req *rpc_np_trans_send(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
+ uint8_t *data, size_t data_len,
+ uint32_t max_rdata_len,
+ 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_trans_state *state;
- if (!async_req_setup(mem_ctx, &result, &state,
- struct rpc_np_trans_state)) {
+ req = tevent_req_create(mem_ctx, &state, struct rpc_np_trans_state);
+ if (req == NULL) {
return NULL;
}
@@ -233,40 +234,40 @@ static struct async_req *rpc_np_trans_send(TALLOC_CTX *mem_ctx,
goto fail;
}
subreq->async.fn = rpc_np_trans_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_trans_done(struct async_req *subreq)
{
- struct async_req *req = talloc_get_type_abort(
- subreq->async.priv, struct async_req);
- struct rpc_np_trans_state *state = talloc_get_type_abort(
- req->private_data, struct rpc_np_trans_state);
+ struct tevent_req *req = talloc_get_type_abort(
+ subreq->async.priv, struct tevent_req);
+ struct rpc_np_trans_state *state = tevent_req_data(
+ req, struct rpc_np_trans_state);
NTSTATUS status;
status = cli_trans_recv(subreq, state, NULL, NULL, NULL, NULL,
&state->rdata, &state->rdata_len);
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_np_trans_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
+static NTSTATUS rpc_np_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
uint8_t **prdata, uint32_t *prdata_len)
{
- struct rpc_np_trans_state *state = talloc_get_type_abort(
- req->private_data, struct rpc_np_trans_state);
+ struct rpc_np_trans_state *state = tevent_req_data(
+ req, struct rpc_np_trans_state);
NTSTATUS status;
- if (async_req_is_nterror(req, &status)) {
+ if (tevent_req_is_nterror(req, &status)) {
return status;
}
*prdata = talloc_move(mem_ctx, &state->rdata);