1 /* 2 Unix SMB/CIFS implementation. 3 4 NTPTR structures and defines 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 2 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, write to the Free Software 20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 */ 22 23 /* modules can use the following to determine if the interface has changed */ 24 #define NTPTR_INTERFACE_VERSION 0 25 26 struct ntptr_context; 27 28 enum ntptr_HandleType { 29 NTPTR_HANDLE_SERVER, 30 NTPTR_HANDLE_PRINTER, 31 NTPTR_HANDLE_PORT, 32 NTPTR_HANDLE_MONITOR 33 }; 34 35 struct ntptr_GenericHandle { 36 enum ntptr_HandleType type; 37 struct ntptr_context *ntptr; 38 const char *object_name; 39 uint32_t access_mask; 40 void *private_data; 41 }; 42 43 struct spoolss_OpenPrinterEx; 44 struct spoolss_EnumPrinterData; 45 struct spoolss_DeletePrinterData; 46 struct spoolss_AddForm; 47 struct spoolss_GetForm; 48 struct spoolss_SetForm; 49 struct spoolss_DeleteForm; 50 struct spoolss_AddPrinterDriver; 51 struct spoolss_DeletePrinterDriver; 52 struct spoolss_GetPrinterDriverDirectory; 53 struct spoolss_AddPrinter; 54 struct spoolss_GetPrinter; 55 struct spoolss_SetPrinter; 56 struct spoolss_DeletePrinter; 57 struct spoolss_GetPrinterDriver; 58 struct spoolss_AddJob; 59 struct spoolss_EnumJobs; 60 struct spoolss_SetJob; 61 struct spoolss_GetJob; 62 struct spoolss_ScheduleJob; 63 struct spoolss_ReadPrinter; 64 struct spoolss_WritePrinter; 65 struct spoolss_StartDocPrinter; 66 struct spoolss_EndDocPrinter; 67 struct spoolss_StartPagePrinter; 68 struct spoolss_EndPagePrinter; 69 struct spoolss_GetPrinterData; 70 struct spoolss_SetPrinterData; 71 struct spoolss_EnumPrinterDrivers; 72 struct spoolss_EnumMonitors; 73 struct spoolss_EnumPrinters; 74 struct spoolss_EnumForms; 75 struct spoolss_EnumPorts; 76 struct spoolss_EnumPrintProcessors; 77 struct spoolss_XcvData; 78 79 /* the ntptr operations structure - contains function pointers to 80 the backend implementations of each operation */ 81 struct ntptr_ops { 82 const char *name; 83 84 /* initial setup */ 85 NTSTATUS (*init_context)(struct ntptr_context *ntptr); 86 87 /* PrintServer functions */ 88 WERROR (*OpenPrintServer)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, 89 struct spoolss_OpenPrinterEx *r, 90 const char *printer_name, 91 struct ntptr_GenericHandle **server); 92 WERROR (*XcvDataPrintServer)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, 93 struct spoolss_XcvData *r); 94 95 /* PrintServer PrinterData functions */ 96 WERROR (*EnumPrintServerData)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, 97 struct spoolss_EnumPrinterData *r); 98 WERROR (*GetPrintServerData)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, 99 struct spoolss_GetPrinterData *r); 100 WERROR (*SetPrintServerData)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, 101 struct spoolss_SetPrinterData *r); 102 WERROR (*DeletePrintServerData)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, 103 struct spoolss_DeletePrinterData *r); 104 105 /* PrintServer Form functions */ 106 WERROR (*EnumPrintServerForms)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, 107 struct spoolss_EnumForms *r); 108 WERROR (*AddPrintServerForm)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, 109 struct spoolss_AddForm *r); 110 WERROR (*SetPrintServerForm)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, 111 struct spoolss_SetForm *r); 112 WERROR (*DeletePrintServerForm)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, 113 struct spoolss_DeleteForm *r); 114 115 /* PrintServer Driver functions */ 116 WERROR (*EnumPrinterDrivers)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, 117 struct spoolss_EnumPrinterDrivers *r); 118 WERROR (*AddPrinterDriver)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, 119 struct spoolss_AddPrinterDriver *r); 120 WERROR (*DeletePrinterDriver)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, 121 struct spoolss_DeletePrinterDriver *r); 122 WERROR (*GetPrinterDriverDirectory)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, 123 struct spoolss_GetPrinterDriverDirectory *r); 124 125 /* Port functions */ 126 WERROR (*EnumPorts)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, 127 struct spoolss_EnumPorts *r); 128 WERROR (*OpenPort)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, 129 struct spoolss_OpenPrinterEx *r, 130 const char *port_name, 131 struct ntptr_GenericHandle **port); 132 WERROR (*XcvDataPort)(struct ntptr_GenericHandle *port, TALLOC_CTX *mem_ctx, 133 struct spoolss_XcvData *r); 134 135 /* Monitor functions */ 136 WERROR (*EnumMonitors)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, 137 struct spoolss_EnumMonitors *r); 138 WERROR (*OpenMonitor)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, 139 struct spoolss_OpenPrinterEx *r, 140 const char *monitor_name, 141 struct ntptr_GenericHandle **monitor); 142 WERROR (*XcvDataMonitor)(struct ntptr_GenericHandle *monitor, TALLOC_CTX *mem_ctx, 143 struct spoolss_XcvData *r); 144 145 /* PrintProcessor functions */ 146 WERROR (*EnumPrintProcessors)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, 147 struct spoolss_EnumPrintProcessors *r); 148 149 /* Printer functions */ 150 WERROR (*EnumPrinters)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, 151 struct spoolss_EnumPrinters *r); 152 WERROR (*OpenPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, 153 struct spoolss_OpenPrinterEx *r, 154 const char *printer_name, 155 struct ntptr_GenericHandle **printer); 156 WERROR (*AddPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, 157 struct spoolss_AddPrinter *r, 158 struct ntptr_GenericHandle **printer); 159 WERROR (*GetPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, 160 struct spoolss_GetPrinter *r); 161 WERROR (*SetPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, 162 struct spoolss_SetPrinter *r); 163 WERROR (*DeletePrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, 164 struct spoolss_DeletePrinter *r); 165 WERROR (*XcvDataPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 166 struct spoolss_XcvData *r); 167 168 /* Printer Driver functions */ 169 WERROR (*GetPrinterDriver)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, 170 struct spoolss_GetPrinterDriver *r); 171 172 /* Printer PrinterData functions */ 173 WERROR (*EnumPrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 174 struct spoolss_EnumPrinterData *r); 175 WERROR (*GetPrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 176 struct spoolss_GetPrinterData *r); 177 WERROR (*SetPrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 178 struct spoolss_SetPrinterData *r); 179 WERROR (*DeletePrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 180 struct spoolss_DeletePrinterData *r); 181 182 /* Printer Form functions */ 183 WERROR (*EnumPrinterForms)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 184 struct spoolss_EnumForms *r); 185 WERROR (*AddPrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 186 struct spoolss_AddForm *r); 187 WERROR (*GetPrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 188 struct spoolss_GetForm *r); 189 WERROR (*SetPrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 190 struct spoolss_SetForm *r); 191 WERROR (*DeletePrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 192 struct spoolss_DeleteForm *r); 193 194 /* Printer Job functions */ 195 WERROR (*EnumJobs)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 196 struct spoolss_EnumJobs *r); 197 WERROR (*AddJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 198 struct spoolss_AddJob *r); 199 WERROR (*ScheduleJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 200 struct spoolss_ScheduleJob *r); 201 WERROR (*GetJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 202 struct spoolss_GetJob *r); 203 WERROR (*SetJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 204 struct spoolss_SetJob *r); 205 206 /* Printer Printing functions */ 207 WERROR (*StartDocPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 208 struct spoolss_StartDocPrinter *r); 209 WERROR (*EndDocPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 210 struct spoolss_EndDocPrinter *r); 211 WERROR (*StartPagePrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 212 struct spoolss_StartPagePrinter *r); 213 WERROR (*EndPagePrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 214 struct spoolss_EndPagePrinter *r); 215 WERROR (*WritePrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 216 struct spoolss_WritePrinter *r); 217 WERROR (*ReadPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx, 218 struct spoolss_ReadPrinter *r); 219 }; 220 221 struct ntptr_context { 222 const struct ntptr_ops *ops; 223 void *private_data; 224 }; 225 226 /* this structure is used by backends to determine the size of some critical types */ 227 struct ntptr_critical_sizes { 228 int interface_version; 229 int sizeof_ntptr_critical_sizes; 230 int sizeof_ntptr_context; 231 int sizeof_ntptr_ops; 232 }; 233 #include "ntptr/ntptr_proto.h" 234