source: branches/samba-3.0/source/rpc_parse/parse_echo.c

Last change on this file was 1, checked in by Paul Smedley, 18 years ago

Initial code import

File size: 3.6 KB
Line 
1/*
2 * Unix SMB/CIFS implementation.
3 *
4 * RPC Pipe client / server routines
5 *
6 * Copyright (C) Tim Potter 2003
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 2 of the License, or
11 * (at your option) any later version.
12 *
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.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#include "includes.h"
24
25#undef DBGC_CLASS
26#define DBGC_CLASS DBGC_RPC_PARSE
27
28void init_echo_q_add_one(ECHO_Q_ADD_ONE *q_d, uint32 request)
29{
30 q_d->request = request;
31}
32
33BOOL echo_io_q_add_one(const char *desc, ECHO_Q_ADD_ONE *q_d,
34 prs_struct *ps, int depth)
35{
36 if (!prs_uint32("request", ps, 0, &q_d->request))
37 return False;
38
39 return True;
40}
41
42BOOL echo_io_r_add_one(const char *desc, ECHO_R_ADD_ONE *q_d,
43 prs_struct *ps, int depth)
44{
45 if (!prs_uint32("response", ps, 0, &q_d->response))
46 return False;
47
48 return True;
49}
50
51
52void init_echo_q_echo_data(ECHO_Q_ECHO_DATA *q_d, uint32 size, char *data)
53{
54 q_d->size = size;
55 q_d->data = data;
56}
57
58BOOL echo_io_q_echo_data(const char *desc, ECHO_Q_ECHO_DATA *q_d,
59 prs_struct *ps, int depth)
60{
61 if (!prs_uint32("size", ps, depth, &q_d->size))
62 return False;
63
64 if (!prs_uint32("size", ps, depth, &q_d->size))
65 return False;
66
67 if (UNMARSHALLING(ps)) {
68 q_d->data = PRS_ALLOC_MEM(ps, char, q_d->size);
69
70 if (!q_d->data)
71 return False;
72 }
73
74 if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size))
75 return False;
76
77 return True;
78}
79
80BOOL echo_io_r_echo_data(const char *desc, ECHO_R_ECHO_DATA *q_d,
81 prs_struct *ps, int depth)
82{
83 if (!prs_uint32("size", ps, 0, &q_d->size))
84 return False;
85
86 if (UNMARSHALLING(ps)) {
87 q_d->data = PRS_ALLOC_MEM(ps, char, q_d->size);
88
89 if (!q_d->data)
90 return False;
91 }
92
93 if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size))
94 return False;
95
96 return True;
97}
98
99void init_echo_q_sink_data(ECHO_Q_SINK_DATA *q_d, uint32 size, char *data)
100{
101 q_d->size = size;
102 q_d->data = data;
103}
104
105BOOL echo_io_q_sink_data(const char *desc, ECHO_Q_SINK_DATA *q_d,
106 prs_struct *ps, int depth)
107{
108 if (!prs_uint32("size", ps, depth, &q_d->size))
109 return False;
110
111 if (!prs_uint32("size", ps, depth, &q_d->size))
112 return False;
113
114 if (UNMARSHALLING(ps)) {
115 q_d->data = PRS_ALLOC_MEM(ps, char, q_d->size);
116
117 if (!q_d->data)
118 return False;
119 }
120
121 if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size))
122 return False;
123
124 return True;
125}
126
127BOOL echo_io_r_sink_data(const char *desc, ECHO_R_SINK_DATA *q_d,
128 prs_struct *ps, int depth)
129{
130 return True;
131}
132
133void init_echo_q_source_data(ECHO_Q_SOURCE_DATA *q_d, uint32 size)
134{
135 q_d->size = size;
136}
137
138BOOL echo_io_q_source_data(const char *desc, ECHO_Q_SOURCE_DATA *q_d,
139 prs_struct *ps, int depth)
140{
141 if (!prs_uint32("size", ps, depth, &q_d->size))
142 return False;
143
144 return True;
145}
146
147BOOL echo_io_r_source_data(const char *desc, ECHO_R_SOURCE_DATA *q_d,
148 prs_struct *ps, int depth)
149{
150 if (!prs_uint32("size", ps, 0, &q_d->size))
151 return False;
152
153 if (UNMARSHALLING(ps)) {
154 q_d->data = PRS_ALLOC_MEM(ps, char, q_d->size);
155
156 if (!q_d->data)
157 return False;
158 }
159
160 if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size))
161 return False;
162
163 return True;
164}
Note: See TracBrowser for help on using the repository browser.