]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
f14324a7 | 2 | * "$Id: cups-private.h 9596 2011-03-11 18:26:36Z mike $" |
ef416fc2 | 3 | * |
71e16022 | 4 | * Private definitions for CUPS. |
ef416fc2 | 5 | * |
dcb445bc | 6 | * Copyright 2007-2012 by Apple Inc. |
f7deaa1a | 7 | * Copyright 1997-2007 by Easy Software Products, all rights reserved. |
ef416fc2 | 8 | * |
9 | * These coded instructions, statements, and computer programs are the | |
bc44d920 | 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/". | |
ef416fc2 | 14 | * |
15 | * This file is subject to the Apple OS-Developed Software exception. | |
16 | */ | |
17 | ||
71e16022 MS |
18 | #ifndef _CUPS_CUPS_PRIVATE_H_ |
19 | # define _CUPS_CUPS_PRIVATE_H_ | |
ef416fc2 | 20 | |
21 | /* | |
22 | * Include necessary headers... | |
23 | */ | |
24 | ||
71e16022 MS |
25 | # include "string-private.h" |
26 | # include "debug-private.h" | |
5a9febac | 27 | # include "array-private.h" |
71e16022 | 28 | # include "ipp-private.h" |
82cc1f9a | 29 | # include "http-private.h" |
71e16022 | 30 | # include "language-private.h" |
54afec33 | 31 | # include "pwg-private.h" |
82cc1f9a | 32 | # include "ppd-private.h" |
6d2f911b | 33 | # include "thread-private.h" |
82cc1f9a | 34 | # include <cups/cups.h> |
c8fef167 MS |
35 | # ifdef __APPLE__ |
36 | # include <sys/cdefs.h> | |
37 | # include <CoreFoundation/CoreFoundation.h> | |
38 | # endif /* __APPLE__ */ | |
ef416fc2 | 39 | |
40 | ||
41 | /* | |
42 | * C++ magic... | |
43 | */ | |
44 | ||
45 | # ifdef __cplusplus | |
46 | extern "C" { | |
47 | # endif /* __cplusplus */ | |
48 | ||
49 | ||
50 | /* | |
71e16022 | 51 | * Types... |
ef416fc2 | 52 | */ |
53 | ||
dcb445bc MS |
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 | ||
ef416fc2 | 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 | ||
757d2cad | 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 | ||
07ed0e9a MS |
80 | /* auth.c */ |
81 | # ifdef HAVE_GSSAPI | |
82 | char gss_service_name[32]; | |
83 | /* Kerberos service name */ | |
84 | # endif /* HAVE_GSSAPI */ | |
85 | ||
5eb9da71 MS |
86 | /* backend.c */ |
87 | char resolved_uri[1024]; | |
88 | /* Buffer for cupsBackendDeviceURI */ | |
89 | ||
a469f8a5 MS |
90 | /* debug.c */ |
91 | # ifdef DEBUG | |
92 | int thread_id; /* Friendly thread ID */ | |
93 | # endif /* DEBUG */ | |
94 | ||
80ca4592 | 95 | /* file.c */ |
96 | cups_file_t *stdio_files[3];/* stdin, stdout, stderr */ | |
97 | ||
ef416fc2 | 98 | /* http.c */ |
99 | char http_date[256]; /* Date+time buffer */ | |
100 | ||
101 | /* http-addr.c */ | |
102 | unsigned ip_addr; /* Packed IPv4 address */ | |
103 | char *ip_ptrs[2]; /* Pointer to packed address */ | |
104 | struct hostent hostent; /* Host entry for IP address */ | |
105 | # ifdef HAVE_GETADDRINFO | |
106 | char hostname[1024]; /* Hostname */ | |
107 | # endif /* HAVE_GETADDRINFO */ | |
49d87452 | 108 | int need_res_init; /* Need to reinitialize resolver? */ |
ef416fc2 | 109 | |
110 | /* ipp.c */ | |
111 | ipp_uchar_t ipp_date[11]; /* RFC-1903 date/time data */ | |
dcb445bc | 112 | _cups_buffer_t *cups_buffers; /* Buffer list */ |
ef416fc2 | 113 | |
114 | /* ipp-support.c */ | |
115 | int ipp_port; /* IPP port number */ | |
116 | char ipp_unknown[255]; | |
117 | /* Unknown error statuses */ | |
118 | ||
ef416fc2 | 119 | /* language.c */ |
fa73b229 | 120 | cups_lang_t *lang_default; /* Default language */ |
ef416fc2 | 121 | # ifdef __APPLE__ |
ef416fc2 | 122 | char language[32]; /* Cached language */ |
ef416fc2 | 123 | # endif /* __APPLE__ */ |
124 | ||
125 | /* ppd.c */ | |
126 | ppd_status_t ppd_status; /* Status of last ppdOpen*() */ | |
127 | int ppd_line; /* Current line number */ | |
128 | ppd_conform_t ppd_conform; /* Level of conformance required */ | |
129 | ||
54afec33 MS |
130 | /* pwg-media.c */ |
131 | cups_array_t *leg_size_lut, /* Lookup table for legacy names */ | |
132 | *ppd_size_lut, /* Lookup table for PPD names */ | |
133 | *pwg_size_lut; /* Lookup table for PWG names */ | |
134 | _pwg_media_t pwg_media; /* PWG media data for custom size */ | |
135 | char pwg_name[65]; /* PWG media name for custom size */ | |
c168a833 | 136 | |
5180a04c MS |
137 | /* request.c */ |
138 | http_t *http; /* Current server connection */ | |
139 | ipp_status_t last_error; /* Last IPP error */ | |
140 | char *last_status_message; | |
141 | /* Last IPP status-message */ | |
142 | ||
91c84a35 | 143 | /* snmp.c */ |
ac884b6a MS |
144 | char snmp_community[255]; |
145 | /* Default SNMP community name */ | |
91c84a35 MS |
146 | int snmp_debug; /* Log SNMP IO to stderr? */ |
147 | ||
ef416fc2 | 148 | /* tempfile.c */ |
149 | char tempfile[1024]; /* cupsTempFd/File buffer */ | |
150 | ||
ef416fc2 | 151 | /* usersys.c */ |
152 | http_encryption_t encryption; /* Encryption setting */ | |
153 | char user[65], /* User name */ | |
154 | server[256], /* Server address */ | |
dcb445bc MS |
155 | servername[256],/* Server hostname */ |
156 | password[128]; /* Password for default callback */ | |
f11a948a MS |
157 | cups_password_cb2_t password_cb; /* Password callback */ |
158 | void *password_data; /* Password user data */ | |
7cf5915e MS |
159 | http_tls_credentials_t tls_credentials; |
160 | /* Default client credentials */ | |
161 | cups_client_cert_cb_t client_cert_cb; /* Client certificate callback */ | |
162 | void *client_cert_data; | |
163 | /* Client certificate user data */ | |
164 | cups_server_cert_cb_t server_cert_cb; /* Server certificate callback */ | |
165 | void *server_cert_data; | |
166 | /* Server certificate user data */ | |
167 | int any_root, /* Allow any root */ | |
168 | expired_certs, /* Allow expired certs */ | |
169 | expired_root; /* Allow expired root */ | |
ef416fc2 | 170 | |
171 | /* util.c */ | |
ef416fc2 | 172 | char def_printer[256]; |
173 | /* Default printer */ | |
174 | char ppd_filename[HTTP_MAX_URI]; | |
175 | /* PPD filename */ | |
176 | } _cups_globals_t; | |
177 | ||
dcb445bc MS |
178 | typedef struct _cups_media_db_s /* Media database */ |
179 | { | |
180 | char *color, /* Media color, if any */ | |
181 | *key, /* Media key, if any */ | |
182 | *info, /* Media human-readable name, if any */ | |
183 | *size_name, /* Media PWG size name, if provided */ | |
184 | *source, /* Media source, if any */ | |
185 | *type; /* Media type, if any */ | |
186 | int width, /* Width in hundredths of millimeters */ | |
187 | length, /* Length in hundredths of | |
188 | * millimeters */ | |
189 | bottom, /* Bottom margin in hundredths of | |
190 | * millimeters */ | |
191 | left, /* Left margin in hundredths of | |
192 | * millimeters */ | |
193 | right, /* Right margin in hundredths of | |
194 | * millimeters */ | |
195 | top; /* Top margin in hundredths of | |
196 | * millimeters */ | |
197 | } _cups_media_db_t; | |
198 | ||
a29fd7dd MS |
199 | typedef struct _cups_dconstres_s /* Constraint/resolver */ |
200 | { | |
201 | char *name; /* Name of resolver */ | |
202 | ipp_t *collection; /* Collection containing attrs */ | |
203 | } _cups_dconstres_t; | |
204 | ||
dcb445bc MS |
205 | struct _cups_dinfo_s /* Destination capability and status |
206 | * information */ | |
207 | { | |
208 | const char *uri; /* Printer URI */ | |
209 | char *resource; /* Resource path */ | |
210 | ipp_t *attrs; /* Printer attributes */ | |
a29fd7dd MS |
211 | int num_defaults; /* Number of default options */ |
212 | cups_option_t *defaults; /* Default options */ | |
dcb445bc | 213 | cups_array_t *constraints; /* Job constraints */ |
a29fd7dd | 214 | cups_array_t *resolvers; /* Job resolvers */ |
dcb445bc MS |
215 | cups_array_t *localizations; /* Localization information */ |
216 | cups_array_t *media_db; /* Media database */ | |
217 | _cups_media_db_t min_size, /* Minimum size */ | |
218 | max_size; /* Maximum size */ | |
219 | }; | |
220 | ||
ef416fc2 | 221 | |
222 | /* | |
223 | * Prototypes... | |
224 | */ | |
225 | ||
c8fef167 MS |
226 | # ifdef __APPLE__ |
227 | extern CFStringRef _cupsAppleCopyDefaultPaperID(void); | |
f14324a7 | 228 | extern CFStringRef _cupsAppleCopyDefaultPrinter(void); |
c8fef167 MS |
229 | extern int _cupsAppleGetUseLastPrinter(void); |
230 | extern void _cupsAppleSetDefaultPaperID(CFStringRef name); | |
f14324a7 | 231 | extern void _cupsAppleSetDefaultPrinter(CFStringRef name); |
c8fef167 MS |
232 | extern void _cupsAppleSetUseLastPrinter(int uselast); |
233 | # endif /* __APPLE__ */ | |
234 | ||
dcb445bc MS |
235 | extern char *_cupsBufferGet(size_t size); |
236 | extern void _cupsBufferRelease(char *b); | |
237 | ||
3d052e43 | 238 | extern http_t *_cupsConnect(void); |
f8b3a85b MS |
239 | extern int _cupsGet1284Values(const char *device_id, |
240 | cups_option_t **values); | |
dcb445bc MS |
241 | extern const char *_cupsGetDestResource(cups_dest_t *dest, char *resource, |
242 | size_t resourcesize); | |
c8fef167 | 243 | extern int _cupsGetDests(http_t *http, ipp_op_t op, |
dcb445bc MS |
244 | const char *name, cups_dest_t **dests, |
245 | cups_ptype_t type, cups_ptype_t mask); | |
ef416fc2 | 246 | extern const char *_cupsGetPassword(const char *prompt); |
6d2f911b | 247 | extern void _cupsGlobalLock(void); |
ef416fc2 | 248 | extern _cups_globals_t *_cupsGlobals(void); |
6d2f911b | 249 | extern void _cupsGlobalUnlock(void); |
eac3a0a0 MS |
250 | # ifdef HAVE_GSSAPI |
251 | extern const char *_cupsGSSServiceName(void); | |
252 | # endif /* HAVE_GSSAPI */ | |
f14324a7 | 253 | extern int _cupsNextDelay(int current, int *previous); |
e07d4801 | 254 | extern void _cupsSetDefaults(void); |
749b1e90 MS |
255 | extern void _cupsSetError(ipp_status_t status, const char *message, |
256 | int localize); | |
355e94dc | 257 | extern void _cupsSetHTTPError(http_status_t status); |
f14324a7 | 258 | # ifdef HAVE_GSSAPI |
eac3a0a0 MS |
259 | extern int _cupsSetNegotiateAuthString(http_t *http, |
260 | const char *method, | |
261 | const char *resource); | |
f14324a7 | 262 | # endif /* HAVE_GSSAPI */ |
38e73f87 | 263 | extern char *_cupsUserDefault(char *name, size_t namesize); |
ef416fc2 | 264 | |
265 | ||
266 | /* | |
267 | * C++ magic... | |
268 | */ | |
269 | ||
270 | # ifdef __cplusplus | |
271 | } | |
272 | # endif /* __cplusplus */ | |
71e16022 | 273 | #endif /* !_CUPS_CUPS_PRIVATE_H_ */ |
ef416fc2 | 274 | |
275 | /* | |
f14324a7 | 276 | * End of "$Id: cups-private.h 9596 2011-03-11 18:26:36Z mike $". |
ef416fc2 | 277 | */ |