r3428: switched to using minimal includes for the auto-generated RPC code.
[tprouty/samba.git] / source4 / 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 2 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, write to the Free Software
21    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24
25 #include "includes.h"
26 #include "librpc/gen_ndr/ndr_spoolss.h"
27
28 NTSTATUS pull_spoolss_PrinterInfoArray(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
29                                        uint32_t level, uint32_t count,
30                                        union spoolss_PrinterInfo **info)
31 {
32         int i;
33         struct ndr_pull *ndr;
34         ndr = ndr_pull_init_blob(blob, mem_ctx);
35         if (!ndr) {
36                 return NT_STATUS_NO_MEMORY;
37         }
38         NDR_ALLOC_N(ndr, *info, count);
39         for (i=0;i<count;i++) {
40                 ndr->data += ndr->offset;
41                 ndr->offset = 0;
42                 NDR_CHECK(ndr_pull_spoolss_PrinterInfo(ndr, NDR_SCALARS|NDR_BUFFERS, level, &(*info)[i]));
43         }
44         return NT_STATUS_OK;
45 }
46
47 NTSTATUS pull_spoolss_FormInfoArray(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
48                                     uint32_t level, uint32_t count,
49                                     union spoolss_FormInfo **info)
50 {
51         int i;
52         struct ndr_pull *ndr;
53         ndr = ndr_pull_init_blob(blob, mem_ctx);
54         if (!ndr) {
55                 return NT_STATUS_NO_MEMORY;
56         }
57         NDR_ALLOC_N(ndr, *info, count);
58         for (i=0;i<count;i++) {
59                 NDR_CHECK(ndr_pull_spoolss_FormInfo(ndr, NDR_SCALARS|NDR_BUFFERS, level, &(*info)[i]));
60         }
61         return NT_STATUS_OK;
62 }
63
64 NTSTATUS pull_spoolss_JobInfoArray(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
65                                    uint32_t level, uint32_t count,
66                                    union spoolss_JobInfo **info)
67 {
68         int i;
69         struct ndr_pull *ndr;
70         ndr = ndr_pull_init_blob(blob, mem_ctx);
71         if (!ndr) {
72                 return NT_STATUS_NO_MEMORY;
73         }
74         NDR_ALLOC_N(ndr, *info, count);
75         for (i=0;i<count;i++) {
76                 NDR_CHECK(ndr_pull_spoolss_JobInfo(ndr, NDR_SCALARS|NDR_BUFFERS, level, &(*info)[i]));
77         }
78         return NT_STATUS_OK;
79 }
80
81 NTSTATUS pull_spoolss_DriverInfoArray(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
82                                       uint32_t level, uint32_t count,
83                                       union spoolss_DriverInfo **info)
84 {
85         int i;
86         struct ndr_pull *ndr;
87         ndr = ndr_pull_init_blob(blob, mem_ctx);
88         if (!ndr) {
89                 return NT_STATUS_NO_MEMORY;
90         }
91         NDR_ALLOC_N(ndr, *info, count);
92         for (i=0;i<count;i++) {
93                 NDR_CHECK(ndr_pull_spoolss_DriverInfo(ndr, NDR_SCALARS|NDR_BUFFERS, level, &(*info)[i]));
94         }
95         return NT_STATUS_OK;
96 }
97
98 NTSTATUS pull_spoolss_PortInfoArray(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
99                                       uint32_t level, uint32_t count,
100                                       union spoolss_PortInfo **info)
101 {
102         int i;
103         struct ndr_pull *ndr;
104         ndr = ndr_pull_init_blob(blob, mem_ctx);
105         if (!ndr) {
106                 return NT_STATUS_NO_MEMORY;
107         }
108         NDR_ALLOC_N(ndr, *info, count);
109         for (i=0;i<count;i++) {
110                 ndr->data += ndr->offset;
111                 ndr->offset = 0;
112                 NDR_CHECK(ndr_pull_spoolss_PortInfo(ndr, NDR_SCALARS|NDR_BUFFERS, level, &(*info)[i]));
113         }
114         return NT_STATUS_OK;
115 }