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