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