2000-11-15 00:56:32 +03:00
/*
2002-07-15 14:35:28 +04:00
Unix SMB / Netbios implementation .
Version 1.9 .
2000-03-10 20:12:24 +03:00
SMB parameters and setup
Copyright ( C ) Andrew Tridgell 1992 - 2000 ,
Copyright ( C ) Jean Francois Micouleau 1998 - 2000.
2000-11-15 00:56:32 +03:00
2000-03-10 20:12:24 +03:00
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
2007-07-09 23:25:36 +04:00
the Free Software Foundation ; either version 3 of the License , or
2000-03-10 20:12:24 +03:00
( at your option ) any later version .
2000-11-15 00:56:32 +03:00
2000-03-10 20:12:24 +03:00
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 .
2000-11-15 00:56:32 +03:00
2000-03-10 20:12:24 +03:00
You should have received a copy of the GNU General Public License
2007-07-10 04:52:41 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2000-03-10 20:12:24 +03:00
*/
2000-03-10 00:45:16 +03:00
# ifndef NT_PRINTING_H_
# define NT_PRINTING_H_
2002-08-17 21:00:51 +04:00
/* container for a single registry key */
typedef struct {
2009-03-23 20:14:17 +03:00
char * name ;
struct regval_ctr * values ;
2002-08-17 21:00:51 +04:00
} NT_PRINTER_KEY ;
/* container for all printer data */
typedef struct {
int num_keys ;
NT_PRINTER_KEY * keys ;
} NT_PRINTER_DATA ;
2000-02-07 19:17:59 +03:00
typedef struct ntdevicemode
{
fstring devicename ;
2000-06-04 06:29:00 +04:00
fstring formname ;
2000-02-07 19:17:59 +03:00
uint16 specversion ;
uint16 driverversion ;
uint16 size ;
uint16 driverextra ;
uint16 orientation ;
uint16 papersize ;
uint16 paperlength ;
uint16 paperwidth ;
uint16 scale ;
uint16 copies ;
uint16 defaultsource ;
uint16 printquality ;
uint16 color ;
uint16 duplex ;
uint16 yresolution ;
uint16 ttoption ;
uint16 collate ;
uint16 logpixels ;
2000-06-04 06:29:00 +04:00
uint32 fields ;
2000-02-07 19:17:59 +03:00
uint32 bitsperpel ;
uint32 pelswidth ;
uint32 pelsheight ;
uint32 displayflags ;
uint32 displayfrequency ;
uint32 icmmethod ;
uint32 icmintent ;
uint32 mediatype ;
uint32 dithertype ;
uint32 reserved1 ;
uint32 reserved2 ;
uint32 panningwidth ;
uint32 panningheight ;
2005-06-25 00:25:18 +04:00
uint8 * nt_dev_private ;
2000-11-15 00:56:32 +03:00
} NT_DEVICEMODE ;
2000-02-07 19:17:59 +03:00
typedef struct nt_printer_info_level_2
{
uint32 attributes ;
uint32 priority ;
uint32 default_priority ;
uint32 starttime ;
uint32 untiltime ;
2002-01-07 09:13:40 +03:00
uint32 status ;
2000-02-07 19:17:59 +03:00
uint32 cjobs ;
uint32 averageppm ;
fstring servername ;
fstring printername ;
fstring sharename ;
fstring portname ;
fstring drivername ;
2007-11-28 06:05:08 +03:00
char comment [ 1024 ] ;
2000-02-07 19:17:59 +03:00
fstring location ;
NT_DEVICEMODE * devmode ;
fstring sepfile ;
fstring printprocessor ;
fstring datatype ;
fstring parameters ;
2005-08-29 18:55:40 +04:00
NT_PRINTER_DATA * data ;
2000-06-01 06:44:17 +04:00
SEC_DESC_BUF * secdesc_buf ;
2000-03-10 20:12:24 +03:00
uint32 changeid ;
uint32 c_setprinter ;
2000-05-24 10:10:21 +04:00
uint32 setuptime ;
2000-02-07 19:17:59 +03:00
} NT_PRINTER_INFO_LEVEL_2 ;
typedef struct nt_printer_info_level
{
NT_PRINTER_INFO_LEVEL_2 * info_2 ;
} NT_PRINTER_INFO_LEVEL ;
typedef struct
{
2000-05-24 10:10:21 +04:00
fstring name ;
2000-02-07 19:17:59 +03:00
uint32 flag ;
uint32 width ;
uint32 length ;
uint32 left ;
uint32 top ;
uint32 right ;
uint32 bottom ;
} nt_forms_struct ;
2000-08-01 04:41:19 +04:00
# ifndef SAMBA_PRINTER_PORT_NAME
# define SAMBA_PRINTER_PORT_NAME "Samba Printer Port"
2000-11-15 00:56:32 +03:00
# endif
2000-08-01 04:41:19 +04:00
2000-10-25 21:56:38 +04:00
/* DOS header format */
# define DOS_HEADER_SIZE 64
# define DOS_HEADER_MAGIC_OFFSET 0
# define DOS_HEADER_MAGIC 0x5A4D
# define DOS_HEADER_LFANEW_OFFSET 60
/* New Executable format (Win or OS/2 1.x segmented) */
# define NE_HEADER_SIZE 64
# define NE_HEADER_SIGNATURE_OFFSET 0
# define NE_HEADER_SIGNATURE 0x454E
# define NE_HEADER_TARGET_OS_OFFSET 54
# define NE_HEADER_TARGOS_WIN 0x02
# define NE_HEADER_MINOR_VER_OFFSET 62
# define NE_HEADER_MAJOR_VER_OFFSET 63
/* Portable Executable format */
2007-03-19 20:45:13 +03:00
# define PE_HEADER_SIZE 24
2000-10-25 21:56:38 +04:00
# define PE_HEADER_SIGNATURE_OFFSET 0
# define PE_HEADER_SIGNATURE 0x00004550
# define PE_HEADER_MACHINE_OFFSET 4
# define PE_HEADER_MACHINE_I386 0x14c
2000-11-15 00:56:32 +03:00
# define PE_HEADER_NUMBER_OF_SECTIONS 6
2007-03-19 20:45:13 +03:00
# define PE_HEADER_OPTIONAL_HEADER_SIZE 20
2000-11-15 00:56:32 +03:00
# define PE_HEADER_SECT_HEADER_SIZE 40
# define PE_HEADER_SECT_NAME_OFFSET 0
# define PE_HEADER_SECT_SIZE_DATA_OFFSET 16
# define PE_HEADER_SECT_PTR_DATA_OFFSET 20
/* Microsoft file version format */
# define VS_SIGNATURE "VS_VERSION_INFO"
# define VS_MAGIC_VALUE 0xfeef04bd
# define VS_MAJOR_OFFSET 8
# define VS_MINOR_OFFSET 12
# define VS_VERSION_INFO_UNICODE_SIZE (sizeof(VS_SIGNATURE)*2+4+VS_MINOR_OFFSET+4) /* not true size! */
# define VS_VERSION_INFO_SIZE (sizeof(VS_SIGNATURE)+4+VS_MINOR_OFFSET+4) /* not true size! */
# define VS_NE_BUF_SIZE 4096 /* Must be > 2*VS_VERSION_INFO_SIZE */
2000-10-25 21:56:38 +04:00
2002-07-15 14:35:28 +04:00
/* Notify spoolss clients that something has changed. The
notification data is either stored in two uint32 values or a
variable length array . */
# define SPOOLSS_NOTIFY_MSG_UNIX_JOBID 0x0001 /* Job id is unix */
2002-09-25 19:19:00 +04:00
typedef struct spoolss_notify_msg {
2002-07-15 14:35:28 +04:00
fstring printer ; /* Name of printer notified */
uint32 type ; /* Printer or job notify */
uint32 field ; /* Notify field changed */
uint32 id ; /* Job id */
uint32 len ; /* Length of data, 0 for two uint32 value */
uint32 flags ;
union {
uint32 value [ 2 ] ;
char * data ;
} notify ;
2002-09-25 19:19:00 +04:00
} SPOOLSS_NOTIFY_MSG ;
typedef struct {
fstring printername ;
uint32 num_msgs ;
SPOOLSS_NOTIFY_MSG * msgs ;
} SPOOLSS_NOTIFY_MSG_GROUP ;
typedef struct {
TALLOC_CTX * ctx ;
uint32 num_groups ;
SPOOLSS_NOTIFY_MSG_GROUP * msg_groups ;
} SPOOLSS_NOTIFY_MSG_CTR ;
2002-07-15 14:35:28 +04:00
2006-03-03 22:28:51 +03:00
# define SPLHND_PRINTER 1
# define SPLHND_SERVER 2
# define SPLHND_PORTMON_TCP 3
# define SPLHND_PORTMON_LOCAL 4
2003-02-25 23:53:53 +03:00
/* structure to store the printer handles */
/* and a reference to what it's pointing to */
/* and the notify info asked about */
/* that's the central struct */
typedef struct _Printer {
struct _Printer * prev , * next ;
2007-10-19 04:40:25 +04:00
bool document_started ;
bool page_started ;
2003-02-25 23:53:53 +03:00
uint32 jobid ; /* jobid in printing backend */
2007-10-19 04:40:25 +04:00
int printer_type ;
2004-10-02 00:34:12 +04:00
fstring servername ;
fstring sharename ;
2003-02-25 23:53:53 +03:00
uint32 type ;
uint32 access_granted ;
struct {
uint32 flags ;
uint32 options ;
fstring localmachine ;
uint32 printerlocal ;
2009-02-17 02:12:21 +03:00
struct spoolss_NotifyOption * option ;
2009-03-19 00:49:41 +03:00
struct policy_handle client_hnd ;
2007-10-19 04:40:25 +04:00
bool client_connected ;
2003-02-25 23:53:53 +03:00
uint32 change ;
/* are we in a FindNextPrinterChangeNotify() call? */
2007-10-19 04:40:25 +04:00
bool fnpcn ;
2003-02-25 23:53:53 +03:00
} notify ;
struct {
fstring machine ;
fstring user ;
} client ;
/* devmode sent in the OpenPrinter() call */
NT_DEVICEMODE * nt_devmode ;
/* cache the printer info */
NT_PRINTER_INFO_LEVEL * printer_info ;
} Printer_entry ;
2009-03-17 14:48:46 +03:00
/*
* The printer attributes .
* I # defined all of them ( grabbed form MSDN )
* I ' m only using :
* ( SHARED | NETWORK | RAW_ONLY )
* RAW_ONLY _MUST_ be present otherwise NT will send an EMF file
*/
# define PRINTER_ATTRIBUTE_SAMBA (PRINTER_ATTRIBUTE_RAW_ONLY|\
PRINTER_ATTRIBUTE_SHARED | \
PRINTER_ATTRIBUTE_LOCAL )
# define PRINTER_ATTRIBUTE_NOT_SAMBA (PRINTER_ATTRIBUTE_NETWORK)
2009-03-17 19:17:18 +03:00
# define DRIVER_ANY_VERSION 0xffffffff
# define DRIVER_MAX_VERSION 4
2009-05-12 16:15:01 +04:00
struct print_architecture_table_node {
const char * long_archi ;
const char * short_archi ;
int version ;
} ;
2000-03-10 00:45:16 +03:00
# endif /* NT_PRINTING_H_ */