s3-spoolss: remove device mode defines from nt_printing.h.
[ira/wip.git] / source3 / include / nt_printing.h
1 /*
2    Unix SMB/Netbios implementation.
3    Version 1.9.
4    SMB parameters and setup
5    Copyright (C) Andrew Tridgell              1992-2000,
6    Copyright (C) Jean Francois Micouleau      1998-2000.
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 3 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, see <http://www.gnu.org/licenses/>.
20 */
21
22 #ifndef NT_PRINTING_H_
23 #define NT_PRINTING_H_
24
25 typedef struct nt_printer_driver_info_level_3
26 {
27         uint32 cversion;
28
29         fstring name;
30         fstring environment;
31         fstring driverpath;
32         fstring datafile;
33         fstring configfile;
34         fstring helpfile;
35         fstring monitorname;
36         fstring defaultdatatype;
37         fstring *dependentfiles;
38 } NT_PRINTER_DRIVER_INFO_LEVEL_3;
39
40 /* SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure */
41 typedef struct {
42         uint32  version;
43         fstring name;
44         fstring environment;
45         fstring driverpath;
46         fstring datafile;
47         fstring configfile;
48         fstring helpfile;
49         fstring monitorname;
50         fstring defaultdatatype;
51         fstring mfgname;
52         fstring oemurl;
53         fstring hardwareid;
54         fstring provider;
55         fstring *dependentfiles;
56         fstring *previousnames;
57 } NT_PRINTER_DRIVER_INFO_LEVEL_6;
58
59
60 typedef struct nt_printer_driver_info_level
61 {
62         NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3;
63         NT_PRINTER_DRIVER_INFO_LEVEL_6 *info_6;
64 } NT_PRINTER_DRIVER_INFO_LEVEL;
65
66 /* predefined registry key names for printer data */
67
68 #define SPOOL_PRINTERDATA_KEY           "PrinterDriverData"
69 #define SPOOL_DSSPOOLER_KEY             "DsSpooler"
70 #define SPOOL_DSDRIVER_KEY              "DsDriver"
71 #define SPOOL_DSUSER_KEY                "DsUser"
72 #define SPOOL_PNPDATA_KEY               "PnPData"
73 #define SPOOL_OID_KEY                   "OID"
74
75 /* predefined value names for printer data */
76 #define SPOOL_REG_ASSETNUMBER           "assetNumber"
77 #define SPOOL_REG_BYTESPERMINUTE        "bytesPerMinute"
78 #define SPOOL_REG_DEFAULTPRIORITY       "defaultPriority"
79 #define SPOOL_REG_DESCRIPTION           "description"
80 #define SPOOL_REG_DRIVERNAME            "driverName"
81 #define SPOOL_REG_DRIVERVERSION         "driverVersion"
82 #define SPOOL_REG_FLAGS                 "flags"
83 #define SPOOL_REG_LOCATION              "location"
84 #define SPOOL_REG_OPERATINGSYSTEM       "operatingSystem"
85 #define SPOOL_REG_OPERATINGSYSTEMHOTFIX "operatingSystemHotfix"
86 #define SPOOL_REG_OPERATINGSYSTEMSERVICEPACK "operatingSystemServicePack"
87 #define SPOOL_REG_OPERATINGSYSTEMVERSION "operatingSystemVersion"
88 #define SPOOL_REG_PORTNAME              "portName"
89 #define SPOOL_REG_PRINTATTRIBUTES       "printAttributes"
90 #define SPOOL_REG_PRINTBINNAMES         "printBinNames"
91 #define SPOOL_REG_PRINTCOLLATE          "printCollate"
92 #define SPOOL_REG_PRINTCOLOR            "printColor"
93 #define SPOOL_REG_PRINTDUPLEXSUPPORTED  "printDuplexSupported"
94 #define SPOOL_REG_PRINTENDTIME          "printEndTime"
95 #define SPOOL_REG_PRINTERNAME           "printerName"
96 #define SPOOL_REG_PRINTFORMNAME         "printFormName"
97 #define SPOOL_REG_PRINTKEEPPRINTEDJOBS  "printKeepPrintedJobs"
98 #define SPOOL_REG_PRINTLANGUAGE         "printLanguage"
99 #define SPOOL_REG_PRINTMACADDRESS       "printMACAddress"
100 #define SPOOL_REG_PRINTMAXCOPIES        "printMaxCopies"
101 #define SPOOL_REG_PRINTMAXRESOLUTIONSUPPORTED "printMaxResolutionSupported"
102 #define SPOOL_REG_PRINTMAXXEXTENT       "printMaxXExtent"
103 #define SPOOL_REG_PRINTMAXYEXTENT       "printMaxYExtent"
104 #define SPOOL_REG_PRINTMEDIAREADY       "printMediaReady"
105 #define SPOOL_REG_PRINTMEDIASUPPORTED   "printMediaSupported"
106 #define SPOOL_REG_PRINTMEMORY           "printMemory"
107 #define SPOOL_REG_PRINTMINXEXTENT       "printMinXExtent"
108 #define SPOOL_REG_PRINTMINYEXTENT       "printMinYExtent"
109 #define SPOOL_REG_PRINTNETWORKADDRESS   "printNetworkAddress"
110 #define SPOOL_REG_PRINTNOTIFY           "printNotify"
111 #define SPOOL_REG_PRINTNUMBERUP         "printNumberUp"
112 #define SPOOL_REG_PRINTORIENTATIONSSUPPORTED "printOrientationsSupported"
113 #define SPOOL_REG_PRINTOWNER            "printOwner"
114 #define SPOOL_REG_PRINTPAGESPERMINUTE   "printPagesPerMinute"
115 #define SPOOL_REG_PRINTRATE             "printRate"
116 #define SPOOL_REG_PRINTRATEUNIT         "printRateUnit"
117 #define SPOOL_REG_PRINTSEPARATORFILE    "printSeparatorFile"
118 #define SPOOL_REG_PRINTSHARENAME        "printShareName"
119 #define SPOOL_REG_PRINTSPOOLING         "printSpooling"
120 #define SPOOL_REGVAL_PRINTWHILESPOOLING "PrintWhileSpooling"
121 #define SPOOL_REGVAL_PRINTAFTERSPOOLED  "PrintAfterSpooled"
122 #define SPOOL_REGVAL_PRINTDIRECT        "PrintDirect"
123 #define SPOOL_REG_PRINTSTAPLINGSUPPORTED "printStaplingSupported"
124 #define SPOOL_REG_PRINTSTARTTIME        "printStartTime"
125 #define SPOOL_REG_PRINTSTATUS           "printStatus"
126 #define SPOOL_REG_PRIORITY              "priority"
127 #define SPOOL_REG_SERVERNAME            "serverName"
128 #define SPOOL_REG_SHORTSERVERNAME       "shortServerName"
129 #define SPOOL_REG_UNCNAME               "uNCName"
130 #define SPOOL_REG_URL                   "url"
131 #define SPOOL_REG_VERSIONNUMBER         "versionNumber"
132
133 /* container for a single registry key */
134
135 typedef struct {
136         char                    *name;
137         struct regval_ctr       *values;
138 } NT_PRINTER_KEY;
139
140 /* container for all printer data */
141
142 typedef struct {
143         int             num_keys;
144         NT_PRINTER_KEY  *keys;
145 } NT_PRINTER_DATA;
146
147 #define MAXDEVICENAME   32
148
149 typedef struct ntdevicemode
150 {
151         fstring devicename;
152         fstring formname;
153
154         uint16  specversion;
155         uint16  driverversion;
156         uint16  size;
157         uint16  driverextra;
158         uint16  orientation;
159         uint16  papersize;
160         uint16  paperlength;
161         uint16  paperwidth;
162         uint16  scale;
163         uint16  copies;
164         uint16  defaultsource;
165         uint16  printquality;
166         uint16  color;
167         uint16  duplex;
168         uint16  yresolution;
169         uint16  ttoption;
170         uint16  collate;
171         uint16  logpixels;
172
173         uint32  fields;
174         uint32  bitsperpel;
175         uint32  pelswidth;
176         uint32  pelsheight;
177         uint32  displayflags;
178         uint32  displayfrequency;
179         uint32  icmmethod;
180         uint32  icmintent;
181         uint32  mediatype;
182         uint32  dithertype;
183         uint32  reserved1;
184         uint32  reserved2;
185         uint32  panningwidth;
186         uint32  panningheight;
187         uint8   *nt_dev_private;
188 } NT_DEVICEMODE;
189
190 typedef struct nt_printer_info_level_2
191 {
192         uint32 attributes;
193         uint32 priority;
194         uint32 default_priority;
195         uint32 starttime;
196         uint32 untiltime;
197         uint32 status;
198         uint32 cjobs;
199         uint32 averageppm;
200         fstring servername;
201         fstring printername;
202         fstring sharename;
203         fstring portname;
204         fstring drivername;
205         char comment[1024];
206         fstring location;
207         NT_DEVICEMODE *devmode;
208         fstring sepfile;
209         fstring printprocessor;
210         fstring datatype;
211         fstring parameters;
212         NT_PRINTER_DATA *data;
213         SEC_DESC_BUF *secdesc_buf;
214         uint32 changeid;
215         uint32 c_setprinter;
216         uint32 setuptime;       
217 } NT_PRINTER_INFO_LEVEL_2;
218
219 typedef struct nt_printer_info_level
220 {
221         NT_PRINTER_INFO_LEVEL_2 *info_2;
222 } NT_PRINTER_INFO_LEVEL;
223
224 typedef struct
225 {
226         fstring name;
227         uint32 flag;
228         uint32 width;
229         uint32 length;
230         uint32 left;
231         uint32 top;
232         uint32 right;
233         uint32 bottom;
234 } nt_forms_struct;
235
236 #ifndef SAMBA_PRINTER_PORT_NAME
237 #define SAMBA_PRINTER_PORT_NAME "Samba Printer Port"
238 #endif
239
240 /* DOS header format */
241 #define DOS_HEADER_SIZE                 64
242 #define DOS_HEADER_MAGIC_OFFSET         0
243 #define DOS_HEADER_MAGIC                0x5A4D
244 #define DOS_HEADER_LFANEW_OFFSET        60
245
246 /* New Executable format (Win or OS/2 1.x segmented) */
247 #define NE_HEADER_SIZE                  64
248 #define NE_HEADER_SIGNATURE_OFFSET      0
249 #define NE_HEADER_SIGNATURE             0x454E
250 #define NE_HEADER_TARGET_OS_OFFSET      54
251 #define NE_HEADER_TARGOS_WIN            0x02
252 #define NE_HEADER_MINOR_VER_OFFSET      62
253 #define NE_HEADER_MAJOR_VER_OFFSET      63
254
255 /* Portable Executable format */
256 #define PE_HEADER_SIZE                  24
257 #define PE_HEADER_SIGNATURE_OFFSET      0
258 #define PE_HEADER_SIGNATURE             0x00004550
259 #define PE_HEADER_MACHINE_OFFSET        4
260 #define PE_HEADER_MACHINE_I386          0x14c
261 #define PE_HEADER_NUMBER_OF_SECTIONS    6
262 #define PE_HEADER_OPTIONAL_HEADER_SIZE  20
263 #define PE_HEADER_SECT_HEADER_SIZE      40
264 #define PE_HEADER_SECT_NAME_OFFSET      0
265 #define PE_HEADER_SECT_SIZE_DATA_OFFSET 16
266 #define PE_HEADER_SECT_PTR_DATA_OFFSET  20
267
268 /* Microsoft file version format */
269 #define VS_SIGNATURE                    "VS_VERSION_INFO"
270 #define VS_MAGIC_VALUE                  0xfeef04bd
271 #define VS_MAJOR_OFFSET                                 8
272 #define VS_MINOR_OFFSET                                 12
273 #define VS_VERSION_INFO_UNICODE_SIZE    (sizeof(VS_SIGNATURE)*2+4+VS_MINOR_OFFSET+4) /* not true size! */
274 #define VS_VERSION_INFO_SIZE            (sizeof(VS_SIGNATURE)+4+VS_MINOR_OFFSET+4)   /* not true size! */
275 #define VS_NE_BUF_SIZE                  4096  /* Must be > 2*VS_VERSION_INFO_SIZE */
276
277 /* Notify spoolss clients that something has changed.  The
278    notification data is either stored in two uint32 values or a
279    variable length array. */
280
281 #define SPOOLSS_NOTIFY_MSG_UNIX_JOBID 0x0001    /* Job id is unix  */
282
283 typedef struct spoolss_notify_msg {
284         fstring printer;        /* Name of printer notified */
285         uint32 type;            /* Printer or job notify */
286         uint32 field;           /* Notify field changed */
287         uint32 id;              /* Job id */
288         uint32 len;             /* Length of data, 0 for two uint32 value */
289         uint32 flags;
290         union {
291                 uint32 value[2];
292                 char *data;
293         } notify;
294 } SPOOLSS_NOTIFY_MSG;
295
296 typedef struct {
297         fstring                 printername;
298         uint32                  num_msgs;
299         SPOOLSS_NOTIFY_MSG      *msgs;
300 } SPOOLSS_NOTIFY_MSG_GROUP;
301
302 typedef struct {
303         TALLOC_CTX                      *ctx;
304         uint32                          num_groups;
305         SPOOLSS_NOTIFY_MSG_GROUP        *msg_groups;
306 } SPOOLSS_NOTIFY_MSG_CTR;
307
308 #define SPLHND_PRINTER          1
309 #define SPLHND_SERVER           2
310 #define SPLHND_PORTMON_TCP      3
311 #define SPLHND_PORTMON_LOCAL    4
312
313 /* structure to store the printer handles */
314 /* and a reference to what it's pointing to */
315 /* and the notify info asked about */
316 /* that's the central struct */
317 typedef struct _Printer{
318         struct _Printer *prev, *next;
319         bool document_started;
320         bool page_started;
321         uint32 jobid; /* jobid in printing backend */
322         int printer_type;
323         fstring servername;
324         fstring sharename;
325         uint32 type;
326         uint32 access_granted;
327         struct {
328                 uint32 flags;
329                 uint32 options;
330                 fstring localmachine;
331                 uint32 printerlocal;
332                 struct spoolss_NotifyOption *option;
333                 struct policy_handle client_hnd;
334                 bool client_connected;
335                 uint32 change;
336                 /* are we in a FindNextPrinterChangeNotify() call? */
337                 bool fnpcn;
338         } notify;
339         struct {
340                 fstring machine;
341                 fstring user;
342         } client;
343         
344         /* devmode sent in the OpenPrinter() call */
345         NT_DEVICEMODE   *nt_devmode;
346         
347         /* cache the printer info */
348         NT_PRINTER_INFO_LEVEL *printer_info;
349         
350 } Printer_entry;
351
352 /*
353  * The printer attributes.
354  * I #defined all of them (grabbed form MSDN)
355  * I'm only using:
356  * ( SHARED | NETWORK | RAW_ONLY )
357  * RAW_ONLY _MUST_ be present otherwise NT will send an EMF file
358  */
359
360 #define PRINTER_ATTRIBUTE_SAMBA                 (PRINTER_ATTRIBUTE_RAW_ONLY|\
361                                                  PRINTER_ATTRIBUTE_SHARED|\
362                                                  PRINTER_ATTRIBUTE_LOCAL)
363 #define PRINTER_ATTRIBUTE_NOT_SAMBA             (PRINTER_ATTRIBUTE_NETWORK)
364
365 #define DRIVER_ANY_VERSION              0xffffffff
366 #define DRIVER_MAX_VERSION              4
367
368 struct print_architecture_table_node {
369         const char      *long_archi;
370         const char      *short_archi;
371         int     version;
372 };
373
374 #endif /* NT_PRINTING_H_ */