]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
503b54c9 | 2 | * Private definitions for CUPS. |
ef416fc2 | 3 | * |
503b54c9 MS |
4 | * Copyright 2007-2015 by Apple Inc. |
5 | * Copyright 1997-2007 by Easy Software Products, all rights reserved. | |
ef416fc2 | 6 | * |
503b54c9 MS |
7 | * These coded instructions, statements, and computer programs are the |
8 | * property of Apple Inc. and are protected by Federal copyright | |
9 | * law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
10 | * which should have been included with this file. If this file is | |
57b7b66b | 11 | * missing or damaged, see the license at "http://www.cups.org/". |
ef416fc2 | 12 | * |
503b54c9 | 13 | * This file is subject to the Apple OS-Developed Software exception. |
ef416fc2 | 14 | */ |
15 | ||
71e16022 MS |
16 | #ifndef _CUPS_CUPS_PRIVATE_H_ |
17 | # define _CUPS_CUPS_PRIVATE_H_ | |
ef416fc2 | 18 | |
19 | /* | |
20 | * Include necessary headers... | |
21 | */ | |
22 | ||
71e16022 MS |
23 | # include "string-private.h" |
24 | # include "debug-private.h" | |
5a9febac | 25 | # include "array-private.h" |
71e16022 | 26 | # include "ipp-private.h" |
82cc1f9a | 27 | # include "http-private.h" |
71e16022 | 28 | # include "language-private.h" |
54afec33 | 29 | # include "pwg-private.h" |
6d2f911b | 30 | # include "thread-private.h" |
82cc1f9a | 31 | # include <cups/cups.h> |
c8fef167 MS |
32 | # ifdef __APPLE__ |
33 | # include <sys/cdefs.h> | |
34 | # include <CoreFoundation/CoreFoundation.h> | |
35 | # endif /* __APPLE__ */ | |
ef416fc2 | 36 | |
37 | ||
38 | /* | |
39 | * C++ magic... | |
40 | */ | |
41 | ||
42 | # ifdef __cplusplus | |
43 | extern "C" { | |
44 | # endif /* __cplusplus */ | |
45 | ||
46 | ||
47 | /* | |
71e16022 | 48 | * Types... |
ef416fc2 | 49 | */ |
50 | ||
dcb445bc MS |
51 | typedef struct _cups_buffer_s /**** Read/write buffer ****/ |
52 | { | |
53 | struct _cups_buffer_s *next; /* Next buffer in list */ | |
54 | size_t size; /* Size of buffer */ | |
55 | char used, /* Is this buffer used? */ | |
56 | d[1]; /* Data buffer */ | |
57 | } _cups_buffer_t; | |
58 | ||
ef416fc2 | 59 | typedef struct _cups_globals_s /**** CUPS global state data ****/ |
60 | { | |
61 | /* Multiple places... */ | |
62 | const char *cups_datadir, /* CUPS_DATADIR environment var */ | |
63 | *cups_serverbin,/* CUPS_SERVERBIN environment var */ | |
64 | *cups_serverroot, | |
65 | /* CUPS_SERVERROOT environment var */ | |
66 | *cups_statedir, /* CUPS_STATEDIR environment var */ | |
67 | *localedir; /* LOCALDIR environment var */ | |
68 | ||
757d2cad | 69 | /* adminutil.c */ |
70 | time_t cupsd_update; /* Last time we got or set cupsd.conf */ | |
71 | char cupsd_hostname[HTTP_MAX_HOST]; | |
72 | /* Hostname for connection */ | |
73 | int cupsd_num_settings; | |
74 | /* Number of server settings */ | |
75 | cups_option_t *cupsd_settings;/* Server settings */ | |
76 | ||
07ed0e9a MS |
77 | /* auth.c */ |
78 | # ifdef HAVE_GSSAPI | |
79 | char gss_service_name[32]; | |
80 | /* Kerberos service name */ | |
81 | # endif /* HAVE_GSSAPI */ | |
82 | ||
5eb9da71 MS |
83 | /* backend.c */ |
84 | char resolved_uri[1024]; | |
85 | /* Buffer for cupsBackendDeviceURI */ | |
86 | ||
a469f8a5 MS |
87 | /* debug.c */ |
88 | # ifdef DEBUG | |
89 | int thread_id; /* Friendly thread ID */ | |
90 | # endif /* DEBUG */ | |
91 | ||
80ca4592 | 92 | /* file.c */ |
93 | cups_file_t *stdio_files[3];/* stdin, stdout, stderr */ | |
94 | ||
ef416fc2 | 95 | /* http.c */ |
96 | char http_date[256]; /* Date+time buffer */ | |
97 | ||
98 | /* http-addr.c */ | |
99 | unsigned ip_addr; /* Packed IPv4 address */ | |
100 | char *ip_ptrs[2]; /* Pointer to packed address */ | |
101 | struct hostent hostent; /* Host entry for IP address */ | |
102 | # ifdef HAVE_GETADDRINFO | |
103 | char hostname[1024]; /* Hostname */ | |
104 | # endif /* HAVE_GETADDRINFO */ | |
49d87452 | 105 | int need_res_init; /* Need to reinitialize resolver? */ |
ef416fc2 | 106 | |
107 | /* ipp.c */ | |
108 | ipp_uchar_t ipp_date[11]; /* RFC-1903 date/time data */ | |
dcb445bc | 109 | _cups_buffer_t *cups_buffers; /* Buffer list */ |
ef416fc2 | 110 | |
111 | /* ipp-support.c */ | |
112 | int ipp_port; /* IPP port number */ | |
113 | char ipp_unknown[255]; | |
114 | /* Unknown error statuses */ | |
115 | ||
ef416fc2 | 116 | /* language.c */ |
fa73b229 | 117 | cups_lang_t *lang_default; /* Default language */ |
ef416fc2 | 118 | # ifdef __APPLE__ |
ef416fc2 | 119 | char language[32]; /* Cached language */ |
ef416fc2 | 120 | # endif /* __APPLE__ */ |
121 | ||
54afec33 MS |
122 | /* pwg-media.c */ |
123 | cups_array_t *leg_size_lut, /* Lookup table for legacy names */ | |
124 | *ppd_size_lut, /* Lookup table for PPD names */ | |
125 | *pwg_size_lut; /* Lookup table for PWG names */ | |
6961465f | 126 | pwg_media_t pwg_media; /* PWG media data for custom size */ |
23862bc6 MS |
127 | char pwg_name[65], /* PWG media name for custom size */ |
128 | ppd_name[41]; /* PPD media name for custom size */ | |
c168a833 | 129 | |
5180a04c MS |
130 | /* request.c */ |
131 | http_t *http; /* Current server connection */ | |
132 | ipp_status_t last_error; /* Last IPP error */ | |
133 | char *last_status_message; | |
134 | /* Last IPP status-message */ | |
135 | ||
91c84a35 | 136 | /* snmp.c */ |
ac884b6a MS |
137 | char snmp_community[255]; |
138 | /* Default SNMP community name */ | |
91c84a35 MS |
139 | int snmp_debug; /* Log SNMP IO to stderr? */ |
140 | ||
ef416fc2 | 141 | /* tempfile.c */ |
142 | char tempfile[1024]; /* cupsTempFd/File buffer */ | |
143 | ||
ef416fc2 | 144 | /* usersys.c */ |
145 | http_encryption_t encryption; /* Encryption setting */ | |
146 | char user[65], /* User name */ | |
db8b865d | 147 | user_agent[256],/* User-Agent string */ |
ef416fc2 | 148 | server[256], /* Server address */ |
dcb445bc MS |
149 | servername[256],/* Server hostname */ |
150 | password[128]; /* Password for default callback */ | |
f11a948a MS |
151 | cups_password_cb2_t password_cb; /* Password callback */ |
152 | void *password_data; /* Password user data */ | |
7cf5915e MS |
153 | http_tls_credentials_t tls_credentials; |
154 | /* Default client credentials */ | |
155 | cups_client_cert_cb_t client_cert_cb; /* Client certificate callback */ | |
156 | void *client_cert_data; | |
157 | /* Client certificate user data */ | |
158 | cups_server_cert_cb_t server_cert_cb; /* Server certificate callback */ | |
159 | void *server_cert_data; | |
160 | /* Server certificate user data */ | |
0cb67df3 | 161 | int server_version, /* Server IPP version */ |
08d56b1f | 162 | trust_first, /* Trust on first use? */ |
9653cfdf | 163 | any_root, /* Allow any (e.g., self-signed) root */ |
f51f3773 MS |
164 | expired_certs, /* Allow expired certs */ |
165 | validate_certs; /* Validate certificates */ | |
ef416fc2 | 166 | |
167 | /* util.c */ | |
ef416fc2 | 168 | char def_printer[256]; |
169 | /* Default printer */ | |
ef416fc2 | 170 | } _cups_globals_t; |
171 | ||
dcb445bc MS |
172 | typedef struct _cups_media_db_s /* Media database */ |
173 | { | |
174 | char *color, /* Media color, if any */ | |
175 | *key, /* Media key, if any */ | |
176 | *info, /* Media human-readable name, if any */ | |
177 | *size_name, /* Media PWG size name, if provided */ | |
178 | *source, /* Media source, if any */ | |
179 | *type; /* Media type, if any */ | |
180 | int width, /* Width in hundredths of millimeters */ | |
181 | length, /* Length in hundredths of | |
182 | * millimeters */ | |
183 | bottom, /* Bottom margin in hundredths of | |
184 | * millimeters */ | |
185 | left, /* Left margin in hundredths of | |
186 | * millimeters */ | |
187 | right, /* Right margin in hundredths of | |
188 | * millimeters */ | |
189 | top; /* Top margin in hundredths of | |
190 | * millimeters */ | |
191 | } _cups_media_db_t; | |
192 | ||
a29fd7dd MS |
193 | typedef struct _cups_dconstres_s /* Constraint/resolver */ |
194 | { | |
195 | char *name; /* Name of resolver */ | |
196 | ipp_t *collection; /* Collection containing attrs */ | |
197 | } _cups_dconstres_t; | |
198 | ||
dcb445bc MS |
199 | struct _cups_dinfo_s /* Destination capability and status |
200 | * information */ | |
201 | { | |
6961465f | 202 | int version; /* IPP version */ |
dcb445bc MS |
203 | const char *uri; /* Printer URI */ |
204 | char *resource; /* Resource path */ | |
205 | ipp_t *attrs; /* Printer attributes */ | |
a29fd7dd MS |
206 | int num_defaults; /* Number of default options */ |
207 | cups_option_t *defaults; /* Default options */ | |
dcb445bc | 208 | cups_array_t *constraints; /* Job constraints */ |
a29fd7dd | 209 | cups_array_t *resolvers; /* Job resolvers */ |
dcb445bc MS |
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 */ | |
6961465f MS |
214 | unsigned cached_flags; /* Flags used for cached media */ |
215 | cups_array_t *cached_db; /* Cache of media from last index/default */ | |
216 | time_t ready_time; /* When xxx-ready attributes were last queried */ | |
217 | ipp_t *ready_attrs; /* xxx-ready attributes */ | |
218 | cups_array_t *ready_db; /* media[-col]-ready media database */ | |
dcb445bc MS |
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); |
7ae00c35 | 239 | extern char *_cupsCreateDest(const char *name, const char *info, const char *device_id, const char *device_uri, char *uri, size_t urisize); |
f8b3a85b MS |
240 | extern int _cupsGet1284Values(const char *device_id, |
241 | cups_option_t **values); | |
dcb445bc MS |
242 | extern const char *_cupsGetDestResource(cups_dest_t *dest, char *resource, |
243 | size_t resourcesize); | |
c8fef167 | 244 | extern int _cupsGetDests(http_t *http, ipp_op_t op, |
dcb445bc MS |
245 | const char *name, cups_dest_t **dests, |
246 | cups_ptype_t type, cups_ptype_t mask); | |
ef416fc2 | 247 | extern const char *_cupsGetPassword(const char *prompt); |
6d2f911b | 248 | extern void _cupsGlobalLock(void); |
ef416fc2 | 249 | extern _cups_globals_t *_cupsGlobals(void); |
6d2f911b | 250 | extern void _cupsGlobalUnlock(void); |
eac3a0a0 MS |
251 | # ifdef HAVE_GSSAPI |
252 | extern const char *_cupsGSSServiceName(void); | |
253 | # endif /* HAVE_GSSAPI */ | |
f14324a7 | 254 | extern int _cupsNextDelay(int current, int *previous); |
e07d4801 | 255 | extern void _cupsSetDefaults(void); |
749b1e90 MS |
256 | extern void _cupsSetError(ipp_status_t status, const char *message, |
257 | int localize); | |
355e94dc | 258 | extern void _cupsSetHTTPError(http_status_t status); |
f14324a7 | 259 | # ifdef HAVE_GSSAPI |
eac3a0a0 MS |
260 | extern int _cupsSetNegotiateAuthString(http_t *http, |
261 | const char *method, | |
262 | const char *resource); | |
f14324a7 | 263 | # endif /* HAVE_GSSAPI */ |
38e73f87 | 264 | extern char *_cupsUserDefault(char *name, size_t namesize); |
ef416fc2 | 265 | |
266 | ||
267 | /* | |
268 | * C++ magic... | |
269 | */ | |
270 | ||
271 | # ifdef __cplusplus | |
272 | } | |
273 | # endif /* __cplusplus */ | |
71e16022 | 274 | #endif /* !_CUPS_CUPS_PRIVATE_H_ */ |