2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines for rpcecho
4 * Copyright (C) Tim Potter 2003.
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.
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.
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.
21 /* This is the interface to the rpcecho pipe. */
29 #define DBGC_CLASS DBGC_RPC_SRV
31 /* Add one to the input and return it */
33 void _echo_add_one(pipes_struct
*p
, ECHO_Q_ADD_ONE
*q_u
, ECHO_R_ADD_ONE
*r_u
)
35 DEBUG(10, ("_echo_add_one\n"));
37 r_u
->response
= q_u
->request
+ 1;
40 /* Echo back an array of data */
42 void _echo_data(pipes_struct
*p
, ECHO_Q_ECHO_DATA
*q_u
,
43 ECHO_R_ECHO_DATA
*r_u
)
45 DEBUG(10, ("_echo_data\n"));
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
);
52 /* Sink an array of data */
54 void _sink_data(pipes_struct
*p
, ECHO_Q_SINK_DATA
*q_u
,
55 ECHO_R_SINK_DATA
*r_u
)
57 DEBUG(10, ("_sink_data\n"));
59 /* My that was some yummy data! */
62 /* Source an array of data */
64 void _source_data(pipes_struct
*p
, ECHO_Q_SOURCE_DATA
*q_u
,
65 ECHO_R_SOURCE_DATA
*r_u
)
69 DEBUG(10, ("_source_data\n"));
71 r_u
->data
= TALLOC(p
->mem_ctx
, q_u
->size
);
72 r_u
->size
= q_u
->size
;
74 for (i
= 0; i
< r_u
->size
; i
++)
75 r_u
->data
[i
] = i
& 0xff;
78 #endif /* DEVELOPER */