1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-01 21:18:10 +03:00
samba-mirror/source3/librpc/gen_ndr/srv_echo.c
Volker Lendecke 6b0b563fa4 r19221: Monster-Checkin after "make idl"
(This used to be commit 416466a16f)
2007-10-10 12:15:22 -05:00

716 lines
15 KiB
C

/*
* 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) {
talloc_free(mem_ctx);
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;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(echo_AddOne, &r);
ZERO_STRUCT(r.out);
r.out.out_data = talloc_zero_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);
if (p->rng_fault_state) {
talloc_free(mem_ctx);
/* Return True here, srv_pipe_hnd.c will take care */
return True;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_OUT_DEBUG(echo_AddOne, &r);
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_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
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) {
talloc_free(mem_ctx);
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;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(echo_EchoData, &r);
ZERO_STRUCT(r.out);
r.out.out_data = talloc_zero_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);
if (p->rng_fault_state) {
talloc_free(mem_ctx);
/* Return True here, srv_pipe_hnd.c will take care */
return True;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_OUT_DEBUG(echo_EchoData, &r);
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_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
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) {
talloc_free(mem_ctx);
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;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(echo_SinkData, &r);
_echo_SinkData(p, r.in.len, r.in.data);
if (p->rng_fault_state) {
talloc_free(mem_ctx);
/* Return True here, srv_pipe_hnd.c will take care */
return True;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_OUT_DEBUG(echo_SinkData, &r);
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_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
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) {
talloc_free(mem_ctx);
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;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(echo_SourceData, &r);
ZERO_STRUCT(r.out);
r.out.data = talloc_zero_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);
if (p->rng_fault_state) {
talloc_free(mem_ctx);
/* Return True here, srv_pipe_hnd.c will take care */
return True;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_OUT_DEBUG(echo_SourceData, &r);
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_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
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) {
talloc_free(mem_ctx);
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;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(echo_TestCall, &r);
ZERO_STRUCT(r.out);
r.out.s2 = talloc_zero_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);
if (p->rng_fault_state) {
talloc_free(mem_ctx);
/* Return True here, srv_pipe_hnd.c will take care */
return True;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_OUT_DEBUG(echo_TestCall, &r);
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_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
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) {
talloc_free(mem_ctx);
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;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(echo_TestCall2, &r);
ZERO_STRUCT(r.out);
r.out.info = talloc_zero_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);
if (p->rng_fault_state) {
talloc_free(mem_ctx);
/* Return True here, srv_pipe_hnd.c will take care */
return True;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_OUT_DEBUG(echo_TestCall2, &r);
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_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
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) {
talloc_free(mem_ctx);
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;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(echo_TestSleep, &r);
r.out.result = _echo_TestSleep(p, r.in.seconds);
if (p->rng_fault_state) {
talloc_free(mem_ctx);
/* Return True here, srv_pipe_hnd.c will take care */
return True;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_OUT_DEBUG(echo_TestSleep, &r);
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_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
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) {
talloc_free(mem_ctx);
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;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(echo_TestEnum, &r);
ZERO_STRUCT(r.out);
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);
if (p->rng_fault_state) {
talloc_free(mem_ctx);
/* Return True here, srv_pipe_hnd.c will take care */
return True;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_OUT_DEBUG(echo_TestEnum, &r);
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_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
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) {
talloc_free(mem_ctx);
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;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(echo_TestSurrounding, &r);
ZERO_STRUCT(r.out);
r.out.data = r.in.data;
_echo_TestSurrounding(p, r.in.data);
if (p->rng_fault_state) {
talloc_free(mem_ctx);
/* Return True here, srv_pipe_hnd.c will take care */
return True;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_OUT_DEBUG(echo_TestSurrounding, &r);
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_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
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) {
talloc_free(mem_ctx);
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;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(echo_TestDoublePointer, &r);
r.out.result = _echo_TestDoublePointer(p, r.in.data);
if (p->rng_fault_state) {
talloc_free(mem_ctx);
/* Return True here, srv_pipe_hnd.c will take care */
return True;
}
if (DEBUGLEVEL >= 10)
NDR_PRINT_OUT_DEBUG(echo_TestDoublePointer, &r);
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_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
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));
}