s3:registry: convert reg_openkey() to use talloc instead of SMB_STRDUP etc
[Samba/bb.git] / source4 / ntptr / ntptr.h
blob91817a202f2592c8092088de989bb3dcf2a8e892
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 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 /* modules can use the following to determine if the interface has changed */
23 #define NTPTR_INTERFACE_VERSION 0
25 struct ntptr_context;
27 enum ntptr_HandleType {
28 NTPTR_HANDLE_SERVER,
29 NTPTR_HANDLE_PRINTER,
30 NTPTR_HANDLE_PORT,
31 NTPTR_HANDLE_MONITOR
34 struct ntptr_GenericHandle {
35 enum ntptr_HandleType type;
36 struct ntptr_context *ntptr;
37 const char *object_name;
38 uint32_t access_mask;
39 void *private_data;
42 struct spoolss_OpenPrinterEx;
43 struct spoolss_EnumPrinterData;
44 struct spoolss_DeletePrinterData;
45 struct spoolss_AddForm;
46 struct spoolss_GetForm;
47 struct spoolss_SetForm;
48 struct spoolss_DeleteForm;
49 struct spoolss_AddPrinterDriver;
50 struct spoolss_DeletePrinterDriver;
51 struct spoolss_GetPrinterDriverDirectory;
52 struct spoolss_AddPrinter;
53 struct spoolss_GetPrinter;
54 struct spoolss_SetPrinter;
55 struct spoolss_DeletePrinter;
56 struct spoolss_GetPrinterDriver;
57 struct spoolss_AddJob;
58 struct spoolss_EnumJobs;
59 struct spoolss_SetJob;
60 struct spoolss_GetJob;
61 struct spoolss_ScheduleJob;
62 struct spoolss_ReadPrinter;
63 struct spoolss_WritePrinter;
64 struct spoolss_StartDocPrinter;
65 struct spoolss_EndDocPrinter;
66 struct spoolss_StartPagePrinter;
67 struct spoolss_EndPagePrinter;
68 struct spoolss_GetPrinterData;
69 struct spoolss_SetPrinterData;
70 struct spoolss_EnumPrinterDrivers;
71 struct spoolss_EnumMonitors;
72 struct spoolss_EnumPrinters;
73 struct spoolss_EnumForms;
74 struct spoolss_EnumPorts;
75 struct spoolss_EnumPrintProcessors;
76 struct spoolss_XcvData;
77 struct spoolss_GetPrintProcessorDirectory;
79 /* the ntptr operations structure - contains function pointers to
80 the backend implementations of each operation */
81 struct ntptr_ops {
82 const char *name;
84 /* initial setup */
85 NTSTATUS (*init_context)(struct ntptr_context *ntptr);
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);
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);
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);
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);
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);
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);
145 /* PrintProcessor functions */
146 WERROR (*EnumPrintProcessors)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
147 struct spoolss_EnumPrintProcessors *r);
148 WERROR (*GetPrintProcessorDirectory)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
149 struct spoolss_GetPrintProcessorDirectory *r);
151 /* Printer functions */
152 WERROR (*EnumPrinters)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
153 struct spoolss_EnumPrinters *r);
154 WERROR (*OpenPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
155 struct spoolss_OpenPrinterEx *r,
156 const char *printer_name,
157 struct ntptr_GenericHandle **printer);
158 WERROR (*AddPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
159 struct spoolss_AddPrinter *r,
160 struct ntptr_GenericHandle **printer);
161 WERROR (*GetPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
162 struct spoolss_GetPrinter *r);
163 WERROR (*SetPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
164 struct spoolss_SetPrinter *r);
165 WERROR (*DeletePrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
166 struct spoolss_DeletePrinter *r);
167 WERROR (*XcvDataPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
168 struct spoolss_XcvData *r);
170 /* Printer Driver functions */
171 WERROR (*GetPrinterDriver)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
172 struct spoolss_GetPrinterDriver *r);
174 /* Printer PrinterData functions */
175 WERROR (*EnumPrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
176 struct spoolss_EnumPrinterData *r);
177 WERROR (*GetPrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
178 struct spoolss_GetPrinterData *r);
179 WERROR (*SetPrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
180 struct spoolss_SetPrinterData *r);
181 WERROR (*DeletePrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
182 struct spoolss_DeletePrinterData *r);
184 /* Printer Form functions */
185 WERROR (*EnumPrinterForms)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
186 struct spoolss_EnumForms *r);
187 WERROR (*AddPrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
188 struct spoolss_AddForm *r);
189 WERROR (*GetPrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
190 struct spoolss_GetForm *r);
191 WERROR (*SetPrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
192 struct spoolss_SetForm *r);
193 WERROR (*DeletePrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
194 struct spoolss_DeleteForm *r);
196 /* Printer Job functions */
197 WERROR (*EnumJobs)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
198 struct spoolss_EnumJobs *r);
199 WERROR (*AddJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
200 struct spoolss_AddJob *r);
201 WERROR (*ScheduleJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
202 struct spoolss_ScheduleJob *r);
203 WERROR (*GetJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
204 struct spoolss_GetJob *r);
205 WERROR (*SetJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
206 struct spoolss_SetJob *r);
208 /* Printer Printing functions */
209 WERROR (*StartDocPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
210 struct spoolss_StartDocPrinter *r);
211 WERROR (*EndDocPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
212 struct spoolss_EndDocPrinter *r);
213 WERROR (*StartPagePrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
214 struct spoolss_StartPagePrinter *r);
215 WERROR (*EndPagePrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
216 struct spoolss_EndPagePrinter *r);
217 WERROR (*WritePrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
218 struct spoolss_WritePrinter *r);
219 WERROR (*ReadPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
220 struct spoolss_ReadPrinter *r);
223 struct ntptr_context {
224 const struct ntptr_ops *ops;
225 void *private_data;
226 struct tevent_context *ev_ctx;
227 struct loadparm_context *lp_ctx;
230 /* this structure is used by backends to determine the size of some critical types */
231 struct ntptr_critical_sizes {
232 int interface_version;
233 int sizeof_ntptr_critical_sizes;
234 int sizeof_ntptr_context;
235 int sizeof_ntptr_ops;
238 struct loadparm_context;
240 #include "ntptr/ntptr_proto.h"