]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/cups-private.h
Update visibility stuff so we can build libcups.2.dylib without an exports list.
[thirdparty/cups.git] / cups / cups-private.h
CommitLineData
ef416fc2 1/*
503b54c9 2 * Private definitions for CUPS.
ef416fc2 3 *
b969d5af
MS
4 * Copyright © 2007-2018 by Apple Inc.
5 * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
ef416fc2 6 *
b969d5af
MS
7 * Licensed under Apache License v2.0. See the file "LICENSE" for more
8 * information.
ef416fc2 9 */
10
71e16022
MS
11#ifndef _CUPS_CUPS_PRIVATE_H_
12# define _CUPS_CUPS_PRIVATE_H_
ef416fc2 13
14/*
15 * Include necessary headers...
16 */
17
71e16022
MS
18# include "string-private.h"
19# include "debug-private.h"
5a9febac 20# include "array-private.h"
71e16022 21# include "ipp-private.h"
82cc1f9a 22# include "http-private.h"
71e16022 23# include "language-private.h"
54afec33 24# include "pwg-private.h"
6d2f911b 25# include "thread-private.h"
82cc1f9a 26# include <cups/cups.h>
c8fef167
MS
27# ifdef __APPLE__
28# include <sys/cdefs.h>
29# include <CoreFoundation/CoreFoundation.h>
30# endif /* __APPLE__ */
ef416fc2 31
32
33/*
34 * C++ magic...
35 */
36
37# ifdef __cplusplus
38extern "C" {
39# endif /* __cplusplus */
40
41
42/*
71e16022 43 * Types...
ef416fc2 44 */
45
dcb445bc
MS
46typedef 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
ef416fc2 54typedef 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
757d2cad 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
07ed0e9a
MS
72 /* auth.c */
73# ifdef HAVE_GSSAPI
74 char gss_service_name[32];
75 /* Kerberos service name */
76# endif /* HAVE_GSSAPI */
77
5eb9da71
MS
78 /* backend.c */
79 char resolved_uri[1024];
80 /* Buffer for cupsBackendDeviceURI */
81
a469f8a5
MS
82 /* debug.c */
83# ifdef DEBUG
84 int thread_id; /* Friendly thread ID */
85# endif /* DEBUG */
86
80ca4592 87 /* file.c */
88 cups_file_t *stdio_files[3];/* stdin, stdout, stderr */
89
ef416fc2 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 */
49d87452 100 int need_res_init; /* Need to reinitialize resolver? */
ef416fc2 101
102 /* ipp.c */
65bebeac 103 ipp_uchar_t ipp_date[11]; /* RFC-2579 date/time data */
dcb445bc 104 _cups_buffer_t *cups_buffers; /* Buffer list */
ef416fc2 105
106 /* ipp-support.c */
107 int ipp_port; /* IPP port number */
108 char ipp_unknown[255];
109 /* Unknown error statuses */
110
ef416fc2 111 /* language.c */
fa73b229 112 cups_lang_t *lang_default; /* Default language */
ef416fc2 113# ifdef __APPLE__
ef416fc2 114 char language[32]; /* Cached language */
ef416fc2 115# endif /* __APPLE__ */
116
54afec33
MS
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 */
6961465f 121 pwg_media_t pwg_media; /* PWG media data for custom size */
23862bc6
MS
122 char pwg_name[65], /* PWG media name for custom size */
123 ppd_name[41]; /* PPD media name for custom size */
c168a833 124
5180a04c
MS
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
91c84a35 131 /* snmp.c */
ac884b6a
MS
132 char snmp_community[255];
133 /* Default SNMP community name */
91c84a35
MS
134 int snmp_debug; /* Log SNMP IO to stderr? */
135
ef416fc2 136 /* tempfile.c */
137 char tempfile[1024]; /* cupsTempFd/File buffer */
138
ef416fc2 139 /* usersys.c */
140 http_encryption_t encryption; /* Encryption setting */
141 char user[65], /* User name */
db8b865d 142 user_agent[256],/* User-Agent string */
ef416fc2 143 server[256], /* Server address */
dcb445bc
MS
144 servername[256],/* Server hostname */
145 password[128]; /* Password for default callback */
f11a948a
MS
146 cups_password_cb2_t password_cb; /* Password callback */
147 void *password_data; /* Password user data */
7cf5915e
MS
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 */
0cb67df3 156 int server_version, /* Server IPP version */
08d56b1f 157 trust_first, /* Trust on first use? */
9653cfdf 158 any_root, /* Allow any (e.g., self-signed) root */
f51f3773
MS
159 expired_certs, /* Allow expired certs */
160 validate_certs; /* Validate certificates */
ef416fc2 161
162 /* util.c */
ef416fc2 163 char def_printer[256];
164 /* Default printer */
ef416fc2 165} _cups_globals_t;
166
dcb445bc
MS
167typedef 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
a29fd7dd
MS
188typedef 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
dcb445bc
MS
194struct _cups_dinfo_s /* Destination capability and status
195 * information */
196{
6961465f 197 int version; /* IPP version */
dcb445bc
MS
198 const char *uri; /* Printer URI */
199 char *resource; /* Resource path */
200 ipp_t *attrs; /* Printer attributes */
a29fd7dd
MS
201 int num_defaults; /* Number of default options */
202 cups_option_t *defaults; /* Default options */
dcb445bc 203 cups_array_t *constraints; /* Job constraints */
a29fd7dd 204 cups_array_t *resolvers; /* Job resolvers */
dcb445bc
MS
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 */
6961465f
MS
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 */
dcb445bc
MS
214};
215
ef416fc2 216
217/*
218 * Prototypes...
219 */
220
c8fef167 221# ifdef __APPLE__
e3586875
MS
222extern CFStringRef _cupsAppleCopyDefaultPaperID(void) _CUPS_PRIVATE;
223extern CFStringRef _cupsAppleCopyDefaultPrinter(void) _CUPS_PRIVATE;
224extern int _cupsAppleGetUseLastPrinter(void) _CUPS_PRIVATE;
225extern void _cupsAppleSetDefaultPaperID(CFStringRef name) _CUPS_PRIVATE;
226extern void _cupsAppleSetDefaultPrinter(CFStringRef name) _CUPS_PRIVATE;
227extern void _cupsAppleSetUseLastPrinter(int uselast) _CUPS_PRIVATE;
c8fef167
MS
228# endif /* __APPLE__ */
229
e3586875
MS
230extern char *_cupsBufferGet(size_t size) _CUPS_PRIVATE;
231extern void _cupsBufferRelease(char *b) _CUPS_PRIVATE;
232
233extern http_t *_cupsConnect(void) _CUPS_PRIVATE;
234extern char *_cupsCreateDest(const char *name, const char *info, const char *device_id, const char *device_uri, char *uri, size_t urisize) _CUPS_PRIVATE;
235extern ipp_attribute_t *_cupsEncodeOption(ipp_t *ipp, ipp_tag_t group_tag, _ipp_option_t *map, const char *name, const char *value) _CUPS_PRIVATE;
236extern int _cupsGet1284Values(const char *device_id, cups_option_t **values) _CUPS_PRIVATE;
237extern const char *_cupsGetDestResource(cups_dest_t *dest, unsigned flags, char *resource, size_t resourcesize) _CUPS_PRIVATE;
238extern 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;
239extern const char *_cupsGetPassword(const char *prompt) _CUPS_PRIVATE;
240extern void _cupsGlobalLock(void) _CUPS_PRIVATE;
241extern _cups_globals_t *_cupsGlobals(void) _CUPS_PRIVATE;
242extern void _cupsGlobalUnlock(void) _CUPS_PRIVATE;
eac3a0a0 243# ifdef HAVE_GSSAPI
e3586875 244extern const char *_cupsGSSServiceName(void) _CUPS_PRIVATE;
eac3a0a0 245# endif /* HAVE_GSSAPI */
e3586875
MS
246extern int _cupsNextDelay(int current, int *previous) _CUPS_PRIVATE;
247extern void _cupsSetDefaults(void) _CUPS_PRIVATE;
248extern void _cupsSetError(ipp_status_t status, const char *message, int localize) _CUPS_PRIVATE;
249extern void _cupsSetHTTPError(http_status_t status) _CUPS_PRIVATE;
f14324a7 250# ifdef HAVE_GSSAPI
e3586875 251extern int _cupsSetNegotiateAuthString(http_t *http, const char *method, const char *resource) _CUPS_PRIVATE;
f14324a7 252# endif /* HAVE_GSSAPI */
e3586875 253extern char *_cupsUserDefault(char *name, size_t namesize) _CUPS_PRIVATE;
ef416fc2 254
255
256/*
257 * C++ magic...
258 */
259
260# ifdef __cplusplus
261}
262# endif /* __cplusplus */
71e16022 263#endif /* !_CUPS_CUPS_PRIVATE_H_ */