s4:libcli/wrepl: convert wrepl_associate_stop_send to tevent_req
[Samba/cd1.git] / source3 / rpc_server / srv_echo_nt.c
blob248ca0bf2abadb5e199a14b411284d1d7f1b148e
1 /*
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
7 *
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 3 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, see <http://www.gnu.org/licenses/>.
22 /* This is the interface to the rpcecho pipe. */
24 #include "includes.h"
25 #include "../librpc/gen_ndr/srv_echo.h"
27 #ifdef DEVELOPER
29 #undef DBGC_CLASS
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_AddOne\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_EchoData\n"));
47 if ( r->in.len == 0 ) {
48 r->out.out_data = NULL;
49 return;
52 r->out.out_data = TALLOC_ARRAY(p->mem_ctx, uint8, r->in.len);
53 memcpy( r->out.out_data, r->in.in_data, r->in.len );
54 return;
57 /* Sink an array of data */
59 void _echo_SinkData(pipes_struct *p, struct echo_SinkData *r)
61 DEBUG(10, ("_echo_SinkData\n"));
63 /* My that was some yummy data! */
64 return;
67 /* Source an array of data */
69 void _echo_SourceData(pipes_struct *p, struct echo_SourceData *r)
71 uint32 i;
73 DEBUG(10, ("_echo_SourceData\n"));
75 if ( r->in.len == 0 ) {
76 r->out.data = NULL;
77 return;
80 r->out.data = TALLOC_ARRAY(p->mem_ctx, uint8, r->in.len );
82 for (i = 0; i < r->in.len; i++ ) {
83 r->out.data[i] = i & 0xff;
86 return;
89 void _echo_TestCall(pipes_struct *p, struct echo_TestCall *r)
91 p->rng_fault_state = True;
92 return;
95 NTSTATUS _echo_TestCall2(pipes_struct *p, struct echo_TestCall2 *r)
97 p->rng_fault_state = True;
98 return NT_STATUS_OK;
101 uint32 _echo_TestSleep(pipes_struct *p, struct echo_TestSleep *r)
103 p->rng_fault_state = True;
104 return 0;
107 void _echo_TestEnum(pipes_struct *p, struct echo_TestEnum *r)
109 p->rng_fault_state = True;
110 return;
113 void _echo_TestSurrounding(pipes_struct *p, struct echo_TestSurrounding *r)
115 p->rng_fault_state = True;
116 return;
119 uint16 _echo_TestDoublePointer(pipes_struct *p, struct echo_TestDoublePointer *r)
121 p->rng_fault_state = True;
122 return 0;
125 #endif /* DEVELOPER */