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