From e5db7fee0f5cb3bd7434cdefebabc7a8376aa0d4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 15 Sep 2006 22:49:27 +0000 Subject: r18572: Use the autogenerated client and server for the echo interface and implement some of the missing functions. RPC-ECHO now passes against Samba3. (This used to be commit 9e9a05366176454cc1779acc6c2b6070743f5939) --- source3/librpc/gen_ndr/cli_echo.c | 203 +++++ source3/librpc/gen_ndr/cli_echo.h | 14 + source3/librpc/gen_ndr/echo.h | 195 +++++ source3/librpc/gen_ndr/ndr_echo.c | 1466 +++++++++++++++++++++++++++++++++++++ source3/librpc/gen_ndr/ndr_echo.h | 59 ++ source3/librpc/gen_ndr/srv_echo.c | 568 ++++++++++++++ source3/librpc/gen_ndr/srv_echo.h | 16 + source3/librpc/ndr/ndr_basic.c | 5 +- 8 files changed, 2522 insertions(+), 4 deletions(-) create mode 100644 source3/librpc/gen_ndr/cli_echo.c create mode 100644 source3/librpc/gen_ndr/cli_echo.h create mode 100644 source3/librpc/gen_ndr/echo.h create mode 100644 source3/librpc/gen_ndr/ndr_echo.c create mode 100644 source3/librpc/gen_ndr/ndr_echo.h create mode 100644 source3/librpc/gen_ndr/srv_echo.c create mode 100644 source3/librpc/gen_ndr/srv_echo.h (limited to 'source3/librpc') diff --git a/source3/librpc/gen_ndr/cli_echo.c b/source3/librpc/gen_ndr/cli_echo.c new file mode 100644 index 0000000000..8632077055 --- /dev/null +++ b/source3/librpc/gen_ndr/cli_echo.c @@ -0,0 +1,203 @@ +/* + * Unix SMB/CIFS implementation. + * client auto-generated by pidl. DO NOT MODIFY! + */ + +#include "includes.h" +#include "librpc/gen_ndr/cli_echo.h" + +NTSTATUS rpccli_echo_AddOne(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t in_data, uint32_t *out_data) +{ + struct echo_AddOne r; + NTSTATUS status; + + /* In parameters */ + r.in.in_data = in_data; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_ADDONE, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_AddOne, (ndr_push_flags_fn_t)ndr_push_echo_AddOne); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *out_data = *r.out.out_data; + + /* Return result */ + return NT_STATUS_OK; +} + +NTSTATUS rpccli_echo_EchoData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *in_data, uint8_t *out_data) +{ + struct echo_EchoData r; + NTSTATUS status; + + /* In parameters */ + r.in.len = len; + r.in.in_data = in_data; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_ECHODATA, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_EchoData, (ndr_push_flags_fn_t)ndr_push_echo_EchoData); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *out_data = *r.out.out_data; + + /* Return result */ + return NT_STATUS_OK; +} + +NTSTATUS rpccli_echo_SinkData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *data) +{ + struct echo_SinkData r; + NTSTATUS status; + + /* In parameters */ + r.in.len = len; + r.in.data = data; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_SINKDATA, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_SinkData, (ndr_push_flags_fn_t)ndr_push_echo_SinkData); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return NT_STATUS_OK; +} + +NTSTATUS rpccli_echo_SourceData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *data) +{ + struct echo_SourceData r; + NTSTATUS status; + + /* In parameters */ + r.in.len = len; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_SOURCEDATA, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_SourceData, (ndr_push_flags_fn_t)ndr_push_echo_SourceData); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *data = *r.out.data; + + /* Return result */ + return NT_STATUS_OK; +} + +NTSTATUS rpccli_echo_TestCall(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *s1, const char **s2) +{ + struct echo_TestCall r; + NTSTATUS status; + + /* In parameters */ + r.in.s1 = s1; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_TESTCALL, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_TestCall, (ndr_push_flags_fn_t)ndr_push_echo_TestCall); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *s2 = *r.out.s2; + + /* Return result */ + return NT_STATUS_OK; +} + +NTSTATUS rpccli_echo_TestCall2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t level, union echo_Info *info) +{ + struct echo_TestCall2 r; + NTSTATUS status; + + /* In parameters */ + r.in.level = level; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_TESTCALL2, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_TestCall2, (ndr_push_flags_fn_t)ndr_push_echo_TestCall2); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *info = *r.out.info; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_echo_TestSleep(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t seconds) +{ + struct echo_TestSleep r; + NTSTATUS status; + + /* In parameters */ + r.in.seconds = seconds; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_TESTSLEEP, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_TestSleep, (ndr_push_flags_fn_t)ndr_push_echo_TestSleep); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + /* Sorry, don't know how to convert uint32 to NTSTATUS */ + return NT_STATUS_OK; +} + +NTSTATUS rpccli_echo_TestEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, enum echo_Enum1 *foo1, struct echo_Enum2 *foo2, union echo_Enum3 *foo3) +{ + struct echo_TestEnum r; + NTSTATUS status; + + /* In parameters */ + r.in.foo1 = foo1; + r.in.foo2 = foo2; + r.in.foo3 = foo3; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_TESTENUM, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_TestEnum, (ndr_push_flags_fn_t)ndr_push_echo_TestEnum); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *foo1 = *r.out.foo1; + *foo2 = *r.out.foo2; + *foo3 = *r.out.foo3; + + /* Return result */ + return NT_STATUS_OK; +} + +NTSTATUS rpccli_echo_TestSurrounding(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct echo_Surrounding *data) +{ + struct echo_TestSurrounding r; + NTSTATUS status; + + /* In parameters */ + r.in.data = data; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_TESTSURROUNDING, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_TestSurrounding, (ndr_push_flags_fn_t)ndr_push_echo_TestSurrounding); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *data = *r.out.data; + + /* Return result */ + return NT_STATUS_OK; +} + +NTSTATUS rpccli_echo_TestDoublePointer(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t ***data) +{ + struct echo_TestDoublePointer r; + NTSTATUS status; + + /* In parameters */ + r.in.data = data; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_TESTDOUBLEPOINTER, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_TestDoublePointer, (ndr_push_flags_fn_t)ndr_push_echo_TestDoublePointer); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + /* Sorry, don't know how to convert uint16 to NTSTATUS */ + return NT_STATUS_OK; +} + diff --git a/source3/librpc/gen_ndr/cli_echo.h b/source3/librpc/gen_ndr/cli_echo.h new file mode 100644 index 0000000000..d7e7f31704 --- /dev/null +++ b/source3/librpc/gen_ndr/cli_echo.h @@ -0,0 +1,14 @@ +#include "librpc/gen_ndr/ndr_echo.h" +#ifndef __CLI_RPCECHO__ +#define __CLI_RPCECHO__ +NTSTATUS rpccli_echo_AddOne(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t in_data, uint32_t *out_data); +NTSTATUS rpccli_echo_EchoData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *in_data, uint8_t *out_data); +NTSTATUS rpccli_echo_SinkData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *data); +NTSTATUS rpccli_echo_SourceData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *data); +NTSTATUS rpccli_echo_TestCall(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *s1, const char **s2); +NTSTATUS rpccli_echo_TestCall2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t level, union echo_Info *info); +NTSTATUS rpccli_echo_TestSleep(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t seconds); +NTSTATUS rpccli_echo_TestEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, enum echo_Enum1 *foo1, struct echo_Enum2 *foo2, union echo_Enum3 *foo3); +NTSTATUS rpccli_echo_TestSurrounding(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct echo_Surrounding *data); +NTSTATUS rpccli_echo_TestDoublePointer(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t ***data); +#endif /* __CLI_RPCECHO__ */ diff --git a/source3/librpc/gen_ndr/echo.h b/source3/librpc/gen_ndr/echo.h new file mode 100644 index 0000000000..d6ee5b1e63 --- /dev/null +++ b/source3/librpc/gen_ndr/echo.h @@ -0,0 +1,195 @@ +/* header auto-generated by pidl */ + +#ifndef _HEADER_rpcecho +#define _HEADER_rpcecho + +struct echo_info1 { + uint8_t v;/* [keepref] */ +}; + +struct echo_info2 { + uint16_t v;/* [keepref] */ +}; + +struct echo_info3 { + uint32_t v;/* [keepref] */ +}; + +struct echo_info4 { + uint64_t v;/* [keepref] */ +}; + +struct echo_info5 { + uint8_t v1;/* [keepref] */ + uint64_t v2;/* [keepref] */ +}; + +struct echo_info6 { + uint8_t v1;/* [keepref] */ + struct echo_info1 info1;/* [keepref] */ +}; + +struct echo_info7 { + uint8_t v1;/* [keepref] */ + struct echo_info4 info4;/* [keepref] */ +}; + +union echo_Info { + struct echo_info1 info1;/* [keepref,case] */ + struct echo_info2 info2;/* [keepref,case(2)] */ + struct echo_info3 info3;/* [keepref,case(3)] */ + struct echo_info4 info4;/* [keepref,case(4)] */ + struct echo_info5 info5;/* [keepref,case(5)] */ + struct echo_info6 info6;/* [keepref,case(6)] */ + struct echo_info7 info7;/* [keepref,case(7)] */ +}/* [switch_type(uint16)] */; + +enum echo_Enum1 { + ECHO_ENUM1=1, + ECHO_ENUM2=2 +}; + +enum echo_Enum1_32 { + ECHO_ENUM1_32=1, + ECHO_ENUM2_32=2 +}; + +struct echo_Enum2 { + enum echo_Enum1 e1;/* [keepref] */ + enum echo_Enum1_32 e2;/* [keepref] */ +}; + +union echo_Enum3 { + enum echo_Enum1 e1;/* [keepref,case(ECHO_ENUM1)] */ + struct echo_Enum2 e2;/* [keepref,case(ECHO_ENUM2)] */ +}/* [switch_type(uint16)] */; + +struct echo_Surrounding { + uint32_t x;/* [keepref] */ + uint16_t *surrounding;/* [keepref,size_is(x)] */ +}; + + +struct echo_AddOne { + struct { + uint32_t in_data;/* [keepref] */ + } in; + + struct { + uint32_t *out_data;/* [keepref,ref] */ + } out; + +}; + + +struct echo_EchoData { + struct { + uint32_t len;/* [keepref] */ + uint8_t *in_data;/* [keepref,size_is(len)] */ + } in; + + struct { + uint8_t *out_data;/* [keepref,size_is(len)] */ + } out; + +}; + + +struct echo_SinkData { + struct { + uint32_t len;/* [keepref] */ + uint8_t *data;/* [keepref,size_is(len)] */ + } in; + +}; + + +struct echo_SourceData { + struct { + uint32_t len;/* [keepref] */ + } in; + + struct { + uint8_t *data;/* [keepref,size_is(len)] */ + } out; + +}; + + +struct echo_TestCall { + struct { + const char *s1;/* [keepref,ref,charset(UTF16)] */ + } in; + + struct { + const char **s2;/* [keepref,ref,charset(UTF16)] */ + } out; + +}; + + +struct echo_TestCall2 { + struct { + uint16_t level;/* [keepref] */ + } in; + + struct { + union echo_Info *info;/* [keepref,ref,switch_is(level)] */ + NTSTATUS result; + } out; + +}; + + +struct echo_TestSleep { + struct { + uint32_t seconds;/* [keepref] */ + } in; + + struct { + uint32_t result; + } out; + +}; + + +struct echo_TestEnum { + struct { + enum echo_Enum1 *foo1;/* [keepref,ref] */ + struct echo_Enum2 *foo2;/* [keepref,ref] */ + union echo_Enum3 *foo3;/* [keepref,ref,switch_is(*foo1)] */ + } in; + + struct { + enum echo_Enum1 *foo1;/* [keepref,ref] */ + struct echo_Enum2 *foo2;/* [keepref,ref] */ + union echo_Enum3 *foo3;/* [keepref,ref,switch_is(*foo1)] */ + } out; + +}; + + +struct echo_TestSurrounding { + struct { + struct echo_Surrounding *data;/* [keepref,ref] */ + } in; + + struct { + struct echo_Surrounding *data;/* [keepref,ref] */ + } out; + +}; + + +struct echo_TestDoublePointer { + struct { + uint16_t ***data;/* [keepref,ref] */ + } in; + + struct { + uint16_t result; + } out; + +}; + +#endif /* _HEADER_rpcecho */ diff --git a/source3/librpc/gen_ndr/ndr_echo.c b/source3/librpc/gen_ndr/ndr_echo.c new file mode 100644 index 0000000000..8f71f886d5 --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_echo.c @@ -0,0 +1,1466 @@ +/* parser auto-generated by pidl */ + +#include "includes.h" +#include "librpc/gen_ndr/ndr_echo.h" + +NTSTATUS ndr_push_echo_info1(struct ndr_push *ndr, int ndr_flags, const struct echo_info1 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 1)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->v)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_info1(struct ndr_pull *ndr, int ndr_flags, struct echo_info1 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 1)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->v)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_info1(struct ndr_print *ndr, const char *name, const struct echo_info1 *r) +{ + ndr_print_struct(ndr, name, "echo_info1"); + ndr->depth++; + ndr_print_uint8(ndr, "v", r->v); + ndr->depth--; +} + +NTSTATUS ndr_push_echo_info2(struct ndr_push *ndr, int ndr_flags, const struct echo_info2 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 2)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->v)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_info2(struct ndr_pull *ndr, int ndr_flags, struct echo_info2 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 2)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->v)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_info2(struct ndr_print *ndr, const char *name, const struct echo_info2 *r) +{ + ndr_print_struct(ndr, name, "echo_info2"); + ndr->depth++; + ndr_print_uint16(ndr, "v", r->v); + ndr->depth--; +} + +NTSTATUS ndr_push_echo_info3(struct ndr_push *ndr, int ndr_flags, const struct echo_info3 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->v)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_info3(struct ndr_pull *ndr, int ndr_flags, struct echo_info3 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->v)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_info3(struct ndr_print *ndr, const char *name, const struct echo_info3 *r) +{ + ndr_print_struct(ndr, name, "echo_info3"); + ndr->depth++; + ndr_print_uint32(ndr, "v", r->v); + ndr->depth--; +} + +NTSTATUS ndr_push_echo_info4(struct ndr_push *ndr, int ndr_flags, const struct echo_info4 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->v)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_info4(struct ndr_pull *ndr, int ndr_flags, struct echo_info4 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->v)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_info4(struct ndr_print *ndr, const char *name, const struct echo_info4 *r) +{ + ndr_print_struct(ndr, name, "echo_info4"); + ndr->depth++; + ndr_print_hyper(ndr, "v", r->v); + ndr->depth--; +} + +NTSTATUS ndr_push_echo_info5(struct ndr_push *ndr, int ndr_flags, const struct echo_info5 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->v1)); + NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->v2)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_info5(struct ndr_pull *ndr, int ndr_flags, struct echo_info5 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->v1)); + NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->v2)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_info5(struct ndr_print *ndr, const char *name, const struct echo_info5 *r) +{ + ndr_print_struct(ndr, name, "echo_info5"); + ndr->depth++; + ndr_print_uint8(ndr, "v1", r->v1); + ndr_print_hyper(ndr, "v2", r->v2); + ndr->depth--; +} + +NTSTATUS ndr_push_echo_info6(struct ndr_push *ndr, int ndr_flags, const struct echo_info6 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 1)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->v1)); + NDR_CHECK(ndr_push_echo_info1(ndr, NDR_SCALARS, &r->info1)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_info6(struct ndr_pull *ndr, int ndr_flags, struct echo_info6 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 1)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->v1)); + NDR_CHECK(ndr_pull_echo_info1(ndr, NDR_SCALARS, &r->info1)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_info6(struct ndr_print *ndr, const char *name, const struct echo_info6 *r) +{ + ndr_print_struct(ndr, name, "echo_info6"); + ndr->depth++; + ndr_print_uint8(ndr, "v1", r->v1); + ndr_print_echo_info1(ndr, "info1", &r->info1); + ndr->depth--; +} + +NTSTATUS ndr_push_echo_info7(struct ndr_push *ndr, int ndr_flags, const struct echo_info7 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->v1)); + NDR_CHECK(ndr_push_echo_info4(ndr, NDR_SCALARS, &r->info4)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_info7(struct ndr_pull *ndr, int ndr_flags, struct echo_info7 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->v1)); + NDR_CHECK(ndr_pull_echo_info4(ndr, NDR_SCALARS, &r->info4)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_info7(struct ndr_print *ndr, const char *name, const struct echo_info7 *r) +{ + ndr_print_struct(ndr, name, "echo_info7"); + ndr->depth++; + ndr_print_uint8(ndr, "v1", r->v1); + ndr_print_echo_info4(ndr, "info4", &r->info4); + ndr->depth--; +} + +NTSTATUS ndr_push_echo_Info(struct ndr_push *ndr, int ndr_flags, const union echo_Info *r) +{ + int level; + level = ndr_push_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level)); + switch (level) { + case 1: + NDR_CHECK(ndr_push_echo_info1(ndr, NDR_SCALARS, &r->info1)); + break; + + case 2: + NDR_CHECK(ndr_push_echo_info2(ndr, NDR_SCALARS, &r->info2)); + break; + + case 3: + NDR_CHECK(ndr_push_echo_info3(ndr, NDR_SCALARS, &r->info3)); + break; + + case 4: + NDR_CHECK(ndr_push_echo_info4(ndr, NDR_SCALARS, &r->info4)); + break; + + case 5: + NDR_CHECK(ndr_push_echo_info5(ndr, NDR_SCALARS, &r->info5)); + break; + + case 6: + NDR_CHECK(ndr_push_echo_info6(ndr, NDR_SCALARS, &r->info6)); + break; + + case 7: + NDR_CHECK(ndr_push_echo_info7(ndr, NDR_SCALARS, &r->info7)); + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case 1: + break; + + case 2: + break; + + case 3: + break; + + case 4: + break; + + case 5: + break; + + case 6: + break; + + case 7: + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_Info(struct ndr_pull *ndr, int ndr_flags, union echo_Info *r) +{ + int level; + uint16_t _level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level)); + if (_level != level) { + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for echo_Info", _level); + } + switch (level) { + case 1: { + NDR_CHECK(ndr_pull_echo_info1(ndr, NDR_SCALARS, &r->info1)); + break; } + + case 2: { + NDR_CHECK(ndr_pull_echo_info2(ndr, NDR_SCALARS, &r->info2)); + break; } + + case 3: { + NDR_CHECK(ndr_pull_echo_info3(ndr, NDR_SCALARS, &r->info3)); + break; } + + case 4: { + NDR_CHECK(ndr_pull_echo_info4(ndr, NDR_SCALARS, &r->info4)); + break; } + + case 5: { + NDR_CHECK(ndr_pull_echo_info5(ndr, NDR_SCALARS, &r->info5)); + break; } + + case 6: { + NDR_CHECK(ndr_pull_echo_info6(ndr, NDR_SCALARS, &r->info6)); + break; } + + case 7: { + NDR_CHECK(ndr_pull_echo_info7(ndr, NDR_SCALARS, &r->info7)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case 1: + break; + + case 2: + break; + + case 3: + break; + + case 4: + break; + + case 5: + break; + + case 6: + break; + + case 7: + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_Info(struct ndr_print *ndr, const char *name, const union echo_Info *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "echo_Info"); + switch (level) { + case 1: + ndr_print_echo_info1(ndr, "info1", &r->info1); + break; + + case 2: + ndr_print_echo_info2(ndr, "info2", &r->info2); + break; + + case 3: + ndr_print_echo_info3(ndr, "info3", &r->info3); + break; + + case 4: + ndr_print_echo_info4(ndr, "info4", &r->info4); + break; + + case 5: + ndr_print_echo_info5(ndr, "info5", &r->info5); + break; + + case 6: + ndr_print_echo_info6(ndr, "info6", &r->info6); + break; + + case 7: + ndr_print_echo_info7(ndr, "info7", &r->info7); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +NTSTATUS ndr_push_echo_Enum1(struct ndr_push *ndr, int ndr_flags, enum echo_Enum1 r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_Enum1(struct ndr_pull *ndr, int ndr_flags, enum echo_Enum1 *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_Enum1(struct ndr_print *ndr, const char *name, enum echo_Enum1 r) +{ + const char *val = NULL; + + switch (r) { + case ECHO_ENUM1: val = "ECHO_ENUM1"; break; + case ECHO_ENUM2: val = "ECHO_ENUM2"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +NTSTATUS ndr_push_echo_Enum1_32(struct ndr_push *ndr, int ndr_flags, enum echo_Enum1_32 r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_Enum1_32(struct ndr_pull *ndr, int ndr_flags, enum echo_Enum1_32 *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_Enum1_32(struct ndr_print *ndr, const char *name, enum echo_Enum1_32 r) +{ + const char *val = NULL; + + switch (r) { + case ECHO_ENUM1_32: val = "ECHO_ENUM1_32"; break; + case ECHO_ENUM2_32: val = "ECHO_ENUM2_32"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +NTSTATUS ndr_push_echo_Enum2(struct ndr_push *ndr, int ndr_flags, const struct echo_Enum2 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_echo_Enum1(ndr, NDR_SCALARS, r->e1)); + NDR_CHECK(ndr_push_echo_Enum1_32(ndr, NDR_SCALARS, r->e2)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_Enum2(struct ndr_pull *ndr, int ndr_flags, struct echo_Enum2 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_echo_Enum1(ndr, NDR_SCALARS, &r->e1)); + NDR_CHECK(ndr_pull_echo_Enum1_32(ndr, NDR_SCALARS, &r->e2)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_Enum2(struct ndr_print *ndr, const char *name, const struct echo_Enum2 *r) +{ + ndr_print_struct(ndr, name, "echo_Enum2"); + ndr->depth++; + ndr_print_echo_Enum1(ndr, "e1", r->e1); + ndr_print_echo_Enum1_32(ndr, "e2", r->e2); + ndr->depth--; +} + +NTSTATUS ndr_push_echo_Enum3(struct ndr_push *ndr, int ndr_flags, const union echo_Enum3 *r) +{ + int level; + level = ndr_push_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level)); + switch (level) { + case ECHO_ENUM1: + NDR_CHECK(ndr_push_echo_Enum1(ndr, NDR_SCALARS, r->e1)); + break; + + case ECHO_ENUM2: + NDR_CHECK(ndr_push_echo_Enum2(ndr, NDR_SCALARS, &r->e2)); + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case ECHO_ENUM1: + break; + + case ECHO_ENUM2: + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_Enum3(struct ndr_pull *ndr, int ndr_flags, union echo_Enum3 *r) +{ + int level; + uint16_t _level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level)); + if (_level != level) { + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for echo_Enum3", _level); + } + switch (level) { + case ECHO_ENUM1: { + NDR_CHECK(ndr_pull_echo_Enum1(ndr, NDR_SCALARS, &r->e1)); + break; } + + case ECHO_ENUM2: { + NDR_CHECK(ndr_pull_echo_Enum2(ndr, NDR_SCALARS, &r->e2)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case ECHO_ENUM1: + break; + + case ECHO_ENUM2: + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_Enum3(struct ndr_print *ndr, const char *name, const union echo_Enum3 *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "echo_Enum3"); + switch (level) { + case ECHO_ENUM1: + ndr_print_echo_Enum1(ndr, "e1", r->e1); + break; + + case ECHO_ENUM2: + ndr_print_echo_Enum2(ndr, "e2", &r->e2); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +NTSTATUS ndr_push_echo_Surrounding(struct ndr_push *ndr, int ndr_flags, const struct echo_Surrounding *r) +{ + uint32_t cntr_surrounding_0; + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->x)); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->x)); + for (cntr_surrounding_0 = 0; cntr_surrounding_0 < r->x; cntr_surrounding_0++) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->surrounding[cntr_surrounding_0])); + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_Surrounding(struct ndr_pull *ndr, int ndr_flags, struct echo_Surrounding *r) +{ + uint32_t cntr_surrounding_0; + TALLOC_CTX *_mem_save_surrounding_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_array_size(ndr, &r->surrounding)); + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->x)); + NDR_PULL_ALLOC_N(ndr, r->surrounding, ndr_get_array_size(ndr, &r->surrounding)); + _mem_save_surrounding_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->surrounding, 0); + for (cntr_surrounding_0 = 0; cntr_surrounding_0 < r->x; cntr_surrounding_0++) { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->surrounding[cntr_surrounding_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_surrounding_0, 0); + if (r->surrounding) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->surrounding, r->x)); + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_Surrounding(struct ndr_print *ndr, const char *name, const struct echo_Surrounding *r) +{ + uint32_t cntr_surrounding_0; + ndr_print_struct(ndr, name, "echo_Surrounding"); + ndr->depth++; + ndr_print_uint32(ndr, "x", r->x); + ndr->print(ndr, "%s: ARRAY(%d)", "surrounding", r->x); + ndr->depth++; + for (cntr_surrounding_0=0;cntr_surrounding_0x;cntr_surrounding_0++) { + char *idx_0=NULL; + asprintf(&idx_0, "[%d]", cntr_surrounding_0); + if (idx_0) { + ndr_print_uint16(ndr, "surrounding", r->surrounding[cntr_surrounding_0]); + free(idx_0); + } + } + ndr->depth--; + ndr->depth--; +} + +NTSTATUS ndr_push_echo_AddOne(struct ndr_push *ndr, int flags, const struct echo_AddOne *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.in_data)); + } + if (flags & NDR_OUT) { + if (r->out.out_data == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.out_data)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_AddOne(struct ndr_pull *ndr, int flags, struct echo_AddOne *r) +{ + TALLOC_CTX *_mem_save_out_data_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.in_data)); + NDR_PULL_ALLOC(ndr, r->out.out_data); + ZERO_STRUCTP(r->out.out_data); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.out_data); + } + _mem_save_out_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.out_data, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.out_data)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_out_data_0, LIBNDR_FLAG_REF_ALLOC); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_AddOne(struct ndr_print *ndr, const char *name, int flags, const struct echo_AddOne *r) +{ + ndr_print_struct(ndr, name, "echo_AddOne"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "echo_AddOne"); + ndr->depth++; + ndr_print_uint32(ndr, "in_data", r->in.in_data); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "echo_AddOne"); + ndr->depth++; + ndr_print_ptr(ndr, "out_data", r->out.out_data); + ndr->depth++; + ndr_print_uint32(ndr, "out_data", *r->out.out_data); + ndr->depth--; + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_echo_EchoData(struct ndr_push *ndr, int flags, const struct echo_EchoData *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.len)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.len)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.in_data, r->in.len)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.len)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.out_data, r->in.len)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_EchoData(struct ndr_pull *ndr, int flags, struct echo_EchoData *r) +{ + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.len)); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.in_data)); + NDR_PULL_ALLOC_N(ndr, r->in.in_data, ndr_get_array_size(ndr, &r->in.in_data)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.in_data, ndr_get_array_size(ndr, &r->in.in_data))); + if (r->in.in_data) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.in_data, r->in.len)); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_array_size(ndr, &r->out.out_data)); + NDR_PULL_ALLOC_N(ndr, r->out.out_data, ndr_get_array_size(ndr, &r->out.out_data)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.out_data, ndr_get_array_size(ndr, &r->out.out_data))); + if (r->out.out_data) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.out_data, r->in.len)); + } + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_EchoData(struct ndr_print *ndr, const char *name, int flags, const struct echo_EchoData *r) +{ + ndr_print_struct(ndr, name, "echo_EchoData"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "echo_EchoData"); + ndr->depth++; + ndr_print_uint32(ndr, "len", r->in.len); + ndr_print_array_uint8(ndr, "in_data", r->in.in_data, r->in.len); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "echo_EchoData"); + ndr->depth++; + ndr_print_array_uint8(ndr, "out_data", r->out.out_data, r->in.len); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_echo_SinkData(struct ndr_push *ndr, int flags, const struct echo_SinkData *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.len)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.len)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.data, r->in.len)); + } + if (flags & NDR_OUT) { + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_SinkData(struct ndr_pull *ndr, int flags, struct echo_SinkData *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.len)); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.data)); + NDR_PULL_ALLOC_N(ndr, r->in.data, ndr_get_array_size(ndr, &r->in.data)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.data, ndr_get_array_size(ndr, &r->in.data))); + if (r->in.data) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.data, r->in.len)); + } + } + if (flags & NDR_OUT) { + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_SinkData(struct ndr_print *ndr, const char *name, int flags, const struct echo_SinkData *r) +{ + ndr_print_struct(ndr, name, "echo_SinkData"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "echo_SinkData"); + ndr->depth++; + ndr_print_uint32(ndr, "len", r->in.len); + ndr_print_array_uint8(ndr, "data", r->in.data, r->in.len); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "echo_SinkData"); + ndr->depth++; + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_echo_SourceData(struct ndr_push *ndr, int flags, const struct echo_SourceData *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.len)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.len)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.data, r->in.len)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_SourceData(struct ndr_pull *ndr, int flags, struct echo_SourceData *r) +{ + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.len)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_array_size(ndr, &r->out.data)); + NDR_PULL_ALLOC_N(ndr, r->out.data, ndr_get_array_size(ndr, &r->out.data)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.data, ndr_get_array_size(ndr, &r->out.data))); + if (r->out.data) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.data, r->in.len)); + } + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_SourceData(struct ndr_print *ndr, const char *name, int flags, const struct echo_SourceData *r) +{ + ndr_print_struct(ndr, name, "echo_SourceData"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "echo_SourceData"); + ndr->depth++; + ndr_print_uint32(ndr, "len", r->in.len); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "echo_SourceData"); + ndr->depth++; + ndr_print_array_uint8(ndr, "data", r->out.data, r->in.len); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_echo_TestCall(struct ndr_push *ndr, int flags, const struct echo_TestCall *r) +{ + if (flags & NDR_IN) { + if (r->in.s1 == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.s1, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.s1, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.s1, ndr_charset_length(r->in.s1, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + if (flags & NDR_OUT) { + if (r->out.s2 == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + if (*r->out.s2 == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_ref_ptr(ndr)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.s2, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.s2, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.s2, ndr_charset_length(*r->out.s2, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_TestCall(struct ndr_pull *ndr, int flags, struct echo_TestCall *r) +{ + uint32_t _ptr_s2; + TALLOC_CTX *_mem_save_s2_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.s1)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.s1)); + if (ndr_get_array_length(ndr, &r->in.s1) > ndr_get_array_size(ndr, &r->in.s1)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.s1), ndr_get_array_length(ndr, &r->in.s1)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.s1), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.s1, ndr_get_array_length(ndr, &r->in.s1), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_ALLOC(ndr, r->out.s2); + ZERO_STRUCTP(r->out.s2); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.s2); + } + _mem_save_s2_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.s2, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_s2)); + NDR_CHECK(ndr_pull_array_size(ndr, r->out.s2)); + NDR_CHECK(ndr_pull_array_length(ndr, r->out.s2)); + if (ndr_get_array_length(ndr, r->out.s2) > ndr_get_array_size(ndr, r->out.s2)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.s2), ndr_get_array_length(ndr, r->out.s2)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.s2), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.s2, ndr_get_array_length(ndr, r->out.s2), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_s2_0, LIBNDR_FLAG_REF_ALLOC); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_TestCall(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestCall *r) +{ + ndr_print_struct(ndr, name, "echo_TestCall"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "echo_TestCall"); + ndr->depth++; + ndr_print_ptr(ndr, "s1", r->in.s1); + ndr->depth++; + ndr_print_string(ndr, "s1", r->in.s1); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "echo_TestCall"); + ndr->depth++; + ndr_print_ptr(ndr, "s2", r->out.s2); + ndr->depth++; + ndr_print_ptr(ndr, "s2", *r->out.s2); + ndr->depth++; + ndr_print_string(ndr, "s2", *r->out.s2); + ndr->depth--; + ndr->depth--; + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_echo_TestCall2(struct ndr_push *ndr, int flags, const struct echo_TestCall2 *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + } + if (flags & NDR_OUT) { + if (r->out.info == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_push_echo_Info(ndr, NDR_SCALARS, r->out.info)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_TestCall2(struct ndr_pull *ndr, int flags, struct echo_TestCall2 *r) +{ + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_pull_echo_Info(ndr, NDR_SCALARS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_TestCall2(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestCall2 *r) +{ + ndr_print_struct(ndr, name, "echo_TestCall2"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "echo_TestCall2"); + ndr->depth++; + ndr_print_uint16(ndr, "level", r->in.level); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "echo_TestCall2"); + ndr->depth++; + ndr_print_ptr(ndr, "info", r->out.info); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->out.info, r->in.level); + ndr_print_echo_Info(ndr, "info", r->out.info); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_echo_TestSleep(struct ndr_push *ndr, int flags, const struct echo_TestSleep *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.seconds)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_TestSleep(struct ndr_pull *ndr, int flags, struct echo_TestSleep *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.seconds)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_TestSleep(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestSleep *r) +{ + ndr_print_struct(ndr, name, "echo_TestSleep"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "echo_TestSleep"); + ndr->depth++; + ndr_print_uint32(ndr, "seconds", r->in.seconds); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "echo_TestSleep"); + ndr->depth++; + ndr_print_uint32(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_echo_TestEnum(struct ndr_push *ndr, int flags, const struct echo_TestEnum *r) +{ + if (flags & NDR_IN) { + if (r->in.foo1 == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_echo_Enum1(ndr, NDR_SCALARS, *r->in.foo1)); + if (r->in.foo2 == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_echo_Enum2(ndr, NDR_SCALARS, r->in.foo2)); + if (r->in.foo3 == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + if (r->in.foo1 == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.foo3, *r->in.foo1)); + NDR_CHECK(ndr_push_echo_Enum3(ndr, NDR_SCALARS, r->in.foo3)); + } + if (flags & NDR_OUT) { + if (r->out.foo1 == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_echo_Enum1(ndr, NDR_SCALARS, *r->out.foo1)); + if (r->out.foo2 == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_echo_Enum2(ndr, NDR_SCALARS, r->out.foo2)); + if (r->out.foo3 == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + if (r->out.foo1 == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.foo3, *r->out.foo1)); + NDR_CHECK(ndr_push_echo_Enum3(ndr, NDR_SCALARS, r->out.foo3)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_TestEnum(struct ndr_pull *ndr, int flags, struct echo_TestEnum *r) +{ + TALLOC_CTX *_mem_save_foo1_0; + TALLOC_CTX *_mem_save_foo2_0; + TALLOC_CTX *_mem_save_foo3_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.foo1); + } + _mem_save_foo1_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.foo1, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_echo_Enum1(ndr, NDR_SCALARS, r->in.foo1)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_foo1_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.foo2); + } + _mem_save_foo2_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.foo2, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_echo_Enum2(ndr, NDR_SCALARS, r->in.foo2)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_foo2_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.foo3); + } + _mem_save_foo3_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.foo3, LIBNDR_FLAG_REF_ALLOC); + if (r->in.foo1 == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.foo3, *r->in.foo1)); + NDR_CHECK(ndr_pull_echo_Enum3(ndr, NDR_SCALARS, r->in.foo3)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_foo3_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.foo1); + *r->out.foo1 = *r->in.foo1; + NDR_PULL_ALLOC(ndr, r->out.foo2); + *r->out.foo2 = *r->in.foo2; + NDR_PULL_ALLOC(ndr, r->out.foo3); + *r->out.foo3 = *r->in.foo3; + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.foo1); + } + _mem_save_foo1_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.foo1, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_echo_Enum1(ndr, NDR_SCALARS, r->out.foo1)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_foo1_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.foo2); + } + _mem_save_foo2_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.foo2, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_echo_Enum2(ndr, NDR_SCALARS, r->out.foo2)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_foo2_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.foo3); + } + _mem_save_foo3_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.foo3, LIBNDR_FLAG_REF_ALLOC); + if (r->out.foo1 == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.foo3, *r->out.foo1)); + NDR_CHECK(ndr_pull_echo_Enum3(ndr, NDR_SCALARS, r->out.foo3)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_foo3_0, LIBNDR_FLAG_REF_ALLOC); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_TestEnum(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestEnum *r) +{ + ndr_print_struct(ndr, name, "echo_TestEnum"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "echo_TestEnum"); + ndr->depth++; + ndr_print_ptr(ndr, "foo1", r->in.foo1); + ndr->depth++; + ndr_print_echo_Enum1(ndr, "foo1", *r->in.foo1); + ndr->depth--; + ndr_print_ptr(ndr, "foo2", r->in.foo2); + ndr->depth++; + ndr_print_echo_Enum2(ndr, "foo2", r->in.foo2); + ndr->depth--; + ndr_print_ptr(ndr, "foo3", r->in.foo3); + ndr->depth++; + if (r->in.foo1 == NULL) return; + ndr_print_set_switch_value(ndr, r->in.foo3, *r->in.foo1); + ndr_print_echo_Enum3(ndr, "foo3", r->in.foo3); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "echo_TestEnum"); + ndr->depth++; + ndr_print_ptr(ndr, "foo1", r->out.foo1); + ndr->depth++; + ndr_print_echo_Enum1(ndr, "foo1", *r->out.foo1); + ndr->depth--; + ndr_print_ptr(ndr, "foo2", r->out.foo2); + ndr->depth++; + ndr_print_echo_Enum2(ndr, "foo2", r->out.foo2); + ndr->depth--; + ndr_print_ptr(ndr, "foo3", r->out.foo3); + ndr->depth++; + if (r->out.foo1 == NULL) return; + ndr_print_set_switch_value(ndr, r->out.foo3, *r->out.foo1); + ndr_print_echo_Enum3(ndr, "foo3", r->out.foo3); + ndr->depth--; + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_echo_TestSurrounding(struct ndr_push *ndr, int flags, const struct echo_TestSurrounding *r) +{ + if (flags & NDR_IN) { + if (r->in.data == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_echo_Surrounding(ndr, NDR_SCALARS, r->in.data)); + } + if (flags & NDR_OUT) { + if (r->out.data == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_echo_Surrounding(ndr, NDR_SCALARS, r->out.data)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_TestSurrounding(struct ndr_pull *ndr, int flags, struct echo_TestSurrounding *r) +{ + TALLOC_CTX *_mem_save_data_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.data); + } + _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.data, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_echo_Surrounding(ndr, NDR_SCALARS, r->in.data)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.data); + *r->out.data = *r->in.data; + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.data); + } + _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.data, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_echo_Surrounding(ndr, NDR_SCALARS, r->out.data)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, LIBNDR_FLAG_REF_ALLOC); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_TestSurrounding(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestSurrounding *r) +{ + ndr_print_struct(ndr, name, "echo_TestSurrounding"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "echo_TestSurrounding"); + ndr->depth++; + ndr_print_ptr(ndr, "data", r->in.data); + ndr->depth++; + ndr_print_echo_Surrounding(ndr, "data", r->in.data); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "echo_TestSurrounding"); + ndr->depth++; + ndr_print_ptr(ndr, "data", r->out.data); + ndr->depth++; + ndr_print_echo_Surrounding(ndr, "data", r->out.data); + ndr->depth--; + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_echo_TestDoublePointer(struct ndr_push *ndr, int flags, const struct echo_TestDoublePointer *r) +{ + if (flags & NDR_IN) { + if (r->in.data == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + if (*r->in.data == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_ref_ptr(ndr)); + if (**r->in.data == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_ref_ptr(ndr)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ***r->in.data)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_echo_TestDoublePointer(struct ndr_pull *ndr, int flags, struct echo_TestDoublePointer *r) +{ + uint32_t _ptr_data; + TALLOC_CTX *_mem_save_data_0; + TALLOC_CTX *_mem_save_data_1; + TALLOC_CTX *_mem_save_data_2; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.data); + } + _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.data, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_data)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, *r->in.data); + } + _mem_save_data_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->in.data, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_data)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, **r->in.data); + } + _mem_save_data_2 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, **r->in.data, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, **r->in.data)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_2, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_1, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, LIBNDR_FLAG_REF_ALLOC); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_echo_TestDoublePointer(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestDoublePointer *r) +{ + ndr_print_struct(ndr, name, "echo_TestDoublePointer"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "echo_TestDoublePointer"); + ndr->depth++; + ndr_print_ptr(ndr, "data", r->in.data); + ndr->depth++; + ndr_print_ptr(ndr, "data", *r->in.data); + ndr->depth++; + ndr_print_ptr(ndr, "data", **r->in.data); + ndr->depth++; + ndr_print_uint16(ndr, "data", ***r->in.data); + ndr->depth--; + ndr->depth--; + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "echo_TestDoublePointer"); + ndr->depth++; + ndr_print_uint16(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +const struct dcerpc_interface_call rpcecho_calls[] = { + { + "echo_AddOne", + sizeof(struct echo_AddOne), + (ndr_push_flags_fn_t) ndr_push_echo_AddOne, + (ndr_pull_flags_fn_t) ndr_pull_echo_AddOne, + (ndr_print_function_t) ndr_print_echo_AddOne, + False, + }, + { + "echo_EchoData", + sizeof(struct echo_EchoData), + (ndr_push_flags_fn_t) ndr_push_echo_EchoData, + (ndr_pull_flags_fn_t) ndr_pull_echo_EchoData, + (ndr_print_function_t) ndr_print_echo_EchoData, + False, + }, + { + "echo_SinkData", + sizeof(struct echo_SinkData), + (ndr_push_flags_fn_t) ndr_push_echo_SinkData, + (ndr_pull_flags_fn_t) ndr_pull_echo_SinkData, + (ndr_print_function_t) ndr_print_echo_SinkData, + False, + }, + { + "echo_SourceData", + sizeof(struct echo_SourceData), + (ndr_push_flags_fn_t) ndr_push_echo_SourceData, + (ndr_pull_flags_fn_t) ndr_pull_echo_SourceData, + (ndr_print_function_t) ndr_print_echo_SourceData, + False, + }, + { + "echo_TestCall", + sizeof(struct echo_TestCall), + (ndr_push_flags_fn_t) ndr_push_echo_TestCall, + (ndr_pull_flags_fn_t) ndr_pull_echo_TestCall, + (ndr_print_function_t) ndr_print_echo_TestCall, + False, + }, + { + "echo_TestCall2", + sizeof(struct echo_TestCall2), + (ndr_push_flags_fn_t) ndr_push_echo_TestCall2, + (ndr_pull_flags_fn_t) ndr_pull_echo_TestCall2, + (ndr_print_function_t) ndr_print_echo_TestCall2, + False, + }, + { + "echo_TestSleep", + sizeof(struct echo_TestSleep), + (ndr_push_flags_fn_t) ndr_push_echo_TestSleep, + (ndr_pull_flags_fn_t) ndr_pull_echo_TestSleep, + (ndr_print_function_t) ndr_print_echo_TestSleep, + False, + }, + { + "echo_TestEnum", + sizeof(struct echo_TestEnum), + (ndr_push_flags_fn_t) ndr_push_echo_TestEnum, + (ndr_pull_flags_fn_t) ndr_pull_echo_TestEnum, + (ndr_print_function_t) ndr_print_echo_TestEnum, + False, + }, + { + "echo_TestSurrounding", + sizeof(struct echo_TestSurrounding), + (ndr_push_flags_fn_t) ndr_push_echo_TestSurrounding, + (ndr_pull_flags_fn_t) ndr_pull_echo_TestSurrounding, + (ndr_print_function_t) ndr_print_echo_TestSurrounding, + False, + }, + { + "echo_TestDoublePointer", + sizeof(struct echo_TestDoublePointer), + (ndr_push_flags_fn_t) ndr_push_echo_TestDoublePointer, + (ndr_pull_flags_fn_t) ndr_pull_echo_TestDoublePointer, + (ndr_print_function_t) ndr_print_echo_TestDoublePointer, + False, + }, + { NULL, 0, NULL, NULL, NULL, False } +}; + +const char * const rpcecho_endpoint_strings[] = { + "ncacn_np:[\\pipe\\rpcecho]", + "ncacn_ip_tcp:", + "ncalrpc:", +}; + +const struct dcerpc_endpoint_list rpcecho_endpoints = { + .count = 3, + .names = rpcecho_endpoint_strings +}; + +const char * const rpcecho_authservice_strings[] = { + "host", +}; + +const struct dcerpc_authservice_list rpcecho_authservices = { + .count = 3, + .names = rpcecho_authservice_strings +}; + + +const struct dcerpc_interface_table dcerpc_table_rpcecho = { + .name = "rpcecho", + .syntax_id = { + {0x60a15ec5,0x4de8,0x11d7,{0xa6,0x37},{0x00,0x50,0x56,0xa2,0x01,0x82}}, + DCERPC_RPCECHO_VERSION + }, + .helpstring = DCERPC_RPCECHO_HELPSTRING, + .num_calls = 10, + .calls = rpcecho_calls, + .endpoints = &rpcecho_endpoints, + .authservices = &rpcecho_authservices +}; + diff --git a/source3/librpc/gen_ndr/ndr_echo.h b/source3/librpc/gen_ndr/ndr_echo.h new file mode 100644 index 0000000000..9c4603bc11 --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_echo.h @@ -0,0 +1,59 @@ +/* header auto-generated by pidl */ + +#include "librpc/gen_ndr/echo.h" + +#ifndef _HEADER_NDR_rpcecho +#define _HEADER_NDR_rpcecho + +#include "librpc/ndr/libndr.h" +#define DCERPC_RPCECHO_UUID "60a15ec5-4de8-11d7-a637-005056a20182" +#define DCERPC_RPCECHO_VERSION 1.0 +#define DCERPC_RPCECHO_NAME "rpcecho" +#define DCERPC_RPCECHO_HELPSTRING "Simple echo pipe" +extern const struct dcerpc_interface_table dcerpc_table_rpcecho; +NTSTATUS dcerpc_server_rpcecho_init(void); +#define DCERPC_ECHO_ADDONE (0x00) + +#define DCERPC_ECHO_ECHODATA (0x01) + +#define DCERPC_ECHO_SINKDATA (0x02) + +#define DCERPC_ECHO_SOURCEDATA (0x03) + +#define DCERPC_ECHO_TESTCALL (0x04) + +#define DCERPC_ECHO_TESTCALL2 (0x05) + +#define DCERPC_ECHO_TESTSLEEP (0x06) + +#define DCERPC_ECHO_TESTENUM (0x07) + +#define DCERPC_ECHO_TESTSURROUNDING (0x08) + +#define DCERPC_ECHO_TESTDOUBLEPOINTER (0x09) + +#define DCERPC_RPCECHO_CALL_COUNT (10) +void ndr_print_echo_info1(struct ndr_print *ndr, const char *name, const struct echo_info1 *r); +void ndr_print_echo_info2(struct ndr_print *ndr, const char *name, const struct echo_info2 *r); +void ndr_print_echo_info3(struct ndr_print *ndr, const char *name, const struct echo_info3 *r); +void ndr_print_echo_info4(struct ndr_print *ndr, const char *name, const struct echo_info4 *r); +void ndr_print_echo_info5(struct ndr_print *ndr, const char *name, const struct echo_info5 *r); +void ndr_print_echo_info6(struct ndr_print *ndr, const char *name, const struct echo_info6 *r); +void ndr_print_echo_info7(struct ndr_print *ndr, const char *name, const struct echo_info7 *r); +void ndr_print_echo_Info(struct ndr_print *ndr, const char *name, const union echo_Info *r); +void ndr_print_echo_Enum1(struct ndr_print *ndr, const char *name, enum echo_Enum1 r); +void ndr_print_echo_Enum1_32(struct ndr_print *ndr, const char *name, enum echo_Enum1_32 r); +void ndr_print_echo_Enum2(struct ndr_print *ndr, const char *name, const struct echo_Enum2 *r); +void ndr_print_echo_Enum3(struct ndr_print *ndr, const char *name, const union echo_Enum3 *r); +void ndr_print_echo_Surrounding(struct ndr_print *ndr, const char *name, const struct echo_Surrounding *r); +void ndr_print_echo_AddOne(struct ndr_print *ndr, const char *name, int flags, const struct echo_AddOne *r); +void ndr_print_echo_EchoData(struct ndr_print *ndr, const char *name, int flags, const struct echo_EchoData *r); +void ndr_print_echo_SinkData(struct ndr_print *ndr, const char *name, int flags, const struct echo_SinkData *r); +void ndr_print_echo_SourceData(struct ndr_print *ndr, const char *name, int flags, const struct echo_SourceData *r); +void ndr_print_echo_TestCall(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestCall *r); +void ndr_print_echo_TestCall2(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestCall2 *r); +void ndr_print_echo_TestSleep(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestSleep *r); +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); +#endif /* _HEADER_NDR_rpcecho */ diff --git a/source3/librpc/gen_ndr/srv_echo.c b/source3/librpc/gen_ndr/srv_echo.c new file mode 100644 index 0000000000..d3dc7b9e1f --- /dev/null +++ b/source3/librpc/gen_ndr/srv_echo.c @@ -0,0 +1,568 @@ +/* + * Unix SMB/CIFS implementation. + * server auto-generated by pidl. DO NOT MODIFY! + */ + +#include "includes.h" +#include "librpc/gen_ndr/srv_echo.h" + +static BOOL api_echo_AddOne(pipes_struct *p) +{ + struct ndr_pull *pull; + struct ndr_push *push; + NTSTATUS status; + DATA_BLOB blob; + struct echo_AddOne r; + TALLOC_CTX *mem_ctx = talloc_init("api_echo_AddOne"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_echo_AddOne(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.out_data = talloc_size(mem_ctx, sizeof(*r.out.out_data)); + if (r.out.out_data == NULL) { + talloc_free(mem_ctx); + return False; + } + + _echo_AddOne(p, r.in.in_data, r.out.out_data); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_echo_AddOne(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_echo_EchoData(pipes_struct *p) +{ + struct ndr_pull *pull; + struct ndr_push *push; + NTSTATUS status; + DATA_BLOB blob; + struct echo_EchoData r; + TALLOC_CTX *mem_ctx = talloc_init("api_echo_EchoData"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_echo_EchoData(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.out_data = talloc_array_size(mem_ctx, sizeof(*r.out.out_data), r.in.len); + if (r.out.out_data == NULL) { + talloc_free(mem_ctx); + return False; + } + + _echo_EchoData(p, r.in.len, r.in.in_data, r.out.out_data); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_echo_EchoData(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_echo_SinkData(pipes_struct *p) +{ + struct ndr_pull *pull; + struct ndr_push *push; + NTSTATUS status; + DATA_BLOB blob; + struct echo_SinkData r; + TALLOC_CTX *mem_ctx = talloc_init("api_echo_SinkData"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_echo_SinkData(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + _echo_SinkData(p, r.in.len, r.in.data); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_echo_SinkData(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_echo_SourceData(pipes_struct *p) +{ + struct ndr_pull *pull; + struct ndr_push *push; + NTSTATUS status; + DATA_BLOB blob; + struct echo_SourceData r; + TALLOC_CTX *mem_ctx = talloc_init("api_echo_SourceData"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_echo_SourceData(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.data = talloc_array_size(mem_ctx, sizeof(*r.out.data), r.in.len); + if (r.out.data == NULL) { + talloc_free(mem_ctx); + return False; + } + + _echo_SourceData(p, r.in.len, r.out.data); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_echo_SourceData(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_echo_TestCall(pipes_struct *p) +{ + struct ndr_pull *pull; + struct ndr_push *push; + NTSTATUS status; + DATA_BLOB blob; + struct echo_TestCall r; + TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestCall"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_echo_TestCall(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.s2 = talloc_size(mem_ctx, sizeof(*r.out.s2)); + if (r.out.s2 == NULL) { + talloc_free(mem_ctx); + return False; + } + + _echo_TestCall(p, r.in.s1, r.out.s2); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_echo_TestCall(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_echo_TestCall2(pipes_struct *p) +{ + struct ndr_pull *pull; + struct ndr_push *push; + NTSTATUS status; + DATA_BLOB blob; + struct echo_TestCall2 r; + TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestCall2"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_echo_TestCall2(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.info = talloc_size(mem_ctx, sizeof(*r.out.info)); + if (r.out.info == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _echo_TestCall2(p, r.in.level, r.out.info); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_echo_TestCall2(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_echo_TestSleep(pipes_struct *p) +{ + struct ndr_pull *pull; + struct ndr_push *push; + NTSTATUS status; + DATA_BLOB blob; + struct echo_TestSleep r; + TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestSleep"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_echo_TestSleep(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _echo_TestSleep(p, r.in.seconds); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_echo_TestSleep(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_echo_TestEnum(pipes_struct *p) +{ + struct ndr_pull *pull; + struct ndr_push *push; + NTSTATUS status; + DATA_BLOB blob; + struct echo_TestEnum r; + TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestEnum"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_echo_TestEnum(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.foo1 = r.in.foo1; + r.out.foo2 = r.in.foo2; + r.out.foo3 = r.in.foo3; + _echo_TestEnum(p, r.in.foo1, r.in.foo2, r.in.foo3); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_echo_TestEnum(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_echo_TestSurrounding(pipes_struct *p) +{ + struct ndr_pull *pull; + struct ndr_push *push; + NTSTATUS status; + DATA_BLOB blob; + struct echo_TestSurrounding r; + TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestSurrounding"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_echo_TestSurrounding(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.data = r.in.data; + _echo_TestSurrounding(p, r.in.data); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_echo_TestSurrounding(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_echo_TestDoublePointer(pipes_struct *p) +{ + struct ndr_pull *pull; + struct ndr_push *push; + NTSTATUS status; + DATA_BLOB blob; + struct echo_TestDoublePointer r; + TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestDoublePointer"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_echo_TestDoublePointer(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _echo_TestDoublePointer(p, r.in.data); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_echo_TestDoublePointer(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + + +/* Tables */ +static struct api_struct api_rpcecho_cmds[] = +{ + {"ECHO_ADDONE", DCERPC_ECHO_ADDONE, api_echo_AddOne}, + {"ECHO_ECHODATA", DCERPC_ECHO_ECHODATA, api_echo_EchoData}, + {"ECHO_SINKDATA", DCERPC_ECHO_SINKDATA, api_echo_SinkData}, + {"ECHO_SOURCEDATA", DCERPC_ECHO_SOURCEDATA, api_echo_SourceData}, + {"ECHO_TESTCALL", DCERPC_ECHO_TESTCALL, api_echo_TestCall}, + {"ECHO_TESTCALL2", DCERPC_ECHO_TESTCALL2, api_echo_TestCall2}, + {"ECHO_TESTSLEEP", DCERPC_ECHO_TESTSLEEP, api_echo_TestSleep}, + {"ECHO_TESTENUM", DCERPC_ECHO_TESTENUM, api_echo_TestEnum}, + {"ECHO_TESTSURROUNDING", DCERPC_ECHO_TESTSURROUNDING, api_echo_TestSurrounding}, + {"ECHO_TESTDOUBLEPOINTER", DCERPC_ECHO_TESTDOUBLEPOINTER, api_echo_TestDoublePointer}, +}; + +void rpcecho_get_pipe_fns(struct api_struct **fns, int *n_fns) +{ + *fns = api_rpcecho_cmds; + *n_fns = sizeof(api_rpcecho_cmds) / sizeof(struct api_struct); +} + +NTSTATUS rpc_rpcecho_init(void) +{ + return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "rpcecho", "rpcecho", api_rpcecho_cmds, sizeof(api_rpcecho_cmds) / sizeof(struct api_struct)); +} diff --git a/source3/librpc/gen_ndr/srv_echo.h b/source3/librpc/gen_ndr/srv_echo.h new file mode 100644 index 0000000000..aa06afb264 --- /dev/null +++ b/source3/librpc/gen_ndr/srv_echo.h @@ -0,0 +1,16 @@ +#include "librpc/gen_ndr/ndr_echo.h" +#ifndef __SRV_RPCECHO__ +#define __SRV_RPCECHO__ +void _echo_AddOne(pipes_struct *p, uint32_t in_data, uint32_t *out_data); +void _echo_EchoData(pipes_struct *p, uint32_t len, uint8_t *in_data, uint8_t *out_data); +void _echo_SinkData(pipes_struct *p, uint32_t len, uint8_t *data); +void _echo_SourceData(pipes_struct *p, uint32_t len, uint8_t *data); +void _echo_TestCall(pipes_struct *p, const char *s1, const char **s2); +NTSTATUS _echo_TestCall2(pipes_struct *p, uint16_t level, union echo_Info *info); +uint32 _echo_TestSleep(pipes_struct *p, uint32_t seconds); +void _echo_TestEnum(pipes_struct *p, enum echo_Enum1 *foo1, struct echo_Enum2 *foo2, union echo_Enum3 *foo3); +void _echo_TestSurrounding(pipes_struct *p, struct echo_Surrounding *data); +uint16 _echo_TestDoublePointer(pipes_struct *p, uint16_t ***data); +void rpcecho_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_rpcecho_init(void); +#endif /* __SRV_RPCECHO__ */ diff --git a/source3/librpc/ndr/ndr_basic.c b/source3/librpc/ndr/ndr_basic.c index ce2af31784..af006f2e91 100644 --- a/source3/librpc/ndr/ndr_basic.c +++ b/source3/librpc/ndr/ndr_basic.c @@ -492,11 +492,8 @@ NTSTATUS ndr_push_sptr_ptr(struct ndr_push *ndr, const void *p) /* push always a 0, if a pointer is NULL it's a fatal error */ -NTSTATUS ndr_push_ref_ptr(struct ndr_push *ndr, const void *p) +NTSTATUS ndr_push_ref_ptr(struct ndr_push *ndr) { - if (p == NULL) { - return NT_STATUS_INVALID_PARAMETER_MIX; - } return ndr_push_uint32(ndr, NDR_SCALARS, 0xAEF1AEF1); } -- cgit