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.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 /* This is the interface to the rpcecho pipe. */
30 #define DBGC_CLASS DBGC_RPC_SRV
32 /* Add one to the input and return it */
34 void _echo_AddOne(pipes_struct *p, struct echo_AddOne *r)
36 DEBUG(10, ("_echo_add_one\n"));
38 *r->out.out_data = r->in.in_data + 1;
41 /* Echo back an array of data */
43 void _echo_EchoData(pipes_struct *p, struct echo_EchoData *r)
45 DEBUG(10, ("_echo_data\n"));
47 memcpy(r->out.out_data, r->in.in_data, r->in.len);
50 /* Sink an array of data */
52 void _echo_SinkData(pipes_struct *p, struct echo_SinkData *r)
54 DEBUG(10, ("_sink_data\n"));
56 /* My that was some yummy data! */
59 /* Source an array of data */
61 void _echo_SourceData(pipes_struct *p, struct echo_SourceData *r)
65 DEBUG(10, ("_source_data\n"));
67 for (i = 0; i < r->in.len; i++)
68 r->out.data[i] = i & 0xff;
71 void _echo_TestCall(pipes_struct *p, struct echo_TestCall *r)
73 *r->out.s2 = talloc_strdup(p->mem_ctx, r->in.s1);
76 NTSTATUS _echo_TestCall2(pipes_struct *p, struct echo_TestCall2 *r)
78 switch (r->in.level) {
80 r->out.info->info1.v = 10;
83 r->out.info->info2.v = 20;
86 r->out.info->info3.v = 30;
89 r->out.info->info4.v = 40;
92 r->out.info->info5.v1 = 50;
93 r->out.info->info5.v2 = 60;
96 r->out.info->info6.v1 = 70;
97 r->out.info->info6.info1.v= 80;
100 r->out.info->info7.v1 = 80;
101 r->out.info->info7.info4.v = 90;
104 return NT_STATUS_INVALID_LEVEL;
110 uint32 _echo_TestSleep(pipes_struct *p, struct echo_TestSleep *r)
112 sleep(r->in.seconds);
113 return r->in.seconds;
116 void _echo_TestEnum(pipes_struct *p, struct echo_TestEnum *r)
120 void _echo_TestSurrounding(pipes_struct *p, struct echo_TestSurrounding *r)
123 r->out.data->surrounding = TALLOC_ZERO_ARRAY(p->mem_ctx, uint16_t, r->in.data->x);
126 uint16 _echo_TestDoublePointer(pipes_struct *p, struct echo_TestDoublePointer *r)
132 return ***r->in.data;
135 #endif /* DEVELOPER */