summaryrefslogtreecommitdiff
path: root/source4/ntptr/ntptr.h
blob: 91817a202f2592c8092088de989bb3dcf2a8e892 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
/* 
   Unix SMB/CIFS implementation.

   NTPTR structures and defines

   Copyright (C) Stefan (metze) Metzmacher 2005
   
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/* modules can use the following to determine if the interface has changed */
#define NTPTR_INTERFACE_VERSION 0

struct ntptr_context;

enum ntptr_HandleType {
	NTPTR_HANDLE_SERVER,
	NTPTR_HANDLE_PRINTER,
	NTPTR_HANDLE_PORT,
	NTPTR_HANDLE_MONITOR
};

struct ntptr_GenericHandle {
	enum ntptr_HandleType type;
	struct ntptr_context *ntptr;
	const char *object_name;
	uint32_t access_mask;
	void *private_data;
};

struct spoolss_OpenPrinterEx;
struct spoolss_EnumPrinterData;
struct spoolss_DeletePrinterData;
struct spoolss_AddForm;
struct spoolss_GetForm;
struct spoolss_SetForm;
struct spoolss_DeleteForm;
struct spoolss_AddPrinterDriver;
struct spoolss_DeletePrinterDriver;
struct spoolss_GetPrinterDriverDirectory;
struct spoolss_AddPrinter;
struct spoolss_GetPrinter;
struct spoolss_SetPrinter;
struct spoolss_DeletePrinter;
struct spoolss_GetPrinterDriver;
struct spoolss_AddJob;
struct spoolss_EnumJobs;
struct spoolss_SetJob;
struct spoolss_GetJob;
struct spoolss_ScheduleJob;
struct spoolss_ReadPrinter;
struct spoolss_WritePrinter;
struct spoolss_StartDocPrinter;
struct spoolss_EndDocPrinter;
struct spoolss_StartPagePrinter;
struct spoolss_EndPagePrinter;
struct spoolss_GetPrinterData;
struct spoolss_SetPrinterData;
struct spoolss_EnumPrinterDrivers;
struct spoolss_EnumMonitors;
struct spoolss_EnumPrinters;
struct spoolss_EnumForms;
struct spoolss_EnumPorts;
struct spoolss_EnumPrintProcessors;
struct spoolss_XcvData;
struct spoolss_GetPrintProcessorDirectory;

/* the ntptr operations structure - contains function pointers to 
   the backend implementations of each operation */
struct ntptr_ops {
	const char *name;

	/* initial setup */
	NTSTATUS (*init_context)(struct ntptr_context *ntptr);

