r9022: One more step in the game of whack-a-mole with the PAC.
[Samba/gbeck.git] / source4 / ntptr / ntptr.h
blob0f07f26cbbd2daea607a1c577def4afa8cd8025b
1 /*
2 Unix SMB/CIFS implementation.
4 NTPTR structures and defines
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 /* modules can use the following to determine if the interface has changed */
24 #define NTPTR_INTERFACE_VERSION 0
26 struct ntptr_context;
28 enum ntptr_HandleType {
29 NTPTR_HANDLE_SERVER,
30 NTPTR_HANDLE_PRINTER,
31 NTPTR_HANDLE_PORT,
32 NTPTR_HANDLE_MONITOR
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;
43 /* the ntptr operations structure - contains function pointers to
44 the backend implementations of each operation */
45 struct ntptr_ops {
46 const char *name;
48 /* initial setup */
49 NTSTATUS (*init_context)(struct ntptr_context *ntptr);
51 /* PrintServer functions */
52 WERROR (*OpenPrintServer)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
53 struct spoolss_OpenPrinterEx *r,
54 const char *printer_name,
55 struct ntptr_GenericHandle **server);
57 /* PrintServer PrinterData functions */
58 WERROR (*EnumPrintServerData)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
59 struct spoolss_EnumPrinterData *r);
60 WERROR (*GetPrintServerData)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
61 struct spoolss_GetPrinterData *r);
62 WERROR (*SetPrintServerData)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
63 struct spoolss_SetPrinterData *r);
64 WERROR (*DeletePrintServerData)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
65 struct spoolss_DeletePrinterData *r);
67 /* PrintServer Form functions */
68 WERROR (*EnumPrintServerForms)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
69 struct spoolss_EnumForms *r);
70 WERROR (*AddPrintServerForm)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
71 struct spoolss_AddForm *r);
72 WERROR (*SetPrintServerForm)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
73 struct spoolss_SetForm *r);
74 WERROR (*DeletePrintServerForm)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
75 struct spoolss_DeleteForm *r);
77 /* PrintServer Driver functions */
78 WERROR (*EnumPrinterDrivers)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
79 struct spoolss_EnumPrinterDrivers *r);
80 WERROR (*AddPrinterDriver)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
81 struct spoolss_AddPrinterDriver *r);
82 WERROR (*DeletePrinterDriver)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
83 struct spoolss_DeletePrinterDriver *r);
84 WERROR (*GetPrinterDriverDirectory)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
85 struct spoolss_GetPrinterDriverDirectory *r);
87 /* Port functions */
88 WERROR (*EnumPorts)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
89 struct spoolss_EnumPorts *r);
90 WERROR (*OpenPort)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
91 struct spoolss_OpenPrinterEx *r,
92 const char *port_name,
93 struct ntptr_GenericHandle **prt);
95 /* Monitor functions */
96 WERROR (*EnumMonitors)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
97 struct spoolss_EnumMonitors *r);
98 WERROR (*OpenMonitor)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
99 struct spoolss_OpenPrinterEx *r,
100 const char *monitor_name,
101 struct ntptr_GenericHandle **monitor);
103 /* PrintProcessor functions */
104 WERROR (*EnumPrintProcessors)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
105 struct spoolss_EnumPrintProcessors *r);
107 /* Printer functions */
108 WERROR (*EnumPrinters)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
109 struct spoolss_EnumPrinters *r);
110 WERROR (*OpenPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
111 struct spoolss_OpenPrinterEx *r,
112 const char *printer_name,
113 struct ntptr_GenericHandle **printer);
114 WERROR (*AddPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
115 struct spoolss_AddPrinter *r,
116 struct ntptr_GenericHandle **printer);
117 WERROR (*GetPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
118 struct spoolss_GetPrinter *r);
119 WERROR (*SetPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
120 struct spoolss_SetPrinter *r);
121 WERROR (*DeletePrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
122 struct spoolss_DeletePrinter *r);
124 /* Printer Driver functions */
125 WERROR (*GetPrinterDriver)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
126 struct spoolss_GetPrinterDriver *r);
128 /* Printer PrinterData functions */
129 WERROR (*EnumPrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
130 struct spoolss_EnumPrinterData *r);
131 WERROR (*GetPrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
132 struct spoolss_GetPrinterData *r);
133 WERROR (*SetPrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
134 struct spoolss_SetPrinterData *r);
135 WERROR (*DeletePrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
136 struct spoolss_DeletePrinterData *r);
138 /* Printer Form functions */
139 WERROR (*EnumPrinterForms)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
140 struct spoolss_EnumForms *r);
141 WERROR (*AddPrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
142 struct spoolss_AddForm *r);
143 WERROR (*GetPrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
144 struct spoolss_GetForm *r);
145 WERROR (*SetPrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
146 struct spoolss_SetForm *r);
147 WERROR (*DeletePrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
148 struct spoolss_DeleteForm *r);
150 /* Printer Job functions */
151 WERROR (*EnumJobs)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
152 struct spoolss_EnumJobs *r);
153 WERROR (*AddJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
154 struct spoolss_AddJob *r);
155 WERROR (*ScheduleJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
156 struct spoolss_ScheduleJob *r);
157 WERROR (*GetJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
158 struct spoolss_GetJob *r);
159 WERROR (*SetJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
160 struct spoolss_SetJob *r);
162 /* Printer Printing functions */
163 WERROR (*StartDocPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
164 struct spoolss_StartDocPrinter *r);
165 WERROR (*EndDocPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
166 struct spoolss_EndDocPrinter *r);
167 WERROR (*StartPagePrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
168 struct spoolss_StartPagePrinter *r);
169 WERROR (*EndPagePrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
170 struct spoolss_EndPagePrinter *r);
171 WERROR (*WritePrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
172 struct spoolss_WritePrinter *r);
173 WERROR (*ReadPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
174 struct spoolss_ReadPrinter *r);
177 struct ntptr_context {
178 const struct ntptr_ops *ops;
179 void *private_data;
182 /* this structure is used by backends to determine the size of some critical types */
183 struct ntptr_critical_sizes {
184 int interface_version;
185 int sizeof_ntptr_critical_sizes;
186 int sizeof_ntptr_context;
187 int sizeof_ntptr_ops;