• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt/router/samba-3.0.25b/source/rpc_server/
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
33void _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
42void _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	if (q_u->size == 0) {
48		r_u->data = NULL;
49		r_u->size = 0;
50		return;
51	}
52	r_u->data = TALLOC(p->mem_ctx, q_u->size);
53	r_u->size = q_u->size;
54	memcpy(r_u->data, q_u->data, q_u->size);
55}
56
57/* Sink an array of data */
58
59void _sink_data(pipes_struct *p, ECHO_Q_SINK_DATA *q_u,
60		ECHO_R_SINK_DATA *r_u)
61{
62	DEBUG(10, ("_sink_data\n"));
63
64	/* My that was some yummy data! */
65}
66
67/* Source an array of data */
68
69void _source_data(pipes_struct *p, ECHO_Q_SOURCE_DATA *q_u,
70		  ECHO_R_SOURCE_DATA *r_u)
71{
72	uint32 i;
73
74	DEBUG(10, ("_source_data\n"));
75
76	if (q_u->size == 0) {
77		r_u->data = NULL;
78		r_u->size = 0;
79		return;
80	}
81	r_u->data = TALLOC(p->mem_ctx, q_u->size);
82	r_u->size = q_u->size;
83
84	for (i = 0; i < r_u->size; i++)
85		r_u->data[i] = i & 0xff;
86}
87
88#endif /* DEVELOPER */
89