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