| 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 | WERROR ntptr_GetPrintProcessorDirectory(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
 | 
|---|
| 267 |                                         struct spoolss_GetPrintProcessorDirectory *r)
 | 
|---|
| 268 | {
 | 
|---|
| 269 |         if (!ntptr->ops->GetPrintProcessorDirectory) {
 | 
|---|
| 270 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 271 |         }
 | 
|---|
| 272 |         return ntptr->ops->GetPrintProcessorDirectory(ntptr, mem_ctx, r);
 | 
|---|
| 273 | }
 | 
|---|
| 274 | 
 | 
|---|
| 275 | 
 | 
|---|
| 276 | /* Printer functions */
 | 
|---|
| 277 | WERROR ntptr_EnumPrinters(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
 | 
|---|
| 278 |                           struct spoolss_EnumPrinters *r)
 | 
|---|
| 279 | {
 | 
|---|
| 280 |         if (!ntptr->ops->EnumPrinters) {
 | 
|---|
| 281 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 282 |         }
 | 
|---|
| 283 |         return ntptr->ops->EnumPrinters(ntptr, mem_ctx, r);
 | 
|---|
| 284 | }
 | 
|---|
| 285 | 
 | 
|---|
| 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)
 | 
|---|
| 290 | {
 | 
|---|
| 291 |         if (!ntptr->ops->OpenPrinter) {
 | 
|---|
| 292 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 293 |         }
 | 
|---|
| 294 |         return ntptr->ops->OpenPrinter(ntptr, mem_ctx, r, printer_name, printer);
 | 
|---|
| 295 | }
 | 
|---|
| 296 | 
 | 
|---|
| 297 | WERROR ntptr_AddPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
 | 
|---|
| 298 |                         struct spoolss_AddPrinter *r,
 | 
|---|
| 299 |                         struct ntptr_GenericHandle **printer)
 | 
|---|
| 300 | {
 | 
|---|
| 301 |         if (!ntptr->ops->AddPrinter) {
 | 
|---|
| 302 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 303 |         }
 | 
|---|
| 304 |         return ntptr->ops->AddPrinter(ntptr, mem_ctx, r, printer);
 | 
|---|
| 305 | }
 | 
|---|
| 306 | 
 | 
|---|
| 307 | WERROR ntptr_GetPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
 | 
|---|
| 308 |                         struct spoolss_GetPrinter *r)
 | 
|---|
| 309 | {
 | 
|---|
| 310 |         if (!ntptr->ops->GetPrinter) {
 | 
|---|
| 311 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 312 |         }
 | 
|---|
| 313 |         return ntptr->ops->GetPrinter(ntptr, mem_ctx, r);
 | 
|---|
| 314 | }
 | 
|---|
| 315 | 
 | 
|---|
| 316 | WERROR ntptr_SetPrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
 | 
|---|
| 317 |                         struct spoolss_SetPrinter *r)
 | 
|---|
| 318 | {
 | 
|---|
| 319 |         if (!ntptr->ops->SetPrinter) {
 | 
|---|
| 320 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 321 |         }
 | 
|---|
| 322 |         return ntptr->ops->SetPrinter(ntptr, mem_ctx, r);
 | 
|---|
| 323 | }
 | 
|---|
| 324 | 
 | 
|---|
| 325 | WERROR ntptr_DeletePrinter(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
 | 
|---|
| 326 |                            struct spoolss_DeletePrinter *r)
 | 
|---|
| 327 | {
 | 
|---|
| 328 |         if (!ntptr->ops->DeletePrinter) {
 | 
|---|
| 329 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 330 |         }
 | 
|---|
| 331 |         return ntptr->ops->DeletePrinter(ntptr, mem_ctx, r);
 | 
|---|
| 332 | }
 | 
|---|
| 333 | 
 | 
|---|
| 334 | WERROR ntptr_XcvDataPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 335 |                             struct spoolss_XcvData *r)
 | 
|---|
| 336 | {
 | 
|---|
| 337 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 338 |                 return WERR_FOOBAR;
 | 
|---|
| 339 |         }
 | 
|---|
| 340 |         if (!printer->ntptr->ops->XcvDataPrinter) {
 | 
|---|
| 341 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 342 |         }
 | 
|---|
| 343 |         return printer->ntptr->ops->XcvDataPrinter(printer, mem_ctx, r);
 | 
|---|
| 344 | }
 | 
|---|
| 345 | 
 | 
|---|
| 346 | 
 | 
|---|
| 347 | /* Printer Driver functions */
 | 
