spoolss: add ndr_size_spoolss_StringArray to spoolss helper.
[ira/wip.git] / librpc / ndr / ndr_spoolss_buf.c
1 /*
2    Unix SMB/CIFS implementation.
3
4    routines for marshalling/unmarshalling spoolss subcontext buffer structures
5
6    Copyright (C) Andrew Tridgell 2003
7    Copyright (C) Tim Potter 2003
8
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 3 of the License, or
12    (at your option) any later version.
13
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.
21 */
22
23
24 #include "includes.h"
25 #include "librpc/gen_ndr/ndr_spoolss.h"
26 #if (_SAMBA_BUILD_ >= 4)
27 #include "param/param.h"
28 #endif
29
30 #define NDR_SPOOLSS_PUSH_ENUM_IN(fn) do { \
31         if (!r->in.buffer && r->in.offered != 0) {\
32                 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
33                         "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
34                         (unsigned)r->in.offered);\
35         } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
36                 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
37                         "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
38                         (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
39         }\
40         _r.in.level     = r->in.level;\
41         _r.in.buffer    = r->in.buffer;\
42         _r.in.offered   = r->in.offered;\
43         NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
44 } while(0)
45
46 #define NDR_SPOOLSS_PUSH_ENUM_OUT(fn) do { \
47         struct ndr_push *_ndr_info;\
48         _r.in.level     = r->in.level;\
49         _r.in.buffer    = r->in.buffer;\
50         _r.in.offered   = r->in.offered;\
51         _r.out.info     = NULL;\
52         _r.out.needed   = r->out.needed;\
53         _r.out.count    = r->out.count;\
54         _r.out.result   = r->out.result;\
55         if (r->out.info && !r->in.buffer) {\
56                 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
57                         "SPOOLSS Buffer: r->out.info but there's no r->in.buffer");\
58         }\
59         if (r->in.buffer) {\
60                 DATA_BLOB _data_blob_info;\
61                 _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);\
62                 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
63                 _ndr_info->flags= ndr->flags;\
64                 if (r->out.info) {\
65                         struct __##fn __r;\
66                         __r.in.level    = r->in.level;\
67                         __r.in.count    = *r->out.count;\
68                         __r.out.info    = r->out.info;\
69                         NDR_CHECK(ndr_push___##fn(_ndr_info, flags, &__r)); \
70                 }\
71                 if (r->in.offered > _ndr_info->offset) {\
72                         uint32_t _padding_len = r->in.offered - _ndr_info->offset;\
73                         NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));\
74                 } else if (r->in.offered < _ndr_info->offset) {\
75                         return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
76                                 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]!",\
77                                 (unsigned)r->in.offered, (unsigned)_ndr_info->offset);\
78                 }\
79                 _data_blob_info = ndr_push_blob(_ndr_info);\
80                 _r.out.info     = &_data_blob_info;\
81         }\
82         NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
83 } while(0)
84
85 #define NDR_SPOOLSS_PUSH_ENUM(fn,in,out) do { \
86         struct _##fn _r;\
87         if (flags & NDR_IN) {\
88                 in;\
89                 NDR_SPOOLSS_PUSH_ENUM_IN(fn);\
90         }\
91         if (flags & NDR_OUT) {\
92                 out;\
93                 NDR_SPOOLSS_PUSH_ENUM_OUT(fn);\
94         }\
95 } while(0)
96
97 #define NDR_SPOOLSS_PULL_ENUM_IN(fn) do { \
98         ZERO_STRUCT(r->out);\
99         NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
100         r->in.level     = _r.in.level;\
101         r->in.buffer    = _r.in.buffer;\
102         r->in.offered   = _r.in.offered;\
103         r->out.needed   = _r.out.needed;\
104         r->out.count    = _r.out.count;\
105         if (!r->in.buffer && r->in.offered != 0) {\
106                 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
107                         "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
108                         (unsigned)r->in.offered);\
109         } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
110                 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
111                         "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
112                         (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
113         }\
114 } while(0)
115
116 #define NDR_SPOOLSS_PULL_ENUM_OUT(fn) do { \
117         _r.in.level     = r->in.level;\
118         _r.in.buffer    = r->in.buffer;\
119         _r.in.offered   = r->in.offered;\
120         _r.out.needed   = r->out.needed;\
121         _r.out.count    = r->out.count;\
122         NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
123         r->out.info     = NULL;\
124         r->out.needed   = _r.out.needed;\
125         r->out.count    = _r.out.count;\
126         r->out.result   = _r.out.result;\
127         if (_r.out.info) {\
128                 struct ndr_pull *_ndr_info = ndr_pull_init_blob(_r.out.info, ndr, ndr->iconv_convenience);\
129                 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
130                 _ndr_info->flags= ndr->flags;\
131                 if (r->in.offered != _ndr_info->data_size) {\
132                         return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
133                                 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",\
134                                 (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);\
135                 }\
136                 if (*r->out.needed <= _ndr_info->data_size) {\
137                         struct __##fn __r;\
138                         __r.in.level    = r->in.level;\
139                         __r.in.count    = *r->out.count;\
140                         __r.out.info    = NULL;\
141                         NDR_CHECK(ndr_pull___##fn(_ndr_info, flags, &__r));\
142                         r->out.info     = __r.out.info;\
143                 }\
144         }\
145 } while(0)
146
147 #define NDR_SPOOLSS_PULL_ENUM(fn,in,out) do { \
148         struct _##fn _r;\
149         if (flags & NDR_IN) {\
150                 out;\
151                 NDR_SPOOLSS_PULL_ENUM_IN(fn);\
152                 in;\
153         }\
154         if (flags & NDR_OUT) {\
155                 out;\
156                 NDR_SPOOLSS_PULL_ENUM_OUT(fn);\
157         }\
158 } while(0)
159
160 #define _NDR_CHECK_UINT32(call) do {\
161         enum ndr_err_code _ndr_err; \
162         _ndr_err = call; \
163         if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
164                 return 0; \
165         }\
166 } while (0)
167
168 /* TODO: set _ndr_info->flags correct */
169 #define NDR_SPOOLSS_SIZE_ENUM(fn) do { \
170         struct __##fn __r;\
171         DATA_BLOB _data_blob_info;\
172         struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\
173         if (!_ndr_info) return 0;\
174         _ndr_info->flags|=0;\
175         __r.in.level    = level;\
176         __r.in.count    = count;\
177         __r.out.info    = info;\
178         _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
179         _data_blob_info = ndr_push_blob(_ndr_info);\
180         return _data_blob_info.length;\
181 } while(0)
182
183 /*
184   spoolss_EnumPrinters
185 */
186 enum ndr_err_code ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinters *r)
187 {
188         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinters,{
189                 _r.in.flags     = r->in.flags;
190                 _r.in.server    = r->in.server;
191         },{
192                 _r.in.flags     = r->in.flags;
193                 _r.in.server    = r->in.server;
194         });
195         return NDR_ERR_SUCCESS;
196 }
197
198 enum ndr_err_code ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinters *r)
199 {
200         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinters,{
201                 r->in.flags     = _r.in.flags;
202                 r->in.server    = _r.in.server;
203         },{
204                 _r.in.flags     = r->in.flags;
205                 _r.in.server    = r->in.server;
206         });
207         return NDR_ERR_SUCCESS;
208 }
209
210 uint32_t ndr_size_spoolss_EnumPrinters_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_PrinterInfo *info)
211 {
212         NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinters);
213 }
214
215 /*
216   spoolss_EnumJobs
217 */
218 enum ndr_err_code ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, int flags, const struct spoolss_EnumJobs *r)
219 {
220         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumJobs,{
221                 _r.in.handle    = r->in.handle;
222                 _r.in.firstjob  = r->in.firstjob;
223                 _r.in.numjobs   = r->in.numjobs;
224         },{
225                 _r.in.handle    = r->in.handle;
226                 _r.in.firstjob  = r->in.firstjob;
227                 _r.in.numjobs   = r->in.numjobs;
228         });
229         return NDR_ERR_SUCCESS;
230 }
231
232 enum ndr_err_code ndr_pull_spoolss_EnumJobs(struct ndr_pull *ndr, int flags, struct spoolss_EnumJobs *r)
233 {
234         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumJobs,{
235                 r->in.handle    = _r.in.handle;
236                 r->in.firstjob  = _r.in.firstjob;
237                 r->in.numjobs   = _r.in.numjobs;
238         },{
239                 _r.in.handle    = r->in.handle;
240                 _r.in.firstjob  = r->in.firstjob;
241                 _r.in.numjobs   = r->in.numjobs;
242         });
243         return NDR_ERR_SUCCESS;
244 }
245
246 uint32_t ndr_size_spoolss_EnumJobss_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_JobInfo *info)
247 {
248         NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumJobs);
249 }
250
251 /*
252   spoolss_EnumPrinterDrivers
253 */
254 enum ndr_err_code ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDrivers *r)
255 {
256         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinterDrivers,{
257                 _r.in.server            = r->in.server;
258                 _r.in.environment       = r->in.environment;
259         },{
260                 _r.in.server            = r->in.server;
261                 _r.in.environment       = r->in.environment;
262         });
263         return NDR_ERR_SUCCESS;
264 }
265
266 enum ndr_err_code ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDrivers *r)
267 {
268         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinterDrivers,{
269                 r->in.server            = _r.in.server;
270                 r->in.environment       = _r.in.environment;
271         },{
272                 _r.in.server            = r->in.server;
273                 _r.in.environment       = r->in.environment;
274         });
275         return NDR_ERR_SUCCESS;
276 }
277
278 uint32_t ndr_size_spoolss_EnumPrinterDrivers_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_DriverInfo *info)
279 {
280         NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDrivers);
281 }
282
283 /*
284   spoolss_EnumForms
285 */
286 enum ndr_err_code ndr_push_spoolss_EnumForms(struct ndr_push *ndr, int flags, const struct spoolss_EnumForms *r)
287 {
288         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumForms,{
289                 _r.in.handle    = r->in.handle;
290         },{
291                 _r.in.handle    = r->in.handle;
292         });
293         return NDR_ERR_SUCCESS;
294 }
295
296 enum ndr_err_code ndr_pull_spoolss_EnumForms(struct ndr_pull *ndr, int flags, struct spoolss_EnumForms *r)
297 {
298         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumForms,{
299                 r->in.handle    = _r.in.handle;
300         },{
301                 _r.in.handle    = r->in.handle;
302         });
303         return NDR_ERR_SUCCESS;
304 }
305
306 uint32_t ndr_size_spoolss_EnumForms_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_FormInfo *info)
307 {
308         NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumForms);
309 }
310
311 /*
312   spoolss_EnumPorts
313 */
314 enum ndr_err_code ndr_push_spoolss_EnumPorts(struct ndr_push *ndr, int flags, const struct spoolss_EnumPorts *r)
315 {
316         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPorts,{
317                 _r.in.servername= r->in.servername;
318         },{
319                 _r.in.servername= r->in.servername;
320         });
321         return NDR_ERR_SUCCESS;
322 }
323
324 enum ndr_err_code ndr_pull_spoolss_EnumPorts(struct ndr_pull *ndr, int flags, struct spoolss_EnumPorts *r)
325 {
326         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPorts,{
327                 r->in.servername= _r.in.servername;
328         },{
329                 _r.in.servername= r->in.servername;
330         });
331         return NDR_ERR_SUCCESS;
332 }
333
334 uint32_t ndr_size_spoolss_EnumPorts_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_PortInfo *info)
335 {
336         NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPorts);
337 }
338
339 /*
340   spoolss_EnumMonitors
341 */
342 enum ndr_err_code ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, const struct spoolss_EnumMonitors *r)
343 {
344         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumMonitors,{
345                 _r.in.servername= r->in.servername;
346         },{
347                 _r.in.servername= r->in.servername;
348         });
349         return NDR_ERR_SUCCESS;
350 }
351
352 enum ndr_err_code ndr_pull_spoolss_EnumMonitors(struct ndr_pull *ndr, int flags, struct spoolss_EnumMonitors *r)
353 {
354         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumMonitors,{
355                 r->in.servername= _r.in.servername;
356         },{
357                 _r.in.servername= r->in.servername;
358         });
359         return NDR_ERR_SUCCESS;
360 }
361
362 uint32_t ndr_size_spoolss_EnumMonitors_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_MonitorInfo *info)
363 {
364         NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumMonitors);
365 }
366
367 /*
368   spoolss_EnumPrintProcessors
369 */
370 enum ndr_err_code ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessors *r)
371 {
372         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcessors,{
373                 _r.in.servername        = r->in.servername;
374                 _r.in.environment       = r->in.environment;
375         },{
376                 _r.in.servername        = r->in.servername;
377                 _r.in.environment       = r->in.environment;
378         });
379         return NDR_ERR_SUCCESS;
380 }
381
382 enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessors *r)
383 {
384         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcessors,{
385                 r->in.servername        = _r.in.servername;
386                 r->in.environment       = _r.in.environment;
387         },{
388                 _r.in.servername        = r->in.servername;
389                 _r.in.environment       = r->in.environment;
390         });
391         return NDR_ERR_SUCCESS;
392 }
393
394 uint32_t ndr_size_spoolss_EnumPrinterProcessors_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
395                                                                                                          uint32_t level, uint32_t count, union spoolss_PrintProcessorInfo *info)
396 {
397         NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrintProcessors);
398 }
399
400 /*
401   spoolss_GetPrinterData
402 */
403 enum ndr_err_code ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterData *r)
404 {
405         struct _spoolss_GetPrinterData _r;
406         if (flags & NDR_IN) {
407                 _r.in.handle    = r->in.handle;
408                 _r.in.value_name= r->in.value_name;
409                 _r.in.offered   = r->in.offered;
410                 NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr, flags, &_r));
411         }
412         if (flags & NDR_OUT) {
413                 struct ndr_push *_ndr_info;
414                 _r.in.handle    = r->in.handle;
415                 _r.in.value_name= r->in.value_name;
416                 _r.in.offered   = r->in.offered;
417                 _r.out.type     = r->out.type;
418                 _r.out.data     = data_blob(NULL, 0);
419                 _r.out.needed   = r->out.needed;
420                 _r.out.result   = r->out.result;
421                 {
422                         struct __spoolss_GetPrinterData __r;
423                         _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
424                         NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
425                         _ndr_info->flags= ndr->flags;
426                         __r.in.type     = *r->out.type;
427                         __r.out.data    = r->out.data;
428                         NDR_CHECK(ndr_push___spoolss_GetPrinterData(_ndr_info, flags, &__r));
429                         if (r->in.offered > _ndr_info->offset) {
430                                 uint32_t _padding_len = r->in.offered - _ndr_info->offset;
431                                 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));
432                         }
433                         _r.out.data = ndr_push_blob(_ndr_info);
434                 }
435                 NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr, flags, &_r));
436         }
437         return NDR_ERR_SUCCESS;
438 }
439
440 enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterData *r)
441 {
442         struct _spoolss_GetPrinterData _r;
443         if (flags & NDR_IN) {
444                 ZERO_STRUCT(r->out);
445
446                 _r.in.handle    = r->in.handle;
447                 _r.in.value_name= r->in.value_name;
448                 _r.in.offered   = r->in.offered;
449                 _r.out.type     = r->out.type;
450                 _r.out.data     = data_blob(NULL,0),
451                 _r.out.needed   = r->out.needed;
452                 NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr, flags, &_r));
453                 r->in.handle    = _r.in.handle;
454                 r->in.value_name= _r.in.value_name;
455                 r->in.offered   = _r.in.offered;
456                 r->out.needed   = _r.out.needed;
457         }
458         if (flags & NDR_OUT) {
459                 _r.in.handle    = r->in.handle;
460                 _r.in.value_name= r->in.value_name;
461                 _r.in.offered   = r->in.offered;
462                 _r.out.type     = r->out.type;
463                 _r.out.data     = data_blob(NULL,0),
464                 _r.out.needed   = r->out.needed;
465                 _r.out.result   = r->out.result;
466                 NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr, flags, &_r));
467                 r->out.type     = _r.out.type;
468                 ZERO_STRUCT(r->out.data);
469                 r->out.needed   = _r.out.needed;
470                 r->out.result   = _r.out.result;
471                 if (_r.out.data.length != r->in.offered) {
472                         return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
473                                 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]",
474                                 (unsigned)r->in.offered, (unsigned)_r.out.data.length);
475                 }
476                 if (_r.out.data.length > 0 && *r->out.needed <= _r.out.data.length) {
477                         struct __spoolss_GetPrinterData __r;
478                         struct ndr_pull *_ndr_data = ndr_pull_init_blob(&_r.out.data, ndr, ndr->iconv_convenience);
479                         NDR_ERR_HAVE_NO_MEMORY(_ndr_data);
480                         _ndr_data->flags= ndr->flags;
481                         __r.in.type     = *r->out.type;
482                         __r.out.data    = r->out.data;
483                         NDR_CHECK(ndr_pull___spoolss_GetPrinterData(_ndr_data, flags, &__r));
484                         r->out.data     = __r.out.data;
485                 } else {
486                         *r->out.type    = SPOOLSS_PRINTER_DATA_TYPE_NULL;
487                 }
488         }
489         return NDR_ERR_SUCCESS;
490 }
491
492 /*
493   spoolss_SetPrinterData
494 */
495 enum ndr_err_code ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterData *r)
496 {
497         struct _spoolss_SetPrinterData _r;
498         if (flags & NDR_IN) {
499                 struct ndr_push *_ndr_data;
500                 struct __spoolss_SetPrinterData __r;
501                 DATA_BLOB _data_blob_data;
502
503                 _ndr_data = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
504                 NDR_ERR_HAVE_NO_MEMORY(_ndr_data);
505                 _ndr_data->flags= ndr->flags;
506
507                 __r.in.type     = r->in.type;
508                 __r.out.data    = r->in.data;
509                 NDR_CHECK(ndr_push___spoolss_SetPrinterData(_ndr_data, NDR_OUT, &__r));
510                 _data_blob_data = ndr_push_blob(_ndr_data);
511
512                 _r.in.handle    = r->in.handle;
513                 _r.in.value_name= r->in.value_name;
514                 _r.in.type      = r->in.type;
515                 _r.in.data      = _data_blob_data;
516                 _r.in._offered  = _data_blob_data.length;
517                 _r.out.result   = r->out.result;
518                 NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr, flags, &_r));
519         }
520         if (flags & NDR_OUT) {
521                 _r.in.handle    = r->in.handle;
522                 _r.in.value_name= r->in.value_name;
523                 _r.in.type      = r->in.type;
524                 _r.in.data      = data_blob(NULL,0),
525                 _r.in._offered  = r->in._offered;
526                 _r.out.result   = r->out.result;
527                 NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr, flags, &_r));
528         }
529         return NDR_ERR_SUCCESS;
530 }
531
532 uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, struct smb_iconv_convenience *ic, uint32_t flags)
533 {
534         if (!devmode) return 0;
535         return ndr_size_spoolss_DeviceMode(devmode,ic,flags);
536 }
537
538 _PUBLIC_ size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, struct smb_iconv_convenience *ic, int flags)
539 {
540         if (!r) {
541                 return 4;
542         }
543
544         return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_StringArray, ic);
545 }
546