2 Unix SMB/CIFS implementation.
4 endpoint server for the echo pipe
6 Copyright (C) Andrew Tridgell 2003
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include "librpc/gen_ndr/ndr_echo.h"
27 static NTSTATUS echo_AddOne(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_AddOne *r)
29 *r->out.v = *r->in.v + 1;
33 static NTSTATUS echo_EchoData(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_EchoData *r)
39 r->out.out_data = talloc(mem_ctx, r->in.len);
40 if (!r->out.out_data) {
41 return NT_STATUS_NO_MEMORY;
43 memcpy(r->out.out_data, r->in.in_data, r->in.len);
48 static NTSTATUS echo_SinkData(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_SinkData *r)
53 static NTSTATUS echo_SourceData(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_SourceData *r)
56 for (i=0;i<r->in.len;i++) {
63 static NTSTATUS echo_TestCall(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_TestCall *r)
65 r->out.s2 = "this is a test string";
70 static NTSTATUS echo_TestCall2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_TestCall2 *r)
72 r->out.info = talloc(mem_ctx, sizeof(*r->out.info));
74 return NT_STATUS_NO_MEMORY;
77 switch (r->in.level) {
79 r->out.info->info1.v = 10;
82 r->out.info->info2.v = 20;
85 r->out.info->info3.v = 30;
88 r->out.info->info4.v = 40;
91 r->out.info->info5.v1 = 50;
92 r->out.info->info5.v2 = 60;
95 r->out.info->info6.v1 = 70;
96 r->out.info->info6.info1.v= 80;
99 r->out.info->info7.v1 = 80;
100 r->out.info->info7.info4.v = 90;
103 return NT_STATUS_INVALID_LEVEL;
109 static long echo_TestSleep(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_TestSleep *r)
111 sleep(r->in.seconds);
112 return r->in.seconds;
115 /* include the generated boilerplate */
116 #include "librpc/gen_ndr/ndr_echo_s.c"