winbind4: Remove unused winbind_get_idmap irpc operation
[Samba.git] / source4 / ntptr / ntptr_interface.c
blobb65a2e32cd52314728b732e19a16139e47e850ca
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 3 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, see <http://www.gnu.org/licenses/>.
22 #include "includes.h"
23 #include "ntptr/ntptr.h"
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)
32 if (!ntptr->ops->OpenPrintServer) {
33 return WERR_NOT_SUPPORTED;
35 return ntptr->ops->OpenPrintServer(ntptr, mem_ctx, r, printer_name, server);
38 WERROR ntptr_XcvDataPrintServer(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
39 struct spoolss_XcvData *r)
41 if (server->type != NTPTR_HANDLE_SERVER) {
42 return WERR_FOOBAR;
44 if (!server->ntptr->ops->XcvDataPrintServer) {
45 return WERR_NOT_SUPPORTED;
47 return server->ntptr->ops->XcvDataPrintServer(server, mem_ctx, r);
51 /* PrintServer PrinterData functions */
52 WERROR ntptr_EnumPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
53 struct spoolss_EnumPrinterData *r)
55 if (server->type != NTPTR_HANDLE_SERVER) {
56 return WERR_FOOBAR;
58 if (!server->ntptr->ops->EnumPrintServerData) {
59 return WERR_NOT_SUPPORTED;
61 return server->ntptr->ops->EnumPrintServerData(server, mem_ctx, r);
64 WERROR ntptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
65 struct spoolss_GetPrinterData *r)
67 if (server->type != NTPTR_HANDLE_SERVER) {
68 return WERR_FOOBAR;
70 if (!server->ntptr->ops->GetPrintServerData) {
71 return WERR_NOT_SUPPORTED;
73 return server->ntptr->ops->GetPrintServerData(server, mem_ctx, r);
76 WERROR ntptr_SetPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
77 struct spoolss_SetPrinterData *r)
79 if (server->type != NTPTR_HANDLE_SERVER) {
80 return WERR_FOOBAR;
82 if (!server->ntptr->ops->SetPrintServerData) {
83 return WERR_NOT_SUPPORTED;
85 return server->ntptr->ops->SetPrintServerData(server, mem_ctx, r);
88 WERROR ntptr_DeletePrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
89 struct spoolss_DeletePrinterData *r)
91 if (server->type != NTPTR_HANDLE_SERVER) {
92 return WERR_FOOBAR;
94 if (!server->ntptr->ops->DeletePrintServerData) {
95 return WERR_NOT_SUPPORTED;
97 return server->ntptr->ops->DeletePrintServerData(server, mem_ctx, r);
101 /* PrintServer Form functions */
102 WERROR ntptr_EnumPrintServerForms(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
103 struct spoolss_EnumForms *r)
105 if (server->type != NTPTR_HANDLE_SERVER) {
106 return WERR_FOOBAR;
108 if (!server->ntptr->ops->EnumPrintServerForms) {
109 return WERR_NOT_SUPPORTED;
111 return server->ntptr->ops->EnumPrintServerForms(server, mem_ctx, r);
114 WERROR ntptr_AddPrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
115 struct spoolss_AddForm *r)
117 if (server->type != NTPTR_HANDLE_SERVER) {
118 return WERR_FOOBAR;
120 if (!server->ntptr->ops->AddPrintServerForm) {
121 return WERR_NOT_SUPPORTED;
123 return server->ntptr->ops->AddPrintServerForm(server, mem_ctx, r);
126 WERROR ntptr_SetPrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
127 struct spoolss_SetForm *r)
129 if (server->type != NTPTR_HANDLE_SERVER) {
130 return WERR_FOOBAR;
132 if (!server->ntptr->ops->SetPrintServerForm) {
133 return WERR_NOT_SUPPORTED;
135 return server->ntptr->ops->SetPrintServerForm(server, mem_ctx, r);
138 WERROR ntptr_DeletePrintServerForm(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
139 struct spoolss_DeleteForm *r)
141 if (server->type != NTPTR_HANDLE_SERVER) {
142 return WERR_FOOBAR;
144 if (!server->ntptr->ops->DeletePrintServerForm) {
145 return WERR_NOT_SUPPORTED;
147 return server->ntptr->ops->DeletePrintServerForm(server, mem_ctx, r);
151 /* PrintServer Driver functions */
152 WERROR ntptr_EnumPrinterDrivers(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
153 struct spoolss_EnumPrinterDrivers *r)
155 if (!ntptr->ops->EnumPrinterDrivers) {
156 return WERR_NOT_SUPPORTED;
158 return ntptr->ops->EnumPrinterDrivers(ntptr, mem_ctx, r);
161 WERROR ntptr_AddPrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
162 struct spoolss_AddPrinterDriver *r)
164 if (!ntptr->ops->AddPrinterDriver) {
165 return WERR_NOT_SUPPORTED;
167 return ntptr->ops->AddPrinterDriver(ntptr, mem_ctx, r);
170 WERROR ntptr_DeletePrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
171 struct spoolss_DeletePrinterDriver *r)
173 if (!ntptr->ops->DeletePrinterDriver) {
174 return WERR_NOT_SUPPORTED;
176 return ntptr->ops->DeletePrinterDriver(ntptr, mem_ctx, r);
179 WERROR ntptr_GetPrinterDriverDirectory(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
180 struct spoolss_GetPrinterDriverDirectory *r)
182 if (!ntptr->ops->GetPrinterDriverDirectory) {
183 return WERR_NOT_SUPPORTED;
185 return ntptr->ops->GetPrinterDriverDirectory(ntptr, mem_ctx, r);
189 /* Port functions */
190 WERROR ntptr_EnumPorts(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
191 struct spoolss_EnumPorts *r)
193 if (!ntptr->ops->EnumPorts) {
194 return WERR_NOT_SUPPORTED;
196 return ntptr->ops->EnumPorts(ntptr, mem_ctx, r);
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)
204 if (!ntptr->ops->OpenPort) {
205 return WERR_NOT_SUPPORTED;
207 return ntptr->ops->OpenPort(ntptr, mem_ctx, r, port_name, port);
210 WERROR ntptr_XcvDataPort(struct ntptr_GenericHandle *port, TALLOC_CTX *mem_ctx,
211 struct spoolss_XcvData *r)
213 if (port->type != NTPTR_HANDLE_PORT) {
214 return WERR_FOOBAR;
216 if (!port->ntptr->ops->XcvDataPort) {
217 return WERR_NOT_SUPPORTED;
219 return port->ntptr->ops->XcvDataPort(port, mem_ctx, r);
222 /* Monitor functions */
223 WERROR ntptr_EnumMonitors(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
224 struct spoolss_EnumMonitors *r)
226 if (!ntptr->ops->EnumMonitors) {
227 return WERR_NOT_SUPPORTED;
229 return ntptr->ops->EnumMonitors(ntptr, mem_ctx, r);
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)
237 if (!ntptr->ops->OpenMonitor) {
238 return WERR_NOT_SUPPORTED;
240 return ntptr->ops->OpenMonitor(ntptr, mem_ctx, r, monitor_name, monitor);
243 WERROR ntptr_XcvDataMonitor(struct ntptr_GenericHandle *monitor, TALLOC_CTX *mem_ctx,
244 struct spoolss_XcvData *r)
246 if (monitor->type != NTPTR_HANDLE_MONITOR) {
247 return WERR_FOOBAR;
249 if (!monitor->ntptr->ops->XcvDataMonitor) {
250 return WERR_NOT_SUPPORTED;
252 return monitor->ntptr->ops->XcvDataMonitor(monitor, mem_ctx, r);
256 /* PrintProcessor functions */
257 WERROR ntptr_EnumPrintProcessors(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
258 struct spoolss_EnumPrintProcessors *r)
260 if (!ntptr->ops->EnumPrintProcessors) {
261 return WERR_NOT_SUPPORTED;
263 return ntptr->ops->EnumPrintProcessors(ntptr, mem_ctx, r);
266 WERROR ntptr_GetPrintProcessorDirectory(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
267 struct spoolss_GetPrintProcessorDirectory *r)
269 if (!ntptr->ops->GetPrintProcessorDirectory) {
270 return WERR_NOT_SUPPORTED;
272 return ntptr->ops->GetPrintProcessorDirectory(ntptr, mem_ctx, r);
276 /* Printer functions */
277 WERROR ntptr_EnumPrinters(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
278 struct spoolss_EnumPrinters *r)
280 if (!ntptr->ops->EnumPrinters) {
281 return WERR_NOT_SUPPORTED;
283 return ntptr->ops->EnumPrinters(ntptr, mem_ctx, r);
286 WERROR ntptr_OpenPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
287 struct spoolss_OpenPrinterEx *r,
288 const char *printer_name,
289 struct ntptr_GenericHandle **printer)
291 if (!ntptr->ops->OpenPrinter) {
292 return WERR_NOT_SUPPORTED;
294 return ntptr->ops->OpenPrinter(ntptr, mem_ctx, r, printer_name, printer);
297 WERROR ntptr_AddPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
298 struct spoolss_AddPrinter *r,
299 struct ntptr_GenericHandle **printer)
301 if (!ntptr->ops->AddPrinter) {
302 return WERR_NOT_SUPPORTED;
304 return ntptr->ops->AddPrinter(ntptr, mem_ctx, r, printer);
307 WERROR ntptr_GetPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
308 struct spoolss_GetPrinter *r)
310 if (!ntptr->ops->GetPrinter) {
311 return WERR_NOT_SUPPORTED;
313 return ntptr->ops->GetPrinter(ntptr, mem_ctx, r);
316 WERROR ntptr_SetPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
317 struct spoolss_SetPrinter *r)
319 if (!ntptr->ops->SetPrinter) {
320 return WERR_NOT_SUPPORTED;
322 return ntptr->ops->SetPrinter(ntptr, mem_ctx, r);
325 WERROR ntptr_DeletePrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
326 struct spoolss_DeletePrinter *r)
328 if (!ntptr->ops->DeletePrinter) {
329 return WERR_NOT_SUPPORTED;
331 return ntptr->ops->DeletePrinter(ntptr, mem_ctx, r);
334 WERROR ntptr_XcvDataPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
335 struct spoolss_XcvData *r)
337 if (printer->type != NTPTR_HANDLE_PRINTER) {
338 return WERR_FOOBAR;
340 if (!printer->ntptr->ops->XcvDataPrinter) {
341 return WERR_NOT_SUPPORTED;
343 return printer->ntptr->ops->XcvDataPrinter(printer, mem_ctx, r);
347 /* Printer Driver functions */
348 WERROR ntptr_GetPrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
349 struct spoolss_GetPrinterDriver *r)
351 if (!ntptr->ops->GetPrinterDriver) {
352 return WERR_NOT_SUPPORTED;
354 return ntptr->ops->GetPrinterDriver(ntptr, mem_ctx, r);
358 /* Printer PrinterData functions */
359 WERROR ntptr_EnumPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
360 struct spoolss_EnumPrinterData *r)
362 if (printer->type != NTPTR_HANDLE_PRINTER) {
363 return WERR_FOOBAR;
365 if (!printer->ntptr->ops->EnumPrinterData) {
366 return WERR_NOT_SUPPORTED;
368 return printer->ntptr->ops->EnumPrinterData(printer, mem_ctx, r);
371 WERROR ntptr_GetPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
372 struct spoolss_GetPrinterData *r)
374 if (printer->type != NTPTR_HANDLE_PRINTER) {
375 return WERR_FOOBAR;
377 if (!printer->ntptr->ops->GetPrinterData) {
378 return WERR_NOT_SUPPORTED;
380 return printer->ntptr->ops->GetPrinterData(printer, mem_ctx, r);
383 WERROR ntptr_SetPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
384 struct spoolss_SetPrinterData *r)
386 if (printer->type != NTPTR_HANDLE_PRINTER) {
387 return WERR_FOOBAR;
389 if (!printer->ntptr->ops->SetPrinterData) {
390 return WERR_NOT_SUPPORTED;
392 return printer->ntptr->ops->SetPrinterData(printer, mem_ctx, r);
395 WERROR ntptr_DeletePrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
396 struct spoolss_DeletePrinterData *r)
398 if (printer->type != NTPTR_HANDLE_PRINTER) {
399 return WERR_FOOBAR;
401 if (!printer->ntptr->ops->DeletePrinterData) {
402 return WERR_NOT_SUPPORTED;
404 return printer->ntptr->ops->DeletePrinterData(printer, mem_ctx, r);
408 /* Printer Form functions */
409 WERROR ntptr_EnumPrinterForms(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
410 struct spoolss_EnumForms *r)
412 if (printer->type != NTPTR_HANDLE_PRINTER) {
413 return WERR_FOOBAR;
415 if (!printer->ntptr->ops->EnumPrinterForms) {
416 return WERR_NOT_SUPPORTED;
418 return printer->ntptr->ops->EnumPrinterForms(printer, mem_ctx, r);
421 WERROR ntptr_AddPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
422 struct spoolss_AddForm *r)
424 if (printer->type != NTPTR_HANDLE_PRINTER) {
425 return WERR_FOOBAR;
427 if (!printer->ntptr->ops->AddPrinterForm) {
428 return WERR_NOT_SUPPORTED;
430 return printer->ntptr->ops->AddPrinterForm(printer, mem_ctx, r);
433 WERROR ntptr_GetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
434 struct spoolss_GetForm *r)
436 if (printer->type != NTPTR_HANDLE_PRINTER) {
437 return WERR_FOOBAR;
439 if (!printer->ntptr->ops->GetPrinterForm) {
440 return WERR_NOT_SUPPORTED;
442 return printer->ntptr->ops->GetPrinterForm(printer, mem_ctx, r);
445 WERROR ntptr_SetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
446 struct spoolss_SetForm *r)
448 if (printer->type != NTPTR_HANDLE_PRINTER) {
449 return WERR_FOOBAR;
451 if (!printer->ntptr->ops->SetPrinterForm) {
452 return WERR_NOT_SUPPORTED;
454 return printer->ntptr->ops->SetPrinterForm(printer, mem_ctx, r);
457 WERROR ntptr_DeletePrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
458 struct spoolss_DeleteForm *r)
460 if (printer->type != NTPTR_HANDLE_PRINTER) {
461 return WERR_FOOBAR;
463 if (!printer->ntptr->ops->DeletePrinterForm) {
464 return WERR_NOT_SUPPORTED;
466 return printer->ntptr->ops->DeletePrinterForm(printer, mem_ctx, r);
470 /* Printer Job functions */
471 WERROR ntptr_EnumJobs(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
472 struct spoolss_EnumJobs *r)
474 if (printer->type != NTPTR_HANDLE_PRINTER) {
475 return WERR_FOOBAR;
477 if (!printer->ntptr->ops->EnumJobs) {
478 return WERR_NOT_SUPPORTED;
480 return printer->ntptr->ops->EnumJobs(printer, mem_ctx, r);
483 WERROR ntptr_AddJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
484 struct spoolss_AddJob *r)
486 if (printer->type != NTPTR_HANDLE_PRINTER) {
487 return WERR_FOOBAR;
489 if (!printer->ntptr->ops->AddJob) {
490 return WERR_NOT_SUPPORTED;
492 return printer->ntptr->ops->AddJob(printer, mem_ctx, r);
495 WERROR ntptr_ScheduleJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
496 struct spoolss_ScheduleJob *r)
498 if (printer->type != NTPTR_HANDLE_PRINTER) {
499 return WERR_FOOBAR;
501 if (!printer->ntptr->ops->ScheduleJob) {
502 return WERR_NOT_SUPPORTED;
504 return printer->ntptr->ops->ScheduleJob(printer, mem_ctx, r);
507 WERROR ntptr_GetJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
508 struct spoolss_GetJob *r)
510 if (printer->type != NTPTR_HANDLE_PRINTER) {
511 return WERR_FOOBAR;
513 if (!printer->ntptr->ops->GetJob) {
514 return WERR_NOT_SUPPORTED;
516 return printer->ntptr->ops->GetJob(printer, mem_ctx, r);
519 WERROR ntptr_SetJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
520 struct spoolss_SetJob *r)
522 if (printer->type != NTPTR_HANDLE_PRINTER) {
523 return WERR_FOOBAR;
525 if (!printer->ntptr->ops->SetJob) {
526 return WERR_NOT_SUPPORTED;
528 return printer->ntptr->ops->SetJob(printer, mem_ctx, r);
532 /* Printer Printing functions */
533 WERROR ntptr_StartDocPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
534 struct spoolss_StartDocPrinter *r)
536 if (printer->type != NTPTR_HANDLE_PRINTER) {
537 return WERR_FOOBAR;
539 if (!printer->ntptr->ops->StartDocPrinter) {
540 return WERR_NOT_SUPPORTED;
542 return printer->ntptr->ops->StartDocPrinter(printer, mem_ctx, r);
545 WERROR ntptr_EndDocPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
546 struct spoolss_EndDocPrinter *r)
548 if (printer->type != NTPTR_HANDLE_PRINTER) {
549 return WERR_FOOBAR;
551 if (!printer->ntptr->ops->EndDocPrinter) {
552 return WERR_NOT_SUPPORTED;
554 return printer->ntptr->ops->EndDocPrinter(printer, mem_ctx, r);
557 WERROR ntptr_StartPagePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
558 struct spoolss_StartPagePrinter *r)
560 if (printer->type != NTPTR_HANDLE_PRINTER) {
561 return WERR_FOOBAR;
563 if (!printer->ntptr->ops->StartPagePrinter) {
564 return WERR_NOT_SUPPORTED;
566 return printer->ntptr->ops->StartPagePrinter(printer, mem_ctx, r);
569 WERROR ntptr_EndPagePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
570 struct spoolss_EndPagePrinter *r)
572 if (printer->type != NTPTR_HANDLE_PRINTER) {
573 return WERR_FOOBAR;
575 if (!printer->ntptr->ops->EndPagePrinter) {
576 return WERR_NOT_SUPPORTED;
578 return printer->ntptr->ops->EndPagePrinter(printer, mem_ctx, r);
581 WERROR ntptr_WritePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
582 struct spoolss_WritePrinter *r)
584 if (printer->type != NTPTR_HANDLE_PRINTER) {
585 return WERR_FOOBAR;
587 if (!printer->ntptr->ops->WritePrinter) {
588 return WERR_NOT_SUPPORTED;
590 return printer->ntptr->ops->WritePrinter(printer, mem_ctx, r);
593 WERROR ntptr_ReadPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
594 struct spoolss_ReadPrinter *r)
596 if (printer->type != NTPTR_HANDLE_PRINTER) {
597 return WERR_FOOBAR;
599 if (!printer->ntptr->ops->ReadPrinter) {
600 return WERR_NOT_SUPPORTED;
602 return printer->ntptr->ops->ReadPrinter(printer, mem_ctx, r);