]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/cups-private.h
Implemented ready media support for the cupsGetDestMediaXxx APIs (STR #4289)
[thirdparty/cups.git] / cups / cups-private.h
CommitLineData
03f61bf3 1/*
2 * "$Id$"
3 *
3d94661a 4 * Private definitions for CUPS.
03f61bf3 5 *
821fdb51 6 * Copyright 2007-2013 by Apple Inc.
753db4fd 7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
03f61bf3 8 *
9 * These coded instructions, statements, and computer programs are the
4e8d321f 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/".
03f61bf3 14 *
15 * This file is subject to the Apple OS-Developed Software exception.
16 */
17
3d94661a 18#ifndef _CUPS_CUPS_PRIVATE_H_
19# define _CUPS_CUPS_PRIVATE_H_
03f61bf3 20
21/*
22 * Include necessary headers...
23 */
24
3d94661a 25# include "string-private.h"
26# include "debug-private.h"
480e077e 27# include "array-private.h"
3d94661a 28# include "ipp-private.h"
6b1c0b1c 29# include "http-private.h"
3d94661a 30# include "language-private.h"
64dd1836 31# include "pwg-private.h"
6b1c0b1c 32# include "ppd-private.h"
fa7e8544 33# include "thread-private.h"
6b1c0b1c 34# include <cups/cups.h>
181f5167 35# ifdef __APPLE__
36# include <sys/cdefs.h>
37# include <CoreFoundation/CoreFoundation.h>
38# endif /* __APPLE__ */
03f61bf3 39
40
41/*
42 * C++ magic...
43 */
44
45# ifdef __cplusplus
46extern "C" {
47# endif /* __cplusplus */
48
49
03f61bf3 50/*
3d94661a 51 * Types...
03f61bf3 52 */
53
2e0982a5 54typedef struct _cups_buffer_s /**** Read/write buffer ****/
55{
56 struct _cups_buffer_s *next; /* Next buffer in list */
57 size_t size; /* Size of buffer */
58 char used, /* Is this buffer used? */
59 d[1]; /* Data buffer */
60} _cups_buffer_t;
61
2625096f 62typedef struct _cups_globals_s /**** CUPS global state data ****/
03f61bf3 63{
a501ad17 64 /* Multiple places... */
65 const char *cups_datadir, /* CUPS_DATADIR environment var */
66 *cups_serverbin,/* CUPS_SERVERBIN environment var */
67 *cups_serverroot,
68 /* CUPS_SERVERROOT environment var */
69 *cups_statedir, /* CUPS_STATEDIR environment var */
70 *localedir; /* LOCALDIR environment var */
71
7701ffe8 72 /* adminutil.c */
73 time_t cupsd_update; /* Last time we got or set cupsd.conf */
74 char cupsd_hostname[HTTP_MAX_HOST];
75 /* Hostname for connection */
76 int cupsd_num_settings;
77 /* Number of server settings */
78 cups_option_t *cupsd_settings;/* Server settings */
79
9200f229 80 /* auth.c */
81# ifdef HAVE_GSSAPI
82 char gss_service_name[32];
83 /* Kerberos service name */
84# endif /* HAVE_GSSAPI */
85
012d7a28 86 /* backend.c */
87 char resolved_uri[1024];
88 /* Buffer for cupsBackendDeviceURI */
89
ef1a6c9d 90 /* debug.c */
91# ifdef DEBUG
92 int thread_id; /* Friendly thread ID */
93# endif /* DEBUG */
94
5cc5c44f 95 /* file.c */
96 cups_file_t *stdio_files[3];/* stdin, stdout, stderr */
97
03f61bf3 98 /* http.c */
99 char http_date[256]; /* Date+time buffer */
100
101 /* http-addr.c */
086c584d 102 unsigned ip_addr; /* Packed IPv4 address */
103 char *ip_ptrs[2]; /* Pointer to packed address */
03f61bf3 104 struct hostent hostent; /* Host entry for IP address */
105# ifdef HAVE_GETADDRINFO
106 char hostname[1024]; /* Hostname */
107# endif /* HAVE_GETADDRINFO */
36b81b47 108 int need_res_init; /* Need to reinitialize resolver? */
03f61bf3 109
110 /* ipp.c */
111 ipp_uchar_t ipp_date[11]; /* RFC-1903 date/time data */
2e0982a5 112 _cups_buffer_t *cups_buffers; /* Buffer list */
03f61bf3 113
114 /* ipp-support.c */
115 int ipp_port; /* IPP port number */
116 char ipp_unknown[255];
117 /* Unknown error statuses */
118
03f61bf3 119 /* language.c */
89fd567e 120 cups_lang_t *lang_default; /* Default language */
03f61bf3 121# ifdef __APPLE__
03f61bf3 122 char language[32]; /* Cached language */
03f61bf3 123# endif /* __APPLE__ */
124
125 /* ppd.c */
126 ppd_status_t ppd_status; /* Status of last ppdOpen*() */
127 int ppd_line; /* Current line number */
128 ppd_conform_t ppd_conform; /* Level of conformance required */
129
64dd1836 130 /* pwg-media.c */
131 cups_array_t *leg_size_lut, /* Lookup table for legacy names */
132 *ppd_size_lut, /* Lookup table for PPD names */
133 *pwg_size_lut; /* Lookup table for PWG names */
e106c1dc 134 pwg_media_t pwg_media; /* PWG media data for custom size */
64dd1836 135 char pwg_name[65]; /* PWG media name for custom size */
22d59a30 136
29a3a9e6 137 /* request.c */
138 http_t *http; /* Current server connection */
139 ipp_status_t last_error; /* Last IPP error */
140 char *last_status_message;
141 /* Last IPP status-message */
142
958bdaa3 143 /* snmp.c */
896cc0e8 144 char snmp_community[255];
145 /* Default SNMP community name */
958bdaa3 146 int snmp_debug; /* Log SNMP IO to stderr? */
147
03f61bf3 148 /* tempfile.c */
149 char tempfile[1024]; /* cupsTempFd/File buffer */
150
03f61bf3 151 /* usersys.c */
152 http_encryption_t encryption; /* Encryption setting */
153 char user[65], /* User name */
c35095b6 154 user_agent[256],/* User-Agent string */
086c584d 155 server[256], /* Server address */
24e92ab1 156 servername[256],/* Server hostname */
157 password[128]; /* Password for default callback */
c890e5ea 158 cups_password_cb2_t password_cb; /* Password callback */
159 void *password_data; /* Password user data */
b9738d7c 160 http_tls_credentials_t tls_credentials;
161 /* Default client credentials */
162 cups_client_cert_cb_t client_cert_cb; /* Client certificate callback */
163 void *client_cert_data;
164 /* Client certificate user data */
165 cups_server_cert_cb_t server_cert_cb; /* Server certificate callback */
166 void *server_cert_data;
167 /* Server certificate user data */
821fdb51 168 int server_version, /* Server IPP version */
169 any_root, /* Allow any root */
b9738d7c 170 expired_certs, /* Allow expired certs */
171 expired_root; /* Allow expired root */
03f61bf3 172
173 /* util.c */
03f61bf3 174 char def_printer[256];
175 /* Default printer */
176 char ppd_filename[HTTP_MAX_URI];
177 /* PPD filename */
2625096f 178} _cups_globals_t;
03f61bf3 179
fb5d8bf6 180typedef struct _cups_media_db_s /* Media database */
181{
182 char *color, /* Media color, if any */
183 *key, /* Media key, if any */
184 *info, /* Media human-readable name, if any */
185 *size_name, /* Media PWG size name, if provided */
186 *source, /* Media source, if any */
187 *type; /* Media type, if any */
188 int width, /* Width in hundredths of millimeters */
189 length, /* Length in hundredths of
190 * millimeters */
191 bottom, /* Bottom margin in hundredths of
192 * millimeters */
193 left, /* Left margin in hundredths of
194 * millimeters */
195 right, /* Right margin in hundredths of
196 * millimeters */
197 top; /* Top margin in hundredths of
198 * millimeters */
199} _cups_media_db_t;
200
a98cf586 201typedef struct _cups_dconstres_s /* Constraint/resolver */
202{
203 char *name; /* Name of resolver */
204 ipp_t *collection; /* Collection containing attrs */
205} _cups_dconstres_t;
206
fb5d8bf6 207struct _cups_dinfo_s /* Destination capability and status
208 * information */
209{
3945ef67 210 int version; /* IPP version */
fb5d8bf6 211 const char *uri; /* Printer URI */
212 char *resource; /* Resource path */
213 ipp_t *attrs; /* Printer attributes */
a98cf586 214 int num_defaults; /* Number of default options */
215 cups_option_t *defaults; /* Default options */
fb5d8bf6 216 cups_array_t *constraints; /* Job constraints */
a98cf586 217 cups_array_t *resolvers; /* Job resolvers */
fb5d8bf6 218 cups_array_t *localizations; /* Localization information */
219 cups_array_t *media_db; /* Media database */
220 _cups_media_db_t min_size, /* Minimum size */
221 max_size; /* Maximum size */
1ab364a0 222 unsigned cached_flags; /* Flags used for cached media */
223 cups_array_t *cached_db; /* Cache of media from last index/default */
224 time_t ready_time; /* When xxx-ready attributes were last queried */
225 ipp_t *ready_attrs; /* xxx-ready attributes */
226 cups_array_t *ready_db; /* media[-col]-ready media database */
fb5d8bf6 227};
228
03f61bf3 229
230/*
231 * Prototypes...
232 */
233
181f5167 234# ifdef __APPLE__
235extern CFStringRef _cupsAppleCopyDefaultPaperID(void);
56c4a391 236extern CFStringRef _cupsAppleCopyDefaultPrinter(void);
181f5167 237extern int _cupsAppleGetUseLastPrinter(void);
238extern void _cupsAppleSetDefaultPaperID(CFStringRef name);
56c4a391 239extern void _cupsAppleSetDefaultPrinter(CFStringRef name);
181f5167 240extern void _cupsAppleSetUseLastPrinter(int uselast);
241# endif /* __APPLE__ */
242
2e0982a5 243extern char *_cupsBufferGet(size_t size);
244extern void _cupsBufferRelease(char *b);
245
36883182 246extern http_t *_cupsConnect(void);
2256cc12 247extern int _cupsGet1284Values(const char *device_id,
248 cups_option_t **values);
fb5d8bf6 249extern const char *_cupsGetDestResource(cups_dest_t *dest, char *resource,
250 size_t resourcesize);
181f5167 251extern int _cupsGetDests(http_t *http, ipp_op_t op,
fb5d8bf6 252 const char *name, cups_dest_t **dests,
253 cups_ptype_t type, cups_ptype_t mask);
03f61bf3 254extern const char *_cupsGetPassword(const char *prompt);
fa7e8544 255extern void _cupsGlobalLock(void);
2625096f 256extern _cups_globals_t *_cupsGlobals(void);
fa7e8544 257extern void _cupsGlobalUnlock(void);
1b26e418 258# ifdef HAVE_GSSAPI
259extern const char *_cupsGSSServiceName(void);
260# endif /* HAVE_GSSAPI */
fc596e79 261extern int _cupsNextDelay(int current, int *previous);
d4c4cd54 262extern void _cupsSetDefaults(void);
e6f60272 263extern void _cupsSetError(ipp_status_t status, const char *message,
264 int localize);
64e79e51 265extern void _cupsSetHTTPError(http_status_t status);
f5259d8c 266# ifdef HAVE_GSSAPI
ec6e3e5a 267extern int _cupsSetNegotiateAuthString(http_t *http,
268 const char *method,
269 const char *resource);
f5259d8c 270# endif /* HAVE_GSSAPI */
fec07f7a 271extern char *_cupsUserDefault(char *name, size_t namesize);
03f61bf3 272
273
274/*
275 * C++ magic...
276 */
277
278# ifdef __cplusplus
279}
280# endif /* __cplusplus */
3d94661a 281#endif /* !_CUPS_CUPS_PRIVATE_H_ */
03f61bf3 282
283/*
284 * End of "$Id$".
285 */