f2e44560252324b9cbdd1faab7e243d5d2ec2d39
[ira/wip.git] / source3 / rpc_parse / parse_ntsvcs.c
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.
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 #include "includes.h"
22
23 #undef DBGC_CLASS
24 #define DBGC_CLASS DBGC_RPC_PARSE
25
26 /*******************************************************************
27 ********************************************************************/
28
29 BOOL ntsvcs_io_q_get_version(const char *desc, NTSVCS_Q_GET_VERSION *q_u, prs_struct *ps, int depth)
30 {
31         if (q_u == NULL)
32                 return False;
33
34         prs_debug(ps, depth, desc, "ntsvcs_io_q_get_version");
35         depth++;
36
37         /* there is nothing to parse in this PDU */
38
39         return True;
40
41 }
42
43 /*******************************************************************
44 ********************************************************************/
45
46 BOOL ntsvcs_io_r_get_version(const char *desc, NTSVCS_R_GET_VERSION *r_u, prs_struct *ps, int depth)
47 {
48         if ( !r_u )
49                 return False;
50
51         prs_debug(ps, depth, desc, "ntsvcs_io_r_get_version");
52         depth++;
53
54         if(!prs_align(ps))
55                 return False;
56                 
57         if(!prs_uint32("version", ps, depth, &r_u->version))
58                 return False;
59                 
60         if(!prs_werror("status", ps, depth, &r_u->status))
61                 return False;
62
63         return True;
64 }
65
66 /*******************************************************************
67 ********************************************************************/
68
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)
70 {
71         if (q_u == NULL)
72                 return False;
73
74         prs_debug(ps, depth, desc, "ntsvcs_io_q_get_device_list_size");
75         depth++;
76         
77         if(!prs_align(ps))
78                 return False;
79
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;
84                 
85         if ( !prs_uint32("flags", ps, depth, &q_u->flags) )
86                 return False;
87         
88         return True;
89
90 }
91
92 /*******************************************************************
93 ********************************************************************/
94
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)
96 {
97         if ( !r_u )
98                 return False;
99
100         prs_debug(ps, depth, desc, "ntsvcs_io_r_get_device_list_size");
101         depth++;
102
103         if(!prs_align(ps))
104                 return False;
105                 
106         if(!prs_uint32("size", ps, depth, &r_u->size))
107                 return False;
108                 
109         if(!prs_werror("status", ps, depth, &r_u->status))
110                 return False;
111
112         return True;
113 }
114
115
116 /*******************************************************************
117 ********************************************************************/
118
119 BOOL ntsvcs_io_q_get_device_list(const char *desc, NTSVCS_Q_GET_DEVICE_LIST *q_u, prs_struct *ps, int depth)
120 {
121         if (q_u == NULL)
122                 return False;
123
124         prs_debug(ps, depth, desc, "ntsvcs_io_q_get_device_list");
125         depth++;
126         
127         if(!prs_align(ps))
128                 return False;
129
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;
134                 
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;
139         
140         return True;
141
142 }
143
144 /*******************************************************************
145 ********************************************************************/
146
147 BOOL ntsvcs_io_r_get_device_list(const char *desc, NTSVCS_R_GET_DEVICE_LIST *r_u, prs_struct *ps, int depth)
148 {
149         if ( !r_u )
150                 return False;
151
152         prs_debug(ps, depth, desc, "ntsvcs_io_r_get_device_list_size");
153         depth++;
154
155         if(!prs_align(ps))
156                 return False;
157                 
158         if ( !prs_io_unistr2("devicepath", ps, depth, &r_u->devicepath) )
159                 return False;
160         if(!prs_align(ps))
161                 return False;
162                 
163         if(!prs_uint32("needed", ps, depth, &r_u->needed))
164                 return False;
165                 
166         if(!prs_werror("status", ps, depth, &r_u->status))
167                 return False;
168
169         return True;
170 }
171
172 /*******************************************************************
173 ********************************************************************/
174
175 BOOL ntsvcs_io_q_validate_device_instance(const char *desc, NTSVCS_Q_VALIDATE_DEVICE_INSTANCE *q_u, prs_struct *ps, int depth)
176 {
177         if (q_u == NULL)
178                 return False;
179
180         prs_debug(ps, depth, desc, "ntsvcs_io_q_validate_device_instance");
181         depth++;
182         
183         if(!prs_align(ps))
184                 return False;
185
186         if ( !prs_io_unistr2("devicepath", ps, depth, &q_u->devicepath) )
187                 return False;
188         if( !prs_align(ps) )
189                 return False;
190                 
191         if ( !prs_uint32("flags", ps, depth, &q_u->flags) )
192                 return False;
193         
194         return True;
195
196 }
197
198 /*******************************************************************
199 ********************************************************************/
200
201 BOOL ntsvcs_io_r_validate_device_instance(const char *desc, NTSVCS_R_VALIDATE_DEVICE_INSTANCE *r_u, prs_struct *ps, int depth)
202 {
203         if ( !r_u )
204                 return False;
205
206         prs_debug(ps, depth, desc, "ntsvcs_io_r_validate_device_instance");
207         depth++;
208
209         if(!prs_werror("status", ps, depth, &r_u->status))
210                 return False;
211
212         return True;
213 }
214
215 /*******************************************************************
216 ********************************************************************/
217
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)
219 {
220         if (q_u == NULL)
221                 return False;
222
223         prs_debug(ps, depth, desc, "ntsvcs_io_q_get_device_reg_property");
224         depth++;
225         
226         if(!prs_align(ps))
227                 return False;
228
229         if ( !prs_io_unistr2("devicepath", ps, depth, &q_u->devicepath) )
230                 return False;
231         if( !prs_align(ps) )
232                 return False;
233
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;
244         
245         return True;
246
247 }
248
249 /*******************************************************************
250 ********************************************************************/
251
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)
253 {
254         if ( !r_u )
255                 return False;
256
257         prs_debug(ps, depth, desc, "ntsvcs_io_r_get_device_reg_property");
258         depth++;
259
260         if ( !prs_align(ps) )
261                 return False;
262
263         if ( !prs_uint32("unknown1", ps, depth, &r_u->unknown1) )
264                 return False;
265
266         if ( !smb_io_regval_buffer("value", ps, depth, &r_u->value) )
267                 return False;
268         if ( !prs_align(ps) )
269                 return False;
270
271         if ( !prs_uint32("size", ps, depth, &r_u->size) )
272                 return False;
273
274         if ( !prs_uint32("needed", ps, depth, &r_u->needed) )
275                 return False;
276
277         if(!prs_werror("status", ps, depth, &r_u->status))
278                 return False;
279
280         return True;
281 }
282
283 /*******************************************************************
284 ********************************************************************/
285
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)
287 {
288         if (q_u == NULL)
289                 return False;
290
291         prs_debug(ps, depth, desc, "ntsvcs_io_q_get_hw_profile_info");
292         depth++;
293         
294         if(!prs_align(ps))
295                 return False;
296
297         if ( !prs_uint32("index", ps, depth, &q_u->index) )
298                 return False;
299
300         q_u->buffer_size = 0x000000a8;
301
302         if ( UNMARSHALLING(ps) )
303                 q_u->buffer = TALLOC_ARRAY(get_talloc_ctx(), uint8, q_u->buffer_size );
304
305         if ( !prs_uint8s(True, "buffer", ps, depth, q_u->buffer, q_u->buffer_size) )
306                 return False;
307
308         if ( !prs_uint32("buffer_size", ps, depth, &q_u->buffer_size) )
309                 return False;
310
311         if ( !prs_uint32("unknown1", ps, depth, &q_u->unknown1) )
312                 return False;
313         
314         return True;
315
316 }
317
318 /*******************************************************************
319 ********************************************************************/
320
321 BOOL ntsvcs_io_r_get_hw_profile_info(const char *desc, NTSVCS_R_GET_HW_PROFILE_INFO *r_u, prs_struct *ps, int depth)
322 {
323         if ( !r_u )
324                 return False;
325
326         prs_debug(ps, depth, desc, "ntsvcs_io_r_get_device_reg_property");
327         depth++;
328
329         if ( !prs_align(ps) )
330                 return False;
331
332         if ( UNMARSHALLING(ps) )
333                 r_u->buffer = TALLOC_ARRAY(get_talloc_ctx(), uint8, r_u->buffer_size );
334
335         if ( !prs_uint8s(True, "buffer", ps, depth, r_u->buffer, r_u->buffer_size) )
336                 return False;
337
338         if(!prs_werror("status", ps, depth, &r_u->status))
339                 return False;
340
341         return True;
342 }
343
344 /*******************************************************************
345 ********************************************************************/
346
347 BOOL ntsvcs_io_q_hw_profile_flags(const char *desc, NTSVCS_Q_HW_PROFILE_FLAGS *q_u, prs_struct *ps, int depth)
348 {
349         if (q_u == NULL)
350                 return False;
351
352         prs_debug(ps, depth, desc, "ntsvcs_io_q_hw_profile_flags");
353         depth++;
354         
355         if(!prs_align(ps))
356                 return False;
357
358         if ( !prs_uint32("unknown1", ps, depth, &q_u->unknown1) )
359                 return False;
360                 
361
362         if ( !prs_io_unistr2("devicepath", ps, depth, &q_u->devicepath) )
363                 return False;
364         if( !prs_align(ps) )
365                 return False;
366
367         if ( !prs_uint32("unknown2", ps, depth, &q_u->unknown2) )
368                 return False;
369         if ( !prs_uint32("unknown3", ps, depth, &q_u->unknown3) )
370                 return False;
371         if ( !prs_uint32("unknown4", ps, depth, &q_u->unknown4) )
372                 return False;
373         if ( !prs_uint32("unknown5", ps, depth, &q_u->unknown5) )
374                 return False;
375         if ( !prs_uint32("unknown6", ps, depth, &q_u->unknown6) )
376                 return False;
377         if ( !prs_uint32("unknown7", ps, depth, &q_u->unknown7) )
378                 return False;
379
380         if ( !prs_uint32("unknown1", ps, depth, &q_u->unknown1) )
381                 return False;
382         
383         return True;
384
385 }
386
387 /*******************************************************************
388 ********************************************************************/
389
390 BOOL ntsvcs_io_r_hw_profile_flags(const char *desc, NTSVCS_R_HW_PROFILE_FLAGS *r_u, prs_struct *ps, int depth)
391 {
392         if ( !r_u )
393                 return False;
394
395         prs_debug(ps, depth, desc, "ntsvcs_io_r_hw_profile_flags");
396         depth++;
397
398         if ( !prs_align(ps) )
399                 return False;
400
401         if ( !prs_uint32("unknown1", ps, depth, &r_u->unknown1) )
402                 return False;
403         if ( !prs_uint32("unknown2", ps, depth, &r_u->unknown2) )
404                 return False;
405         if ( !prs_uint32("unknown3", ps, depth, &r_u->unknown3) )
406                 return False;
407         if(!prs_werror("status", ps, depth, &r_u->status))
408                 return False;
409
410         return True;
411 }
412
413
414
415