r15099: An attempt to fix BSD make portability issues. With these changes Samba 4...
[Samba.git] / source4 / ntptr / ntptr_interface.c
blob1920b37f215622ed0f99aa16d1c77c52dd1bc767
1 /*
2 Unix SMB/CIFS implementation.
4 NTPTR interface functions
6 Copyright (C) Stefan (metze) Metzmacher 2005
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 2 of the License, or
11 (at your option) any later version.
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.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "includes.h"
24 #include "ntptr/ntptr.h"
27 /* PrintServer functions */
28 WERROR ntptr_OpenPrintServer(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
29 struct spoolss_OpenPrinterEx *r,
30 const char *printer_name,
31 struct ntptr_GenericHandle **server)
33 if (!ntptr->ops->OpenPrintServer) {
34 return WERR_NOT_SUPPORTED;
36 return ntptr->ops->OpenPrintServer(ntptr, mem_ctx, r, printer_name, server);
40 /* PrintServer PrinterData functions */
41 WERROR ntptr_EnumPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
42 struct spoolss_EnumPrinterData *r)
44 if (server->type != NTPTR_HANDLE_SERVER) {
45 return WERR_FOOBAR;
47 if (!server->ntptr->ops->EnumPrintServerData) {
48 return WERR_NOT_SUPPORTED;
50 return server->ntptr->ops->EnumPrintServerData(server, mem_ctx, r);
53 WERROR ntptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
54 struct spoolss_GetPrinterData *r)
56 if (server->type != NTPTR_HANDLE_SERVER) {
57 return WERR_FOOBAR;
59 if (!server->ntptr->ops->GetPrintServerData) {
60 return WERR_NOT_SUPPORTED;
62 return server->ntptr->ops->GetPrintServerData(server, mem_ctx, r);
65 WERROR ntptr_SetPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
66 struct spoolss_SetPrinterData *r)
68 if (server->type != NTPTR_HANDLE_SERVER) {
69 return WERR_FOOBAR;
71 if (!server->ntptr->ops->SetPrintServerData) {
72 return WERR_NOT_SUPPORTED;
74 return server->ntptr->ops->SetPrintServerData(server, mem_ctx, r);
77 WERROR ntptr_DeletePrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
78 struct spoolss_DeletePrinterData *r)
80 if (server->type != NTPTR_HANDLE_SERVER) {
81 return WERR_FOOBAR;
83 if (!server->ntptr->ops->DeletePrintServerData) {
84 return WERR_NOT_SUPPORTED;
86 return server->ntptr->ops->DeletePrintServerData(server, mem_ctx, r);
90 /* PrintServer Form functions */
91 WERROR ntptr_EnumPrintServerForms(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
92 struct spoolss_EnumForms *r)
94 if (server->type != NTPTR_HANDLE_SERVER) {
95 return WERR_FOOBAR;
97 if (!server->ntptr->ops->EnumPrintServerForms) {
98 return WERR_NOT_SUPPORTED;
100 return server->ntptr->ops->EnumPrintServerForms(server, mem_ctx, r);
103 WERROR ntptr_AddPrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
104 struct spoolss_AddForm *r)
106 if (server->type != NTPTR_HANDLE_SERVER) {
107 return WERR_FOOBAR;
109 if (!server->ntptr->ops->AddPrintServerForm) {
110 return WERR_NOT_SUPPORTED;
112 return server->ntptr->ops->AddPrintServerForm(server, mem_ctx, r);
115 WERROR ntptr_SetPrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
116 struct spoolss_SetForm *r)
118 if (server->type != NTPTR_HANDLE_SERVER) {
119 return WERR_FOOBAR;
121 if (!server->ntptr->ops->SetPrintServerForm) {
122 return WERR_NOT_SUPPORTED;
124 return server->ntptr->ops->SetPrintServerForm(server, mem_ctx, r);
127 WERROR ntptr_DeletePrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
128 struct spoolss_DeleteForm *r)
130 if (server->type != NTPTR_HANDLE_SERVER) {
131 return WERR_FOOBAR;
133 if (!server->ntptr->ops->DeletePrintServerForm) {
134 return WERR_NOT_SUPPORTED;
136 return server->ntptr->ops->DeletePrintServerForm(server, mem_ctx, r);
140 /* PrintServer Driver functions */
141 WERROR ntptr_EnumPrinterDrivers(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
142 struct spoolss_EnumPrinterDrivers *r)
144 if (!ntptr->ops->EnumPrinterDrivers) {
145 return WERR_NOT_SUPPORTED;
147 return ntptr->ops->EnumPrinterDrivers(ntptr, mem_ctx, r);
150 WERROR ntptr_AddPrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
151 struct spoolss_AddPrinterDriver *r)
153 if (!ntptr->ops->AddPrinterDriver) {
154 return WERR_NOT_SUPPORTED;
156 return ntptr->ops->AddPrinterDriver(ntptr, mem_ctx, r);
159 WERROR ntptr_DeletePrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
160 struct spoolss_DeletePrinterDriver *r)
162 if (!ntptr->ops->DeletePrinterDriver) {
163 return WERR_NOT_SUPPORTED;
165 return ntptr->ops->DeletePrinterDriver(ntptr, mem_ctx, r);
168 WERROR ntptr_GetPrinterDriverDirectory(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
169 struct spoolss_GetPrinterDriverDirectory *r)
171 if (!ntptr->ops->GetPrinterDriverDirectory) {
172 return WERR_NOT_SUPPORTED;
174 return ntptr->ops->GetPrinterDriverDirectory(ntptr, mem_ctx, r);
178 /* Port functions */
179 WERROR ntptr_EnumPorts(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
180 struct spoolss_EnumPorts *r)
182 if (!ntptr->ops->EnumPorts) {
183 return WERR_NOT_SUPPORTED;
185 return ntptr->ops->EnumPorts(ntptr, mem_ctx, r);
188 WERROR ntptr_OpenPort(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
189 struct spoolss_OpenPrinterEx *r,
190 const char *port_name,
191 struct ntptr_GenericHandle **prt)
193 if (!ntptr->ops->OpenPort) {
194 return WERR_NOT_SUPPORTED;
196 return ntptr->ops->OpenPort(ntptr, mem_ctx, r, port_name, prt);
200 /* Monitor functions */
201 WERROR ntptr_EnumMonitors(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
202 struct spoolss_EnumMonitors *r)
204 if (!ntptr->ops->EnumMonitors) {
205 return WERR_NOT_SUPPORTED;
207 return ntptr->ops->EnumMonitors(ntptr, mem_ctx, r);
210 WERROR ntptr_OpenMonitor(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
211 struct spoolss_OpenPrinterEx *r,
212 const char *monitor_name,
213 struct ntptr_GenericHandle **monitor)
215 if (!ntptr->ops->OpenMonitor) {
216 return WERR_NOT_SUPPORTED;
218 return ntptr->ops->OpenMonitor(ntptr, mem_ctx, r, monitor_name, monitor);
222 /* PrintProcessor functions */
223 WERROR ntptr_EnumPrintProcessors(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
224 struct spoolss_EnumPrintProcessors *r)
226 if (!ntptr->ops->EnumPrintProcessors) {
227 return WERR_NOT_SUPPORTED;
229 return ntptr->ops->EnumPrintProcessors(ntptr, mem_ctx, r);
233 /* Printer functions */
234 WERROR ntptr_EnumPrinters(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
235 struct spoolss_EnumPrinters *r)
237 if (!ntptr->ops->EnumPrinters) {
238 return WERR_NOT_SUPPORTED;
240 return ntptr->ops->EnumPrinters(ntptr, mem_ctx, r);
243 WERROR ntptr_OpenPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
244 struct spoolss_OpenPrinterEx *r,
245 const char *printer_name,
246 struct ntptr_GenericHandle **printer)
248 if (!ntptr->ops->OpenPrinter) {
249 return WERR_NOT_SUPPORTED;
251 return ntptr->ops->OpenPrinter(ntptr, mem_ctx, r, printer_name, printer);
254 WERROR ntptr_AddPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
255 struct spoolss_AddPrinter *r,
256 struct ntptr_GenericHandle **printer)
258 if (!ntptr->ops->AddPrinter) {
259 return WERR_NOT_SUPPORTED;
261 return ntptr->ops->AddPrinter(ntptr, mem_ctx, r, printer);
264 WERROR ntptr_GetPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
265 struct spoolss_GetPrinter *r)
267 if (!ntptr->ops->GetPrinter) {
268 return WERR_NOT_SUPPORTED;
270 return ntptr->ops->GetPrinter(ntptr, mem_ctx, r);
273 WERROR ntptr_SetPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
274 struct spoolss_SetPrinter *r)
276 if (!ntptr->ops->SetPrinter) {
277 return WERR_NOT_SUPPORTED;
279 return ntptr->ops->SetPrinter(ntptr, mem_ctx, r);
282 WERROR ntptr_DeletePrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
283 struct spoolss_DeletePrinter *r)
285 if (!ntptr->ops->DeletePrinter) {
286 return WERR_NOT_SUPPORTED;
288 return ntptr->ops->DeletePrinter(ntptr, mem_ctx, r);
292 /* Printer Driver functions */
293 WERROR ntptr_GetPrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
294 struct spoolss_GetPrinterDriver *r)
296 if (!ntptr->ops->GetPrinterDriver) {
297 return WERR_NOT_SUPPORTED;
299 return ntptr->ops->GetPrinterDriver(ntptr, mem_ctx, r);
303 /* Printer PrinterData functions */
304 WERROR ntptr_EnumPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
305 struct spoolss_EnumPrinterData *r)
307 if (printer->type != NTPTR_HANDLE_PRINTER) {
308 return WERR_FOOBAR;
310 if (!printer->ntptr->ops->EnumPrinterData) {
311 return WERR_NOT_SUPPORTED;
313 return printer->ntptr->ops->EnumPrinterData(printer, mem_ctx, r);
316 WERROR ntptr_GetPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
317 struct spoolss_GetPrinterData *r)
319 if (printer->type != NTPTR_HANDLE_PRINTER) {
320 return WERR_FOOBAR;
322 if (!printer->ntptr->ops->GetPrinterData) {
323 return WERR_NOT_SUPPORTED;
325 return printer->ntptr->ops->GetPrinterData(printer, mem_ctx, r);
328 WERROR ntptr_SetPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
329 struct spoolss_SetPrinterData *r)
331 if (printer->type != NTPTR_HANDLE_PRINTER) {
332 return WERR_FOOBAR;
334 if (!printer->ntptr->ops->SetPrinterData) {
335 return WERR_NOT_SUPPORTED;
337 return printer->ntptr->ops->SetPrinterData(printer, mem_ctx, r);
340 WERROR ntptr_DeletePrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
341 struct spoolss_DeletePrinterData *r)
343 if (printer->type != NTPTR_HANDLE_PRINTER) {
344 return WERR_FOOBAR;
346 if (!printer->ntptr->ops->DeletePrinterData) {
347 return WERR_NOT_SUPPORTED;
349 return printer->ntptr->ops->DeletePrinterData(printer, mem_ctx, r);
353 /* Printer Form functions */
354 WERROR ntptr_EnumPrinterForms(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
355 struct spoolss_EnumForms *r)
357 if (printer->type != NTPTR_HANDLE_PRINTER) {
358 return WERR_FOOBAR;
360 if (!printer->ntptr->ops->EnumPrinterForms) {
361 return WERR_NOT_SUPPORTED;
363 return printer->ntptr->ops->EnumPrinterForms(printer, mem_ctx, r);
366 WERROR ntptr_AddPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
367 struct spoolss_AddForm *r)
369 if (printer->type != NTPTR_HANDLE_PRINTER) {
370 return WERR_FOOBAR;
372 if (!printer->ntptr->ops->AddPrinterForm) {
373 return WERR_NOT_SUPPORTED;
375 return printer->ntptr->ops->AddPrinterForm(printer, mem_ctx, r);
378 WERROR ntptr_GetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
379 struct spoolss_GetForm *r)
381 if (printer->type != NTPTR_HANDLE_PRINTER) {
382 return WERR_FOOBAR;
384 if (!printer->ntptr->ops->GetPrinterForm) {
385 return WERR_NOT_SUPPORTED;
387 return printer->ntptr->ops->GetPrinterForm(printer, mem_ctx, r);
390 WERROR ntptr_SetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
391 struct spoolss_SetForm *r)
393 if (printer->type != NTPTR_HANDLE_PRINTER) {
394 return WERR_FOOBAR;
396 if (!printer->ntptr->ops->SetPrinterForm) {
397 return WERR_NOT_SUPPORTED;
399 return printer->ntptr->ops->SetPrinterForm(printer, mem_ctx, r);
402 WERROR ntptr_DeletePrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
403 struct spoolss_DeleteForm *r)
405 if (printer->type != NTPTR_HANDLE_PRINTER) {
406 return WERR_FOOBAR;
408 if (!printer->ntptr->ops->DeletePrinterForm) {
409 return WERR_NOT_SUPPORTED;
411 return printer->ntptr->ops->DeletePrinterForm(printer, mem_ctx, r);
415 /* Printer Job functions */
416 WERROR ntptr_EnumJobs(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
417 struct spoolss_EnumJobs *r)
419 if (printer->type != NTPTR_HANDLE_PRINTER) {
420 return WERR_FOOBAR;
422 if (!printer->ntptr->ops->EnumJobs) {
423 return WERR_NOT_SUPPORTED;
425 return printer->ntptr->ops->EnumJobs(printer, mem_ctx, r);
428 WERROR ntptr_AddJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
429 struct spoolss_AddJob *r)
431 if (printer->type != NTPTR_HANDLE_PRINTER) {
432 return WERR_FOOBAR;
434 if (!printer->ntptr->ops->AddJob) {
435 return WERR_NOT_SUPPORTED;
437 return printer->ntptr->ops->AddJob(printer, mem_ctx, r);
440 WERROR ntptr_ScheduleJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
441 struct spoolss_ScheduleJob *r)
443 if (printer->type != NTPTR_HANDLE_PRINTER) {
444 return WERR_FOOBAR;
446 if (!printer->ntptr->ops->ScheduleJob) {
447 return WERR_NOT_SUPPORTED;
449 return printer->ntptr->ops->ScheduleJob(printer, mem_ctx, r);
452 WERROR ntptr_GetJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
453 struct spoolss_GetJob *r)
455 if (printer->type != NTPTR_HANDLE_PRINTER) {
456 return WERR_FOOBAR;
458 if (!printer->ntptr->ops->GetJob) {
459 return WERR_NOT_SUPPORTED;
461 return printer->ntptr->ops->GetJob(printer, mem_ctx, r);
464 WERROR ntptr_SetJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
465 struct spoolss_SetJob *r)
467 if (printer->type != NTPTR_HANDLE_PRINTER) {
468 return WERR_FOOBAR;
470 if (!printer->ntptr->ops->SetJob) {
471 return WERR_NOT_SUPPORTED;
473 return printer->ntptr->ops->SetJob(printer, mem_ctx, r);
477 /* Printer Printing functions */
478 WERROR ntptr_StartDocPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
479 struct spoolss_StartDocPrinter *r)
481 if (printer->type != NTPTR_HANDLE_PRINTER) {
482 return WERR_FOOBAR;
484 if (!printer->ntptr->ops->StartDocPrinter) {
485 return WERR_NOT_SUPPORTED;
487 return printer->ntptr->ops->StartDocPrinter(printer, mem_ctx, r);
490 WERROR ntptr_EndDocPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
491 struct spoolss_EndDocPrinter *r)
493 if (printer->type != NTPTR_HANDLE_PRINTER) {
494 return WERR_FOOBAR;
496 if (!printer->ntptr->ops->EndDocPrinter) {
497 return WERR_NOT_SUPPORTED;
499 return printer->ntptr->ops->EndDocPrinter(printer, mem_ctx, r);
502 WERROR ntptr_StartPagePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
503 struct spoolss_StartPagePrinter *r)
505 if (printer->type != NTPTR_HANDLE_PRINTER) {
506 return WERR_FOOBAR;
508 if (!printer->ntptr->ops->StartPagePrinter) {
509 return WERR_NOT_SUPPORTED;
511 return printer->ntptr->ops->StartPagePrinter(printer, mem_ctx, r);
514 WERROR ntptr_EndPagePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
515 struct spoolss_EndPagePrinter *r)
517 if (printer->type != NTPTR_HANDLE_PRINTER) {
518 return WERR_FOOBAR;
520 if (!printer->ntptr->ops->EndPagePrinter) {
521 return WERR_NOT_SUPPORTED;
523 return printer->ntptr->ops->EndPagePrinter(printer, mem_ctx, r);
526 WERROR ntptr_WritePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
527 struct spoolss_WritePrinter *r)
529 if (printer->type != NTPTR_HANDLE_PRINTER) {
530 return WERR_FOOBAR;
532 if (!printer->ntptr->ops->WritePrinter) {
533 return WERR_NOT_SUPPORTED;
535 return printer->ntptr->ops->WritePrinter(printer, mem_ctx, r);
538 WERROR ntptr_ReadPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
539 struct spoolss_ReadPrinter *r)
541 if (printer->type != NTPTR_HANDLE_PRINTER) {
542 return WERR_FOOBAR;
544 if (!printer->ntptr->ops->ReadPrinter) {
545 return WERR_NOT_SUPPORTED;
547 return printer->ntptr->ops->ReadPrinter(printer, mem_ctx, r);