]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/cups-private.h
Merge changes from CUPS 1.7svn-r10629.
[thirdparty/cups.git] / cups / cups-private.h
1 /*
2 * "$Id: cups-private.h 9596 2011-03-11 18:26:36Z mike $"
3 *
4 * Private definitions for CUPS.
5 *
6 * Copyright 2007-2012 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
8 *
9 * These coded instructions, statements, and computer programs are the
10 * property of Apple Inc. and are protected by Federal copyright
11 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 * which should have been included with this file. If this file is
13 * file is missing or damaged, see the license at "http://www.cups.org/".
14 *
15 * This file is subject to the Apple OS-Developed Software exception.
16 */
17
18 #ifndef _CUPS_CUPS_PRIVATE_H_
19 # define _CUPS_CUPS_PRIVATE_H_
20
21 /*
22 * Include necessary headers...
23 */
24
25 # include "string-private.h"
26 # include "debug-private.h"
27 # include "array-private.h"
28 # include "ipp-private.h"
29 # include "http-private.h"
30 # include "language-private.h"
31 # include "pwg-private.h"
32 # include "ppd-private.h"
33 # include "thread-private.h"
34 # include <cups/cups.h>
35 # ifdef __APPLE__
36 # include <sys/cdefs.h>
37 # include <CoreFoundation/CoreFoundation.h>
38 # endif /* __APPLE__ */
39
40
41 /*
42 * C++ magic...
43 */
44
45 # ifdef __cplusplus
46 extern "C" {
47 # endif /* __cplusplus */
48
49
50 /*
51 * Types...
52 */
53
54 typedef struct _cups_buffer_s /**** Read/write buffer ****/
55 {
56 struct _cups_buffer_s *next; /* Next buffer in list */
57 size_t size; /* Size of buffer */
58 char used, /* Is this buffer used? */
59 d[1]; /* Data buffer */
60 } _cups_buffer_t;
61
62 typedef struct _cups_globals_s /**** CUPS global state data ****/
63 {
64 /* Multiple places... */
65 const char *cups_datadir, /* CUPS_DATADIR environment var */
66 *cups_serverbin,/* CUPS_SERVERBIN environment var */
67 *cups_serverroot,
68 /* CUPS_SERVERROOT environment var */
69 *cups_statedir, /* CUPS_STATEDIR environment var */
70 *localedir; /* LOCALDIR environment var */
71
72 /* adminutil.c */
73 time_t cupsd_update; /* Last time we got or set cupsd.conf */
74 char cupsd_hostname[HTTP_MAX_HOST];
75 /* Hostname for connection */
76 int cupsd_num_settings;
77 /* Number of server settings */
78 cups_option_t *cupsd_settings;/* Server settings */
79
80 /* auth.c */
81 # ifdef HAVE_GSSAPI
82 char gss_service_name[32];
83 /* Kerberos service name */
84 # endif /* HAVE_GSSAPI */
85
86 /* backend.c */
87 char resolved_uri[1024];
88 /* Buffer for cupsBackendDeviceURI */
89
90 /* file.c */
91 cups_file_t *stdio_files[3];/* stdin, stdout, stderr */
92
93 /* http.c */
94 char http_date[256]; /* Date+time buffer */
95
96 /* http-addr.c */
97 unsigned ip_addr; /* Packed IPv4 address */
98 char *ip_ptrs[2]; /* Pointer to packed address */
99 struct hostent hostent; /* Host entry for IP address */
100 # ifdef HAVE_GETADDRINFO
101 char hostname[1024]; /* Hostname */
102 # endif /* HAVE_GETADDRINFO */
103 int need_res_init; /* Need to reinitialize resolver? */
104
105 /* ipp.c */
106 ipp_uchar_t ipp_date[11]; /* RFC-1903 date/time data */
107 _cups_buffer_t *cups_buffers; /* Buffer list */
108
109 /* ipp-support.c */
110 int ipp_port; /* IPP port number */
111 char ipp_unknown[255];
112 /* Unknown error statuses */
113
114 /* language.c */
115 cups_lang_t *lang_default; /* Default language */
116 # ifdef __APPLE__
117 char language[32]; /* Cached language */
118 # endif /* __APPLE__ */
119
120 /* ppd.c */
121 ppd_status_t ppd_status; /* Status of last ppdOpen*() */
122 int ppd_line; /* Current line number */
123 ppd_conform_t ppd_conform; /* Level of conformance required */
124
125 /* pwg-media.c */
126 cups_array_t *leg_size_lut, /* Lookup table for legacy names */
127 *ppd_size_lut, /* Lookup table for PPD names */
128 *pwg_size_lut; /* Lookup table for PWG names */
129 _pwg_media_t pwg_media; /* PWG media data for custom size */
130 char pwg_name[65]; /* PWG media name for custom size */
131
132 /* request.c */
133 http_t *http; /* Current server connection */
134 ipp_status_t last_error; /* Last IPP error */
135 char *last_status_message;
136 /* Last IPP status-message */
137
138 /* snmp.c */
139 char snmp_community[255];
140 /* Default SNMP community name */
141 int snmp_debug; /* Log SNMP IO to stderr? */
142
143 /* tempfile.c */
144 char tempfile[1024]; /* cupsTempFd/File buffer */
145
146 /* usersys.c */
147 http_encryption_t encryption; /* Encryption setting */
148 char user[65], /* User name */
149 server[256], /* Server address */
150 servername[256],/* Server hostname */
151 password[128]; /* Password for default callback */
152 cups_password_cb2_t password_cb; /* Password callback */
153 void *password_data; /* Password user data */
154 http_tls_credentials_t tls_credentials;
155 /* Default client credentials */
156 cups_client_cert_cb_t client_cert_cb; /* Client certificate callback */
157 void *client_cert_data;
158 /* Client certificate user data */
159 cups_server_cert_cb_t server_cert_cb; /* Server certificate callback */
160 void *server_cert_data;
161 /* Server certificate user data */
162 int any_root, /* Allow any root */
163 expired_certs, /* Allow expired certs */
164 expired_root; /* Allow expired root */
165
166 /* util.c */
167 char def_printer[256];
168 /* Default printer */
169 char ppd_filename[HTTP_MAX_URI];
170 /* PPD filename */
171 } _cups_globals_t;
172
173 typedef struct _cups_media_db_s /* Media database */
174 {
175 char *color, /* Media color, if any */
176 *key, /* Media key, if any */
177 *info, /* Media human-readable name, if any */
178 *size_name, /* Media PWG size name, if provided */
179 *source, /* Media source, if any */
180 *type; /* Media type, if any */
181 int width, /* Width in hundredths of millimeters */
182 length, /* Length in hundredths of
183 * millimeters */
184 bottom, /* Bottom margin in hundredths of
185 * millimeters */
186 left, /* Left margin in hundredths of
187 * millimeters */
188 right, /* Right margin in hundredths of
189 * millimeters */
190 top; /* Top margin in hundredths of
191 * millimeters */
192 } _cups_media_db_t;
193
194 typedef struct _cups_dconstres_s /* Constraint/resolver */
195 {
196 char *name; /* Name of resolver */
197 ipp_t *collection; /* Collection containing attrs */
198 } _cups_dconstres_t;
199
200 struct _cups_dinfo_s /* Destination capability and status
201 * information */
202 {
203 const char *uri; /* Printer URI */
204 char *resource; /* Resource path */
205 ipp_t *attrs; /* Printer attributes */
206 int num_defaults; /* Number of default options */
207 cups_option_t *defaults; /* Default options */
208 cups_array_t *constraints; /* Job constraints */
209 cups_array_t *resolvers; /* Job resolvers */
210 cups_array_t *localizations; /* Localization information */
211 cups_array_t *media_db; /* Media database */
212 _cups_media_db_t min_size, /* Minimum size */
213 max_size; /* Maximum size */
214 };
215
216
217 /*
218 * Prototypes...
219 */
220
221 # ifdef __APPLE__
222 extern CFStringRef _cupsAppleCopyDefaultPaperID(void);
223 extern CFStringRef _cupsAppleCopyDefaultPrinter(void);
224 extern int _cupsAppleGetUseLastPrinter(void);
225 extern void _cupsAppleSetDefaultPaperID(CFStringRef name);
226 extern void _cupsAppleSetDefaultPrinter(CFStringRef name);
227 extern void _cupsAppleSetUseLastPrinter(int uselast);
228 # endif /* __APPLE__ */
229
230 extern char *_cupsBufferGet(size_t size);
231 extern void _cupsBufferRelease(char *b);
232
233 extern http_t *_cupsConnect(void);
234 extern int _cupsGet1284Values(const char *device_id,
235 cups_option_t **values);
236 extern const char *_cupsGetDestResource(cups_dest_t *dest, char *resource,
237 size_t resourcesize);
238 extern int _cupsGetDests(http_t *http, ipp_op_t op,
239 const char *name, cups_dest_t **dests,
240 cups_ptype_t type, cups_ptype_t mask);
241 extern const char *_cupsGetPassword(const char *prompt);
242 extern void _cupsGlobalLock(void);
243 extern _cups_globals_t *_cupsGlobals(void);
244 extern void _cupsGlobalUnlock(void);
245 # ifdef HAVE_GSSAPI
246 extern const char *_cupsGSSServiceName(void);
247 # endif /* HAVE_GSSAPI */
248 extern int _cupsNextDelay(int current, int *previous);
249 extern void _cupsSetDefaults(void);
250 extern void _cupsSetError(ipp_status_t status, const char *message,
251 int localize);
252 extern void _cupsSetHTTPError(http_status_t status);
253 # ifdef HAVE_GSSAPI
254 extern int _cupsSetNegotiateAuthString(http_t *http,
255 const char *method,
256 const char *resource);
257 # endif /* HAVE_GSSAPI */
258 extern char *_cupsUserDefault(char *name, size_t namesize);
259
260
261 /*
262 * C++ magic...
263 */
264
265 # ifdef __cplusplus
266 }
267 # endif /* __cplusplus */
268 #endif /* !_CUPS_CUPS_PRIVATE_H_ */
269
270 /*
271 * End of "$Id: cups-private.h 9596 2011-03-11 18:26:36Z mike $".
272 */