source: branches/samba-3.2.x/source/include/nt_printing.h

Last change on this file was 133, checked in by Paul Smedley, 17 years ago

Update trunk to 3.2.0pre3

File size: 15.6 KB
Line 
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#define ORIENTATION 0x00000001L
26#define PAPERSIZE 0x00000002L
27#define PAPERLENGTH 0x00000004L
28#define PAPERWIDTH 0x00000008L
29#define SCALE 0x00000010L
30#define COPIES 0x00000100L
31#define DEFAULTSOURCE 0x00000200L
32#define PRINTQUALITY 0x00000400L
33#define COLOR 0x00000800L
34#define DUPLEX 0x00001000L
35#define YRESOLUTION 0x00002000L
36#define TTOPTION 0x00004000L
37#define COLLATE 0x00008000L
38#define FORMNAME 0x00010000L
39#define LOGPIXELS 0x00020000L
40#define BITSPERPEL 0x00040000L
41#define PELSWIDTH 0x00080000L
42#define PELSHEIGHT 0x00100000L
43#define DISPLAYFLAGS 0x00200000L
44#define DISPLAYFREQUENCY 0x00400000L
45#define PANNINGWIDTH 0x00800000L
46#define PANNINGHEIGHT 0x01000000L
47
48#define ORIENT_PORTRAIT 1
49#define ORIENT_LANDSCAPE 2
50
51#define PAPER_FIRST PAPER_LETTER
52#define PAPER_LETTER 1 /* Letter 8 1/2 x 11 in */
53#define PAPER_LETTERSMALL 2 /* Letter Small 8 1/2 x 11 in */
54#define PAPER_TABLOID 3 /* Tabloid 11 x 17 in */
55#define PAPER_LEDGER 4 /* Ledger 17 x 11 in */
56#define PAPER_LEGAL 5 /* Legal 8 1/2 x 14 in */
57#define PAPER_STATEMENT 6 /* Statement 5 1/2 x 8 1/2 in */
58#define PAPER_EXECUTIVE 7 /* Executive 7 1/4 x 10 1/2 in */
59#define PAPER_A3 8 /* A3 297 x 420 mm */
60#define PAPER_A4 9 /* A4 210 x 297 mm */
61#define PAPER_A4SMALL 10 /* A4 Small 210 x 297 mm */
62#define PAPER_A5 11 /* A5 148 x 210 mm */
63#define PAPER_B4 12 /* B4 (JIS) 250 x 354 */
64#define PAPER_B5 13 /* B5 (JIS) 182 x 257 mm */
65#define PAPER_FOLIO 14 /* Folio 8 1/2 x 13 in */
66#define PAPER_QUARTO 15 /* Quarto 215 x 275 mm */
67#define PAPER_10X14 16 /* 10x14 in */
68#define PAPER_11X17 17 /* 11x17 in */
69#define PAPER_NOTE 18 /* Note 8 1/2 x 11 in */
70#define PAPER_ENV_9 19 /* Envelope #9 3 7/8 x 8 7/8 */
71#define PAPER_ENV_10 20 /* Envelope #10 4 1/8 x 9 1/2 */
72#define PAPER_ENV_11 21 /* Envelope #11 4 1/2 x 10 3/8 */
73#define PAPER_ENV_12 22 /* Envelope #12 4 \276 x 11 */
74#define PAPER_ENV_14 23 /* Envelope #14 5 x 11 1/2 */
75#define PAPER_CSHEET 24 /* C size sheet */
76#define PAPER_DSHEET 25 /* D size sheet */
77#define PAPER_ESHEET 26 /* E size sheet */
78#define PAPER_ENV_DL 27 /* Envelope DL 110 x 220mm */
79#define PAPER_ENV_C5 28 /* Envelope C5 162 x 229 mm */
80#define PAPER_ENV_C3 29 /* Envelope C3 324 x 458 mm */
81#define PAPER_ENV_C4 30 /* Envelope C4 229 x 324 mm */
82#define PAPER_ENV_C6 31 /* Envelope C6 114 x 162 mm */
83#define PAPER_ENV_C65 32 /* Envelope C65 114 x 229 mm */
84#define PAPER_ENV_B4 33 /* Envelope B4 250 x 353 mm */
85#define PAPER_ENV_B5 34 /* Envelope B5 176 x 250 mm */
86#define PAPER_ENV_B6 35 /* Envelope B6 176 x 125 mm */
87#define PAPER_ENV_ITALY 36 /* Envelope 110 x 230 mm */
88#define PAPER_ENV_MONARCH 37 /* Envelope Monarch 3.875 x 7.5 in */
89#define PAPER_ENV_PERSONAL 38 /* 6 3/4 Envelope 3 5/8 x 6 1/2 in */
90#define PAPER_FANFOLD_US 39 /* US Std Fanfold 14 7/8 x 11 in */
91#define PAPER_FANFOLD_STD_GERMAN 40 /* German Std Fanfold 8 1/2 x 12 in */
92#define PAPER_FANFOLD_LGL_GERMAN 41 /* German Legal Fanfold 8 1/2 x 13 in */
93
94#define PAPER_LAST PAPER_FANFOLD_LGL_GERMAN
95#define PAPER_USER 256
96
97#define BIN_FIRST BIN_UPPER
98#define BIN_UPPER 1
99#define BIN_ONLYONE 1
100#define BIN_LOWER 2
101#define BIN_MIDDLE 3
102#define BIN_MANUAL 4
103#define BIN_ENVELOPE 5
104#define BIN_ENVMANUAL 6
105#define BIN_AUTO 7
106#define BIN_TRACTOR 8
107#define BIN_SMALLFMT 9
108#define BIN_LARGEFMT 10
109#define BIN_LARGECAPACITY 11
110#define BIN_CASSETTE 14
111#define BIN_FORMSOURCE 15
112#define BIN_LAST BIN_FORMSOURCE
113
114#define BIN_USER 256 /* device specific bins start here */
115
116#define RES_DRAFT (-1)
117#define RES_LOW (-2)
118#define RES_MEDIUM (-3)
119#define RES_HIGH (-4)
120
121#define COLOR_MONOCHROME 1
122#define COLOR_COLOR 2
123
124#define DUP_SIMPLEX 1
125#define DUP_VERTICAL 2
126#define DUP_HORIZONTAL 3
127
128#define TT_BITMAP 1 /* print TT fonts as graphics */
129#define TT_DOWNLOAD 2 /* download TT fonts as soft fonts */
130#define TT_SUBDEV 3 /* substitute device fonts for TT fonts */
131
132#define COLLATE_FALSE 0
133#define COLLATE_TRUE 1
134
135typedef struct nt_printer_driver_info_level_3
136{
137 uint32 cversion;
138
139 fstring name;
140 fstring environment;
141 fstring driverpath;
142 fstring datafile;
143 fstring configfile;
144 fstring helpfile;
145 fstring monitorname;
146 fstring defaultdatatype;
147 fstring *dependentfiles;
148} NT_PRINTER_DRIVER_INFO_LEVEL_3;
149
150/* SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure */
151typedef struct {
152 uint32 version;
153 fstring name;
154 fstring environment;
155 fstring driverpath;
156 fstring datafile;
157 fstring configfile;
158 fstring helpfile;
159 fstring monitorname;
160 fstring defaultdatatype;
161 fstring mfgname;
162 fstring oemurl;
163 fstring hardwareid;
164 fstring provider;
165 fstring *dependentfiles;
166 fstring *previousnames;
167} NT_PRINTER_DRIVER_INFO_LEVEL_6;
168
169
170typedef struct nt_printer_driver_info_level
171{
172 NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3;
173 NT_PRINTER_DRIVER_INFO_LEVEL_6 *info_6;
174} NT_PRINTER_DRIVER_INFO_LEVEL;
175
176/* predefined registry key names for printer data */
177
178#define SPOOL_PRINTERDATA_KEY "PrinterDriverData"
179#define SPOOL_DSSPOOLER_KEY "DsSpooler"
180#define SPOOL_DSDRIVER_KEY "DsDriver"
181#define SPOOL_DSUSER_KEY "DsUser"
182#define SPOOL_PNPDATA_KEY "PnPData"
183#define SPOOL_OID_KEY "OID"
184
185/* predefined value names for printer data */
186#define SPOOL_REG_ASSETNUMBER "assetNumber"
187#define SPOOL_REG_BYTESPERMINUTE "bytesPerMinute"
188#define SPOOL_REG_DEFAULTPRIORITY "defaultPriority"
189#define SPOOL_REG_DESCRIPTION "description"
190#define SPOOL_REG_DRIVERNAME "driverName"
191#define SPOOL_REG_DRIVERVERSION "driverVersion"
192#define SPOOL_REG_FLAGS "flags"
193#define SPOOL_REG_LOCATION "location"
194#define SPOOL_REG_OPERATINGSYSTEM "operatingSystem"
195#define SPOOL_REG_OPERATINGSYSTEMHOTFIX "operatingSystemHotfix"
196#define SPOOL_REG_OPERATINGSYSTEMSERVICEPACK "operatingSystemServicePack"
197#define SPOOL_REG_OPERATINGSYSTEMVERSION "operatingSystemVersion"
198#define SPOOL_REG_PORTNAME "portName"
199#define SPOOL_REG_PRINTATTRIBUTES "printAttributes"
200#define SPOOL_REG_PRINTBINNAMES "printBinNames"
201#define SPOOL_REG_PRINTCOLLATE "printCollate"
202#define SPOOL_REG_PRINTCOLOR "printColor"
203#define SPOOL_REG_PRINTDUPLEXSUPPORTED "printDuplexSupported"
204#define SPOOL_REG_PRINTENDTIME "printEndTime"
205#define SPOOL_REG_PRINTERNAME "printerName"
206#define SPOOL_REG_PRINTFORMNAME "printFormName"
207#define SPOOL_REG_PRINTKEEPPRINTEDJOBS "printKeepPrintedJobs"
208#define SPOOL_REG_PRINTLANGUAGE "printLanguage"
209#define SPOOL_REG_PRINTMACADDRESS "printMACAddress"
210#define SPOOL_REG_PRINTMAXCOPIES "printMaxCopies"
211#define SPOOL_REG_PRINTMAXRESOLUTIONSUPPORTED "printMaxResolutionSupported"
212#define SPOOL_REG_PRINTMAXXEXTENT "printMaxXExtent"
213#define SPOOL_REG_PRINTMAXYEXTENT "printMaxYExtent"
214#define SPOOL_REG_PRINTMEDIAREADY "printMediaReady"
215#define SPOOL_REG_PRINTMEDIASUPPORTED "printMediaSupported"
216#define SPOOL_REG_PRINTMEMORY "printMemory"
217#define SPOOL_REG_PRINTMINXEXTENT "printMinXExtent"
218#define SPOOL_REG_PRINTMINYEXTENT "printMinYExtent"
219#define SPOOL_REG_PRINTNETWORKADDRESS "printNetworkAddress"
220#define SPOOL_REG_PRINTNOTIFY "printNotify"
221#define SPOOL_REG_PRINTNUMBERUP "printNumberUp"
222#define SPOOL_REG_PRINTORIENTATIONSSUPPORTED "printOrientationsSupported"
223#define SPOOL_REG_PRINTOWNER "printOwner"
224#define SPOOL_REG_PRINTPAGESPERMINUTE "printPagesPerMinute"
225#define SPOOL_REG_PRINTRATE "printRate"
226#define SPOOL_REG_PRINTRATEUNIT "printRateUnit"
227#define SPOOL_REG_PRINTSEPARATORFILE "printSeparatorFile"
228#define SPOOL_REG_PRINTSHARENAME "printShareName"
229#define SPOOL_REG_PRINTSPOOLING "printSpooling"
230#define SPOOL_REGVAL_PRINTWHILESPOOLING "PrintWhileSpooling"
231#define SPOOL_REGVAL_PRINTAFTERSPOOLED "PrintAfterSpooled"
232#define SPOOL_REGVAL_PRINTDIRECT "PrintDirect"
233#define SPOOL_REG_PRINTSTAPLINGSUPPORTED "printStaplingSupported"
234#define SPOOL_REG_PRINTSTARTTIME "printStartTime"
235#define SPOOL_REG_PRINTSTATUS "printStatus"
236#define SPOOL_REG_PRIORITY "priority"
237#define SPOOL_REG_SERVERNAME "serverName"
238#define SPOOL_REG_SHORTSERVERNAME "shortServerName"
239#define SPOOL_REG_UNCNAME "uNCName"
240#define SPOOL_REG_URL "url"
241#define SPOOL_REG_VERSIONNUMBER "versionNumber"
242
243/* container for a single registry key */
244
245typedef struct {
246 char *name;
247 REGVAL_CTR *values;
248} NT_PRINTER_KEY;
249
250/* container for all printer data */
251
252typedef struct {
253 int num_keys;
254 NT_PRINTER_KEY *keys;
255} NT_PRINTER_DATA;
256
257#define MAXDEVICENAME 32
258
259typedef struct ntdevicemode
260{
261 fstring devicename;
262 fstring formname;
263
264 uint16 specversion;
265 uint16 driverversion;
266 uint16 size;
267 uint16 driverextra;
268 uint16 orientation;
269 uint16 papersize;
270 uint16 paperlength;
271 uint16 paperwidth;
272 uint16 scale;
273 uint16 copies;
274 uint16 defaultsource;
275 uint16 printquality;
276 uint16 color;
277 uint16 duplex;
278 uint16 yresolution;
279 uint16 ttoption;
280 uint16 collate;
281 uint16 logpixels;
282
283 uint32 fields;
284 uint32 bitsperpel;
285 uint32 pelswidth;
286 uint32 pelsheight;
287 uint32 displayflags;
288 uint32 displayfrequency;
289 uint32 icmmethod;
290 uint32 icmintent;
291 uint32 mediatype;
292 uint32 dithertype;
293 uint32 reserved1;
294 uint32 reserved2;
295 uint32 panningwidth;
296 uint32 panningheight;
297 uint8 *nt_dev_private;
298} NT_DEVICEMODE;
299
300typedef struct nt_printer_info_level_2
301{
302 uint32 attributes;
303 uint32 priority;
304 uint32 default_priority;
305 uint32 starttime;
306 uint32 untiltime;
307 uint32 status;
308 uint32 cjobs;
309 uint32 averageppm;
310 fstring servername;
311 fstring printername;
312 fstring sharename;
313 fstring portname;
314 fstring drivername;
315 char comment[1024];
316 fstring location;
317 NT_DEVICEMODE *devmode;
318 fstring sepfile;
319 fstring printprocessor;
320 fstring datatype;
321 fstring parameters;
322 NT_PRINTER_DATA *data;
323 SEC_DESC_BUF *secdesc_buf;
324 uint32 changeid;
325 uint32 c_setprinter;
326 uint32 setuptime;
327} NT_PRINTER_INFO_LEVEL_2;
328
329typedef struct nt_printer_info_level
330{
331 NT_PRINTER_INFO_LEVEL_2 *info_2;
332} NT_PRINTER_INFO_LEVEL;
333
334typedef struct
335{
336 fstring name;
337 uint32 flag;
338 uint32 width;
339 uint32 length;
340 uint32 left;
341 uint32 top;
342 uint32 right;
343 uint32 bottom;
344} nt_forms_struct;
345
346#ifndef SAMBA_PRINTER_PORT_NAME
347#define SAMBA_PRINTER_PORT_NAME "Samba Printer Port"
348#endif
349
350
351/*
352 * Structures for the XcvDataPort() calls
353 */
354
355#define PORT_PROTOCOL_DIRECT 1
356#define PORT_PROTOCOL_LPR 2
357
358typedef struct {
359 fstring name;
360 uint32 version;
361 uint32 protocol;
362 fstring hostaddr;
363 fstring snmpcommunity;
364 fstring queue;
365 uint32 dblspool;
366 fstring ipaddr;
367 uint32 port;
368 bool enable_snmp;
369 uint32 snmp_index;
370} NT_PORT_DATA_1;
371
372/* DOS header format */
373#define DOS_HEADER_SIZE 64
374#define DOS_HEADER_MAGIC_OFFSET 0
375#define DOS_HEADER_MAGIC 0x5A4D
376#define DOS_HEADER_LFANEW_OFFSET 60
377
378/* New Executable format (Win or OS/2 1.x segmented) */
379#define NE_HEADER_SIZE 64
380#define NE_HEADER_SIGNATURE_OFFSET 0
381#define NE_HEADER_SIGNATURE 0x454E
382#define NE_HEADER_TARGET_OS_OFFSET 54
383#define NE_HEADER_TARGOS_WIN 0x02
384#define NE_HEADER_MINOR_VER_OFFSET 62
385#define NE_HEADER_MAJOR_VER_OFFSET 63
386
387/* Portable Executable format */
388#define PE_HEADER_SIZE 24
389#define PE_HEADER_SIGNATURE_OFFSET 0
390#define PE_HEADER_SIGNATURE 0x00004550
391#define PE_HEADER_MACHINE_OFFSET 4
392#define PE_HEADER_MACHINE_I386 0x14c
393#define PE_HEADER_NUMBER_OF_SECTIONS 6
394#define PE_HEADER_OPTIONAL_HEADER_SIZE 20
395#define PE_HEADER_SECT_HEADER_SIZE 40
396#define PE_HEADER_SECT_NAME_OFFSET 0
397#define PE_HEADER_SECT_SIZE_DATA_OFFSET 16
398#define PE_HEADER_SECT_PTR_DATA_OFFSET 20
399
400/* Microsoft file version format */
401#define VS_SIGNATURE "VS_VERSION_INFO"
402#define VS_MAGIC_VALUE 0xfeef04bd
403#define VS_MAJOR_OFFSET 8
404#define VS_MINOR_OFFSET 12
405#define VS_VERSION_INFO_UNICODE_SIZE (sizeof(VS_SIGNATURE)*2+4+VS_MINOR_OFFSET+4) /* not true size! */
406#define VS_VERSION_INFO_SIZE (sizeof(VS_SIGNATURE)+4+VS_MINOR_OFFSET+4) /* not true size! */
407#define VS_NE_BUF_SIZE 4096 /* Must be > 2*VS_VERSION_INFO_SIZE */
408
409/* Notify spoolss clients that something has changed. The
410 notification data is either stored in two uint32 values or a
411 variable length array. */
412
413#define SPOOLSS_NOTIFY_MSG_UNIX_JOBID 0x0001 /* Job id is unix */
414
415typedef struct spoolss_notify_msg {
416 fstring printer; /* Name of printer notified */
417 uint32 type; /* Printer or job notify */
418 uint32 field; /* Notify field changed */
419 uint32 id; /* Job id */
420 uint32 len; /* Length of data, 0 for two uint32 value */
421 uint32 flags;
422 union {
423 uint32 value[2];
424 char *data;
425 } notify;
426} SPOOLSS_NOTIFY_MSG;
427
428typedef struct {
429 fstring printername;
430 uint32 num_msgs;
431 SPOOLSS_NOTIFY_MSG *msgs;
432} SPOOLSS_NOTIFY_MSG_GROUP;
433
434typedef struct {
435 TALLOC_CTX *ctx;
436 uint32 num_groups;
437 SPOOLSS_NOTIFY_MSG_GROUP *msg_groups;
438} SPOOLSS_NOTIFY_MSG_CTR;
439
440#define SPLHND_PRINTER 1
441#define SPLHND_SERVER 2
442#define SPLHND_PORTMON_TCP 3
443#define SPLHND_PORTMON_LOCAL 4
444
445/* structure to store the printer handles */
446/* and a reference to what it's pointing to */
447/* and the notify info asked about */
448/* that's the central struct */
449typedef struct _Printer{
450 struct _Printer *prev, *next;
451 bool document_started;
452 bool page_started;
453 uint32 jobid; /* jobid in printing backend */
454 int printer_type;
455 TALLOC_CTX *ctx;
456 fstring servername;
457 fstring sharename;
458 uint32 type;
459 uint32 access_granted;
460 struct {
461 uint32 flags;
462 uint32 options;
463 fstring localmachine;
464 uint32 printerlocal;
465 SPOOL_NOTIFY_OPTION *option;
466 POLICY_HND client_hnd;
467 bool client_connected;
468 uint32 change;
469 /* are we in a FindNextPrinterChangeNotify() call? */
470 bool fnpcn;
471 } notify;
472 struct {
473 fstring machine;
474 fstring user;
475 } client;
476
477 /* devmode sent in the OpenPrinter() call */
478 NT_DEVICEMODE *nt_devmode;
479
480 /* cache the printer info */
481 NT_PRINTER_INFO_LEVEL *printer_info;
482
483} Printer_entry;
484
485#endif /* NT_PRINTING_H_ */
Note: See TracBrowser for help on using the repository browser.