|---|
| 348 | WERROR ntptr_GetPrinterDriver(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
 | 
|---|
| 349 |                               struct spoolss_GetPrinterDriver *r)
 | 
|---|
| 350 | {
 | 
|---|
| 351 |         if (!ntptr->ops->GetPrinterDriver) {
 | 
|---|
| 352 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 353 |         }
 | 
|---|
| 354 |         return ntptr->ops->GetPrinterDriver(ntptr, mem_ctx, r);
 | 
|---|
| 355 | }
 | 
|---|
| 356 | 
 | 
|---|
| 357 | 
 | 
|---|
| 358 | /* Printer PrinterData functions */
 | 
|---|
| 359 | WERROR ntptr_EnumPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 360 |                              struct spoolss_EnumPrinterData *r)
 | 
|---|
| 361 | {
 | 
|---|
| 362 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 363 |                 return WERR_FOOBAR;
 | 
|---|
| 364 |         }
 | 
|---|
| 365 |         if (!printer->ntptr->ops->EnumPrinterData) {
 | 
|---|
| 366 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 367 |         }
 | 
|---|
| 368 |         return printer->ntptr->ops->EnumPrinterData(printer, mem_ctx, r);
 | 
|---|
| 369 | }
 | 
|---|
| 370 | 
 | 
|---|
| 371 | WERROR ntptr_GetPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 372 |                             struct spoolss_GetPrinterData *r)
 | 
|---|
| 373 | {
 | 
|---|
| 374 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 375 |                 return WERR_FOOBAR;
 | 
|---|
| 376 |         }
 | 
|---|
| 377 |         if (!printer->ntptr->ops->GetPrinterData) {
 | 
|---|
| 378 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 379 |         }
 | 
|---|
| 380 |         return printer->ntptr->ops->GetPrinterData(printer, mem_ctx, r);
 | 
|---|
| 381 | }
 | 
|---|
| 382 | 
 | 
|---|
| 383 | WERROR ntptr_SetPrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 384 |                             struct spoolss_SetPrinterData *r)
 | 
|---|
| 385 | {
 | 
|---|
| 386 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 387 |                 return WERR_FOOBAR;
 | 
|---|
| 388 |         }
 | 
|---|
| 389 |         if (!printer->ntptr->ops->SetPrinterData) {
 | 
|---|
| 390 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 391 |         }
 | 
|---|
| 392 |         return printer->ntptr->ops->SetPrinterData(printer, mem_ctx, r);
 | 
|---|
| 393 | }
 | 
|---|
| 394 | 
 | 
|---|
| 395 | WERROR ntptr_DeletePrinterData(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 396 |                                struct spoolss_DeletePrinterData *r)
 | 
|---|
| 397 | {
 | 
|---|
| 398 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 399 |                 return WERR_FOOBAR;
 | 
|---|
| 400 |         }
 | 
|---|
| 401 |         if (!printer->ntptr->ops->DeletePrinterData) {
 | 
|---|
| 402 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 403 |         }
 | 
|---|
| 404 |         return printer->ntptr->ops->DeletePrinterData(printer, mem_ctx, r);
 | 
|---|
| 405 | }
 | 
|---|
| 406 | 
 | 
|---|
| 407 | 
 | 
|---|
| 408 | /* Printer Form functions */
 | 
|---|
| 409 | WERROR ntptr_EnumPrinterForms(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 410 |                               struct spoolss_EnumForms *r)
 | 
|---|
| 411 | {
 | 
|---|
| 412 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 413 |                 return WERR_FOOBAR;
 | 
|---|
| 414 |         }
 | 
|---|
| 415 |         if (!printer->ntptr->ops->EnumPrinterForms) {
 | 
|---|
| 416 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 417 |         }
 | 
|---|
| 418 |         return printer->ntptr->ops->EnumPrinterForms(printer, mem_ctx, r);
 | 
|---|
| 419 | }
 | 
|---|
| 420 | 
 | 
|---|
| 421 | WERROR ntptr_AddPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 422 |                             struct spoolss_AddForm *r)
 | 
|---|
| 423 | {
 | 
|---|
| 424 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 425 |                 return WERR_FOOBAR;
 | 
|---|
| 426 |         }
 | 
|---|
| 427 |         if (!printer->ntptr->ops->AddPrinterForm) {
 | 
|---|
| 428 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 429 |         }
 | 
|---|
| 430 |         return printer->ntptr->ops->AddPrinterForm(printer, mem_ctx, r);
 | 
|---|
| 431 | }
 | 
|---|
| 432 | 
 | 
