]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/cups-private.h
Add support for DigestOptions directive in client.conf (Issue #5647)
[thirdparty/cups.git] / cups / cups-private.h
1 /*
2 * Private definitions for CUPS.
3 *
4 * Copyright © 2007-2019 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
8 * information.
9 */
10
11 #ifndef _CUPS_CUPS_PRIVATE_H_
12 # define _CUPS_CUPS_PRIVATE_H_
13
14 /*
15 * Include necessary headers...
16 */
17
18 # include "string-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_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
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
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
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
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
95 /* auth.c */
96 # ifdef HAVE_GSSAPI
97 char gss_service_name[32];
98 /* Kerberos service name */
99 # endif /* HAVE_GSSAPI */
100
101 /* backend.c */
102 char resolved_uri[1024];
103 /* Buffer for cupsBackendDeviceURI */
104
105 /* debug.c */
106 # ifdef DEBUG
107 int thread_id; /* Friendly thread ID */
108 # endif /* DEBUG */
109
110 /* file.c */
111 cups_file_t *stdio_files[3];/* stdin, stdout, stderr */
112
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 */
123 int need_res_init; /* Need to reinitialize resolver? */
124
125 /* ipp.c */
126 ipp_uchar_t ipp_date[11]; /* RFC-2579 date/time data */
127 _cups_buffer_t *cups_buffers; /* Buffer list */
128
129 /* ipp-support.c */
130 int ipp_port; /* IPP port number */
131 char ipp_unknown[255];
132 /* Unknown error statuses */
133
134 /* language.c */
135 cups_lang_t *lang_default; /* Default language */
136 # ifdef __APPLE__
137 char language[32]; /* Cached language */
138 # endif /* __APPLE__ */
139
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 */
144 pwg_media_t pwg_media; /* PWG media data for custom size */
145 char pwg_name[65], /* PWG media name for custom size */
146 ppd_name[41]; /* PPD media name for custom size */
147
148 /* raster-error.c */
149 _cups_raster_error_t raster_error; /* Raster error information */
150
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
157 /* snmp.c */
158 char snmp_community[255];
159 /* Default SNMP community name */
160 int snmp_debug; /* Log SNMP IO to stderr? */
161
162 /* tempfile.c */
163 char tempfile[1024]; /* cupsTempFd/File buffer */
164
165 /* usersys.c */
166 _cups_digestoptions_t digestoptions; /* DigestOptions setting */
167 _cups_uatokens_t uatokens; /* UserAgentTokens setting */
168 http_encryption_t encryption; /* Encryption setting */
169 char user[65], /* User name */
170 user_agent[256],/* User-Agent string */
171 server[256], /* Server address */
172 servername[256],/* Server hostname */
173 password[128]; /* Password for default callback */
174 cups_password_cb2_t password_cb; /* Password callback */
175 void *password_data; /* Password user data */
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 */
184 int server_version, /* Server IPP version */
185 trust_first, /* Trust on first use? */
186 any_root, /* Allow any (e.g., self-signed) root */
187 expired_certs, /* Allow expired certs */
188 validate_certs; /* Validate certificates */
189
190 /* util.c */
191 char def_printer[256];
192 /* Default printer */
193 } _cups_globals_t;
194
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
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
222 struct _cups_dinfo_s /* Destination capability and status
223 * information */
224 {
225 int version; /* IPP version */
226 const char *uri; /* Printer URI */
227 char *resource; /* Resource path */
228 ipp_t *attrs; /* Printer attributes */
229 int num_defaults; /* Number of default options */
230 cups_option_t *defaults; /* Default options */
231 cups_array_t *constraints; /* Job constraints */
232 cups_array_t *resolvers; /* Job resolvers */
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 */
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 */
242 };
243
244
245 /*
246 * Prototypes...
247 */
248
249 # ifdef __APPLE__
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;
256 # endif /* __APPLE__ */
257
258 extern char *_cupsBufferGet(size_t size) _CUPS_PRIVATE;
259 extern void _cupsBufferRelease(char *b) _CUPS_PRIVATE;
260
261 extern http_t *_cupsConnect(void) _CUPS_PRIVATE;
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;
271 # ifdef HAVE_GSSAPI
272 extern const char *_cupsGSSServiceName(void) _CUPS_PRIVATE;
273 # endif /* HAVE_GSSAPI */
274 extern int _cupsNextDelay(int current, int *previous) _CUPS_PRIVATE;
275 extern void _cupsSetDefaults(void) _CUPS_INTERNAL;
276 extern void _cupsSetError(ipp_status_t status, const char *message, int localize) _CUPS_PRIVATE;
277 extern void _cupsSetHTTPError(http_status_t status) _CUPS_INTERNAL;
278 # ifdef HAVE_GSSAPI
279 extern int _cupsSetNegotiateAuthString(http_t *http, const char *method, const char *resource) _CUPS_PRIVATE;
280 # endif /* HAVE_GSSAPI */
281 extern char *_cupsUserDefault(char *name, size_t namesize) _CUPS_INTERNAL;
282
283
284 /*
285 * C++ magic...
286 */
287
288 # ifdef __cplusplus
289 }
290 # endif /* __cplusplus */
291 #endif /* !_CUPS_CUPS_PRIVATE_H_ */