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.
26 static NTSTATUS echo_AddOne(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_AddOne *r)
28 *r->out.v = *r->in.v + 1;
32 static NTSTATUS echo_EchoData(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_EchoData *r)
38 r->out.out_data = talloc(mem_ctx, r->in.len);
39 if (!r->out.out_data) {
40 return NT_STATUS_NO_MEMORY;
42 memcpy(r->out.out_data, r->in.in_data, r->in.len);
47 static NTSTATUS echo_SinkData(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_SinkData *r)
52 static NTSTATUS echo_SourceData(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_SourceData *r)
55 for (i=0;i<r->in.len;i++) {
62 static NTSTATUS echo_TestCall(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_TestCall *r)
64 r->out.s2 = "this is a test string";
69 static NTSTATUS echo_TestCall2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_TestCall2 *r)
71 r->out.info = talloc(mem_ctx, sizeof(*r->out.info));
73 return NT_STATUS_NO_MEMORY;
76 switch (r->in.level) {
78 r->out.info->info1.v = 10;
81 r->out.info->info2.v = 20;
84 r->out.info->info3.v = 30;
87 r->out.info->info4.v = 40;
90 r->out.info->info5.v1 = 50;
91 r->out.info->info5.v2 = 60;
94 r->out.info->info6.v1 = 70;
95 r->out.info->info6.info1.v= 80;
98 r->out.info->info7.v1 = 80;
99 r->out.info->info7.info4.v = 90;
102 return NT_STATUS_INVALID_LEVEL;
108 static long echo_TestSleep(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_TestSleep *r)
110 sleep(r->in.seconds);
111 return r->in.seconds;
114 /* include the generated boilerplate */
115 #include "librpc/gen_ndr/ndr_echo_s.c"