Initial import
[samba] / source / rpc_server / srv_echo_nt.c
1 /* 
2  *  Unix SMB/CIFS implementation.
3  *  RPC Pipe client / server routines for rpcecho
4  *  Copyright (C) Tim Potter                   2003.
5  *  
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *  
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *  
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20
21 /* This is the interface to the rpcecho pipe. */
22
23 #include "includes.h"
24 #include "nterr.h"
25
26 #ifdef DEVELOPER
27
28 #undef DBGC_CLASS
29 #define DBGC_CLASS DBGC_RPC_SRV
30
31 /* Add one to the input and return it */
32
33 void _echo_add_one(pipes_struct *p, ECHO_Q_ADD_ONE *q_u, ECHO_R_ADD_ONE *r_u)
34 {
35         DEBUG(10, ("_echo_add_one\n"));
36
37         r_u->response = q_u->request + 1;
38 }
39
40 /* Echo back an array of data */
41
42 void _echo_data(pipes_struct *p, ECHO_Q_ECHO_DATA *q_u, 
43                 ECHO_R_ECHO_DATA *r_u)
44 {
45         DEBUG(10, ("_echo_data\n"));
46
47         r_u->data = TALLOC(p->mem_ctx, q_u->size);
48         r_u->size = q_u->size;
49         memcpy(r_u->data, q_u->data, q_u->size);
50 }
51
52 /* Sink an array of data */
53
54 void _sink_data(pipes_struct *p, ECHO_Q_SINK_DATA *q_u, 
55                 ECHO_R_SINK_DATA *r_u)
56 {
57         DEBUG(10, ("_sink_data\n"));
58
59         /* My that was some yummy data! */
60 }
61
62 /* Source an array of data */
63
64 void _source_data(pipes_struct *p, ECHO_Q_SOURCE_DATA *q_u, 
65                   ECHO_R_SOURCE_DATA *r_u)
66 {
67         uint32 i;
68
69         DEBUG(10, ("_source_data\n"));
70
71         r_u->data = TALLOC(p->mem_ctx, q_u->size);
72         r_u->size = q_u->size;
73
74         for (i = 0; i < r_u->size; i++)
75                 r_u->data[i] = i & 0xff;
76 }
77
78 #endif /* DEVELOPER */