include updates
[tomato.git] / release / src-rt-6.x.4708 / router / samba-3.0.25b / source / rpc_parse / parse_ntsvcs.c
blob559a9d5ab5f647aabb90b5cc3793b1e2eccd3464
1 /*
2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Gerald (Jerry) Carter 2005.
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.
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 #include "includes.h"
23 #undef DBGC_CLASS
24 #define DBGC_CLASS DBGC_RPC_PARSE
26 /*******************************************************************
27 ********************************************************************/
29 BOOL ntsvcs_io_q_get_version(const char *desc, NTSVCS_Q_GET_VERSION *q_u, prs_struct *ps, int depth)
31 if (q_u == NULL)
32 return False;
34 prs_debug(ps, depth, desc, "ntsvcs_io_q_get_version");
35 depth++;
37 /* there is nothing to parse in this PDU */
39 return True;
43 /*******************************************************************
44 ********************************************************************/
46 BOOL ntsvcs_io_r_get_version(const char *desc, NTSVCS_R_GET_VERSION *r_u, prs_struct *ps, int depth)
48 if ( !r_u )
49 return False;
51 prs_debug(ps, depth, desc, "ntsvcs_io_r_get_version");
52 depth++;
54 if(!prs_align(ps))
55 return False;
57 if(!prs_uint32("version", ps, depth, &r_u->version))
58 return False;
60 if(!prs_werror("status", ps, depth, &r_u->status))
61 return False;
63 return True;
66 /*******************************************************************
67 ********************************************************************/
69 BOOL ntsvcs_io_q_get_device_list_size(const char *desc, NTSVCS_Q_GET_DEVICE_LIST_SIZE *q_u, prs_struct *ps, int depth)
71 if (q_u == NULL)
72 return False;
74 prs_debug(ps, depth, desc, "ntsvcs_io_q_get_device_list_size");
75 depth++;
77 if(!prs_align(ps))
78 return False;
80 if ( !prs_pointer("devicename", ps, depth, (void*)&q_u->devicename, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2) )
81 return False;
82 if ( !prs_align(ps) )
83 return False;
85 if ( !prs_uint32("flags", ps, depth, &q_u->flags) )
86 return False;
88 return True;
92 /*******************************************************************
93 ********************************************************************/
95 BOOL ntsvcs_io_r_get_device_list_size(const char *desc, NTSVCS_R_GET_DEVICE_LIST_SIZE *r_u, prs_struct *ps, int depth)
97 if ( !r_u )
98 return False;
100 prs_debug(ps, depth, desc, "ntsvcs_io_r_get_device_list_size");
101 depth++;
103 if(!prs_align(ps))
104 return False;
106 if(!prs_uint32("size", ps, depth, &r_u->size))
107 return False;
109 if(!prs_werror("status", ps, depth, &r_u->status))
110 return False;
112 return True;
116 /*******************************************************************
117 ********************************************************************/
119 BOOL ntsvcs_io_q_get_device_list(const char *desc, NTSVCS_Q_GET_DEVICE_LIST *q_u, prs_struct *ps, int depth)
121 if (q_u == NULL)
122 return False;
124 prs_debug(ps, depth, desc, "ntsvcs_io_q_get_device_list");
125 depth++;
127 if(!prs_align(ps))
128 return False;
130 if ( !prs_pointer("devicename", ps, depth, (void*)&q_u->devicename, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2) )
131 return False;
132 if( !prs_align(ps) )
133 return False;
135 if ( !prs_uint32("buffer_size", ps, depth, &q_u->buffer_size) )
136 return False;
137 if ( !prs_uint32("flags", ps, depth, &q_u->flags) )
138 return False;
140 return True;
144 /*******************************************************************
145 ********************************************************************/
147 BOOL ntsvcs_io_r_get_device_list(const char *desc, NTSVCS_R_GET_DEVICE_LIST *r_u, prs_struct *ps, int depth)
149 if ( !r_u )
150 return False;
152 prs_debug(ps, depth, desc, "ntsvcs_io_r_get_device_list_size");
153 depth++;
155 if(!prs_align(ps))
156 return False;
158 if ( !prs_io_unistr2("devicepath", ps, depth, &r_u->devicepath) )
159 return False;
160 if(!prs_align(ps))
161 return False;
163 if(!prs_uint32("needed", ps, depth, &r_u->needed))
164 return False;
166 if(!prs_werror("status", ps, depth, &r_u->status))
167 return False;
169 return True;
172 /*******************************************************************
173 ********************************************************************/
175 BOOL ntsvcs_io_q_validate_device_instance(const char *desc, NTSVCS_Q_VALIDATE_DEVICE_INSTANCE *q_u, prs_struct *ps, int depth)
177 if (q_u == NULL)
178 return False;
180 prs_debug(ps, depth, desc, "ntsvcs_io_q_validate_device_instance");
181 depth++;
183 if(!prs_align(ps))
184 return False;
186 if ( !prs_io_unistr2("devicepath", ps, depth, &q_u->devicepath) )
187 return False;
188 if( !prs_align(ps) )
189 return False;
191 if ( !prs_uint32("flags", ps, depth, &q_u->flags) )
192 return False;
194 return True;
198 /*******************************************************************
199 ********************************************************************/
201 BOOL ntsvcs_io_r_validate_device_instance(const char *desc, NTSVCS_R_VALIDATE_DEVICE_INSTANCE *r_u, prs_struct *ps, int depth)
203 if ( !r_u )
204 return False;
206 prs_debug(ps, depth, desc, "ntsvcs_io_r_validate_device_instance");
207 depth++;
209 if(!prs_werror("status", ps, depth, &r_u->status))
210 return False;
212 return True;
215 /*******************************************************************
216 ********************************************************************/
218 BOOL ntsvcs_io_q_get_device_reg_property(const char *desc, NTSVCS_Q_GET_DEVICE_REG_PROPERTY *q_u, prs_struct *ps, int depth)
220 if (q_u == NULL)
221 return False;
223 prs_debug(ps, depth, desc, "ntsvcs_io_q_get_device_reg_property");
224 depth++;
226 if(!prs_align(ps))
227 return False;
229 if ( !prs_io_unistr2("devicepath", ps, depth, &q_u->devicepath) )
230 return False;
231 if( !prs_align(ps) )
232 return False;
234 if ( !prs_uint32("property", ps, depth, &q_u->property) )
235 return False;
236 if ( !prs_uint32("unknown2", ps, depth, &q_u->unknown2) )
237 return False;
238 if ( !prs_uint32("buffer_size1", ps, depth, &q_u->buffer_size1) )
239 return False;
240 if ( !prs_uint32("buffer_size2", ps, depth, &q_u->buffer_size2) )
241 return False;
242 if ( !prs_uint32("unknown5", ps, depth, &q_u->unknown5) )
243 return False;
245 return True;
249 /*******************************************************************
250 ********************************************************************/
252 BOOL ntsvcs_io_r_get_device_reg_property(const char *desc, NTSVCS_R_GET_DEVICE_REG_PROPERTY *r_u, prs_struct *ps, int depth)
254 if ( !r_u )
255 return False;
257 prs_debug(ps, depth, desc, "ntsvcs_io_r_get_device_reg_property");
258 depth++;
260 if ( !prs_align(ps) )
261 return False;
263 if ( !prs_uint32("unknown1", ps, depth, &r_u->unknown1) )
264 return False;
266 if ( !smb_io_regval_buffer("value", ps, depth, &r_u->value) )
267 return False;
268 if ( !prs_align(ps) )
269 return False;
271 if ( !prs_uint32("size", ps, depth, &r_u->size) )
272 return False;
274 if ( !prs_uint32("needed", ps, depth, &r_u->needed) )
275 return False;
277 if(!prs_werror("status", ps, depth, &r_u->status))
278 return False;
280 return True;
283 /*******************************************************************
284 ********************************************************************/
286 BOOL ntsvcs_io_q_get_hw_profile_info(const char *desc, NTSVCS_Q_GET_HW_PROFILE_INFO *q_u, prs_struct *ps, int depth)
288 if (q_u == NULL)
289 return False;
291 prs_debug(ps, depth, desc, "ntsvcs_io_q_get_hw_profile_info");
292 depth++;
294 if(!prs_align(ps))
295 return False;
297 if ( !prs_uint32("index", ps, depth, &q_u->index) )
298 return False;
300 q_u->buffer_size = 0x000000a8;
302 if ( UNMARSHALLING(ps) ) {
303 q_u->buffer = TALLOC_ARRAY(get_talloc_ctx(), uint8, q_u->buffer_size );
304 if (!q_u->buffer) {
305 return False;
309 if ( !prs_uint8s(True, "buffer", ps, depth, q_u->buffer, q_u->buffer_size) )
310 return False;
312 if ( !prs_uint32("buffer_size", ps, depth, &q_u->buffer_size) )
313 return False;
315 if ( !prs_uint32("unknown1", ps, depth, &q_u->unknown1) )
316 return False;
318 return True;
322 /*******************************************************************
323 ********************************************************************/
325 BOOL ntsvcs_io_r_get_hw_profile_info(const char *desc, NTSVCS_R_GET_HW_PROFILE_INFO *r_u, prs_struct *ps, int depth)
327 if ( !r_u )
328 return False;
330 prs_debug(ps, depth, desc, "ntsvcs_io_r_get_device_reg_property");
331 depth++;
333 if ( !prs_align(ps) )
334 return False;
336 if ( UNMARSHALLING(ps) ) {
337 if (r_u->buffer_size) {
338 r_u->buffer = TALLOC_ARRAY(get_talloc_ctx(), uint8, r_u->buffer_size );
339 if (!r_u->buffer) {
340 return False;
342 } else {
343 r_u->buffer = NULL;
347 if ( !prs_uint8s(True, "buffer", ps, depth, r_u->buffer, r_u->buffer_size) )
348 return False;
350 if(!prs_werror("status", ps, depth, &r_u->status))
351 return False;
353 return True;
356 /*******************************************************************
357 ********************************************************************/
359 BOOL ntsvcs_io_q_hw_profile_flags(const char *desc, NTSVCS_Q_HW_PROFILE_FLAGS *q_u, prs_struct *ps, int depth)
361 if (q_u == NULL)
362 return False;
364 prs_debug(ps, depth, desc, "ntsvcs_io_q_hw_profile_flags");
365 depth++;
367 if(!prs_align(ps))
368 return False;
370 if ( !prs_uint32("unknown1", ps, depth, &q_u->unknown1) )
371 return False;
374 if ( !prs_io_unistr2("devicepath", ps, depth, &q_u->devicepath) )
375 return False;
376 if( !prs_align(ps) )
377 return False;
379 if ( !prs_uint32("unknown2", ps, depth, &q_u->unknown2) )
380 return False;
381 if ( !prs_uint32("unknown3", ps, depth, &q_u->unknown3) )
382 return False;
383 if ( !prs_uint32("unknown4", ps, depth, &q_u->unknown4) )
384 return False;
385 if ( !prs_uint32("unknown5", ps, depth, &q_u->unknown5) )
386 return False;
387 if ( !prs_uint32("unknown6", ps, depth, &q_u->unknown6) )
388 return False;
389 if ( !prs_uint32("unknown7", ps, depth, &q_u->unknown7) )
390 return False;
392 if ( !prs_uint32("unknown1", ps, depth, &q_u->unknown1) )
393 return False;
395 return True;
399 /*******************************************************************
400 ********************************************************************/
402 BOOL ntsvcs_io_r_hw_profile_flags(const char *desc, NTSVCS_R_HW_PROFILE_FLAGS *r_u, prs_struct *ps, int depth)
404 if ( !r_u )
405 return False;
407 prs_debug(ps, depth, desc, "ntsvcs_io_r_hw_profile_flags");
408 depth++;
410 if ( !prs_align(ps) )
411 return False;
413 if ( !prs_uint32("unknown1", ps, depth, &r_u->unknown1) )
414 return False;
415 if ( !prs_uint32("unknown2", ps, depth, &r_u->unknown2) )
416 return False;
417 if ( !prs_uint32("unknown3", ps, depth, &r_u->unknown3) )
418 return False;
419 if(!prs_werror("status", ps, depth, &r_u->status))
420 return False;
422 return True;