2 * "$Id: cups-private.h 13138 2016-03-15 14:59:54Z msweet $"
4 * Private definitions for CUPS.
6 * Copyright 2007-2015 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
9 * These coded instructions, statements, and computer programs are the
10 * property of Apple Inc. and are protected by Federal copyright
11 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 * which should have been included with this file. If this file is
13 * file is missing or damaged, see the license at "http://www.cups.org/".
15 * This file is subject to the Apple OS-Developed Software exception.
18 #ifndef _CUPS_CUPS_PRIVATE_H_
19 # define _CUPS_CUPS_PRIVATE_H_
22 * Include necessary headers...
25 # include "string-private.h"
26 # include "debug-private.h"
27 # include "array-private.h"
28 # include "ipp-private.h"
29 # include "http-private.h"
30 # include "language-private.h"
31 # include "pwg-private.h"
32 # include "thread-private.h"
33 # include <cups/cups.h>
35 # include <sys/cdefs.h>
36 # include <CoreFoundation/CoreFoundation.h>
37 # endif /* __APPLE__ */
46 # endif /* __cplusplus */
53 typedef struct _cups_buffer_s
/**** Read/write buffer ****/
55 struct _cups_buffer_s
*next
; /* Next buffer in list */
56 size_t size
; /* Size of buffer */
57 char used
, /* Is this buffer used? */
58 d
[1]; /* Data buffer */
61 typedef struct _cups_globals_s
/**** CUPS global state data ****/
63 /* Multiple places... */
64 const char *cups_datadir
, /* CUPS_DATADIR environment var */
65 *cups_serverbin
,/* CUPS_SERVERBIN environment var */
67 /* CUPS_SERVERROOT environment var */
68 *cups_statedir
, /* CUPS_STATEDIR environment var */
69 *localedir
; /* LOCALDIR environment var */
72 time_t cupsd_update
; /* Last time we got or set cupsd.conf */
73 char cupsd_hostname
[HTTP_MAX_HOST
];
74 /* Hostname for connection */
75 int cupsd_num_settings
;
76 /* Number of server settings */
77 cups_option_t
*cupsd_settings
;/* Server settings */
81 char gss_service_name
[32];
82 /* Kerberos service name */
83 # endif /* HAVE_GSSAPI */
86 char resolved_uri
[1024];
87 /* Buffer for cupsBackendDeviceURI */
91 int thread_id
; /* Friendly thread ID */
95 cups_file_t
*stdio_files
[3];/* stdin, stdout, stderr */
98 char http_date
[256]; /* Date+time buffer */
101 unsigned ip_addr
; /* Packed IPv4 address */
102 char *ip_ptrs
[2]; /* Pointer to packed address */
103 struct hostent hostent
; /* Host entry for IP address */
104 # ifdef HAVE_GETADDRINFO
105 char hostname
[1024]; /* Hostname */
106 # endif /* HAVE_GETADDRINFO */
107 int need_res_init
; /* Need to reinitialize resolver? */
110 ipp_uchar_t ipp_date
[11]; /* RFC-1903 date/time data */
111 _cups_buffer_t
*cups_buffers
; /* Buffer list */
114 int ipp_port
; /* IPP port number */
115 char ipp_unknown
[255];
116 /* Unknown error statuses */
119 cups_lang_t
*lang_default
; /* Default language */
121 char language
[32]; /* Cached language */
122 # endif /* __APPLE__ */
125 cups_array_t
*leg_size_lut
, /* Lookup table for legacy names */
126 *ppd_size_lut
, /* Lookup table for PPD names */
127 *pwg_size_lut
; /* Lookup table for PWG names */
128 pwg_media_t pwg_media
; /* PWG media data for custom size */
129 char pwg_name
[65]; /* PWG media name for custom size */
132 http_t
*http
; /* Current server connection */
133 ipp_status_t last_error
; /* Last IPP error */
134 char *last_status_message
;
135 /* Last IPP status-message */
138 char snmp_community
[255];
139 /* Default SNMP community name */
140 int snmp_debug
; /* Log SNMP IO to stderr? */
143 char tempfile
[1024]; /* cupsTempFd/File buffer */
146 http_encryption_t encryption
; /* Encryption setting */
147 char user
[65], /* User name */
148 user_agent
[256],/* User-Agent string */
149 server
[256], /* Server address */
150 servername
[256],/* Server hostname */
151 password
[128]; /* Password for default callback */
152 cups_password_cb2_t password_cb
; /* Password callback */
153 void *password_data
; /* Password user data */
154 http_tls_credentials_t tls_credentials
;
155 /* Default client credentials */
156 cups_client_cert_cb_t client_cert_cb
; /* Client certificate callback */
157 void *client_cert_data
;
158 /* Client certificate user data */
159 cups_server_cert_cb_t server_cert_cb
; /* Server certificate callback */
160 void *server_cert_data
;
161 /* Server certificate user data */
162 int server_version
, /* Server IPP version */
163 any_root
, /* Allow any (e.g., self-signed) root */
164 expired_certs
, /* Allow expired certs */
165 validate_certs
; /* Validate certificates */
168 char def_printer
[256];
169 /* Default printer */
172 typedef struct _cups_media_db_s
/* Media database */
174 char *color
, /* Media color, if any */
175 *key
, /* Media key, if any */
176 *info
, /* Media human-readable name, if any */
177 *size_name
, /* Media PWG size name, if provided */
178 *source
, /* Media source, if any */
179 *type
; /* Media type, if any */
180 int width
, /* Width in hundredths of millimeters */
181 length
, /* Length in hundredths of
183 bottom
, /* Bottom margin in hundredths of
185 left
, /* Left margin in hundredths of
187 right
, /* Right margin in hundredths of
189 top
; /* Top margin in hundredths of
193 typedef struct _cups_dconstres_s
/* Constraint/resolver */
195 char *name
; /* Name of resolver */
196 ipp_t
*collection
; /* Collection containing attrs */
199 struct _cups_dinfo_s
/* Destination capability and status
202 int version
; /* IPP version */
203 const char *uri
; /* Printer URI */
204 char *resource
; /* Resource path */
205 ipp_t
*attrs
; /* Printer attributes */
206 int num_defaults
; /* Number of default options */
207 cups_option_t
*defaults
; /* Default options */
208 cups_array_t
*constraints
; /* Job constraints */
209 cups_array_t
*resolvers
; /* Job resolvers */
210 cups_array_t
*localizations
; /* Localization information */
211 cups_array_t
*media_db
; /* Media database */
212 _cups_media_db_t min_size
, /* Minimum size */
213 max_size
; /* Maximum size */
214 unsigned cached_flags
; /* Flags used for cached media */
215 cups_array_t
*cached_db
; /* Cache of media from last index/default */
216 time_t ready_time
; /* When xxx-ready attributes were last queried */
217 ipp_t
*ready_attrs
; /* xxx-ready attributes */
218 cups_array_t
*ready_db
; /* media[-col]-ready media database */
227 extern CFStringRef
_cupsAppleCopyDefaultPaperID(void);
228 extern CFStringRef
_cupsAppleCopyDefaultPrinter(void);
229 extern int _cupsAppleGetUseLastPrinter(void);
230 extern void _cupsAppleSetDefaultPaperID(CFStringRef name
);
231 extern void _cupsAppleSetDefaultPrinter(CFStringRef name
);
232 extern void _cupsAppleSetUseLastPrinter(int uselast
);
233 # endif /* __APPLE__ */
235 extern char *_cupsBufferGet(size_t size
);
236 extern void _cupsBufferRelease(char *b
);
238 extern http_t
*_cupsConnect(void);
239 extern char *_cupsCreateDest(const char *name
, const char *info
, const char *device_id
, const char *device_uri
, char *uri
, size_t urisize
);
240 extern int _cupsGet1284Values(const char *device_id
,
241 cups_option_t
**values
);
242 extern const char *_cupsGetDestResource(cups_dest_t
*dest
, char *resource
,
243 size_t resourcesize
);
244 extern int _cupsGetDests(http_t
*http
, ipp_op_t op
,
245 const char *name
, cups_dest_t
**dests
,
246 cups_ptype_t type
, cups_ptype_t mask
);
247 extern const char *_cupsGetPassword(const char *prompt
);
248 extern void _cupsGlobalLock(void);
249 extern _cups_globals_t
*_cupsGlobals(void);
250 extern void _cupsGlobalUnlock(void);
252 extern const char *_cupsGSSServiceName(void);
253 # endif /* HAVE_GSSAPI */
254 extern int _cupsNextDelay(int current
, int *previous
);
255 extern void _cupsSetDefaults(void);
256 extern void _cupsSetError(ipp_status_t status
, const char *message
,
258 extern void _cupsSetHTTPError(http_status_t status
);
260 extern int _cupsSetNegotiateAuthString(http_t
*http
,
262 const char *resource
);
263 # endif /* HAVE_GSSAPI */
264 extern char *_cupsUserDefault(char *name
, size_t namesize
);
273 # endif /* __cplusplus */
274 #endif /* !_CUPS_CUPS_PRIVATE_H_ */
277 * End of "$Id: cups-private.h 13138 2016-03-15 14:59:54Z msweet $".