From 6cf3db91499ebd245b08997a319edf36cfee3365 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 28 Jul 2009 15:06:11 -0400 Subject: s3:winbind: Add NDR-based parent-child communication to winbind --- source3/librpc/gen_ndr/cli_wbint.c | 159 +++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 source3/librpc/gen_ndr/cli_wbint.c (limited to 'source3/librpc/gen_ndr/cli_wbint.c') diff --git a/source3/librpc/gen_ndr/cli_wbint.c b/source3/librpc/gen_ndr/cli_wbint.c new file mode 100644 index 0000000000..044fdf9d1c --- /dev/null +++ b/source3/librpc/gen_ndr/cli_wbint.c @@ -0,0 +1,159 @@ +/* + * Unix SMB/CIFS implementation. + * client auto-generated by pidl. DO NOT MODIFY! + */ + +#include "includes.h" +#include "librpc/gen_ndr/cli_wbint.h" + +struct rpccli_wbint_Ping_state { + struct wbint_Ping orig; + struct wbint_Ping tmp; + TALLOC_CTX *out_mem_ctx; + NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx); +}; + +static void rpccli_wbint_Ping_done(struct tevent_req *subreq); + +struct tevent_req *rpccli_wbint_Ping_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct rpc_pipe_client *cli, + uint32_t _in_data /* [in] */, + uint32_t *_out_data /* [out] [ref] */) +{ + struct tevent_req *req; + struct rpccli_wbint_Ping_state *state; + struct tevent_req *subreq; + + req = tevent_req_create(mem_ctx, &state, + struct rpccli_wbint_Ping_state); + if (req == NULL) { + return NULL; + } + state->out_mem_ctx = NULL; + state->dispatch_recv = cli->dispatch_recv; + + /* In parameters */ + state->orig.in.in_data = _in_data; + + /* Out parameters */ + state->orig.out.out_data = _out_data; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(wbint_Ping, &state->orig); + } + + state->out_mem_ctx = talloc_named_const(state, 0, + "rpccli_wbint_Ping_out_memory"); + if (tevent_req_nomem(state->out_mem_ctx, req)) { + return tevent_req_post(req, ev); + } + + /* make a temporary copy, that we pass to the dispatch function */ + state->tmp = state->orig; + + subreq = cli->dispatch_send(state, ev, cli, + &ndr_table_wbint, + NDR_WBINT_PING, + &state->tmp); + if (tevent_req_nomem(subreq, req)) { + return tevent_req_post(req, ev); + } + tevent_req_set_callback(subreq, rpccli_wbint_Ping_done, req); + return req; +} + +static void rpccli_wbint_Ping_done(struct tevent_req *subreq) +{ + struct tevent_req *req = tevent_req_callback_data( + subreq, struct tevent_req); + struct rpccli_wbint_Ping_state *state = tevent_req_data( + req, struct rpccli_wbint_Ping_state); + NTSTATUS status; + TALLOC_CTX *mem_ctx; + + if (state->out_mem_ctx) { + mem_ctx = state->out_mem_ctx; + } else { + mem_ctx = state; + } + + status = state->dispatch_recv(subreq, mem_ctx); + TALLOC_FREE(subreq); + if (!NT_STATUS_IS_OK(status)) { + tevent_req_nterror(req, status); + return; + } + + /* Copy out parameters */ + *state->orig.out.out_data = *state->tmp.out.out_data; + + /* Reset temporary structure */ + ZERO_STRUCT(state->tmp); + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(wbint_Ping, &state->orig); + } + + tevent_req_done(req); +} + +NTSTATUS rpccli_wbint_Ping_recv(struct tevent_req *req, + TALLOC_CTX *mem_ctx) +{ + struct rpccli_wbint_Ping_state *state = tevent_req_data( + req, struct rpccli_wbint_Ping_state); + NTSTATUS status; + + if (tevent_req_is_nterror(req, &status)) { + tevent_req_received(req); + return status; + } + + /* Steal possbile out parameters to the callers context */ + talloc_steal(mem_ctx, state->out_mem_ctx); + + tevent_req_received(req); + return NT_STATUS_OK; +} + +NTSTATUS rpccli_wbint_Ping(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t in_data /* [in] */, + uint32_t *out_data /* [out] [ref] */) +{ + struct wbint_Ping r; + NTSTATUS status; + + /* In parameters */ + r.in.in_data = in_data; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(wbint_Ping, &r); + } + + status = cli->dispatch(cli, + mem_ctx, + &ndr_table_wbint, + NDR_WBINT_PING, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(wbint_Ping, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *out_data = *r.out.out_data; + + /* Return result */ + return NT_STATUS_OK; +} + -- cgit