s4:rpc_server: Add multiplex state to dcerpc flags and control over multiplex PFC...
[Samba.git] / source3 / include / nt_printing.h
blob914e2e3e4a017223d3f39863ec8d0c6eb828be27
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.
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.
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.
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/>.
22 #ifndef NT_PRINTING_H_
23 #define NT_PRINTING_H_
25 #include "client.h"
26 #include "../librpc/gen_ndr/spoolss.h"
28 #ifndef SAMBA_PRINTER_PORT_NAME
29 #define SAMBA_PRINTER_PORT_NAME "Samba Printer Port"
30 #endif
32 /* DOS header format */
33 #define DOS_HEADER_SIZE 64
34 #define DOS_HEADER_MAGIC_OFFSET 0
35 #define DOS_HEADER_MAGIC 0x5A4D
36 #define DOS_HEADER_LFANEW_OFFSET 60
38 /* New Executable format (Win or OS/2 1.x segmented) */
39 #define NE_HEADER_SIZE 64
40 #define NE_HEADER_SIGNATURE_OFFSET 0
41 #define NE_HEADER_SIGNATURE 0x454E
42 #define NE_HEADER_TARGET_OS_OFFSET 54
43 #define NE_HEADER_TARGOS_WIN 0x02
44 #define NE_HEADER_MINOR_VER_OFFSET 62
45 #define NE_HEADER_MAJOR_VER_OFFSET 63
47 /* Portable Executable format */
48 #define PE_HEADER_SIZE 24
49 #define PE_HEADER_SIGNATURE_OFFSET 0
50 #define PE_HEADER_SIGNATURE 0x00004550
51 #define PE_HEADER_MACHINE_OFFSET 4
52 #define PE_HEADER_MACHINE_I386 0x14c
53 #define PE_HEADER_NUMBER_OF_SECTIONS 6
54 #define PE_HEADER_OPTIONAL_HEADER_SIZE 20
55 #define PE_HEADER_SECT_HEADER_SIZE 40
56 #define PE_HEADER_SECT_NAME_OFFSET 0
57 #define PE_HEADER_SECT_SIZE_DATA_OFFSET 16
58 #define PE_HEADER_SECT_PTR_DATA_OFFSET 20
60 /* Microsoft file version format */
61 #define VS_SIGNATURE "VS_VERSION_INFO"
62 #define VS_MAGIC_VALUE 0xfeef04bd
63 #define VS_MAJOR_OFFSET 8
64 #define VS_MINOR_OFFSET 12
65 #define VS_VERSION_INFO_UNICODE_SIZE (sizeof(VS_SIGNATURE)*2+4+VS_MINOR_OFFSET+4) /* not true size! */
66 #define VS_VERSION_INFO_SIZE (sizeof(VS_SIGNATURE)+4+VS_MINOR_OFFSET+4) /* not true size! */
67 #define VS_NE_BUF_SIZE 4096 /* Must be > 2*VS_VERSION_INFO_SIZE */
69 /* Notify spoolss clients that something has changed. The
70 notification data is either stored in two uint32 values or a
71 variable length array. */
73 #define SPOOLSS_NOTIFY_MSG_UNIX_JOBID 0x0001 /* Job id is unix */
75 typedef struct spoolss_notify_msg {
76 fstring printer; /* Name of printer notified */
77 uint32 type; /* Printer or job notify */
78 uint32 field; /* Notify field changed */
79 uint32 id; /* Job id */
80 uint32 len; /* Length of data, 0 for two uint32 value */
81 uint32 flags;
82 union {
83 uint32 value[2];
84 char *data;
85 } notify;
86 } SPOOLSS_NOTIFY_MSG;
88 typedef struct {
89 fstring printername;
90 uint32 num_msgs;
91 SPOOLSS_NOTIFY_MSG *msgs;
92 } SPOOLSS_NOTIFY_MSG_GROUP;
94 typedef struct {
95 TALLOC_CTX *ctx;
96 uint32 num_groups;
97 SPOOLSS_NOTIFY_MSG_GROUP *msg_groups;
98 } SPOOLSS_NOTIFY_MSG_CTR;
100 #define SPLHND_PRINTER 1
101 #define SPLHND_SERVER 2
102 #define SPLHND_PORTMON_TCP 3
103 #define SPLHND_PORTMON_LOCAL 4
106 * The printer attributes.
107 * I #defined all of them (grabbed form MSDN)
108 * I'm only using:
109 * ( SHARED | NETWORK | RAW_ONLY )
110 * RAW_ONLY _MUST_ be present otherwise NT will send an EMF file
113 #define PRINTER_ATTRIBUTE_SAMBA (PRINTER_ATTRIBUTE_RAW_ONLY|\
114 PRINTER_ATTRIBUTE_SHARED|\
115 PRINTER_ATTRIBUTE_LOCAL)
116 #define PRINTER_ATTRIBUTE_NOT_SAMBA (PRINTER_ATTRIBUTE_NETWORK)
118 #define DRIVER_ANY_VERSION 0xffffffff
119 #define DRIVER_MAX_VERSION 4
121 struct print_architecture_table_node {
122 const char *long_archi;
123 const char *short_archi;
124 int version;
127 bool nt_printing_init(struct messaging_context *msg_ctx);
129 const char *get_short_archi(const char *long_archi);
131 bool print_access_check(const struct auth_session_info *server_info,
132 struct messaging_context *msg_ctx, int snum,
133 int access_type);
135 WERROR nt_printer_guid_retrieve(TALLOC_CTX *mem_ctx, const char *printer,
136 struct GUID *pguid);
138 WERROR nt_printer_guid_store(struct messaging_context *msg_ctx,
139 const char *printer, struct GUID guid);
141 WERROR nt_printer_guid_get(TALLOC_CTX *mem_ctx,
142 const struct auth_session_info *session_info,
143 struct messaging_context *msg_ctx,
144 const char *printer, struct GUID *guid);
146 WERROR nt_printer_publish(TALLOC_CTX *mem_ctx,
147 const struct auth_session_info *server_info,
148 struct messaging_context *msg_ctx,
149 struct spoolss_PrinterInfo2 *pinfo2,
150 int action);
152 bool is_printer_published(TALLOC_CTX *mem_ctx,
153 const struct auth_session_info *server_info,
154 struct messaging_context *msg_ctx,
155 const char *servername,
156 const char *printer,
157 struct spoolss_PrinterInfo2 **info2);
159 WERROR check_published_printers(struct messaging_context *msg_ctx);
161 struct dcerpc_binding_handle;
163 bool printer_driver_in_use(TALLOC_CTX *mem_ctx,
164 struct dcerpc_binding_handle *b,
165 const struct spoolss_DriverInfo8 *r);
166 bool printer_driver_files_in_use(TALLOC_CTX *mem_ctx,
167 struct dcerpc_binding_handle *b,
168 struct spoolss_DriverInfo8 *r);
169 bool delete_driver_files(const struct auth_session_info *server_info,
170 const struct spoolss_DriverInfo8 *r);
172 WERROR move_driver_to_download_area(struct auth_session_info *session_info,
173 struct spoolss_AddDriverInfoCtr *r);
175 WERROR clean_up_driver_struct(TALLOC_CTX *mem_ctx,
176 struct auth_session_info *session_info,
177 struct spoolss_AddDriverInfoCtr *r);
179 void map_printer_permissions(struct security_descriptor *sd);
181 void map_job_permissions(struct security_descriptor *sd);
183 bool print_time_access_check(const struct auth_session_info *server_info,
184 struct messaging_context *msg_ctx,
185 const char *servicename);
187 void nt_printer_remove(TALLOC_CTX *mem_ctx,
188 const struct auth_session_info *server_info,
189 struct messaging_context *msg_ctx,
190 const char *printer);
191 void nt_printer_add(TALLOC_CTX *mem_ctx,
192 const struct auth_session_info *server_info,
193 struct messaging_context *msg_ctx,
194 const char *printer);
196 #endif /* NT_PRINTING_H_ */