	/* PrintServer functions */
	WERROR (*OpenPrintServer)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
				  struct spoolss_OpenPrinterEx *r,
				  const char *printer_name,
				  struct ntptr_GenericHandle **server);
	WERROR (*XcvDataPrintServer)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
				     struct spoolss_XcvData *r);

	/* PrintServer PrinterData functions */
	WERROR (*EnumPrintServerData)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
				     struct spoolss_EnumPrinterData *r);
	WERROR (*GetPrintServerData)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
				     struct spoolss_GetPrinterData *r);
	WERROR (*SetPrintServerData)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
				     struct spoolss_SetPrinterData *r);
	WERROR (*DeletePrintServerData)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
					struct spoolss_DeletePrinterData *r);

	/* PrintServer Form functions */
	WERROR (*EnumPrintServerForms)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
				       struct spoolss_EnumForms *r);
	WERROR (*AddPrintServerForm)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
				     struct spoolss_AddForm *r);
	WERROR (*SetPrintServerForm)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
				     struct spoolss_SetForm *r);
	WERROR (*DeletePrintServerForm)(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
					struct spoolss_DeleteForm *r);

	/* PrintServer Driver functions */
	WERROR (*EnumPrinterDrivers)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
				     struct spoolss_EnumPrinterDrivers *r);
	WERROR (*AddPrinterDriver)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
				   struct spoolss_AddPrinterDriver *r);
	WERROR (*DeletePrinterDriver)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
				      struct spoolss_DeletePrinterDriver *r);
	WERROR (*GetPrinterDriverDirectory)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
					    struct spoolss_GetPrinterDriverDirectory *r);

	/* Port functions */
	WERROR (*EnumPorts)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
			    struct spoolss_EnumPorts *r);
	WERROR (*OpenPort)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
			   struct spoolss_OpenPrinterEx *r,
			   const char *port_name,
			   struct ntptr_GenericHandle **port);
	WERROR (*XcvDataPort)(struct ntptr_GenericHandle *port, TALLOC_CTX *mem_ctx,
			      struct spoolss_XcvData *r);
	
	/* Monitor functions */
	WERROR (*EnumMonitors)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
			       struct spoolss_EnumMonitors *r);
	WERROR (*OpenMonitor)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
			      struct spoolss_OpenPrinterEx *r,
			      const char *monitor_name,
			      struct ntptr_GenericHandle **monitor);
	WERROR (*XcvDataMonitor)(struct ntptr_GenericHandle *monitor, TALLOC_CTX *mem_ctx,
				 struct spoolss_XcvData *r);

	/* PrintProcessor functions */
	WERROR (*EnumPrintProcessors)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
				      struct spoolss_EnumPrintProcessors *r);
	WERROR (*GetPrintProcessorDirectory)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
					     struct spoolss_GetPrintProcessorDirectory *r);

	/* Printer functions */
	WERROR (*EnumPrinters)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
			       struct spoolss_EnumPrinters *r);
	WERROR (*OpenPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
			      struct spoolss_OpenPrinterEx *r,
			      const char *printer_name,
			      struct ntptr_GenericHandle **printer);
	WERROR (*AddPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
			     struct spoolss_AddPrinter *r,
			     struct ntptr_GenericHandle **printer);
	WERROR (*GetPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
			     struct spoolss_GetPrinter *r);
	WERROR (*SetPrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
			     struct spoolss_SetPrinter *r);
	WERROR (*DeletePrinter)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
				struct spoolss_DeletePrinter *r);
	WERROR (*XcvDataPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
				 struct spoolss_XcvData *r);

	/* Printer Driver functions */
	WERROR (*GetPrinterDriver)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx,
				   struct spoolss_GetPrinterDriver *r);

	/* Printer PrinterData functions */
	WERROR (*EnumPrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
				  struct spoolss_EnumPrinterData *r);
	WERROR (*GetPrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
				 struct spoolss_GetPrinterData *r);
	WERROR (*SetPrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
				 struct spoolss_SetPrinterData *r);
	WERROR (*DeletePrinterData)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
				    struct spoolss_DeletePrinterData *r);

	/* Printer Form functions */
	WERROR (*EnumPrinterForms)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
				   struct spoolss_EnumForms *r);
	WERROR (*AddPrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
				 struct spoolss_AddForm *r);
	WERROR (*GetPrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
				 struct spoolss_GetForm *r);
	WERROR (*SetPrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
				 struct spoolss_SetForm *r);
	WERROR (*DeletePrinterForm)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
				    struct spoolss_DeleteForm *r);

	/* Printer Job functions */
	WERROR (*EnumJobs)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
			   struct spoolss_EnumJobs *r);
	WERROR (*AddJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
			 struct spoolss_AddJob *r);
	WERROR (*ScheduleJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
			      struct spoolss_ScheduleJob *r);
	WERROR (*GetJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
			 struct spoolss_GetJob *r);
	WERROR (*SetJob)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
			 struct spoolss_SetJob *r);

	/* Printer Printing functions */
	WERROR (*StartDocPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
				  struct spoolss_StartDocPrinter *r);
	WERROR (*EndDocPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
				struct spoolss_EndDocPrinter *r);
	WERROR (*StartPagePrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
				   struct spoolss_StartPagePrinter *r);
	WERROR (*EndPagePrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
				 struct spoolss_EndPagePrinter *r);
	WERROR (*WritePrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
			       struct spoolss_WritePrinter *r);
	WERROR (*ReadPrinter)(struct ntptr_GenericHandle *printer, TALLOC_CTX *mem_ctx,
			      struct spoolss_ReadPrinter *r);
};

struct ntptr_context {
	const struct ntptr_ops *ops;
	void *private_data;
	struct tevent_context *ev_ctx;
	struct loadparm_context *lp_ctx;
};

/* this structure is used by backends to determine the size of some critical types */
struct ntptr_critical_sizes {
	int interface_version;
	int sizeof_ntptr_critical_sizes;
	int sizeof_ntptr_context;
	int sizeof_ntptr_ops;
};

struct loadparm_context;

#include "ntptr/ntptr_proto.h"