r23792: convert Samba4 to GPLv3
[bbaumbach/samba-autobuild/.git] / source4 / ntptr / ntptr_interface.c
1 /* 
2    Unix SMB/CIFS implementation.
3
4    NTPTR interface functions
5
6    Copyright (C) Stefan (metze) Metzmacher 2005
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3 of the License, or
11    (at your option) any later version.
12    
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17    
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #include "includes.h"
23 #include "ntptr/ntptr.h"
24
25
26 /* PrintServer functions */
27 WERROR ntptr_OpenPrintServer(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
28                              struct spoolss_OpenPrinterEx *r,
29                              const char *printer_name,
30                              struct ntptr_GenericHandle **server)
31 {
32         if (!ntptr->ops->OpenPrintServer) {
33                 return WERR_NOT_SUPPORTED;
34         }
35         return ntptr->ops->OpenPrintServer(ntptr, mem_ctx, r, printer_name, server);
36 }
37
38 WERROR ntptr_XcvDataPrintServer(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
39                                 struct spoolss_XcvData *r)
40 {
41         if (server->type != NTPTR_HANDLE_SERVER) {
42                 return WERR_FOOBAR;
43         }
44         if (!server->ntptr->ops->XcvDataPrintServer) {
45                 return WERR_NOT_SUPPORTED;
46         }
47         return server->ntptr->ops->XcvDataPrintServer(server, mem_ctx, r);
48 }
49
50
51 /* PrintServer PrinterData functions */
52 WERROR ntptr_EnumPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
53                                  struct spoolss_EnumPrinterData *r)
54 {
55         if (server->type != NTPTR_HANDLE_SERVER) {
56                 return WERR_FOOBAR;
57         }
58         if (!server->ntptr->ops->EnumPrintServerData) {
59                 return WERR_NOT_SUPPORTED;
60         }
61         return server->ntptr->ops->EnumPrintServerData(server, mem_ctx, r);
62 }
63
64 WERROR ntptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
65                                 struct spoolss_GetPrinterData *r)
66 {
67         if (server->type != NTPTR_HANDLE_SERVER) {
68                 return WERR_FOOBAR;
69         }
70         if (!server->ntptr->ops->GetPrintServerData) {
71                 return WERR_NOT_SUPPORTED;
72         }
73         return server->ntptr->ops->GetPrintServerData(server, mem_ctx, r);
74 }
75
76 WERROR ntptr_SetPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
77                                 struct spoolss_SetPrinterData *r)
78 {
79         if (server->type != NTPTR_HANDLE_SERVER) {
80                 return WERR_FOOBAR;
81         }
82         if (!server->ntptr->ops->SetPrintServerData) {
83                 return WERR_NOT_SUPPORTED;
84         }
85         return server->ntptr->ops->SetPrintServerData(server, mem_ctx, r);
86 }
87
88 WERROR ntptr_DeletePrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
89                                    struct spoolss_DeletePrinterData *r)
90 {
91         if (server->type != NTPTR_HANDLE_SERVER) {
92                 return WERR_FOOBAR;
93         }
94         if (!server->ntptr->ops->DeletePrintServerData) {
95                 return WERR_NOT_SUPPORTED;
96         }
97         return server->ntptr->ops->DeletePrintServerData(server, mem_ctx, r);
98 }
99
100
101 /* PrintServer Form functions */
102 WERROR ntptr_EnumPrintServerForms(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
103                                   struct spoolss_EnumForms *r)
104 {
105         if (server->type != NTPTR_HANDLE_SERVER) {
106                 return WERR_FOOBAR;
107         }
108         if (!server->ntptr->ops->EnumPrintServerForms) {
109                 return WERR_NOT_SUPPORTED;
110         }
111         return server->ntptr->ops->EnumPrintServerForms(server, mem_ctx, r);
112 }
113
114 WERROR ntptr_AddPrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
115                                 struct spoolss_AddForm *r)
116 {
117         if (server->type != NTPTR_HANDLE_SERVER) {
118                 return WERR_FOOBAR;
119         }
120         if (!server->ntptr->ops->AddPrintServerForm) {
121                 return WERR_NOT_SUPPORTED;
122         }
123         return server->ntptr->ops->AddPrintServerForm(server, mem_ctx, r);
124 }
125
126 WERROR ntptr_SetPrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
127                                 struct spoolss_SetForm *r)
128 {
129         if (server->type != NTPTR_HANDLE_SERVER) {
130                 return WERR_FOOBAR;
131         }
132         if (!server->ntptr->ops->SetPrintServerForm) {
133                 return WERR_NOT_SUPPORTED;
134         }
135         return server->ntptr->ops->SetPrintServerForm(server, mem_ctx, r);
136 }
137
138 WERROR ntptr_DeletePrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
139                                    struct spoolss_DeleteForm *r)
140 {
141         if (server->type != NTPTR_HANDLE_SERVER) {
142                 return WERR_FOOBAR;
143         }
144         if (!server->ntptr->ops->DeletePrintServerForm) {
145                 return WERR_NOT_SUPPORTED;
146         }
147         return server->ntptr->ops->DeletePrintServerForm(server, mem_ctx, r);
148 }
149
150
151 /* PrintServer Driver functions */
152 WERROR ntptr_EnumPrinterDrivers(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
153                                 struct spoolss_EnumPrinterDrivers *r)
154 {
155         if (!ntptr->ops->EnumPrinterDrivers) {
156                 return WERR_NOT_SUPPORTED;
157         }
158         return ntptr->ops->EnumPrinterDrivers(ntptr, mem_ctx, r);
159 }
160
161 WERROR ntptr_AddPrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
162                               struct spoolss_AddPrinterDriver *r)
163 {
164         if (!ntptr->ops->AddPrinterDriver) {
165                 return WERR_NOT_SUPPORTED;
166         }
167         return ntptr->ops->AddPrinterDriver(ntptr, mem_ctx, r);
168 }
169
170 WERROR ntptr_DeletePrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
171                                  struct spoolss_DeletePrinterDriver *r)
172 {
173         if (!ntptr->ops->DeletePrinterDriver) {
174                 return WERR_NOT_SUPPORTED;
175         }
176         return ntptr->ops->DeletePrinterDriver(ntptr, mem_ctx, r);
177 }
178
179 WERROR ntptr_GetPrinterDriverDirectory(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
180                                  struct spoolss_GetPrinterDriverDirectory *r)
181 {
182         if (!ntptr->ops->GetPrinterDriverDirectory) {
183                 return WERR_NOT_SUPPORTED;
184         }
185         return ntptr->ops->GetPrinterDriverDirectory(ntptr, mem_ctx, r);
186 }
187
188
189 /* Port functions */
190 WERROR ntptr_EnumPorts(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
191                        struct spoolss_EnumPorts *r)
192 {
193         if (!ntptr->ops->EnumPorts) {
194                 return WERR_NOT_SUPPORTED;
195         }
196         return ntptr->ops->EnumPorts(ntptr, mem_ctx, r);
197 }
198
199 WERROR ntptr_OpenPort(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
200                       struct spoolss_OpenPrinterEx *r,
201                       const char *port_name,
202                       struct ntptr_GenericHandle **port)
203 {
204         if (!ntptr->ops->OpenPort) {
205                 return WERR_NOT_SUPPORTED;
206         }
207         return ntptr->ops->OpenPort(ntptr, mem_ctx, r, port_name, port);
208 }
209
210 WERROR ntptr_XcvDataPort(struct ntptr_GenericHandle *port, TALLOC_CTX *mem_ctx,
211                          struct spoolss_XcvData *r)
212 {
213         if (port->type != NTPTR_HANDLE_PORT) {
214                 return WERR_FOOBAR;
215         }
216         if (!port->ntptr->ops->XcvDataPort) {
217                 return WERR_NOT_SUPPORTED;
218         }
219         return port->ntptr->ops->XcvDataPort(port, mem_ctx, r);
220 }
221
222 /* Monitor functions */
223 WERROR ntptr_EnumMonitors(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
224                           struct spoolss_EnumMonitors *r)
225 {
226         if (!ntptr->ops->EnumMonitors) {
227                 return WERR_NOT_SUPPORTED;
228         }
229         return ntptr->ops->EnumMonitors(ntptr, mem_ctx, r);
230 }
231
232 WERROR ntptr_OpenMonitor(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
233                          struct spoolss_OpenPrinterEx *r,
234                          const char *monitor_name,
235                          struct ntptr_GenericHandle **monitor)
236 {
237         if (!ntptr->ops->OpenMonitor) {
238                 return WERR_NOT_SUPPORTED;
239         }
240         return ntptr->ops->OpenMonitor(ntptr, mem_ctx, r, monitor_name, monitor);
241 }
242
243 WERROR ntptr_XcvDataMonitor(struct ntptr_GenericHandle *monitor, TALLOC_CTX *mem_ctx,
244                             struct spoolss_XcvData *r)
245 {
246         if (monitor->type != NTPTR_HANDLE_MONITOR) {
247                 return WERR_FOOBAR;
248         }
249         if (!monitor->ntptr->ops->XcvDataMonitor) {
250                 return WERR_NOT_SUPPORTED;
251         }
252         return monitor->ntptr->ops->XcvDataMonitor(monitor, mem_ctx, r);
253 }
254
255
256 /* PrintProcessor functions */
257 WERROR ntptr_EnumPrintProcessors(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
258                                  struct spoolss_EnumPrintProcessors *r)
259 {
260         if (!ntptr->ops->EnumPrintProcessors) {
261                 return WERR_NOT_SUPPORTED;
262         }
263         return ntptr->ops->EnumPrintProcessors(ntptr, mem_ctx, r);
264 }
265
266
267 /* Printer functions */
268 WERROR ntptr_EnumPrinters(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
269                           struct spoolss_EnumPrinters *r)
270 {
271         if (!ntptr->ops->EnumPrinters) {
272                 return WERR_NOT_SUPPORTED;
273         }
274         return ntptr->ops->EnumPrinters(ntptr, mem_ctx, r);
275 }
276
277 WERROR ntptr_OpenPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
278                          struct spoolss_OpenPrinterEx *r,
279                          const char *printer_name,
280                          struct ntptr_GenericHandle **printer)
281 {
282         if (!ntptr->ops->OpenPrinter) {
283                 return WERR_NOT_SUPPORTED;
284         }
285         return ntptr->ops->OpenPrinter(ntptr, mem_ctx, r, printer_name, printer);
286 }
287
288 WERROR ntptr_AddPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
289                         struct spoolss_AddPrinter *r,
290                         struct ntptr_GenericHandle **printer)
291 {
292         if (!ntptr->ops->AddPrinter) {
293                 return WERR_NOT_SUPPORTED;
294         }
295         return ntptr->ops->AddPrinter(ntptr, mem_ctx, r, printer);
296 }
297
298 WERROR ntptr_GetPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
299                         struct spoolss_GetPrinter *r)
300 {
301         if (!ntptr->ops->GetPrinter) {
302                 return WERR_NOT_SUPPORTED;
303         }
304         return ntptr->ops->GetPrinter(ntptr, mem_ctx, r);
305 }
306
307 WERROR ntptr_SetPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
308                         struct spoolss_SetPrinter *r)
309 {
310         if (!ntptr->ops->SetPrinter) {
311                 return WERR_NOT_SUPPORTED;
312         }
313         return ntptr->ops->SetPrinter(ntptr, mem_ctx, r);
314 }
315
316 WERROR ntptr_DeletePrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
317                            struct spoolss_DeletePrinter *r)
318 {
319         if (!ntptr->ops->DeletePrinter) {
320                 return WERR_NOT_SUPPORTED;
321         }
322         return ntptr->ops->DeletePrinter(ntptr, mem_ctx, r);
323 }
324
325 WERROR ntptr_XcvDataPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
326                             struct spoolss_XcvData *r)
327 {
328         if (printer->type != NTPTR_HANDLE_PRINTER) {
329                 return WERR_FOOBAR;
330         }
331         if (!printer->ntptr->ops->XcvDataPrinter) {
332                 return WERR_NOT_SUPPORTED;
333         }
334         return printer->ntptr->ops->XcvDataPrinter(printer, mem_ctx, r);
335 }
336
337
338 /* Printer Driver functions */
339 WERROR ntptr_GetPrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
340                               struct spoolss_GetPrinterDriver *r)
341 {
342         if (!ntptr->ops->GetPrinterDriver) {
343                 return WERR_NOT_SUPPORTED;
344         }
345         return ntptr->ops->GetPrinterDriver(ntptr, mem_ctx, r);
346 }
347
348
349 /* Printer PrinterData functions */
350 WERROR ntptr_EnumPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
351                              struct spoolss_EnumPrinterData *r)
352 {
353         if (printer->type != NTPTR_HANDLE_PRINTER) {
354                 return WERR_FOOBAR;
355         }
356         if (!printer->ntptr->ops->EnumPrinterData) {
357                 return WERR_NOT_SUPPORTED;
358         }
359         return printer->ntptr->ops->EnumPrinterData(printer, mem_ctx, r);
360 }
361
362 WERROR ntptr_GetPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
363                             struct spoolss_GetPrinterData *r)
364 {
365         if (printer->type != NTPTR_HANDLE_PRINTER) {
366                 return WERR_FOOBAR;
367         }
368         if (!printer->ntptr->ops->GetPrinterData) {
369                 return WERR_NOT_SUPPORTED;
370         }
371         return printer->ntptr->ops->GetPrinterData(printer, mem_ctx, r);
372 }
373
374 WERROR ntptr_SetPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
375                             struct spoolss_SetPrinterData *r)
376 {
377         if (printer->type != NTPTR_HANDLE_PRINTER) {
378                 return WERR_FOOBAR;
379         }
380         if (!printer->ntptr->ops->SetPrinterData) {
381                 return WERR_NOT_SUPPORTED;
382         }
383         return printer->ntptr->ops->SetPrinterData(printer, mem_ctx, r);
384 }
385
386 WERROR ntptr_DeletePrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
387                                struct spoolss_DeletePrinterData *r)
388 {
389         if (printer->type != NTPTR_HANDLE_PRINTER) {
390                 return WERR_FOOBAR;
391         }
392         if (!printer->ntptr->ops->DeletePrinterData) {
393                 return WERR_NOT_SUPPORTED;
394         }
395         return printer->ntptr->ops->DeletePrinterData(printer, mem_ctx, r);
396 }
397
398
399 /* Printer Form functions */
400 WERROR ntptr_EnumPrinterForms(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
401                               struct spoolss_EnumForms *r)
402 {
403         if (printer->type != NTPTR_HANDLE_PRINTER) {
404                 return WERR_FOOBAR;
405         }
406         if (!printer->ntptr->ops->EnumPrinterForms) {
407                 return WERR_NOT_SUPPORTED;
408         }
409         return printer->ntptr->ops->EnumPrinterForms(printer, mem_ctx, r);
410 }
411
412 WERROR ntptr_AddPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
413                             struct spoolss_AddForm *r)
414 {
415         if (printer->type != NTPTR_HANDLE_PRINTER) {
416                 return WERR_FOOBAR;
417         }
418         if (!printer->ntptr->ops->AddPrinterForm) {
419                 return WERR_NOT_SUPPORTED;
420         }
421         return printer->ntptr->ops->AddPrinterForm(printer, mem_ctx, r);
422 }
423
424 WERROR ntptr_GetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
425                             struct spoolss_GetForm *r)
426 {
427         if (printer->type != NTPTR_HANDLE_PRINTER) {
428                 return WERR_FOOBAR;
429         }
430         if (!printer->ntptr->ops->GetPrinterForm) {
431                 return WERR_NOT_SUPPORTED;
432         }
433         return printer->ntptr->ops->GetPrinterForm(printer, mem_ctx, r);
434 }
435
436 WERROR ntptr_SetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
437                             struct spoolss_SetForm *r)
438 {
439         if (printer->type != NTPTR_HANDLE_PRINTER) {
440                 return WERR_FOOBAR;
441         }
442         if (!printer->ntptr->ops->SetPrinterForm) {
443                 return WERR_NOT_SUPPORTED;
444         }
445         return printer->ntptr->ops->SetPrinterForm(printer, mem_ctx, r);
446 }
447
448 WERROR ntptr_DeletePrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
449                                struct spoolss_DeleteForm *r)
450 {
451         if (printer->type != NTPTR_HANDLE_PRINTER) {
452                 return WERR_FOOBAR;
453         }
454         if (!printer->ntptr->ops->DeletePrinterForm) {
455                 return WERR_NOT_SUPPORTED;
456         }
457         return printer->ntptr->ops->DeletePrinterForm(printer, mem_ctx, r);
458 }
459
460
461 /* Printer Job functions */
462 WERROR ntptr_EnumJobs(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
463                       struct spoolss_EnumJobs *r)
464 {
465         if (printer->type != NTPTR_HANDLE_PRINTER) {
466                 return WERR_FOOBAR;
467         }
468         if (!printer->ntptr->ops->EnumJobs) {
469                 return WERR_NOT_SUPPORTED;
470         }
471         return printer->ntptr->ops->EnumJobs(printer, mem_ctx, r);
472 }
473
474 WERROR ntptr_AddJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
475                     struct spoolss_AddJob *r)
476 {
477         if (printer->type != NTPTR_HANDLE_PRINTER) {
478                 return WERR_FOOBAR;
479         }
480         if (!printer->ntptr->ops->AddJob) {
481                 return WERR_NOT_SUPPORTED;
482         }
483         return printer->ntptr->ops->AddJob(printer, mem_ctx, r);
484 }
485
486 WERROR ntptr_ScheduleJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
487                          struct spoolss_ScheduleJob *r)
488 {
489         if (printer->type != NTPTR_HANDLE_PRINTER) {
490                 return WERR_FOOBAR;
491         }
492         if (!printer->ntptr->ops->ScheduleJob) {
493                 return WERR_NOT_SUPPORTED;
494         }
495         return printer->ntptr->ops->ScheduleJob(printer, mem_ctx, r);
496 }
497
498 WERROR ntptr_GetJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
499                     struct spoolss_GetJob *r)
500 {
501         if (printer->type != NTPTR_HANDLE_PRINTER) {
502                 return WERR_FOOBAR;
503         }
504         if (!printer->ntptr->ops->GetJob) {
505                 return WERR_NOT_SUPPORTED;
506         }
507         return printer->ntptr->ops->GetJob(printer, mem_ctx, r);
508 }
509
510 WERROR ntptr_SetJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
511                     struct spoolss_SetJob *r)
512 {
513         if (printer->type != NTPTR_HANDLE_PRINTER) {
514                 return WERR_FOOBAR;
515         }
516         if (!printer->ntptr->ops->SetJob) {
517                 return WERR_NOT_SUPPORTED;
518         }
519         return printer->ntptr->ops->SetJob(printer, mem_ctx, r);
520 }
521
522
523 /* Printer Printing functions */
524 WERROR ntptr_StartDocPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
525                              struct spoolss_StartDocPrinter *r)
526 {
527         if (printer->type != NTPTR_HANDLE_PRINTER) {
528                 return WERR_FOOBAR;
529         }
530         if (!printer->ntptr->ops->StartDocPrinter) {
531                 return WERR_NOT_SUPPORTED;
532         }
533         return printer->ntptr->ops->StartDocPrinter(printer, mem_ctx, r);
534 }
535
536 WERROR ntptr_EndDocPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
537                            struct spoolss_EndDocPrinter *r)
538 {
539         if (printer->type != NTPTR_HANDLE_PRINTER) {
540                 return WERR_FOOBAR;
541         }
542         if (!printer->ntptr->ops->EndDocPrinter) {
543                 return WERR_NOT_SUPPORTED;
544         }
545         return printer->ntptr->ops->EndDocPrinter(printer, mem_ctx, r);
546 }
547
548 WERROR ntptr_StartPagePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
549                               struct spoolss_StartPagePrinter *r)
550 {
551         if (printer->type != NTPTR_HANDLE_PRINTER) {
552                 return WERR_FOOBAR;
553         }
554         if (!printer->ntptr->ops->StartPagePrinter) {
555                 return WERR_NOT_SUPPORTED;
556         }
557         return printer->ntptr->ops->StartPagePrinter(printer, mem_ctx, r);
558 }
559
560 WERROR ntptr_EndPagePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
561                             struct spoolss_EndPagePrinter *r)
562 {
563         if (printer->type != NTPTR_HANDLE_PRINTER) {
564                 return WERR_FOOBAR;
565         }
566         if (!printer->ntptr->ops->EndPagePrinter) {
567                 return WERR_NOT_SUPPORTED;
568         }
569         return printer->ntptr->ops->EndPagePrinter(printer, mem_ctx, r);
570 }
571
572 WERROR ntptr_WritePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
573                           struct spoolss_WritePrinter *r)
574 {
575         if (printer->type != NTPTR_HANDLE_PRINTER) {
576                 return WERR_FOOBAR;
577         }
578         if (!printer->ntptr->ops->WritePrinter) {
579                 return WERR_NOT_SUPPORTED;
580         }
581         return printer->ntptr->ops->WritePrinter(printer, mem_ctx, r);
582 }
583
584 WERROR ntptr_ReadPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
585                          struct spoolss_ReadPrinter *r)
586 {
587         if (printer->type != NTPTR_HANDLE_PRINTER) {
588                 return WERR_FOOBAR;
589         }
590         if (!printer->ntptr->ops->ReadPrinter) {
591                 return WERR_NOT_SUPPORTED;
592         }
593         return printer->ntptr->ops->ReadPrinter(printer, mem_ctx, r);
594 }
595