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
28 enum ntptr_HandleType {
35 struct ntptr_GenericHandle {
36 enum ntptr_HandleType type;
37 struct ntptr_context *ntptr;
38 const char *object_name;
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;
70 /* the ntptr operations structure - contains function pointers to
71 the backend implementations of each operation */
76 NTSTATUS (*init_context)(struct ntptr_context *ntptr);
78 /* PrintServer functions */
79 WERROR (*OpenPrintServer)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
80 struct spoolss_OpenPrinterEx *r,
81 const char *printer_name,
82 struct ntptr_GenericHandle **server);
84 /* PrintServer PrinterData functions */
85 WERROR (*EnumPrintServerData)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
86 struct spoolss_EnumPrinterData *r);
87 WERROR (*GetPrintServerData)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
88 struct spoolss_GetPrinterData *r);
89 WERROR (*SetPrintServerData)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
90 struct spoolss_SetPrinterData *r);
91 WERROR (*DeletePrintServerData)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
92 struct spoolss_DeletePrinterData *r);
94 /* PrintServer Form functions */
95 WERROR (*EnumPrintServerForms)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
96 struct spoolss_EnumForms *r);
97 WERROR (*AddPrintServerForm)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
98 struct spoolss_AddForm *r);
99 WERROR (*SetPrintServerForm)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
100 struct spoolss_SetForm *r);
101 WERROR (*DeletePrintServerForm)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
102 struct spoolss_DeleteForm *r);
104 /* PrintServer Driver functions */
105 WERROR (*EnumPrinterDrivers)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
106 struct spoolss_EnumPrinterDrivers *r);
107 WERROR (*AddPrinterDriver)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
108 struct spoolss_AddPrinterDriver *r);
109 WERROR (*DeletePrinterDriver)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
110 struct spoolss_DeletePrinterDriver *r);
111 WERROR (*GetPrinterDriverDirectory)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
112 struct spoolss_GetPrinterDriverDirectory *r);
115 WERROR (*EnumPorts)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
116 struct spoolss_EnumPorts *r);
117 WERROR (*OpenPort)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
118 struct spoolss_OpenPrinterEx *r,
119 const char *port_name,
120 struct ntptr_GenericHandle **prt);
122 /* Monitor functions */
123 WERROR (*EnumMonitors)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
124 struct spoolss_EnumMonitors *r);
125 WERROR (*OpenMonitor)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
126 struct spoolss_OpenPrinterEx *r,
127 const char *monitor_name,
128 struct ntptr_GenericHandle **monitor);
130 /* PrintProcessor functions */
131 WERROR (*EnumPrintProcessors)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
132 struct spoolss_EnumPrintProcessors *r);
134 /* Printer functions */
135 WERROR (*EnumPrinters)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
136 struct spoolss_EnumPrinters *r);
137 WERROR (*OpenPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
138 struct spoolss_OpenPrinterEx *r,
139 const char *printer_name,
140 struct ntptr_GenericHandle **printer);
141 WERROR (*AddPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
142 struct spoolss_AddPrinter *r,
143 struct ntptr_GenericHandle **printer);
144 WERROR (*GetPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
145 struct spoolss_GetPrinter *r);
146 WERROR (*SetPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
147 struct spoolss_SetPrinter *r);
148 WERROR (*DeletePrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
149 struct spoolss_DeletePrinter *r);
151 /* Printer Driver functions */
152 WERROR (*GetPrinterDriver)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
153 struct spoolss_GetPrinterDriver *r);
155 /* Printer PrinterData functions */
156 WERROR (*EnumPrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
157 struct spoolss_EnumPrinterData *r);
158 WERROR (*GetPrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
159 struct spoolss_GetPrinterData *r);
160 WERROR (*SetPrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
161 struct spoolss_SetPrinterData *r);
162 WERROR (*DeletePrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
163 struct spoolss_DeletePrinterData *r);
165 /* Printer Form functions */
166 WERROR (*EnumPrinterForms)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
167 struct spoolss_EnumForms *r);
168 WERROR (*AddPrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
169 struct spoolss_AddForm *r);
170 WERROR (*GetPrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
171 struct spoolss_GetForm *r);
172 WERROR (*SetPrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
173 struct spoolss_SetForm *r);
174 WERROR (*DeletePrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
175 struct spoolss_DeleteForm *r);
177 /* Printer Job functions */
178 WERROR (*EnumJobs)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
179 struct spoolss_EnumJobs *r);
180 WERROR (*AddJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
181 struct spoolss_AddJob *r);
182 WERROR (*ScheduleJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
183 struct spoolss_ScheduleJob *r);
184 WERROR (*GetJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
185 struct spoolss_GetJob *r);
186 WERROR (*SetJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
187 struct spoolss_SetJob *r);
189 /* Printer Printing functions */
190 WERROR (*StartDocPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
191 struct spoolss_StartDocPrinter *r);
192 WERROR (*EndDocPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
193 struct spoolss_EndDocPrinter *r);
194 WERROR (*StartPagePrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
195 struct spoolss_StartPagePrinter *r);
196 WERROR (*EndPagePrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
197 struct spoolss_EndPagePrinter *r);
198 WERROR (*WritePrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
199 struct spoolss_WritePrinter *r);
200 WERROR (*ReadPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
201 struct spoolss_ReadPrinter *r);
204 struct ntptr_context {
205 const struct ntptr_ops *ops;
209 /* this structure is used by backends to determine the size of some critical types */
210 struct ntptr_critical_sizes {
211 int interface_version;
212 int sizeof_ntptr_critical_sizes;
213 int sizeof_ntptr_context;
214 int sizeof_ntptr_ops;
216 #include "ntptr/ntptr_proto.h"