00001 /* 00002 Unix SMB/Netbios implementation. 00003 Version 1.9. 00004 SMB parameters and setup 00005 Copyright (C) Andrew Tridgell 1992-2000, 00006 Copyright (C) Jean Francois Micouleau 1998-2000. 00007 00008 This program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2 of the License, or 00011 (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00021 */ 00022 00023 #ifndef NT_PRINTING_H_ 00024 #define NT_PRINTING_H_ 00025 00026 #define ORIENTATION 0x00000001L 00027 #define PAPERSIZE 0x00000002L 00028 #define PAPERLENGTH 0x00000004L 00029 #define PAPERWIDTH 0x00000008L 00030 #define SCALE 0x00000010L 00031 #define COPIES 0x00000100L 00032 #define DEFAULTSOURCE 0x00000200L 00033 #define PRINTQUALITY 0x00000400L 00034 #define COLOR 0x00000800L 00035 #define DUPLEX 0x00001000L 00036 #define YRESOLUTION 0x00002000L 00037 #define TTOPTION 0x00004000L 00038 #define COLLATE 0x00008000L 00039 #define FORMNAME 0x00010000L 00040 #define LOGPIXELS 0x00020000L 00041 #define BITSPERPEL 0x00040000L 00042 #define PELSWIDTH 0x00080000L 00043 #define PELSHEIGHT 0x00100000L 00044 #define DISPLAYFLAGS 0x00200000L 00045 #define DISPLAYFREQUENCY 0x00400000L 00046 #define PANNINGWIDTH 0x00800000L 00047 #define PANNINGHEIGHT 0x01000000L 00048 00049 #define ORIENT_PORTRAIT 1 00050 #define ORIENT_LANDSCAPE 2 00051 00052 #define PAPER_FIRST PAPER_LETTER 00053 #define PAPER_LETTER 1 /* Letter 8 1/2 x 11 in */ 00054 #define PAPER_LETTERSMALL 2 /* Letter Small 8 1/2 x 11 in */ 00055 #define PAPER_TABLOID 3 /* Tabloid 11 x 17 in */ 00056 #define PAPER_LEDGER 4 /* Ledger 17 x 11 in */ 00057 #define PAPER_LEGAL 5 /* Legal 8 1/2 x 14 in */ 00058 #define PAPER_STATEMENT 6 /* Statement 5 1/2 x 8 1/2 in */ 00059 #define PAPER_EXECUTIVE 7 /* Executive 7 1/4 x 10 1/2 in */ 00060 #define PAPER_A3 8 /* A3 297 x 420 mm */ 00061 #define PAPER_A4 9 /* A4 210 x 297 mm */ 00062 #define PAPER_A4SMALL 10 /* A4 Small 210 x 297 mm */ 00063 #define PAPER_A5 11 /* A5 148 x 210 mm */ 00064 #define PAPER_B4 12 /* B4 (JIS) 250 x 354 */ 00065 #define PAPER_B5 13 /* B5 (JIS) 182 x 257 mm */ 00066 #define PAPER_FOLIO 14 /* Folio 8 1/2 x 13 in */ 00067 #define PAPER_QUARTO 15 /* Quarto 215 x 275 mm */ 00068 #define PAPER_10X14 16 /* 10x14 in */ 00069 #define PAPER_11X17 17 /* 11x17 in */ 00070 #define PAPER_NOTE 18 /* Note 8 1/2 x 11 in */ 00071 #define PAPER_ENV_9 19 /* Envelope #9 3 7/8 x 8 7/8 */ 00072 #define PAPER_ENV_10 20 /* Envelope #10 4 1/8 x 9 1/2 */ 00073 #define PAPER_ENV_11 21 /* Envelope #11 4 1/2 x 10 3/8 */ 00074 #define PAPER_ENV_12 22 /* Envelope #12 4 \276 x 11 */ 00075 #define PAPER_ENV_14 23 /* Envelope #14 5 x 11 1/2 */ 00076 #define PAPER_CSHEET 24 /* C size sheet */ 00077 #define PAPER_DSHEET 25 /* D size sheet */ 00078 #define PAPER_ESHEET 26 /* E size sheet */ 00079 #define PAPER_ENV_DL 27 /* Envelope DL 110 x 220mm */ 00080 #define PAPER_ENV_C5 28 /* Envelope C5 162 x 229 mm */ 00081 #define PAPER_ENV_C3 29 /* Envelope C3 324 x 458 mm */ 00082 #define PAPER_ENV_C4 30 /* Envelope C4 229 x 324 mm */ 00083 #define PAPER_ENV_C6 31 /* Envelope C6 114 x 162 mm */ 00084 #define PAPER_ENV_C65 32 /* Envelope C65 114 x 229 mm */ 00085 #define PAPER_ENV_B4 33 /* Envelope B4 250 x 353 mm */ 00086 #define PAPER_ENV_B5 34 /* Envelope B5 176 x 250 mm */ 00087 #define PAPER_ENV_B6 35 /* Envelope B6 176 x 125 mm */ 00088 #define PAPER_ENV_ITALY 36 /* Envelope 110 x 230 mm */ 00089 #define PAPER_ENV_MONARCH 37 /* Envelope Monarch 3.875 x 7.5 in */ 00090 #define PAPER_ENV_PERSONAL 38 /* 6 3/4 Envelope 3 5/8 x 6 1/2 in */ 00091 #define PAPER_FANFOLD_US 39 /* US Std Fanfold 14 7/8 x 11 in */ 00092 #define PAPER_FANFOLD_STD_GERMAN 40 /* German Std Fanfold 8 1/2 x 12 in */ 00093 #define PAPER_FANFOLD_LGL_GERMAN 41 /* German Legal Fanfold 8 1/2 x 13 in */ 00094 00095 #define PAPER_LAST PAPER_FANFOLD_LGL_GERMAN 00096 #define PAPER_USER 256 00097 00098 #define BIN_FIRST BIN_UPPER 00099 #define BIN_UPPER 1 00100 #define BIN_ONLYONE 1 00101 #define BIN_LOWER 2 00102 #define BIN_MIDDLE 3 00103 #define BIN_MANUAL 4 00104 #define BIN_ENVELOPE 5 00105 #define BIN_ENVMANUAL 6 00106 #define BIN_AUTO 7 00107 #define BIN_TRACTOR 8 00108 #define BIN_SMALLFMT 9 00109 #define BIN_LARGEFMT 10 00110 #define BIN_LARGECAPACITY 11 00111 #define BIN_CASSETTE 14 00112 #define BIN_FORMSOURCE 15 00113 #define BIN_LAST BIN_FORMSOURCE 00114 00115 #define BIN_USER 256 /* device specific bins start here */ 00116 00117 #define RES_DRAFT (-1) 00118 #define RES_LOW (-2) 00119 #define RES_MEDIUM (-3) 00120 #define RES_HIGH (-4) 00121 00122 #define COLOR_MONOCHROME 1 00123 #define COLOR_COLOR 2 00124 00125 #define DUP_SIMPLEX 1 00126 #define DUP_VERTICAL 2 00127 #define DUP_HORIZONTAL 3 00128 00129 #define TT_BITMAP 1 /* print TT fonts as graphics */ 00130 #define TT_DOWNLOAD 2 /* download TT fonts as soft fonts */ 00131 #define TT_SUBDEV 3 /* substitute device fonts for TT fonts */ 00132 00133 #define COLLATE_FALSE 0 00134 #define COLLATE_TRUE 1 00135 00136 typedef struct nt_printer_driver_info_level_3 00137 { 00138 uint32 cversion; 00139 00140 fstring name; 00141 fstring environment; 00142 fstring driverpath; 00143 fstring datafile; 00144 fstring configfile; 00145 fstring helpfile; 00146 fstring monitorname; 00147 fstring defaultdatatype; 00148 fstring *dependentfiles; 00149 } NT_PRINTER_DRIVER_INFO_LEVEL_3; 00150 00151 /* SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure */ 00152 typedef struct { 00153 uint32 version; 00154 fstring name; 00155 fstring environment; 00156 fstring driverpath; 00157 fstring datafile; 00158 fstring configfile; 00159 fstring helpfile; 00160 fstring monitorname; 00161 fstring defaultdatatype; 00162 fstring mfgname; 00163 fstring oemurl; 00164 fstring hardwareid; 00165 fstring provider; 00166 fstring *dependentfiles; 00167 fstring *previousnames; 00168 } NT_PRINTER_DRIVER_INFO_LEVEL_6; 00169 00170 00171 typedef struct nt_printer_driver_info_level 00172 { 00173 NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3; 00174 NT_PRINTER_DRIVER_INFO_LEVEL_6 *info_6; 00175 } NT_PRINTER_DRIVER_INFO_LEVEL; 00176 00177 /* predefined registry key names for printer data */ 00178 00179 #define SPOOL_PRINTERDATA_KEY "PrinterDriverData" 00180 #define SPOOL_DSSPOOLER_KEY "DsSpooler" 00181 #define SPOOL_DSDRIVER_KEY "DsDriver" 00182 #define SPOOL_DSUSER_KEY "DsUser" 00183 #define SPOOL_PNPDATA_KEY "PnPData" 00184 #define SPOOL_OID_KEY "OID" 00185 00186 /* predefined value names for printer data */ 00187 #define SPOOL_REG_ASSETNUMBER "assetNumber" 00188 #define SPOOL_REG_BYTESPERMINUTE "bytesPerMinute" 00189 #define SPOOL_REG_DEFAULTPRIORITY "defaultPriority" 00190 #define SPOOL_REG_DESCRIPTION "description" 00191 #define SPOOL_REG_DRIVERNAME "driverName" 00192 #define SPOOL_REG_DRIVERVERSION "driverVersion" 00193 #define SPOOL_REG_FLAGS "flags" 00194 #define SPOOL_REG_LOCATION "location" 00195 #define SPOOL_REG_OPERATINGSYSTEM "operatingSystem" 00196 #define SPOOL_REG_OPERATINGSYSTEMHOTFIX "operatingSystemHotfix" 00197 #define SPOOL_REG_OPERATINGSYSTEMSERVICEPACK "operatingSystemServicePack" 00198 #define SPOOL_REG_OPERATINGSYSTEMVERSION "operatingSystemVersion" 00199 #define SPOOL_REG_PORTNAME "portName" 00200 #define SPOOL_REG_PRINTATTRIBUTES "printAttributes" 00201 #define SPOOL_REG_PRINTBINNAMES "printBinNames" 00202 #define SPOOL_REG_PRINTCOLLATE "printCollate" 00203 #define SPOOL_REG_PRINTCOLOR "printColor" 00204 #define SPOOL_REG_PRINTDUPLEXSUPPORTED "printDuplexSupported" 00205 #define SPOOL_REG_PRINTENDTIME "printEndTime" 00206 #define SPOOL_REG_PRINTERNAME "printerName" 00207 #define SPOOL_REG_PRINTFORMNAME "printFormName" 00208 #define SPOOL_REG_PRINTKEEPPRINTEDJOBS "printKeepPrintedJobs" 00209 #define SPOOL_REG_PRINTLANGUAGE "printLanguage" 00210 #define SPOOL_REG_PRINTMACADDRESS "printMACAddress" 00211 #define SPOOL_REG_PRINTMAXCOPIES "printMaxCopies" 00212 #define SPOOL_REG_PRINTMAXRESOLUTIONSUPPORTED "printMaxResolutionSupported" 00213 #define SPOOL_REG_PRINTMAXXEXTENT "printMaxXExtent" 00214 #define SPOOL_REG_PRINTMAXYEXTENT "printMaxYExtent" 00215 #define SPOOL_REG_PRINTMEDIAREADY "printMediaReady" 00216 #define SPOOL_REG_PRINTMEDIASUPPORTED "printMediaSupported" 00217 #define SPOOL_REG_PRINTMEMORY "printMemory" 00218 #define SPOOL_REG_PRINTMINXEXTENT "printMinXExtent" 00219 #define SPOOL_REG_PRINTMINYEXTENT "printMinYExtent" 00220 #define SPOOL_REG_PRINTNETWORKADDRESS "printNetworkAddress" 00221 #define SPOOL_REG_PRINTNOTIFY "printNotify" 00222 #define SPOOL_REG_PRINTNUMBERUP "printNumberUp" 00223 #define SPOOL_REG_PRINTORIENTATIONSSUPPORTED "printOrientationsSupported" 00224 #define SPOOL_REG_PRINTOWNER "printOwner" 00225 #define SPOOL_REG_PRINTPAGESPERMINUTE "printPagesPerMinute" 00226 #define SPOOL_REG_PRINTRATE "printRate" 00227 #define SPOOL_REG_PRINTRATEUNIT "printRateUnit" 00228 #define SPOOL_REG_PRINTSEPARATORFILE "printSeparatorFile" 00229 #define SPOOL_REG_PRINTSHARENAME "printShareName" 00230 #define SPOOL_REG_PRINTSPOOLING "printSpooling" 00231 #define SPOOL_REGVAL_PRINTWHILESPOOLING "PrintWhileSpooling" 00232 #define SPOOL_REGVAL_PRINTAFTERSPOOLED "PrintAfterSpooled" 00233 #define SPOOL_REGVAL_PRINTDIRECT "PrintDirect" 00234 #define SPOOL_REG_PRINTSTAPLINGSUPPORTED "printStaplingSupported" 00235 #define SPOOL_REG_PRINTSTARTTIME "printStartTime" 00236 #define SPOOL_REG_PRINTSTATUS "printStatus" 00237 #define SPOOL_REG_PRIORITY "priority" 00238 #define SPOOL_REG_SERVERNAME "serverName" 00239 #define SPOOL_REG_SHORTSERVERNAME "shortServerName" 00240 #define SPOOL_REG_UNCNAME "uNCName" 00241 #define SPOOL_REG_URL "url" 00242 #define SPOOL_REG_VERSIONNUMBER "versionNumber" 00243 00244 /* container for a single registry key */ 00245 00246 typedef struct { 00247 char *name; 00248 REGVAL_CTR *values; 00249 } NT_PRINTER_KEY; 00250 00251 /* container for all printer data */ 00252 00253 typedef struct { 00254 int num_keys; 00255 NT_PRINTER_KEY *keys; 00256 } NT_PRINTER_DATA; 00257 00258 #define MAXDEVICENAME 32 00259 00260 typedef struct ntdevicemode 00261 { 00262 fstring devicename; 00263 fstring formname; 00264 00265 uint16 specversion; 00266 uint16 driverversion; 00267 uint16 size; 00268 uint16 driverextra; 00269 uint16 orientation; 00270 uint16 papersize; 00271 uint16 paperlength; 00272 uint16 paperwidth; 00273 uint16 scale; 00274 uint16 copies; 00275 uint16 defaultsource; 00276 uint16 printquality; 00277 uint16 color; 00278 uint16 duplex; 00279 uint16 yresolution; 00280 uint16 ttoption; 00281 uint16 collate; 00282 uint16 logpixels; 00283 00284 uint32 fields; 00285 uint32 bitsperpel; 00286 uint32 pelswidth; 00287 uint32 pelsheight; 00288 uint32 displayflags; 00289 uint32 displayfrequency; 00290 uint32 icmmethod; 00291 uint32 icmintent; 00292 uint32 mediatype; 00293 uint32 dithertype; 00294 uint32 reserved1; 00295 uint32 reserved2; 00296 uint32 panningwidth; 00297 uint32 panningheight; 00298 uint8 *nt_dev_private; 00299 } NT_DEVICEMODE; 00300 00301 typedef struct nt_printer_info_level_2 00302 { 00303 uint32 attributes; 00304 uint32 priority; 00305 uint32 default_priority; 00306 uint32 starttime; 00307 uint32 untiltime; 00308 uint32 status; 00309 uint32 cjobs; 00310 uint32 averageppm; 00311 fstring servername; 00312 fstring printername; 00313 fstring sharename; 00314 fstring portname; 00315 fstring drivername; 00316 pstring comment; 00317 fstring location; 00318 NT_DEVICEMODE *devmode; 00319 fstring sepfile; 00320 fstring printprocessor; 00321 fstring datatype; 00322 fstring parameters; 00323 NT_PRINTER_DATA *data; 00324 SEC_DESC_BUF *secdesc_buf; 00325 uint32 changeid; 00326 uint32 c_setprinter; 00327 uint32 setuptime; 00328 } NT_PRINTER_INFO_LEVEL_2; 00329 00330 typedef struct nt_printer_info_level 00331 { 00332 NT_PRINTER_INFO_LEVEL_2 *info_2; 00333 } NT_PRINTER_INFO_LEVEL; 00334 00335 typedef struct 00336 { 00337 fstring name; 00338 uint32 flag; 00339 uint32 width; 00340 uint32 length; 00341 uint32 left; 00342 uint32 top; 00343 uint32 right; 00344 uint32 bottom; 00345 } nt_forms_struct; 00346 00347 #ifndef SAMBA_PRINTER_PORT_NAME 00348 #define SAMBA_PRINTER_PORT_NAME "Samba Printer Port" 00349 #endif 00350 00351 00352 /* 00353 * Structures for the XcvDataPort() calls 00354 */ 00355 00356 #define PORT_PROTOCOL_DIRECT 1 00357 #define PORT_PROTOCOL_LPR 2 00358 00359 typedef struct { 00360 fstring name; 00361 uint32 version; 00362 uint32 protocol; 00363 fstring hostaddr; 00364 fstring snmpcommunity; 00365 fstring queue; 00366 uint32 dblspool; 00367 fstring ipaddr; 00368 uint32 port; 00369 BOOL enable_snmp; 00370 uint32 snmp_index; 00371 } NT_PORT_DATA_1; 00372 00373 /* DOS header format */ 00374 #define DOS_HEADER_SIZE 64 00375 #define DOS_HEADER_MAGIC_OFFSET 0 00376 #define DOS_HEADER_MAGIC 0x5A4D 00377 #define DOS_HEADER_LFANEW_OFFSET 60 00378 00379 /* New Executable format (Win or OS/2 1.x segmented) */ 00380 #define NE_HEADER_SIZE 64 00381 #define NE_HEADER_SIGNATURE_OFFSET 0 00382 #define NE_HEADER_SIGNATURE 0x454E 00383 #define NE_HEADER_TARGET_OS_OFFSET 54 00384 #define NE_HEADER_TARGOS_WIN 0x02 00385 #define NE_HEADER_MINOR_VER_OFFSET 62 00386 #define NE_HEADER_MAJOR_VER_OFFSET 63 00387 00388 /* Portable Executable format */ 00389 #define PE_HEADER_SIZE 24 00390 #define PE_HEADER_SIGNATURE_OFFSET 0 00391 #define PE_HEADER_SIGNATURE 0x00004550 00392 #define PE_HEADER_MACHINE_OFFSET 4 00393 #define PE_HEADER_MACHINE_I386 0x14c 00394 #define PE_HEADER_NUMBER_OF_SECTIONS 6 00395 #define PE_HEADER_OPTIONAL_HEADER_SIZE 20 00396 #define PE_HEADER_SECT_HEADER_SIZE 40 00397 #define PE_HEADER_SECT_NAME_OFFSET 0 00398 #define PE_HEADER_SECT_SIZE_DATA_OFFSET 16 00399 #define PE_HEADER_SECT_PTR_DATA_OFFSET 20 00400 00401 /* Microsoft file version format */ 00402 #define VS_SIGNATURE "VS_VERSION_INFO" 00403 #define VS_MAGIC_VALUE 0xfeef04bd 00404 #define VS_MAJOR_OFFSET 8 00405 #define VS_MINOR_OFFSET 12 00406 #define VS_VERSION_INFO_UNICODE_SIZE (sizeof(VS_SIGNATURE)*2+4+VS_MINOR_OFFSET+4) /* not true size! */ 00407 #define VS_VERSION_INFO_SIZE (sizeof(VS_SIGNATURE)+4+VS_MINOR_OFFSET+4) /* not true size! */ 00408 #define VS_NE_BUF_SIZE 4096 /* Must be > 2*VS_VERSION_INFO_SIZE */ 00409 00410 /* Notify spoolss clients that something has changed. The 00411 notification data is either stored in two uint32 values or a 00412 variable length array. */ 00413 00414 #define SPOOLSS_NOTIFY_MSG_UNIX_JOBID 0x0001 /* Job id is unix */ 00415 00416 typedef struct spoolss_notify_msg { 00417 fstring printer; /* Name of printer notified */ 00418 uint32 type; /* Printer or job notify */ 00419 uint32 field; /* Notify field changed */ 00420 uint32 id; /* Job id */ 00421 uint32 len; /* Length of data, 0 for two uint32 value */ 00422 uint32 flags; 00423 union { 00424 uint32 value[2]; 00425 char *data; 00426 } notify; 00427 } SPOOLSS_NOTIFY_MSG; 00428 00429 typedef struct { 00430 fstring printername; 00431 uint32 num_msgs; 00432 SPOOLSS_NOTIFY_MSG *msgs; 00433 } SPOOLSS_NOTIFY_MSG_GROUP; 00434 00435 typedef struct { 00436 TALLOC_CTX *ctx; 00437 uint32 num_groups; 00438 SPOOLSS_NOTIFY_MSG_GROUP *msg_groups; 00439 } SPOOLSS_NOTIFY_MSG_CTR; 00440 00441 #define SPLHND_PRINTER 1 00442 #define SPLHND_SERVER 2 00443 #define SPLHND_PORTMON_TCP 3 00444 #define SPLHND_PORTMON_LOCAL 4 00445 00446 /* structure to store the printer handles */ 00447 /* and a reference to what it's pointing to */ 00448 /* and the notify info asked about */ 00449 /* that's the central struct */ 00450 typedef struct _Printer{ 00451 struct _Printer *prev, *next; 00452 BOOL document_started; 00453 BOOL page_started; 00454 uint32 jobid; /* jobid in printing backend */ 00455 BOOL printer_type; 00456 TALLOC_CTX *ctx; 00457 fstring servername; 00458 fstring sharename; 00459 uint32 type; 00460 uint32 access_granted; 00461 struct { 00462 uint32 flags; 00463 uint32 options; 00464 fstring localmachine; 00465 uint32 printerlocal; 00466 SPOOL_NOTIFY_OPTION *option; 00467 POLICY_HND client_hnd; 00468 BOOL client_connected; 00469 uint32 change; 00470 /* are we in a FindNextPrinterChangeNotify() call? */ 00471 BOOL fnpcn; 00472 } notify; 00473 struct { 00474 fstring machine; 00475 fstring user; 00476 } client; 00477 00478 /* devmode sent in the OpenPrinter() call */ 00479 NT_DEVICEMODE *nt_devmode; 00480 00481 /* cache the printer info */ 00482 NT_PRINTER_INFO_LEVEL *printer_info; 00483 00484 } Printer_entry; 00485 00486 #endif /* NT_PRINTING_H_ */