From d92e3967ea993cf9573aaa40fd2ef3fcfc4cb4f3 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 26 Sep 2013 05:00:39 +0200 Subject: [PATCH] gen_ndr --- bin.gen_ndr/default/librpc/gen_ndr/echo.h | 36 +- bin.gen_ndr/default/librpc/gen_ndr/ndr_echo.c | 208 +++++++- bin.gen_ndr/default/librpc/gen_ndr/ndr_echo.h | 12 +- .../default/librpc/gen_ndr/ndr_echo_c.c | 453 ++++++++++++++++-- .../default/librpc/gen_ndr/ndr_echo_c.h | 85 +++- .../default/librpc/gen_ndr/ndr_echo_s.c | 64 ++- bin.gen_ndr/default/librpc/gen_ndr/srv_echo.c | 167 ++++++- bin.gen_ndr/default/librpc/gen_ndr/srv_echo.h | 4 +- .../default/librpc/gen_ndr/srv_frstrans.c | 12 - 9 files changed, 936 insertions(+), 105 deletions(-) diff --git a/bin.gen_ndr/default/librpc/gen_ndr/echo.h b/bin.gen_ndr/default/librpc/gen_ndr/echo.h index 09c193457491..a0994207a181 100644 --- a/bin.gen_ndr/default/librpc/gen_ndr/echo.h +++ b/bin.gen_ndr/default/librpc/gen_ndr/echo.h @@ -222,10 +222,11 @@ struct echo_TestDoublePointer { }; -struct echo_BytePipeIn { +struct echo_TestBytePipeIn { struct { - uint32_t value; - struct echo_BytePipe *bp;/* [ref] */ + uint32_t num_chunks; + uint32_t chunk_size; + struct echo_BytePipe *in_pipe;/* [ref] */ } in; struct { @@ -234,5 +235,34 @@ struct echo_BytePipeIn { }; + +struct echo_TestBytePipeOut { + struct { + uint32_t num_chunks; + uint32_t chunk_size; + } in; + + struct { + struct echo_BytePipe *out_pipe;/* [ref] */ + uint32_t result; + } out; + +}; + + +struct echo_TestBytePipeInOut { + struct { + uint32_t num_chunks; + uint32_t chunk_size; + struct echo_BytePipe *out_pipe;/* [ref] */ + } in; + + struct { + struct echo_BytePipe *out_pipe;/* [ref] */ + uint32_t result; + } out; + +}; + #endif /* _HEADER_rpcecho */ #endif /* _PIDL_HEADER_rpcecho */ diff --git a/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo.c b/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo.c index 51681e758977..788c4af4109a 100644 --- a/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo.c +++ b/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo.c @@ -1541,11 +1541,12 @@ _PUBLIC_ void ndr_print_echo_TestDoublePointer(struct ndr_print *ndr, const char ndr->depth--; } -static enum ndr_err_code ndr_push_echo_BytePipeIn(struct ndr_push *ndr, int flags, const struct echo_BytePipeIn *r) +static enum ndr_err_code ndr_push_echo_TestBytePipeIn(struct ndr_push *ndr, int flags, const struct echo_TestBytePipeIn *r) { NDR_PUSH_CHECK_FN_FLAGS(ndr, flags); if (flags & NDR_IN) { - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.value)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_chunks)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.chunk_size)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->out.result)); @@ -1553,11 +1554,12 @@ static enum ndr_err_code ndr_push_echo_BytePipeIn(struct ndr_push *ndr, int flag return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_echo_BytePipeIn(struct ndr_pull *ndr, int flags, struct echo_BytePipeIn *r) +static enum ndr_err_code ndr_pull_echo_TestBytePipeIn(struct ndr_pull *ndr, int flags, struct echo_TestBytePipeIn *r) { NDR_PULL_CHECK_FN_FLAGS(ndr, flags); if (flags & NDR_IN) { - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.value)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.num_chunks)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.chunk_size)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->out.result)); @@ -1565,25 +1567,26 @@ static enum ndr_err_code ndr_pull_echo_BytePipeIn(struct ndr_pull *ndr, int flag return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_echo_BytePipeIn(struct ndr_print *ndr, const char *name, int flags, const struct echo_BytePipeIn *r) +_PUBLIC_ void ndr_print_echo_TestBytePipeIn(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestBytePipeIn *r) { - ndr_print_struct(ndr, name, "echo_BytePipeIn"); + ndr_print_struct(ndr, name, "echo_TestBytePipeIn"); if (r == NULL) { ndr_print_null(ndr); return; } ndr->depth++; if (flags & NDR_SET_VALUES) { ndr->flags |= LIBNDR_PRINT_SET_VALUES; } if (flags & NDR_IN) { - ndr_print_struct(ndr, "in", "echo_BytePipeIn"); + ndr_print_struct(ndr, "in", "echo_TestBytePipeIn"); ndr->depth++; - ndr_print_uint32(ndr, "value", r->in.value); - ndr_print_ptr(ndr, "bp", r->in.bp); + ndr_print_uint32(ndr, "num_chunks", r->in.num_chunks); + ndr_print_uint32(ndr, "chunk_size", r->in.chunk_size); + ndr_print_ptr(ndr, "in_pipe", r->in.in_pipe); ndr->depth++; ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { - ndr_print_struct(ndr, "out", "echo_BytePipeIn"); + ndr_print_struct(ndr, "out", "echo_TestBytePipeIn"); ndr->depth++; ndr_print_uint32(ndr, "result", r->out.result); ndr->depth--; @@ -1591,9 +1594,158 @@ _PUBLIC_ void ndr_print_echo_BytePipeIn(struct ndr_print *ndr, const char *name, ndr->depth--; } -static const struct ndr_interface_call_pipe echo_BytePipeIn_in_pipes[] = { +static enum ndr_err_code ndr_push_echo_TestBytePipeOut(struct ndr_push *ndr, int flags, const struct echo_TestBytePipeOut *r) +{ + NDR_PUSH_CHECK_FN_FLAGS(ndr, flags); + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_chunks)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.chunk_size)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_echo_TestBytePipeOut(struct ndr_pull *ndr, int flags, struct echo_TestBytePipeOut *r) +{ + NDR_PULL_CHECK_FN_FLAGS(ndr, flags); + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.num_chunks)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.chunk_size)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_echo_TestBytePipeOut(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestBytePipeOut *r) +{ + ndr_print_struct(ndr, name, "echo_TestBytePipeOut"); + if (r == NULL) { ndr_print_null(ndr); return; } + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "echo_TestBytePipeOut"); + ndr->depth++; + ndr_print_uint32(ndr, "num_chunks", r->in.num_chunks); + ndr_print_uint32(ndr, "chunk_size", r->in.chunk_size); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "echo_TestBytePipeOut"); + ndr->depth++; + ndr_print_ptr(ndr, "out_pipe", r->out.out_pipe); + ndr->depth++; + ndr->depth--; + ndr_print_uint32(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_echo_TestBytePipeInOut(struct ndr_push *ndr, int flags, const struct echo_TestBytePipeInOut *r) +{ + NDR_PUSH_CHECK_FN_FLAGS(ndr, flags); + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_chunks)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.chunk_size)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_echo_TestBytePipeInOut(struct ndr_pull *ndr, int flags, struct echo_TestBytePipeInOut *r) +{ + NDR_PULL_CHECK_FN_FLAGS(ndr, flags); + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.num_chunks)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.chunk_size)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_echo_TestBytePipeInOut(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestBytePipeInOut *r) +{ + ndr_print_struct(ndr, name, "echo_TestBytePipeInOut"); + if (r == NULL) { ndr_print_null(ndr); return; } + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "echo_TestBytePipeInOut"); + ndr->depth++; + ndr_print_uint32(ndr, "num_chunks", r->in.num_chunks); + ndr_print_uint32(ndr, "chunk_size", r->in.chunk_size); + ndr_print_ptr(ndr, "out_pipe", r->in.out_pipe); + ndr->depth++; + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "echo_TestBytePipeInOut"); + ndr->depth++; + ndr_print_ptr(ndr, "out_pipe", r->out.out_pipe); + ndr->depth++; + ndr->depth--; + ndr_print_uint32(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static const struct ndr_interface_call_pipe echo_TestBytePipeIn_in_pipes[] = { + { + "in.in_pipe", + "echo_BytePipe_chunk", + sizeof(struct echo_BytePipe_chunk), + (ndr_push_flags_fn_t) ndr_push_echo_BytePipe_chunk, + (ndr_pull_flags_fn_t) ndr_pull_echo_BytePipe_chunk, + (ndr_print_fn_t) ndr_print_echo_BytePipe_chunk, + }, + { NULL, NULL, 0, NULL, NULL, NULL } +}; + +static const struct ndr_interface_call_pipe echo_TestBytePipeOut_out_pipes[] = { + { + "out.out_pipe", + "echo_BytePipe_chunk", + sizeof(struct echo_BytePipe_chunk), + (ndr_push_flags_fn_t) ndr_push_echo_BytePipe_chunk, + (ndr_pull_flags_fn_t) ndr_pull_echo_BytePipe_chunk, + (ndr_print_fn_t) ndr_print_echo_BytePipe_chunk, + }, + { NULL, NULL, 0, NULL, NULL, NULL } +}; + +static const struct ndr_interface_call_pipe echo_TestBytePipeInOut_in_pipes[] = { { - "in.bp", + "in.out_pipe", + "echo_BytePipe_chunk", + sizeof(struct echo_BytePipe_chunk), + (ndr_push_flags_fn_t) ndr_push_echo_BytePipe_chunk, + (ndr_pull_flags_fn_t) ndr_pull_echo_BytePipe_chunk, + (ndr_print_fn_t) ndr_print_echo_BytePipe_chunk, + }, + { NULL, NULL, 0, NULL, NULL, NULL } +}; + +static const struct ndr_interface_call_pipe echo_TestBytePipeInOut_out_pipes[] = { + { + "out.out_pipe", "echo_BytePipe_chunk", sizeof(struct echo_BytePipe_chunk), (ndr_push_flags_fn_t) ndr_push_echo_BytePipe_chunk, @@ -1695,14 +1847,32 @@ static const struct ndr_interface_call rpcecho_calls[] = { { 0, NULL }, }, { - "echo_BytePipeIn", - sizeof(struct echo_BytePipeIn), - (ndr_push_flags_fn_t) ndr_push_echo_BytePipeIn, - (ndr_pull_flags_fn_t) ndr_pull_echo_BytePipeIn, - (ndr_print_function_t) ndr_print_echo_BytePipeIn, - { 1, echo_BytePipeIn_in_pipes }, + "echo_TestBytePipeIn", + sizeof(struct echo_TestBytePipeIn), + (ndr_push_flags_fn_t) ndr_push_echo_TestBytePipeIn, + (ndr_pull_flags_fn_t) ndr_pull_echo_TestBytePipeIn, + (ndr_print_function_t) ndr_print_echo_TestBytePipeIn, + { 1, echo_TestBytePipeIn_in_pipes }, { 0, NULL }, }, + { + "echo_TestBytePipeOut", + sizeof(struct echo_TestBytePipeOut), + (ndr_push_flags_fn_t) ndr_push_echo_TestBytePipeOut, + (ndr_pull_flags_fn_t) ndr_pull_echo_TestBytePipeOut, + (ndr_print_function_t) ndr_print_echo_TestBytePipeOut, + { 0, NULL }, + { 1, echo_TestBytePipeOut_out_pipes }, + }, + { + "echo_TestBytePipeInOut", + sizeof(struct echo_TestBytePipeInOut), + (ndr_push_flags_fn_t) ndr_push_echo_TestBytePipeInOut, + (ndr_pull_flags_fn_t) ndr_pull_echo_TestBytePipeInOut, + (ndr_print_function_t) ndr_print_echo_TestBytePipeInOut, + { 1, echo_TestBytePipeInOut_in_pipes }, + { 1, echo_TestBytePipeInOut_out_pipes }, + }, { NULL, 0, NULL, NULL, NULL } }; @@ -1734,7 +1904,7 @@ const struct ndr_interface_table ndr_table_rpcecho = { NDR_RPCECHO_VERSION }, .helpstring = NDR_RPCECHO_HELPSTRING, - .num_calls = 11, + .num_calls = 13, .calls = rpcecho_calls, .endpoints = &rpcecho_endpoints, .authservices = &rpcecho_authservices diff --git a/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo.h b/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo.h index 726ac36c51c8..8af6d4266926 100644 --- a/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo.h +++ b/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo.h @@ -31,9 +31,13 @@ extern const struct ndr_interface_table ndr_table_rpcecho; #define NDR_ECHO_TESTDOUBLEPOINTER (0x09) -#define NDR_ECHO_BYTEPIPEIN (0x0a) +#define NDR_ECHO_TESTBYTEPIPEIN (0x0a) -#define NDR_RPCECHO_CALL_COUNT (11) +#define NDR_ECHO_TESTBYTEPIPEOUT (0x0b) + +#define NDR_ECHO_TESTBYTEPIPEINOUT (0x0c) + +#define NDR_RPCECHO_CALL_COUNT (13) enum ndr_err_code ndr_push_echo_info1(struct ndr_push *ndr, int ndr_flags, const struct echo_info1 *r); enum ndr_err_code ndr_pull_echo_info1(struct ndr_pull *ndr, int ndr_flags, struct echo_info1 *r); void ndr_print_echo_info1(struct ndr_print *ndr, const char *name, const struct echo_info1 *r); @@ -60,5 +64,7 @@ void ndr_print_echo_TestSleep(struct ndr_print *ndr, const char *name, int flags void ndr_print_echo_TestEnum(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestEnum *r); void ndr_print_echo_TestSurrounding(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestSurrounding *r); void ndr_print_echo_TestDoublePointer(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestDoublePointer *r); -void ndr_print_echo_BytePipeIn(struct ndr_print *ndr, const char *name, int flags, const struct echo_BytePipeIn *r); +void ndr_print_echo_TestBytePipeIn(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestBytePipeIn *r); +void ndr_print_echo_TestBytePipeOut(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestBytePipeOut *r); +void ndr_print_echo_TestBytePipeInOut(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestBytePipeInOut *r); #endif /* _HEADER_NDR_rpcecho */ diff --git a/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo_c.c b/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo_c.c index dae482852c2a..d2583f82d521 100644 --- a/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo_c.c +++ b/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo_c.c @@ -2230,36 +2230,36 @@ NTSTATUS dcerpc_echo_TestDoublePointer(struct dcerpc_binding_handle *h, return NT_STATUS_OK; } -struct dcerpc_echo_BytePipeIn_r_state { +struct dcerpc_echo_TestBytePipeIn_r_state { struct dcerpc_pipe_handle_connection *in_pipes[1]; struct dcerpc_binding_handle_call_params params; TALLOC_CTX *out_mem_ctx; }; -static void dcerpc_echo_BytePipeIn_r_done(struct tevent_req *subreq); +static void dcerpc_echo_TestBytePipeIn_r_done(struct tevent_req *subreq); -struct tevent_req *dcerpc_echo_BytePipeIn_r_send(TALLOC_CTX *mem_ctx, +struct tevent_req *dcerpc_echo_TestBytePipeIn_r_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct dcerpc_binding_handle *h, - struct echo_BytePipeIn *r) + struct echo_TestBytePipeIn *r) { struct tevent_req *req; - struct dcerpc_echo_BytePipeIn_r_state *state; + struct dcerpc_echo_TestBytePipeIn_r_state *state; struct tevent_req *subreq; req = tevent_req_create(mem_ctx, &state, - struct dcerpc_echo_BytePipeIn_r_state); + struct dcerpc_echo_TestBytePipeIn_r_state); if (req == NULL) { return NULL; } state->out_mem_ctx = NULL; - if (r->in.bp == NULL) { + if (r->in.in_pipe == NULL) { tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER_MIX); return tevent_req_post(req, ev); } - state->in_pipes[0] = r->in.bp->pc; + state->in_pipes[0] = r->in.in_pipe->pc; state->params.r_mem = state; state->params.r_ptr = r; state->params.in.num_pipes = 1; @@ -2269,16 +2269,16 @@ struct tevent_req *dcerpc_echo_BytePipeIn_r_send(TALLOC_CTX *mem_ctx, subreq = dcerpc_binding_handle_call_params_send(state, ev, h, NULL, &ndr_table_rpcecho, - NDR_ECHO_BYTEPIPEIN, &state->params); + NDR_ECHO_TESTBYTEPIPEIN, &state->params); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); } - tevent_req_set_callback(subreq, dcerpc_echo_BytePipeIn_r_done, req); + tevent_req_set_callback(subreq, dcerpc_echo_TestBytePipeIn_r_done, req); return req; } -static void dcerpc_echo_BytePipeIn_r_done(struct tevent_req *subreq) +static void dcerpc_echo_TestBytePipeIn_r_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data(subreq, @@ -2294,11 +2294,11 @@ static void dcerpc_echo_BytePipeIn_r_done(struct tevent_req *subreq) tevent_req_done(req); } -NTSTATUS dcerpc_echo_BytePipeIn_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx) +NTSTATUS dcerpc_echo_TestBytePipeIn_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx) { - struct dcerpc_echo_BytePipeIn_r_state *state = + struct dcerpc_echo_TestBytePipeIn_r_state *state = tevent_req_data(req, - struct dcerpc_echo_BytePipeIn_r_state); + struct dcerpc_echo_TestBytePipeIn_r_state); NTSTATUS status; if (tevent_req_is_nterror(req, &status)) { @@ -2312,34 +2312,36 @@ NTSTATUS dcerpc_echo_BytePipeIn_r_recv(struct tevent_req *req, TALLOC_CTX *mem_c return NT_STATUS_OK; } -struct dcerpc_echo_BytePipeIn_state { - struct echo_BytePipeIn orig; - struct echo_BytePipeIn tmp; +struct dcerpc_echo_TestBytePipeIn_state { + struct echo_TestBytePipeIn orig; + struct echo_TestBytePipeIn tmp; TALLOC_CTX *out_mem_ctx; }; -static void dcerpc_echo_BytePipeIn_done(struct tevent_req *subreq); +static void dcerpc_echo_TestBytePipeIn_done(struct tevent_req *subreq); -struct tevent_req *dcerpc_echo_BytePipeIn_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct dcerpc_binding_handle *h, - uint32_t _value /* [in] */, - struct echo_BytePipe *_bp /* [in] [ref] */) +struct tevent_req *dcerpc_echo_TestBytePipeIn_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct dcerpc_binding_handle *h, + uint32_t _num_chunks /* [in] */, + uint32_t _chunk_size /* [in] */, + struct echo_BytePipe *_in_pipe /* [in] [ref] */) { struct tevent_req *req; - struct dcerpc_echo_BytePipeIn_state *state; + struct dcerpc_echo_TestBytePipeIn_state *state; struct tevent_req *subreq; req = tevent_req_create(mem_ctx, &state, - struct dcerpc_echo_BytePipeIn_state); + struct dcerpc_echo_TestBytePipeIn_state); if (req == NULL) { return NULL; } state->out_mem_ctx = NULL; /* In parameters */ - state->orig.in.value = _value; - state->orig.in.bp = _bp; + state->orig.in.num_chunks = _num_chunks; + state->orig.in.chunk_size = _chunk_size; + state->orig.in.in_pipe = _in_pipe; /* Out parameters */ @@ -2349,20 +2351,20 @@ struct tevent_req *dcerpc_echo_BytePipeIn_send(TALLOC_CTX *mem_ctx, /* make a temporary copy, that we pass to the dispatch function */ state->tmp = state->orig; - subreq = dcerpc_echo_BytePipeIn_r_send(state, ev, h, &state->tmp); + subreq = dcerpc_echo_TestBytePipeIn_r_send(state, ev, h, &state->tmp); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); } - tevent_req_set_callback(subreq, dcerpc_echo_BytePipeIn_done, req); + tevent_req_set_callback(subreq, dcerpc_echo_TestBytePipeIn_done, req); return req; } -static void dcerpc_echo_BytePipeIn_done(struct tevent_req *subreq) +static void dcerpc_echo_TestBytePipeIn_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data( subreq, struct tevent_req); - struct dcerpc_echo_BytePipeIn_state *state = tevent_req_data( - req, struct dcerpc_echo_BytePipeIn_state); + struct dcerpc_echo_TestBytePipeIn_state *state = tevent_req_data( + req, struct dcerpc_echo_TestBytePipeIn_state); NTSTATUS status; TALLOC_CTX *mem_ctx; @@ -2372,7 +2374,7 @@ static void dcerpc_echo_BytePipeIn_done(struct tevent_req *subreq) mem_ctx = state; } - status = dcerpc_echo_BytePipeIn_r_recv(subreq, mem_ctx); + status = dcerpc_echo_TestBytePipeIn_r_recv(subreq, mem_ctx); TALLOC_FREE(subreq); if (tevent_req_nterror(req, status)) { return; @@ -2389,12 +2391,387 @@ static void dcerpc_echo_BytePipeIn_done(struct tevent_req *subreq) tevent_req_done(req); } -NTSTATUS dcerpc_echo_BytePipeIn_recv(struct tevent_req *req, - TALLOC_CTX *mem_ctx, - uint32_t *result) +NTSTATUS dcerpc_echo_TestBytePipeIn_recv(struct tevent_req *req, + TALLOC_CTX *mem_ctx, + uint32_t *result) +{ + struct dcerpc_echo_TestBytePipeIn_state *state = tevent_req_data( + req, struct dcerpc_echo_TestBytePipeIn_state); + NTSTATUS status; + + if (tevent_req_is_nterror(req, &status)) { + tevent_req_received(req); + return status; + } + + /* Steal possible out parameters to the callers context */ + talloc_steal(mem_ctx, state->out_mem_ctx); + + /* Return result */ + *result = state->orig.out.result; + + tevent_req_received(req); + return NT_STATUS_OK; +} + +struct dcerpc_echo_TestBytePipeOut_r_state { + struct dcerpc_pipe_handle_connection *out_pipes[1]; + struct dcerpc_binding_handle_call_params params; + TALLOC_CTX *out_mem_ctx; +}; + +static void dcerpc_echo_TestBytePipeOut_r_done(struct tevent_req *subreq); + +struct tevent_req *dcerpc_echo_TestBytePipeOut_r_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct dcerpc_binding_handle *h, + struct echo_TestBytePipeOut *r) +{ + struct tevent_req *req; + struct dcerpc_echo_TestBytePipeOut_r_state *state; + struct tevent_req *subreq; + + req = tevent_req_create(mem_ctx, &state, + struct dcerpc_echo_TestBytePipeOut_r_state); + if (req == NULL) { + return NULL; + } + + state->out_mem_ctx = NULL; + + if (r->out.out_pipe == NULL) { + tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER_MIX); + return tevent_req_post(req, ev); + } + state->out_pipes[0] = r->out.out_pipe->pc; + state->params.r_mem = state; + state->params.r_ptr = r; + state->params.in.num_pipes = 0; + state->params.in.pipes = NULL; + state->params.out.num_pipes = 1; + state->params.out.pipes = state->out_pipes; + + subreq = dcerpc_binding_handle_call_params_send(state, ev, h, + NULL, &ndr_table_rpcecho, + NDR_ECHO_TESTBYTEPIPEOUT, &state->params); + if (tevent_req_nomem(subreq, req)) { + return tevent_req_post(req, ev); + } + tevent_req_set_callback(subreq, dcerpc_echo_TestBytePipeOut_r_done, req); + + return req; +} + +static void dcerpc_echo_TestBytePipeOut_r_done(struct tevent_req *subreq) +{ + struct tevent_req *req = + tevent_req_callback_data(subreq, + struct tevent_req); + NTSTATUS status; + + status = dcerpc_binding_handle_call_params_recv(subreq); + TALLOC_FREE(subreq); + if (tevent_req_nterror(req, status)) { + return; + } + + tevent_req_done(req); +} + +NTSTATUS dcerpc_echo_TestBytePipeOut_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx) +{ + struct dcerpc_echo_TestBytePipeOut_r_state *state = + tevent_req_data(req, + struct dcerpc_echo_TestBytePipeOut_r_state); + NTSTATUS status; + + if (tevent_req_is_nterror(req, &status)) { + tevent_req_received(req); + return status; + } + + talloc_steal(mem_ctx, state->out_mem_ctx); + + tevent_req_received(req); + return NT_STATUS_OK; +} + +struct dcerpc_echo_TestBytePipeOut_state { + struct echo_TestBytePipeOut orig; + struct echo_TestBytePipeOut tmp; + TALLOC_CTX *out_mem_ctx; +}; + +static void dcerpc_echo_TestBytePipeOut_done(struct tevent_req *subreq); + +struct tevent_req *dcerpc_echo_TestBytePipeOut_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct dcerpc_binding_handle *h, + uint32_t _num_chunks /* [in] */, + uint32_t _chunk_size /* [in] */, + struct echo_BytePipe *_out_pipe /* [out] [ref] */) +{ + struct tevent_req *req; + struct dcerpc_echo_TestBytePipeOut_state *state; + struct tevent_req *subreq; + + req = tevent_req_create(mem_ctx, &state, + struct dcerpc_echo_TestBytePipeOut_state); + if (req == NULL) { + return NULL; + } + state->out_mem_ctx = NULL; + + /* In parameters */ + state->orig.in.num_chunks = _num_chunks; + state->orig.in.chunk_size = _chunk_size; + + /* Out parameters */ + state->orig.out.out_pipe = _out_pipe; + + /* Result */ + ZERO_STRUCT(state->orig.out.result); + + /* make a temporary copy, that we pass to the dispatch function */ + state->tmp = state->orig; + + subreq = dcerpc_echo_TestBytePipeOut_r_send(state, ev, h, &state->tmp); + if (tevent_req_nomem(subreq, req)) { + return tevent_req_post(req, ev); + } + tevent_req_set_callback(subreq, dcerpc_echo_TestBytePipeOut_done, req); + return req; +} + +static void dcerpc_echo_TestBytePipeOut_done(struct tevent_req *subreq) +{ + struct tevent_req *req = tevent_req_callback_data( + subreq, struct tevent_req); + struct dcerpc_echo_TestBytePipeOut_state *state = tevent_req_data( + req, struct dcerpc_echo_TestBytePipeOut_state); + NTSTATUS status; + TALLOC_CTX *mem_ctx; + + if (state->out_mem_ctx) { + mem_ctx = state->out_mem_ctx; + } else { + mem_ctx = state; + } + + status = dcerpc_echo_TestBytePipeOut_r_recv(subreq, mem_ctx); + TALLOC_FREE(subreq); + if (tevent_req_nterror(req, status)) { + return; + } + + /* Copy out parameters */ + + /* Copy result */ + state->orig.out.result = state->tmp.out.result; + + /* Reset temporary structure */ + ZERO_STRUCT(state->tmp); + + tevent_req_done(req); +} + +NTSTATUS dcerpc_echo_TestBytePipeOut_recv(struct tevent_req *req, + TALLOC_CTX *mem_ctx, + uint32_t *result) +{ + struct dcerpc_echo_TestBytePipeOut_state *state = tevent_req_data( + req, struct dcerpc_echo_TestBytePipeOut_state); + NTSTATUS status; + + if (tevent_req_is_nterror(req, &status)) { + tevent_req_received(req); + return status; + } + + /* Steal possible out parameters to the callers context */ + talloc_steal(mem_ctx, state->out_mem_ctx); + + /* Return result */ + *result = state->orig.out.result; + + tevent_req_received(req); + return NT_STATUS_OK; +} + +struct dcerpc_echo_TestBytePipeInOut_r_state { + struct dcerpc_pipe_handle_connection *in_pipes[1]; + struct dcerpc_pipe_handle_connection *out_pipes[1]; + struct dcerpc_binding_handle_call_params params; + TALLOC_CTX *out_mem_ctx; +}; + +static void dcerpc_echo_TestBytePipeInOut_r_done(struct tevent_req *subreq); + +struct tevent_req *dcerpc_echo_TestBytePipeInOut_r_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct dcerpc_binding_handle *h, + struct echo_TestBytePipeInOut *r) +{ + struct tevent_req *req; + struct dcerpc_echo_TestBytePipeInOut_r_state *state; + struct tevent_req *subreq; + + req = tevent_req_create(mem_ctx, &state, + struct dcerpc_echo_TestBytePipeInOut_r_state); + if (req == NULL) { + return NULL; + } + + state->out_mem_ctx = NULL; + + if (r->in.out_pipe == NULL) { + tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER_MIX); + return tevent_req_post(req, ev); + } + state->in_pipes[0] = r->in.out_pipe->pc; + if (r->out.out_pipe == NULL) { + tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER_MIX); + return tevent_req_post(req, ev); + } + state->out_pipes[0] = r->out.out_pipe->pc; + state->params.r_mem = state; + state->params.r_ptr = r; + state->params.in.num_pipes = 1; + state->params.in.pipes = state->in_pipes; + state->params.out.num_pipes = 1; + state->params.out.pipes = state->out_pipes; + + subreq = dcerpc_binding_handle_call_params_send(state, ev, h, + NULL, &ndr_table_rpcecho, + NDR_ECHO_TESTBYTEPIPEINOUT, &state->params); + if (tevent_req_nomem(subreq, req)) { + return tevent_req_post(req, ev); + } + tevent_req_set_callback(subreq, dcerpc_echo_TestBytePipeInOut_r_done, req); + + return req; +} + +static void dcerpc_echo_TestBytePipeInOut_r_done(struct tevent_req *subreq) +{ + struct tevent_req *req = + tevent_req_callback_data(subreq, + struct tevent_req); + NTSTATUS status; + + status = dcerpc_binding_handle_call_params_recv(subreq); + TALLOC_FREE(subreq); + if (tevent_req_nterror(req, status)) { + return; + } + + tevent_req_done(req); +} + +NTSTATUS dcerpc_echo_TestBytePipeInOut_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx) +{ + struct dcerpc_echo_TestBytePipeInOut_r_state *state = + tevent_req_data(req, + struct dcerpc_echo_TestBytePipeInOut_r_state); + NTSTATUS status; + + if (tevent_req_is_nterror(req, &status)) { + tevent_req_received(req); + return status; + } + + talloc_steal(mem_ctx, state->out_mem_ctx); + + tevent_req_received(req); + return NT_STATUS_OK; +} + +struct dcerpc_echo_TestBytePipeInOut_state { + struct echo_TestBytePipeInOut orig; + struct echo_TestBytePipeInOut tmp; + TALLOC_CTX *out_mem_ctx; +}; + +static void dcerpc_echo_TestBytePipeInOut_done(struct tevent_req *subreq); + +struct tevent_req *dcerpc_echo_TestBytePipeInOut_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct dcerpc_binding_handle *h, + uint32_t _num_chunks /* [in] */, + uint32_t _chunk_size /* [in] */, + struct echo_BytePipe *_out_pipe /* [in,out] [ref] */) +{ + struct tevent_req *req; + struct dcerpc_echo_TestBytePipeInOut_state *state; + struct tevent_req *subreq; + + req = tevent_req_create(mem_ctx, &state, + struct dcerpc_echo_TestBytePipeInOut_state); + if (req == NULL) { + return NULL; + } + state->out_mem_ctx = NULL; + + /* In parameters */ + state->orig.in.num_chunks = _num_chunks; + state->orig.in.chunk_size = _chunk_size; + state->orig.in.out_pipe = _out_pipe; + + /* Out parameters */ + state->orig.out.out_pipe = _out_pipe; + + /* Result */ + ZERO_STRUCT(state->orig.out.result); + + /* make a temporary copy, that we pass to the dispatch function */ + state->tmp = state->orig; + + subreq = dcerpc_echo_TestBytePipeInOut_r_send(state, ev, h, &state->tmp); + if (tevent_req_nomem(subreq, req)) { + return tevent_req_post(req, ev); + } + tevent_req_set_callback(subreq, dcerpc_echo_TestBytePipeInOut_done, req); + return req; +} + +static void dcerpc_echo_TestBytePipeInOut_done(struct tevent_req *subreq) +{ + struct tevent_req *req = tevent_req_callback_data( + subreq, struct tevent_req); + struct dcerpc_echo_TestBytePipeInOut_state *state = tevent_req_data( + req, struct dcerpc_echo_TestBytePipeInOut_state); + NTSTATUS status; + TALLOC_CTX *mem_ctx; + + if (state->out_mem_ctx) { + mem_ctx = state->out_mem_ctx; + } else { + mem_ctx = state; + } + + status = dcerpc_echo_TestBytePipeInOut_r_recv(subreq, mem_ctx); + TALLOC_FREE(subreq); + if (tevent_req_nterror(req, status)) { + return; + } + + /* Copy out parameters */ + + /* Copy result */ + state->orig.out.result = state->tmp.out.result; + + /* Reset temporary structure */ + ZERO_STRUCT(state->tmp); + + tevent_req_done(req); +} + +NTSTATUS dcerpc_echo_TestBytePipeInOut_recv(struct tevent_req *req, + TALLOC_CTX *mem_ctx, + uint32_t *result) { - struct dcerpc_echo_BytePipeIn_state *state = tevent_req_data( - req, struct dcerpc_echo_BytePipeIn_state); + struct dcerpc_echo_TestBytePipeInOut_state *state = tevent_req_data( + req, struct dcerpc_echo_TestBytePipeInOut_state); NTSTATUS status; if (tevent_req_is_nterror(req, &status)) { diff --git a/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo_c.h b/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo_c.h index 5fb509cff66b..09443a650f02 100644 --- a/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo_c.h +++ b/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo_c.h @@ -204,31 +204,90 @@ NTSTATUS dcerpc_echo_TestDoublePointer(struct dcerpc_binding_handle *h, uint16_t ***_data /* [in] [ref] */, uint16_t *result); -struct tevent_req *dcerpc_echo_BytePipeIn_r_send(TALLOC_CTX *mem_ctx, +struct tevent_req *dcerpc_echo_TestBytePipeIn_r_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct dcerpc_binding_handle *h, - struct echo_BytePipeIn *r); -NTSTATUS dcerpc_echo_BytePipeIn_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx); + struct echo_TestBytePipeIn *r); +NTSTATUS dcerpc_echo_TestBytePipeIn_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx); /* * The following function is skipped because * it uses pipes: * - * dcerpc_echo_BytePipeIn_r() + * dcerpc_echo_TestBytePipeIn_r() */ -struct tevent_req *dcerpc_echo_BytePipeIn_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct dcerpc_binding_handle *h, - uint32_t _value /* [in] */, - struct echo_BytePipe *_bp /* [in] [ref] */); -NTSTATUS dcerpc_echo_BytePipeIn_recv(struct tevent_req *req, - TALLOC_CTX *mem_ctx, - uint32_t *result); +struct tevent_req *dcerpc_echo_TestBytePipeIn_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct dcerpc_binding_handle *h, + uint32_t _num_chunks /* [in] */, + uint32_t _chunk_size /* [in] */, + struct echo_BytePipe *_in_pipe /* [in] [ref] */); +NTSTATUS dcerpc_echo_TestBytePipeIn_recv(struct tevent_req *req, + TALLOC_CTX *mem_ctx, + uint32_t *result); +/* + * The following function is skipped because + * it uses pipes: + * + * dcerpc_echo_TestBytePipeIn() + */ + + +struct tevent_req *dcerpc_echo_TestBytePipeOut_r_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct dcerpc_binding_handle *h, + struct echo_TestBytePipeOut *r); +NTSTATUS dcerpc_echo_TestBytePipeOut_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx); +/* + * The following function is skipped because + * it uses pipes: + * + * dcerpc_echo_TestBytePipeOut_r() + */ + +struct tevent_req *dcerpc_echo_TestBytePipeOut_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct dcerpc_binding_handle *h, + uint32_t _num_chunks /* [in] */, + uint32_t _chunk_size /* [in] */, + struct echo_BytePipe *_out_pipe /* [out] [ref] */); +NTSTATUS dcerpc_echo_TestBytePipeOut_recv(struct tevent_req *req, + TALLOC_CTX *mem_ctx, + uint32_t *result); +/* + * The following function is skipped because + * it uses pipes: + * + * dcerpc_echo_TestBytePipeOut() + */ + + +struct tevent_req *dcerpc_echo_TestBytePipeInOut_r_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct dcerpc_binding_handle *h, + struct echo_TestBytePipeInOut *r); +NTSTATUS dcerpc_echo_TestBytePipeInOut_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx); +/* + * The following function is skipped because + * it uses pipes: + * + * dcerpc_echo_TestBytePipeInOut_r() + */ + +struct tevent_req *dcerpc_echo_TestBytePipeInOut_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct dcerpc_binding_handle *h, + uint32_t _num_chunks /* [in] */, + uint32_t _chunk_size /* [in] */, + struct echo_BytePipe *_out_pipe /* [in,out] [ref] */); +NTSTATUS dcerpc_echo_TestBytePipeInOut_recv(struct tevent_req *req, + TALLOC_CTX *mem_ctx, + uint32_t *result); /* * The following function is skipped because * it uses pipes: * - * dcerpc_echo_BytePipeIn() + * dcerpc_echo_TestBytePipeInOut() */ diff --git a/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo_s.c b/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo_s.c index 04f10607c83e..e4dff271cdd9 100644 --- a/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo_s.c +++ b/bin.gen_ndr/default/librpc/gen_ndr/ndr_echo_s.c @@ -171,13 +171,35 @@ static NTSTATUS rpcecho__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_ break; } case 10: { - struct echo_BytePipeIn *r2 = (struct echo_BytePipeIn *)r; + struct echo_TestBytePipeIn *r2 = (struct echo_TestBytePipeIn *)r; if (DEBUGLEVEL >= 10) { - NDR_PRINT_FUNCTION_DEBUG(echo_BytePipeIn, NDR_IN, r2); + NDR_PRINT_FUNCTION_DEBUG(echo_TestBytePipeIn, NDR_IN, r2); } - r2->out.result = dcesrv_echo_BytePipeIn(dce_call, mem_ctx, r2); + r2->out.result = dcesrv_echo_TestBytePipeIn(dce_call, mem_ctx, r2); if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) { - DEBUG(5,("function echo_BytePipeIn will reply async\n")); + DEBUG(5,("function echo_TestBytePipeIn will reply async\n")); + } + break; + } + case 11: { + struct echo_TestBytePipeOut *r2 = (struct echo_TestBytePipeOut *)r; + if (DEBUGLEVEL >= 10) { + NDR_PRINT_FUNCTION_DEBUG(echo_TestBytePipeOut, NDR_IN, r2); + } + r2->out.result = dcesrv_echo_TestBytePipeOut(dce_call, mem_ctx, r2); + if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) { + DEBUG(5,("function echo_TestBytePipeOut will reply async\n")); + } + break; + } + case 12: { + struct echo_TestBytePipeInOut *r2 = (struct echo_TestBytePipeInOut *)r; + if (DEBUGLEVEL >= 10) { + NDR_PRINT_FUNCTION_DEBUG(echo_TestBytePipeInOut, NDR_IN, r2); + } + r2->out.result = dcesrv_echo_TestBytePipeInOut(dce_call, mem_ctx, r2); + if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) { + DEBUG(5,("function echo_TestBytePipeInOut will reply async\n")); } break; } @@ -333,15 +355,41 @@ static NTSTATUS rpcecho__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX break; } case 10: { - struct echo_BytePipeIn *r2 = (struct echo_BytePipeIn *)r; + struct echo_TestBytePipeIn *r2 = (struct echo_TestBytePipeIn *)r; + if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) { + DEBUG(5,("function echo_TestBytePipeIn replied async\n")); + } + if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) { + NDR_PRINT_FUNCTION_DEBUG(echo_TestBytePipeIn, NDR_OUT | NDR_SET_VALUES, r2); + } + if (dce_call->fault_code != 0) { + DEBUG(2,("dcerpc_fault %s in echo_TestBytePipeIn\n", dcerpc_errstr(mem_ctx, dce_call->fault_code))); + } + break; + } + case 11: { + struct echo_TestBytePipeOut *r2 = (struct echo_TestBytePipeOut *)r; + if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) { + DEBUG(5,("function echo_TestBytePipeOut replied async\n")); + } + if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) { + NDR_PRINT_FUNCTION_DEBUG(echo_TestBytePipeOut, NDR_OUT | NDR_SET_VALUES, r2); + } + if (dce_call->fault_code != 0) { + DEBUG(2,("dcerpc_fault %s in echo_TestBytePipeOut\n", dcerpc_errstr(mem_ctx, dce_call->fault_code))); + } + break; + } + case 12: { + struct echo_TestBytePipeInOut *r2 = (struct echo_TestBytePipeInOut *)r; if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) { - DEBUG(5,("function echo_BytePipeIn replied async\n")); + DEBUG(5,("function echo_TestBytePipeInOut replied async\n")); } if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) { - NDR_PRINT_FUNCTION_DEBUG(echo_BytePipeIn, NDR_OUT | NDR_SET_VALUES, r2); + NDR_PRINT_FUNCTION_DEBUG(echo_TestBytePipeInOut, NDR_OUT | NDR_SET_VALUES, r2); } if (dce_call->fault_code != 0) { - DEBUG(2,("dcerpc_fault %s in echo_BytePipeIn\n", dcerpc_errstr(mem_ctx, dce_call->fault_code))); + DEBUG(2,("dcerpc_fault %s in echo_TestBytePipeInOut\n", dcerpc_errstr(mem_ctx, dce_call->fault_code))); } break; } diff --git a/bin.gen_ndr/default/librpc/gen_ndr/srv_echo.c b/bin.gen_ndr/default/librpc/gen_ndr/srv_echo.c index 991880a415b1..08ac56d198b5 100644 --- a/bin.gen_ndr/default/librpc/gen_ndr/srv_echo.c +++ b/bin.gen_ndr/default/librpc/gen_ndr/srv_echo.c @@ -778,17 +778,17 @@ static bool api_echo_TestDoublePointer(struct pipes_struct *p) return true; } -static bool api_echo_BytePipeIn(struct pipes_struct *p) +static bool api_echo_TestBytePipeIn(struct pipes_struct *p) { const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; enum ndr_err_code ndr_err; - struct echo_BytePipeIn *r; + struct echo_TestBytePipeIn *r; - call = &ndr_table_rpcecho.calls[NDR_ECHO_BYTEPIPEIN]; + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTBYTEPIPEIN]; - r = talloc(talloc_tos(), struct echo_BytePipeIn); + r = talloc(talloc_tos(), struct echo_TestBytePipeIn); if (r == NULL) { return false; } @@ -810,10 +810,10 @@ static bool api_echo_BytePipeIn(struct pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_FUNCTION_DEBUG(echo_BytePipeIn, NDR_IN, r); + NDR_PRINT_FUNCTION_DEBUG(echo_TestBytePipeIn, NDR_IN, r); } - r->out.result = _echo_BytePipeIn(p, r); + r->out.result = _echo_TestBytePipeIn(p, r); if (p->fault_state) { talloc_free(r); @@ -822,7 +822,156 @@ static bool api_echo_BytePipeIn(struct pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_FUNCTION_DEBUG(echo_BytePipeIn, NDR_OUT | NDR_SET_VALUES, r); + NDR_PRINT_FUNCTION_DEBUG(echo_TestBytePipeIn, NDR_OUT | NDR_SET_VALUES, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + /* + * carry over the pointer count to the reply in case we are + * using full pointer. See NDR specification for full pointers + */ + push->ptr_count = pull->ptr_count; + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + p->out_data.rdata = ndr_push_blob(push); + talloc_steal(p->mem_ctx, p->out_data.rdata.data); + + talloc_free(r); + + return true; +} + +static bool api_echo_TestBytePipeOut(struct pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + struct echo_TestBytePipeOut *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTBYTEPIPEOUT]; + + r = talloc(talloc_tos(), struct echo_TestBytePipeOut); + if (r == NULL) { + return false; + } + + pull = ndr_pull_init_blob(&p->in_data.data, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + if (p->endian) { + pull->flags |= LIBNDR_FLAG_BIGENDIAN; + } + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_FUNCTION_DEBUG(echo_TestBytePipeOut, NDR_IN, r); + } + + ZERO_STRUCT(r->out); + r->out.result = _echo_TestBytePipeOut(p, r); + + if (p->fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_FUNCTION_DEBUG(echo_TestBytePipeOut, NDR_OUT | NDR_SET_VALUES, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + /* + * carry over the pointer count to the reply in case we are + * using full pointer. See NDR specification for full pointers + */ + push->ptr_count = pull->ptr_count; + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + p->out_data.rdata = ndr_push_blob(push); + talloc_steal(p->mem_ctx, p->out_data.rdata.data); + + talloc_free(r); + + return true; +} + +static bool api_echo_TestBytePipeInOut(struct pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + struct echo_TestBytePipeInOut *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTBYTEPIPEINOUT]; + + r = talloc(talloc_tos(), struct echo_TestBytePipeInOut); + if (r == NULL) { + return false; + } + + pull = ndr_pull_init_blob(&p->in_data.data, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + if (p->endian) { + pull->flags |= LIBNDR_FLAG_BIGENDIAN; + } + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_FUNCTION_DEBUG(echo_TestBytePipeInOut, NDR_IN, r); + } + + ZERO_STRUCT(r->out); + r->out.out_pipe = r->in.out_pipe; + r->out.result = _echo_TestBytePipeInOut(p, r); + + if (p->fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_FUNCTION_DEBUG(echo_TestBytePipeInOut, NDR_OUT | NDR_SET_VALUES, r); } push = ndr_push_init_ctx(r); @@ -865,7 +1014,9 @@ static struct api_struct api_rpcecho_cmds[] = {"ECHO_TESTENUM", NDR_ECHO_TESTENUM, api_echo_TestEnum}, {"ECHO_TESTSURROUNDING", NDR_ECHO_TESTSURROUNDING, api_echo_TestSurrounding}, {"ECHO_TESTDOUBLEPOINTER", NDR_ECHO_TESTDOUBLEPOINTER, api_echo_TestDoublePointer}, - {"ECHO_BYTEPIPEIN", NDR_ECHO_BYTEPIPEIN, api_echo_BytePipeIn}, + {"ECHO_TESTBYTEPIPEIN", NDR_ECHO_TESTBYTEPIPEIN, api_echo_TestBytePipeIn}, + {"ECHO_TESTBYTEPIPEOUT", NDR_ECHO_TESTBYTEPIPEOUT, api_echo_TestBytePipeOut}, + {"ECHO_TESTBYTEPIPEINOUT", NDR_ECHO_TESTBYTEPIPEINOUT, api_echo_TestBytePipeInOut}, }; void rpcecho_get_pipe_fns(struct api_struct **fns, int *n_fns) diff --git a/bin.gen_ndr/default/librpc/gen_ndr/srv_echo.h b/bin.gen_ndr/default/librpc/gen_ndr/srv_echo.h index 62e2ec583933..f939c1021f62 100644 --- a/bin.gen_ndr/default/librpc/gen_ndr/srv_echo.h +++ b/bin.gen_ndr/default/librpc/gen_ndr/srv_echo.h @@ -11,7 +11,9 @@ uint32 _echo_TestSleep(struct pipes_struct *p, struct echo_TestSleep *r); void _echo_TestEnum(struct pipes_struct *p, struct echo_TestEnum *r); void _echo_TestSurrounding(struct pipes_struct *p, struct echo_TestSurrounding *r); uint16 _echo_TestDoublePointer(struct pipes_struct *p, struct echo_TestDoublePointer *r); -uint32 _echo_BytePipeIn(struct pipes_struct *p, struct echo_BytePipeIn *r); +uint32 _echo_TestBytePipeIn(struct pipes_struct *p, struct echo_TestBytePipeIn *r); +uint32 _echo_TestBytePipeOut(struct pipes_struct *p, struct echo_TestBytePipeOut *r); +uint32 _echo_TestBytePipeInOut(struct pipes_struct *p, struct echo_TestBytePipeInOut *r); void rpcecho_get_pipe_fns(struct api_struct **fns, int *n_fns); struct rpc_srv_callbacks; NTSTATUS rpc_rpcecho_init(const struct rpc_srv_callbacks *rpc_srv_cb); diff --git a/bin.gen_ndr/default/librpc/gen_ndr/srv_frstrans.c b/bin.gen_ndr/default/librpc/gen_ndr/srv_frstrans.c index 08ac7ef1c7dd..377f293ad997 100644 --- a/bin.gen_ndr/default/librpc/gen_ndr/srv_frstrans.c +++ b/bin.gen_ndr/default/librpc/gen_ndr/srv_frstrans.c @@ -1222,12 +1222,6 @@ static bool api_frstrans_RawGetFileDataAsync(struct pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.byte_pipe = talloc_zero(r, struct frstrans_BytePipe); - if (r->out.byte_pipe == NULL) { - talloc_free(r); - return false; - } - r->out.result = _frstrans_RawGetFileDataAsync(p, r); if (p->fault_state) { @@ -1302,12 +1296,6 @@ static bool api_frstrans_RdcGetFileDataAsync(struct pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.byte_pipe = talloc_zero(r, struct frstrans_BytePipe); - if (r->out.byte_pipe == NULL) { - talloc_free(r); - return false; - } - r->out.result = _frstrans_RdcGetFileDataAsync(p, r); if (p->fault_state) { -- 2.34.1