|---|
| 433 | WERROR ntptr_GetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 434 |                             struct spoolss_GetForm *r)
 | 
|---|
| 435 | {
 | 
|---|
| 436 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 437 |                 return WERR_FOOBAR;
 | 
|---|
| 438 |         }
 | 
|---|
| 439 |         if (!printer->ntptr->ops->GetPrinterForm) {
 | 
|---|
| 440 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 441 |         }
 | 
|---|
| 442 |         return printer->ntptr->ops->GetPrinterForm(printer, mem_ctx, r);
 | 
|---|
| 443 | }
 | 
|---|
| 444 | 
 | 
|---|
| 445 | WERROR ntptr_SetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 446 |                             struct spoolss_SetForm *r)
 | 
|---|
| 447 | {
 | 
|---|
| 448 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 449 |                 return WERR_FOOBAR;
 | 
|---|
| 450 |         }
 | 
|---|
| 451 |         if (!printer->ntptr->ops->SetPrinterForm) {
 | 
|---|
| 452 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 453 |         }
 | 
|---|
| 454 |         return printer->ntptr->ops->SetPrinterForm(printer, mem_ctx, r);
 | 
|---|
| 455 | }
 | 
|---|
| 456 | 
 | 
|---|
| 457 | WERROR ntptr_DeletePrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 458 |                                struct spoolss_DeleteForm *r)
 | 
|---|
| 459 | {
 | 
|---|
| 460 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 461 |                 return WERR_FOOBAR;
 | 
|---|
| 462 |         }
 | 
|---|
| 463 |         if (!printer->ntptr->ops->DeletePrinterForm) {
 | 
|---|
| 464 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 465 |         }
 | 
|---|
| 466 |         return printer->ntptr->ops->DeletePrinterForm(printer, mem_ctx, r);
 | 
|---|
| 467 | }
 | 
|---|
| 468 | 
 | 
|---|
| 469 | 
 | 
|---|
| 470 | /* Printer Job functions */
 | 
|---|
| 471 | WERROR ntptr_EnumJobs(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 472 |                       struct spoolss_EnumJobs *r)
 | 
|---|
| 473 | {
 | 
|---|
| 474 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 475 |                 return WERR_FOOBAR;
 | 
|---|
| 476 |         }
 | 
|---|
| 477 |         if (!printer->ntptr->ops->EnumJobs) {
 | 
|---|
| 478 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 479 |         }
 | 
|---|
| 480 |         return printer->ntptr->ops->EnumJobs(printer, mem_ctx, r);
 | 
|---|
| 481 | }
 | 
|---|
| 482 | 
 | 
|---|
| 483 | WERROR ntptr_AddJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 484 |                     struct spoolss_AddJob *r)
 | 
|---|
| 485 | {
 | 
|---|
| 486 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 487 |                 return WERR_FOOBAR;
 | 
|---|
| 488 |         }
 | 
|---|
| 489 |         if (!printer->ntptr->ops->AddJob) {
 | 
|---|
| 490 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 491 |         }
 | 
|---|
| 492 |         return printer->ntptr->ops->AddJob(printer, mem_ctx, r);
 | 
|---|
| 493 | }
 | 
|---|
| 494 | 
 | 
|---|
| 495 | WERROR ntptr_ScheduleJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 496 |                          struct spoolss_ScheduleJob *r)
 | 
|---|
| 497 | {
 | 
|---|
| 498 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 499 |                 return WERR_FOOBAR;
 | 
|---|
| 500 |         }
 | 
|---|
| 501 |         if (!printer->ntptr->ops->ScheduleJob) {
 | 
|---|
| 502 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 503 |         }
 | 
|---|
| 504 |         return printer->ntptr->ops->ScheduleJob(printer, mem_ctx, r);
 | 
|---|
| 505 | }
 | 
|---|
| 506 | 
 | 
|---|
| 507 | WERROR ntptr_GetJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 508 |                     struct spoolss_GetJob *r)
 | 
|---|
| 509 | {
 | 
|---|
| 510 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 511 |                 return WERR_FOOBAR;
 | 
|---|
| 512 |         }
 | 
|---|
| 513 |         if (!printer->ntptr->ops->GetJob) {
 | 
|---|
| 514 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 515 |         }
 | 
|---|
| 516 |         return printer->ntptr->ops->GetJob(printer, mem_ctx, r);
 | 
|---|
| 517 | }
 | 
|---|
| 518 | 
 | 
|---|
| 519 | WERROR ntptr_SetJob(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 520 |                     struct spoolss_SetJob *r)
 | 
