2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines for rpcecho
4 * Copyright (C) Tim Potter 2003
5 * Copyright (C) Jelmer Vernooij 2006
6 * Copyright (C) Gerald (Jerry) Carter 2007
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.
23 /* This is the interface to the rpcecho pipe. */
31 #define DBGC_CLASS DBGC_RPC_SRV
33 /* Add one to the input and return it */
35 void _echo_AddOne(pipes_struct *p, struct echo_AddOne *r )
37 DEBUG(10, ("_echo_AddOne\n"));
39 *r->out.out_data = r->in.in_data + 1;
42 /* Echo back an array of data */
44 void _echo_EchoData(pipes_struct *p, struct echo_EchoData *r)
46 DEBUG(10, ("_echo_EchoData\n"));
48 if ( r->in.len == 0 ) {
49 r->out.out_data = NULL;
53 r->out.out_data = TALLOC(p->mem_ctx, r->in.len);
54 memcpy( r->out.out_data, r->in.in_data, r->in.len );
58 /* Sink an array of data */
60 void _echo_SinkData(pipes_struct *p, struct echo_SinkData *r)
62 DEBUG(10, ("_echo_SinkData\n"));
64 /* My that was some yummy data! */
68 /* Source an array of data */
70 void _echo_SourceData(pipes_struct *p, struct echo_SourceData *r)
74 DEBUG(10, ("_echo_SourceData\n"));
76 if ( r->in.len == 0 ) {
81 r->out.data = TALLOC(p->mem_ctx, r->in.len );
83 for (i = 0; i < r->in.len; i++ ) {
84 r->out.data[i] = i & 0xff;
90 void _echo_TestCall(pipes_struct *p, struct echo_TestCall *r)
92 *r->out.s2 = talloc_strdup(p->mem_ctx, r->in.s1);
95 NTSTATUS _echo_TestCall2(pipes_struct *p, struct echo_TestCall2 *r)
97 switch (r->in.level) {
99 r->out.info->info1.v = 10;
102 r->out.info->info2.v = 20;
105 r->out.info->info3.v = 30;
108 r->out.info->info4.v = 40;
111 r->out.info->info5.v1 = 50;
112 r->out.info->info5.v2 = 60;
115 r->out.info->info6.v1 = 70;
116 r->out.info->info6.info1.v= 80;
119 r->out.info->info7.v1 = 80;
120 r->out.info->info7.info4.v = 90;
123 return NT_STATUS_INVALID_LEVEL;
129 uint32 _echo_TestSleep(pipes_struct *p, struct echo_TestSleep *r)
131 sleep(r->in.seconds);
132 return r->in.seconds;
135 void _echo_TestEnum(pipes_struct *p, struct echo_TestEnum *r)
139 void _echo_TestSurrounding(pipes_struct *p, struct echo_TestSurrounding *r)
142 r->out.data->surrounding = TALLOC_ZERO_ARRAY(p->mem_ctx, uint16_t, r->in.data->x);
145 uint16 _echo_TestDoublePointer(pipes_struct *p, struct echo_TestDoublePointer *r)
151 return ***r->in.data;
154 #endif /* DEVELOPER */