]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Private definitions for CUPS. | |
3 | * | |
4 | * Copyright 2007-2017 by Apple Inc. | |
5 | * Copyright 1997-2007 by Easy Software Products, all rights reserved. | |
6 | * | |
7 | * Licensed under Apache License v2.0. See the file "LICENSE" for more information. | |
8 | */ | |
9 | ||
10 | #ifndef _CUPS_CUPS_PRIVATE_H_ | |
11 | # define _CUPS_CUPS_PRIVATE_H_ | |
12 | ||
13 | /* | |
14 | * Include necessary headers... | |
15 | */ | |
16 | ||
17 | # include "string-private.h" | |
18 | # include "debug-private.h" | |
19 | # include "array-private.h" | |
20 | # include "ipp-private.h" | |
21 | # include "http-private.h" | |
22 | # include "language-private.h" | |
23 | # include "pwg-private.h" | |
24 | # include "thread-private.h" | |
25 | # include <cups/cups.h> | |
26 | # ifdef __APPLE__ | |
27 | # include <sys/cdefs.h> | |
28 | # include <CoreFoundation/CoreFoundation.h> | |
29 | # endif /* __APPLE__ */ | |
30 | ||
31 | ||
32 | /* | |
33 | * C++ magic... | |
34 | */ | |
35 | ||
36 | # ifdef __cplusplus | |
37 | extern "C" { | |
38 | # endif /* __cplusplus */ | |
39 | ||
40 | ||
41 | /* | |
42 | * Types... | |
43 | */ | |
44 | ||
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 | ||
53 | typedef struct _cups_globals_s /**** CUPS global state data ****/ | |
54 | { | |
55 | /* Multiple places... */ | |
56 | const char *cups_datadir, /* CUPS_DATADIR environment var */ | |
57 | *cups_serverbin,/* CUPS_SERVERBIN environment var */ | |
58 | *cups_serverroot, | |
59 | /* CUPS_SERVERROOT environment var */ | |
60 | *cups_statedir, /* CUPS_STATEDIR environment var */ | |
61 | *localedir; /* LOCALDIR environment var */ | |
62 | ||
63 | /* adminutil.c */ | |
64 | time_t cupsd_update; /* Last time we got or set cupsd.conf */ | |
65 | char cupsd_hostname[HTTP_MAX_HOST]; | |
66 | /* Hostname for connection */ | |
67 | int cupsd_num_settings; | |
68 | /* Number of server settings */ | |
69 | cups_option_t *cupsd_settings;/* Server settings */ | |
70 | ||
71 | /* auth.c */ | |
72 | # ifdef HAVE_GSSAPI | |
73 | char gss_service_name[32]; | |
74 | /* Kerberos service name */ | |
75 | # endif /* HAVE_GSSAPI */ | |
76 | ||
77 | /* backend.c */ | |
78 | char resolved_uri[1024]; | |
79 | /* Buffer for cupsBackendDeviceURI */ | |
80 | ||
81 | /* debug.c */ | |
82 | # ifdef DEBUG | |
83 | int thread_id; /* Friendly thread ID */ | |
84 | # endif /* DEBUG */ | |
85 | ||
86 | /* file.c */ | |
87 | cups_file_t *stdio_files[3];/* stdin, stdout, stderr */ | |
88 | ||
89 | /* http.c */ | |
90 | char http_date[256]; /* Date+time buffer */ | |
91 | ||
92 | /* http-addr.c */ | |
93 | unsigned ip_addr; /* Packed IPv4 address */ | |
94 | char *ip_ptrs[2]; /* Pointer to packed address */ | |
95 | struct hostent hostent; /* Host entry for IP address */ | |
96 | # ifdef HAVE_GETADDRINFO | |
97 | char hostname[1024]; /* Hostname */ | |
98 | # endif /* HAVE_GETADDRINFO */ | |
99 | int need_res_init; /* Need to reinitialize resolver? */ | |
100 | ||
101 | /* ipp.c */ | |
102 | ipp_uchar_t ipp_date[11]; /* RFC-2579 date/time data */ | |
103 | _cups_buffer_t *cups_buffers; /* Buffer list */ | |
104 | ||
105 | /* ipp-support.c */ | |
106 | int ipp_port; /* IPP port number */ | |
107 | char ipp_unknown[255]; | |
108 | /* Unknown error statuses */ | |
109 | ||
110 | /* language.c */ | |
111 | cups_lang_t *lang_default; /* Default language */ | |
112 | # ifdef __APPLE__ | |
113 | char language[32]; /* Cached language */ | |
114 | # endif /* __APPLE__ */ | |
115 | ||
116 | /* pwg-media.c */ | |
117 | cups_array_t *leg_size_lut, /* Lookup table for legacy names */ | |
118 | *ppd_size_lut, /* Lookup table for PPD names */ | |
119 | *pwg_size_lut; /* Lookup table for PWG names */ | |
120 | pwg_media_t pwg_media; /* PWG media data for custom size */ | |
121 | char pwg_name[65], /* PWG media name for custom size */ | |
122 | ppd_name[41]; /* PPD media name for custom size */ | |
123 | ||
124 | /* request.c */ | |
125 | http_t *http; /* Current server connection */ | |
126 | ipp_status_t last_error; /* Last IPP error */ | |
127 | char *last_status_message; | |
128 | /* Last IPP status-message */ | |
129 | ||
130 | /* snmp.c */ | |
131 | char snmp_community[255]; | |
132 | /* Default SNMP community name */ | |
133 | int snmp_debug; /* Log SNMP IO to stderr? */ | |
134 | ||
135 | /* tempfile.c */ | |
136 | char tempfile[1024]; /* cupsTempFd/File buffer */ | |
137 | ||
138 | /* usersys.c */ | |
139 | http_encryption_t encryption; /* Encryption setting */ | |
140 | char user[65], /* User name */ | |
141 | user_agent[256],/* User-Agent string */ | |
142 | server[256], /* Server address */ | |
143 | servername[256],/* Server hostname */ | |
144 | password[128]; /* Password for default callback */ | |
145 | cups_password_cb2_t password_cb; /* Password callback */ | |
146 | void *password_data; /* Password user data */ | |
147 | http_tls_credentials_t tls_credentials; | |
148 | /* Default client credentials */ | |
149 | cups_client_cert_cb_t client_cert_cb; /* Client certificate callback */ | |
150 | void *client_cert_data; | |
151 | /* Client certificate user data */ | |
152 | cups_server_cert_cb_t server_cert_cb; /* Server certificate callback */ | |
153 | void *server_cert_data; | |
154 | /* Server certificate user data */ | |
155 | int server_version, /* Server IPP version */ | |
156 | trust_first, /* Trust on first use? */ | |
157 | any_root, /* Allow any (e.g., self-signed) root */ | |
158 | expired_certs, /* Allow expired certs */ | |
159 | validate_certs; /* Validate certificates */ | |
160 | ||
161 | /* util.c */ | |
162 | char def_printer[256]; | |
163 | /* Default printer */ | |
164 | } _cups_globals_t; | |
165 | ||
166 | typedef struct _cups_media_db_s /* Media database */ | |
167 | { | |
168 | char *color, /* Media color, if any */ | |
169 | *key, /* Media key, if any */ | |
170 | *info, /* Media human-readable name, if any */ | |
171 | *size_name, /* Media PWG size name, if provided */ | |
172 | *source, /* Media source, if any */ | |
173 | *type; /* Media type, if any */ | |
174 | int width, /* Width in hundredths of millimeters */ | |
175 | length, /* Length in hundredths of | |
176 | * millimeters */ | |
177 | bottom, /* Bottom margin in hundredths of | |
178 | * millimeters */ | |
179 | left, /* Left margin in hundredths of | |
180 | * millimeters */ | |
181 | right, /* Right margin in hundredths of | |
182 | * millimeters */ | |
183 | top; /* Top margin in hundredths of | |
184 | * millimeters */ | |
185 | } _cups_media_db_t; | |
186 | ||
187 | typedef struct _cups_dconstres_s /* Constraint/resolver */ | |
188 | { | |
189 | char *name; /* Name of resolver */ | |
190 | ipp_t *collection; /* Collection containing attrs */ | |
191 | } _cups_dconstres_t; | |
192 | ||
193 | struct _cups_dinfo_s /* Destination capability and status | |
194 | * information */ | |
195 | { | |
196 | int version; /* IPP version */ | |
197 | const char *uri; /* Printer URI */ | |
198 | char *resource; /* Resource path */ | |
199 | ipp_t *attrs; /* Printer attributes */ | |
200 | int num_defaults; /* Number of default options */ | |
201 | cups_option_t *defaults; /* Default options */ | |
202 | cups_array_t *constraints; /* Job constraints */ | |
203 | cups_array_t *resolvers; /* Job resolvers */ | |
204 | cups_array_t *localizations; /* Localization information */ | |
205 | cups_array_t *media_db; /* Media database */ | |
206 | _cups_media_db_t min_size, /* Minimum size */ | |
207 | max_size; /* Maximum size */ | |
208 | unsigned cached_flags; /* Flags used for cached media */ | |
209 | cups_array_t *cached_db; /* Cache of media from last index/default */ | |
210 | time_t ready_time; /* When xxx-ready attributes were last queried */ | |
211 | ipp_t *ready_attrs; /* xxx-ready attributes */ | |
212 | cups_array_t *ready_db; /* media[-col]-ready media database */ | |
213 | }; | |
214 | ||
215 | ||
216 | /* | |
217 | * Prototypes... | |
218 | */ | |
219 | ||
220 | # ifdef __APPLE__ | |
221 | extern CFStringRef _cupsAppleCopyDefaultPaperID(void); | |
222 | extern CFStringRef _cupsAppleCopyDefaultPrinter(void); | |
223 | extern int _cupsAppleGetUseLastPrinter(void); | |
224 | extern void _cupsAppleSetDefaultPaperID(CFStringRef name); | |
225 | extern void _cupsAppleSetDefaultPrinter(CFStringRef name); | |
226 | extern void _cupsAppleSetUseLastPrinter(int uselast); | |
227 | # endif /* __APPLE__ */ | |
228 | ||
229 | extern char *_cupsBufferGet(size_t size); | |
230 | extern void _cupsBufferRelease(char *b); | |
231 | ||
232 | extern http_t *_cupsConnect(void); | |
233 | extern char *_cupsCreateDest(const char *name, const char *info, const char *device_id, const char *device_uri, char *uri, size_t urisize); | |
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_ */ |