|---|
| 521 | {
 | 
|---|
| 522 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 523 |                 return WERR_FOOBAR;
 | 
|---|
| 524 |         }
 | 
|---|
| 525 |         if (!printer->ntptr->ops->SetJob) {
 | 
|---|
| 526 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 527 |         }
 | 
|---|
| 528 |         return printer->ntptr->ops->SetJob(printer, mem_ctx, r);
 | 
|---|
| 529 | }
 | 
|---|
| 530 | 
 | 
|---|
| 531 | 
 | 
|---|
| 532 | /* Printer Printing functions */
 | 
|---|
| 533 | WERROR ntptr_StartDocPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 534 |                              struct spoolss_StartDocPrinter *r)
 | 
|---|
| 535 | {
 | 
|---|
| 536 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 537 |                 return WERR_FOOBAR;
 | 
|---|
| 538 |         }
 | 
|---|
| 539 |         if (!printer->ntptr->ops->StartDocPrinter) {
 | 
|---|
| 540 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 541 |         }
 | 
|---|
| 542 |         return printer->ntptr->ops->StartDocPrinter(printer, mem_ctx, r);
 | 
|---|
| 543 | }
 | 
|---|
| 544 | 
 | 
|---|
| 545 | WERROR ntptr_EndDocPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 546 |                            struct spoolss_EndDocPrinter *r)
 | 
|---|
| 547 | {
 | 
|---|
| 548 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 549 |                 return WERR_FOOBAR;
 | 
|---|
| 550 |         }
 | 
|---|
| 551 |         if (!printer->ntptr->ops->EndDocPrinter) {
 | 
|---|
| 552 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 553 |         }
 | 
|---|
| 554 |         return printer->ntptr->ops->EndDocPrinter(printer, mem_ctx, r);
 | 
|---|
| 555 | }
 | 
|---|
| 556 | 
 | 
|---|
| 557 | WERROR ntptr_StartPagePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 558 |                               struct spoolss_StartPagePrinter *r)
 | 
|---|
| 559 | {
 | 
|---|
| 560 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 561 |                 return WERR_FOOBAR;
 | 
|---|
| 562 |         }
 | 
|---|
| 563 |         if (!printer->ntptr->ops->StartPagePrinter) {
 | 
|---|
| 564 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 565 |         }
 | 
|---|
| 566 |         return printer->ntptr->ops->StartPagePrinter(printer, mem_ctx, r);
 | 
|---|
| 567 | }
 | 
|---|
| 568 | 
 | 
|---|
| 569 | WERROR ntptr_EndPagePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 570 |                             struct spoolss_EndPagePrinter *r)
 | 
|---|
| 571 | {
 | 
|---|
| 572 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 573 |                 return WERR_FOOBAR;
 | 
|---|
| 574 |         }
 | 
|---|
| 575 |         if (!printer->ntptr->ops->EndPagePrinter) {
 | 
|---|
| 576 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 577 |         }
 | 
|---|
| 578 |         return printer->ntptr->ops->EndPagePrinter(printer, mem_ctx, r);
 | 
|---|
| 579 | }
 | 
|---|
| 580 | 
 | 
|---|
| 581 | WERROR ntptr_WritePrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 582 |                           struct spoolss_WritePrinter *r)
 | 
|---|
| 583 | {
 | 
|---|
| 584 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 585 |                 return WERR_FOOBAR;
 | 
|---|
| 586 |         }
 | 
|---|
| 587 |         if (!printer->ntptr->ops->WritePrinter) {
 | 
|---|
| 588 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 589 |         }
 | 
|---|
| 590 |         return printer->ntptr->ops->WritePrinter(printer, mem_ctx, r);
 | 
|---|
| 591 | }
 | 
|---|
| 592 | 
 | 
|---|
| 593 | WERROR ntptr_ReadPrinter(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
 | 
|---|
| 594 |                          struct spoolss_ReadPrinter *r)
 | 
|---|
| 595 | {
 | 
|---|
| 596 |         if (printer->type != NTPTR_HANDLE_PRINTER) {
 | 
|---|
| 597 |                 return WERR_FOOBAR;
 | 
|---|
| 598 |         }
 | 
|---|
| 599 |         if (!printer->ntptr->ops->ReadPrinter) {
 | 
|---|
| 600 |                 return WERR_NOT_SUPPORTED;
 | 
|---|
| 601 |         }
 | 
|---|
| 602 |         return printer->ntptr->ops->ReadPrinter(printer, mem_ctx, r);
 | 
|---|
| 603 | }
 | 
|---|
| 604 | 
 | 
|---|