]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
503b54c9 | 2 | * Private definitions for CUPS. |
ef416fc2 | 3 | * |
59cd12c6 | 4 | * Copyright © 2007-2019 by Apple Inc. |
b969d5af | 5 | * Copyright © 1997-2007 by Easy Software Products, all rights reserved. |
ef416fc2 | 6 | * |
b969d5af MS |
7 | * Licensed under Apache License v2.0. See the file "LICENSE" for more |
8 | * information. | |
ef416fc2 | 9 | */ |
10 | ||
71e16022 MS |
11 | #ifndef _CUPS_CUPS_PRIVATE_H_ |
12 | # define _CUPS_CUPS_PRIVATE_H_ | |
ef416fc2 | 13 | |
14 | /* | |
15 | * Include necessary headers... | |
16 | */ | |
17 | ||
71e16022 | 18 | # include "string-private.h" |
5a9febac | 19 | # include "array-private.h" |
71e16022 | 20 | # include "ipp-private.h" |
82cc1f9a | 21 | # include "http-private.h" |
71e16022 | 22 | # include "language-private.h" |
54afec33 | 23 | # include "pwg-private.h" |
6d2f911b | 24 | # include "thread-private.h" |
82cc1f9a | 25 | # include <cups/cups.h> |
c8fef167 MS |
26 | # ifdef __APPLE__ |
27 | # include <sys/cdefs.h> | |
28 | # include <CoreFoundation/CoreFoundation.h> | |
29 | # endif /* __APPLE__ */ | |
ef416fc2 | 30 | |
31 | ||
32 | /* | |
33 | * C++ magic... | |
34 | */ | |
35 | ||
36 | # ifdef __cplusplus | |
37 | extern "C" { | |
38 | # endif /* __cplusplus */ | |
39 | ||
40 | ||
41 | /* | |
71e16022 | 42 | * Types... |
ef416fc2 | 43 | */ |
44 | ||
dcb445bc MS |
45 | typedef struct _cups_buffer_s /**** Read/write buffer ****/ |
46 | { | |
47 | struct _cups_buffer_s *next; /* Next buffer in list */ | |
48 | size_t size; /* Size of buffer */ | |
49 | char used, /* Is this buffer used? */ | |
50 | d[1]; /* Data buffer */ | |
51 | } _cups_buffer_t; | |
52 | ||
dd204f7a MS |
53 | typedef struct _cups_raster_error_s /**** Error buffer structure ****/ |
54 | { | |
55 | char *start, /* Start of buffer */ | |
56 | *current, /* Current position in buffer */ | |
57 | *end; /* End of buffer */ | |
58 | } _cups_raster_error_t; | |
59 | ||
ec8beb89 MS |
60 | typedef enum _cups_digestoptions_e /**** Digest Options values */ |
61 | { | |
62 | _CUPS_DIGESTOPTIONS_NONE, /* No Digest authentication options */ | |
63 | _CUPS_DIGESTOPTIONS_DENYMD5 /* Do not use MD5 hashes for digest */ | |
64 | } _cups_digestoptions_t; | |
65 | ||
59cd12c6 MS |
66 | typedef enum _cups_uatokens_e /**** UserAgentTokens values */ |
67 | { | |
68 | _CUPS_UATOKENS_NONE, /* Do not send User-Agent */ | |
69 | _CUPS_UATOKENS_PRODUCT_ONLY, /* CUPS IPP */ | |
70 | _CUPS_UATOKENS_MAJOR, /* CUPS/major IPP/2 */ | |
71 | _CUPS_UATOKENS_MINOR, /* CUPS/major.minor IPP/2.1 */ | |
72 | _CUPS_UATOKENS_MINIMAL, /* CUPS/major.minor.patch IPP/2.1 */ | |
73 | _CUPS_UATOKENS_OS, /* CUPS/major.minor.patch (osname osversion) IPP/2.1 */ | |
74 | _CUPS_UATOKENS_FULL /* CUPS/major.minor.patch (osname osversion; architecture) IPP/2.1 */ | |
75 | } _cups_uatokens_t; | |
76 | ||
ef416fc2 | 77 | typedef struct _cups_globals_s /**** CUPS global state data ****/ |
78 | { | |
79 | /* Multiple places... */ | |
80 | const char *cups_datadir, /* CUPS_DATADIR environment var */ | |
81 | *cups_serverbin,/* CUPS_SERVERBIN environment var */ | |
82 | *cups_serverroot, | |
83 | /* CUPS_SERVERROOT environment var */ | |
84 | *cups_statedir, /* CUPS_STATEDIR environment var */ | |
85 | *localedir; /* LOCALDIR environment var */ | |
86 | ||
757d2cad | 87 | /* adminutil.c */ |
88 | time_t cupsd_update; /* Last time we got or set cupsd.conf */ | |
89 | char cupsd_hostname[HTTP_MAX_HOST]; | |
90 | /* Hostname for connection */ | |
91 | int cupsd_num_settings; | |
92 | /* Number of server settings */ | |
93 | cups_option_t *cupsd_settings;/* Server settings */ | |
94 | ||
07ed0e9a MS |
95 | /* auth.c */ |
96 | # ifdef HAVE_GSSAPI | |
97 | char gss_service_name[32]; | |
98 | /* Kerberos service name */ | |
99 | # endif /* HAVE_GSSAPI */ | |
100 | ||
5eb9da71 MS |
101 | /* backend.c */ |
102 | char resolved_uri[1024]; | |
103 | /* Buffer for cupsBackendDeviceURI */ | |
104 | ||
a469f8a5 MS |
105 | /* debug.c */ |
106 | # ifdef DEBUG | |
107 | int thread_id; /* Friendly thread ID */ | |
108 | # endif /* DEBUG */ | |
109 | ||
80ca4592 | 110 | /* file.c */ |
111 | cups_file_t *stdio_files[3];/* stdin, stdout, stderr */ | |
112 | ||
ef416fc2 | 113 | /* http.c */ |
114 | char http_date[256]; /* Date+time buffer */ | |
115 | ||
116 | /* http-addr.c */ | |
117 | unsigned ip_addr; /* Packed IPv4 address */ | |
118 | char *ip_ptrs[2]; /* Pointer to packed address */ | |
119 | struct hostent hostent; /* Host entry for IP address */ | |
120 | # ifdef HAVE_GETADDRINFO | |
121 | char hostname[1024]; /* Hostname */ | |
122 | # endif /* HAVE_GETADDRINFO */ | |
49d87452 | 123 | int need_res_init; /* Need to reinitialize resolver? */ |
ef416fc2 | 124 | |
125 | /* ipp.c */ | |
65bebeac | 126 | ipp_uchar_t ipp_date[11]; /* RFC-2579 date/time data */ |
dcb445bc | 127 | _cups_buffer_t *cups_buffers; /* Buffer list */ |
ef416fc2 | 128 | |
129 | /* ipp-support.c */ | |
130 | int ipp_port; /* IPP port number */ | |
131 | char ipp_unknown[255]; | |
132 | /* Unknown error statuses */ | |
133 | ||
ef416fc2 | 134 | /* language.c */ |
fa73b229 | 135 | cups_lang_t *lang_default; /* Default language */ |
ef416fc2 | 136 | # ifdef __APPLE__ |
ef416fc2 | 137 | char language[32]; /* Cached language */ |
ef416fc2 | 138 | # endif /* __APPLE__ */ |
139 | ||
54afec33 MS |
140 | /* pwg-media.c */ |
141 | cups_array_t *leg_size_lut, /* Lookup table for legacy names */ | |
142 | *ppd_size_lut, /* Lookup table for PPD names */ | |
143 | *pwg_size_lut; /* Lookup table for PWG names */ | |
6961465f | 144 | pwg_media_t pwg_media; /* PWG media data for custom size */ |
23862bc6 MS |
145 | char pwg_name[65], /* PWG media name for custom size */ |
146 | ppd_name[41]; /* PPD media name for custom size */ | |
c168a833 | 147 | |
dd204f7a MS |
148 | /* raster-error.c */ |
149 | _cups_raster_error_t raster_error; /* Raster error information */ | |
150 | ||
5180a04c MS |
151 | /* request.c */ |
152 | http_t *http; /* Current server connection */ | |
153 | ipp_status_t last_error; /* Last IPP error */ | |
154 | char *last_status_message; | |
155 | /* Last IPP status-message */ | |
156 | ||
91c84a35 | 157 | /* snmp.c */ |
ac884b6a MS |
158 | char snmp_community[255]; |
159 | /* Default SNMP community name */ | |
91c84a35 MS |
160 | int snmp_debug; /* Log SNMP IO to stderr? */ |
161 | ||
ef416fc2 | 162 | /* tempfile.c */ |
163 | char tempfile[1024]; /* cupsTempFd/File buffer */ | |
164 | ||
ef416fc2 | 165 | /* usersys.c */ |
ec8beb89 | 166 | _cups_digestoptions_t digestoptions; /* DigestOptions setting */ |
59cd12c6 | 167 | _cups_uatokens_t uatokens; /* UserAgentTokens setting */ |
ef416fc2 | 168 | http_encryption_t encryption; /* Encryption setting */ |
169 | char user[65], /* User name */ | |
db8b865d | 170 | user_agent[256],/* User-Agent string */ |
ef416fc2 | 171 | server[256], /* Server address */ |
dcb445bc MS |
172 | servername[256],/* Server hostname */ |
173 | password[128]; /* Password for default callback */ | |
f11a948a MS |
174 | cups_password_cb2_t password_cb; /* Password callback */ |
175 | void *password_data; /* Password user data */ | |
7cf5915e MS |
176 | http_tls_credentials_t tls_credentials; |
177 | /* Default client credentials */ | |
178 | cups_client_cert_cb_t client_cert_cb; /* Client certificate callback */ | |
179 | void *client_cert_data; | |
180 | /* Client certificate user data */ | |
181 | cups_server_cert_cb_t server_cert_cb; /* Server certificate callback */ | |
182 | void *server_cert_data; | |
183 | /* Server certificate user data */ | |
0cb67df3 | 184 | int server_version, /* Server IPP version */ |
08d56b1f | 185 | trust_first, /* Trust on first use? */ |
9653cfdf | 186 | any_root, /* Allow any (e.g., self-signed) root */ |
f51f3773 MS |
187 | expired_certs, /* Allow expired certs */ |
188 | validate_certs; /* Validate certificates */ | |
ef416fc2 | 189 | |
190 | /* util.c */ | |
ef416fc2 | 191 | char def_printer[256]; |
192 | /* Default printer */ | |
ef416fc2 | 193 | } _cups_globals_t; |
194 | ||
dcb445bc MS |
195 | typedef struct _cups_media_db_s /* Media database */ |
196 | { | |
197 | char *color, /* Media color, if any */ | |
198 | *key, /* Media key, if any */ | |
199 | *info, /* Media human-readable name, if any */ | |
200 | *size_name, /* Media PWG size name, if provided */ | |
201 | *source, /* Media source, if any */ | |
202 | *type; /* Media type, if any */ | |
203 | int width, /* Width in hundredths of millimeters */ | |
204 | length, /* Length in hundredths of | |
205 | * millimeters */ | |
206 | bottom, /* Bottom margin in hundredths of | |
207 | * millimeters */ | |
208 | left, /* Left margin in hundredths of | |
209 | * millimeters */ | |
210 | right, /* Right margin in hundredths of | |
211 | * millimeters */ | |
212 | top; /* Top margin in hundredths of | |
213 | * millimeters */ | |
214 | } _cups_media_db_t; | |
215 | ||
a29fd7dd MS |
216 | typedef struct _cups_dconstres_s /* Constraint/resolver */ |
217 | { | |
218 | char *name; /* Name of resolver */ | |
219 | ipp_t *collection; /* Collection containing attrs */ | |
220 | } _cups_dconstres_t; | |
221 | ||
dcb445bc MS |
222 | struct _cups_dinfo_s /* Destination capability and status |
223 | * information */ | |
224 | { | |
6961465f | 225 | int version; /* IPP version */ |
dcb445bc MS |
226 | const char *uri; /* Printer URI */ |
227 | char *resource; /* Resource path */ | |
228 | ipp_t *attrs; /* Printer attributes */ | |
a29fd7dd MS |
229 | int num_defaults; /* Number of default options */ |
230 | cups_option_t *defaults; /* Default options */ | |
dcb445bc | 231 | cups_array_t *constraints; /* Job constraints */ |
a29fd7dd | 232 | cups_array_t *resolvers; /* Job resolvers */ |
dcb445bc MS |
233 | cups_array_t *localizations; /* Localization information */ |
234 | cups_array_t *media_db; /* Media database */ | |
235 | _cups_media_db_t min_size, /* Minimum size */ | |
236 | max_size; /* Maximum size */ | |
6961465f MS |
237 | unsigned cached_flags; /* Flags used for cached media */ |
238 | cups_array_t *cached_db; /* Cache of media from last index/default */ | |
239 | time_t ready_time; /* When xxx-ready attributes were last queried */ | |
240 | ipp_t *ready_attrs; /* xxx-ready attributes */ | |
241 | cups_array_t *ready_db; /* media[-col]-ready media database */ | |
dcb445bc MS |
242 | }; |
243 | ||
ef416fc2 | 244 | |
245 | /* | |
246 | * Prototypes... | |
247 | */ | |
248 | ||
c8fef167 | 249 | # ifdef __APPLE__ |
e3586875 MS |
250 | extern CFStringRef _cupsAppleCopyDefaultPaperID(void) _CUPS_PRIVATE; |
251 | extern CFStringRef _cupsAppleCopyDefaultPrinter(void) _CUPS_PRIVATE; | |
252 | extern int _cupsAppleGetUseLastPrinter(void) _CUPS_PRIVATE; | |
253 | extern void _cupsAppleSetDefaultPaperID(CFStringRef name) _CUPS_PRIVATE; | |
254 | extern void _cupsAppleSetDefaultPrinter(CFStringRef name) _CUPS_PRIVATE; | |
255 | extern void _cupsAppleSetUseLastPrinter(int uselast) _CUPS_PRIVATE; | |
c8fef167 MS |
256 | # endif /* __APPLE__ */ |
257 | ||
e3586875 MS |
258 | extern char *_cupsBufferGet(size_t size) _CUPS_PRIVATE; |
259 | extern void _cupsBufferRelease(char *b) _CUPS_PRIVATE; | |
260 | ||
fb863569 | 261 | extern http_t *_cupsConnect(void) _CUPS_PRIVATE; |
e3586875 MS |
262 | extern char *_cupsCreateDest(const char *name, const char *info, const char *device_id, const char *device_uri, char *uri, size_t urisize) _CUPS_PRIVATE; |
263 | extern ipp_attribute_t *_cupsEncodeOption(ipp_t *ipp, ipp_tag_t group_tag, _ipp_option_t *map, const char *name, const char *value) _CUPS_PRIVATE; | |
264 | extern int _cupsGet1284Values(const char *device_id, cups_option_t **values) _CUPS_PRIVATE; | |
265 | extern const char *_cupsGetDestResource(cups_dest_t *dest, unsigned flags, char *resource, size_t resourcesize) _CUPS_PRIVATE; | |
266 | extern int _cupsGetDests(http_t *http, ipp_op_t op, const char *name, cups_dest_t **dests, cups_ptype_t type, cups_ptype_t mask) _CUPS_PRIVATE; | |
267 | extern const char *_cupsGetPassword(const char *prompt) _CUPS_PRIVATE; | |
268 | extern void _cupsGlobalLock(void) _CUPS_PRIVATE; | |
269 | extern _cups_globals_t *_cupsGlobals(void) _CUPS_PRIVATE; | |
270 | extern void _cupsGlobalUnlock(void) _CUPS_PRIVATE; | |
eac3a0a0 | 271 | # ifdef HAVE_GSSAPI |
e3586875 | 272 | extern const char *_cupsGSSServiceName(void) _CUPS_PRIVATE; |
eac3a0a0 | 273 | # endif /* HAVE_GSSAPI */ |
e3586875 | 274 | extern int _cupsNextDelay(int current, int *previous) _CUPS_PRIVATE; |
11ea1663 | 275 | extern void _cupsSetDefaults(void) _CUPS_INTERNAL; |
e3586875 | 276 | extern void _cupsSetError(ipp_status_t status, const char *message, int localize) _CUPS_PRIVATE; |
11ea1663 | 277 | extern void _cupsSetHTTPError(http_status_t status) _CUPS_INTERNAL; |
f14324a7 | 278 | # ifdef HAVE_GSSAPI |
e3586875 | 279 | extern int _cupsSetNegotiateAuthString(http_t *http, const char *method, const char *resource) _CUPS_PRIVATE; |
f14324a7 | 280 | # endif /* HAVE_GSSAPI */ |
11ea1663 | 281 | extern char *_cupsUserDefault(char *name, size_t namesize) _CUPS_INTERNAL; |
ef416fc2 | 282 | |
283 | ||
284 | /* | |
285 | * C++ magic... | |
286 | */ | |
287 | ||
288 | # ifdef __cplusplus | |
289 | } | |
290 | # endif /* __cplusplus */ | |
71e16022 | 291 | #endif /* !_CUPS_CUPS_PRIVATE_H_ */ |