]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
18ecb428 | 2 | * "$Id: cups.h 8781 2009-08-28 17:34:54Z mike $" |
ef416fc2 | 3 | * |
aaf19ab0 | 4 | * API definitions for CUPS. |
ef416fc2 | 5 | * |
321d8d57 | 6 | * Copyright 2007-2011 by Apple Inc. |
b86bc4cf | 7 | * Copyright 1997-2007 by Easy Software Products. |
ef416fc2 | 8 | * |
9 | * These coded instructions, statements, and computer programs are the | |
bc44d920 | 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/". | |
ef416fc2 | 14 | * |
15 | * This file is subject to the Apple OS-Developed Software exception. | |
16 | */ | |
17 | ||
18 | #ifndef _CUPS_CUPS_H_ | |
19 | # define _CUPS_CUPS_H_ | |
20 | ||
21 | /* | |
22 | * Include necessary headers... | |
23 | */ | |
24 | ||
b86bc4cf | 25 | # include <sys/types.h> |
26 | # if defined(WIN32) && !defined(__CUPS_SSIZE_T_DEFINED) | |
27 | # define __CUPS_SSIZE_T_DEFINED | |
6d2f911b | 28 | # include <stddef.h> |
b86bc4cf | 29 | /* Windows does not support the ssize_t type, so map it to off_t... */ |
30 | typedef off_t ssize_t; /* @private@ */ | |
31 | # endif /* WIN32 && !__CUPS_SSIZE_T_DEFINED */ | |
32 | ||
aaf19ab0 | 33 | # include "file.h" |
ef416fc2 | 34 | # include "ipp.h" |
fa73b229 | 35 | # include "language.h" |
36 | ||
ef416fc2 | 37 | |
ef416fc2 | 38 | /* |
39 | * C++ magic... | |
40 | */ | |
41 | ||
42 | # ifdef __cplusplus | |
43 | extern "C" { | |
44 | # endif /* __cplusplus */ | |
45 | ||
46 | ||
47 | /* | |
48 | * Constants... | |
49 | */ | |
50 | ||
a4845881 | 51 | # define CUPS_VERSION 1.0599 |
ef416fc2 | 52 | # define CUPS_VERSION_MAJOR 1 |
a4845881 MS |
53 | # define CUPS_VERSION_MINOR 6 |
54 | # define CUPS_VERSION_PATCH -1 | |
3d052e43 | 55 | |
79e1d494 | 56 | # define CUPS_BC_FD 3 /* Back-channel file descriptor for select/poll */ |
3d052e43 | 57 | # define CUPS_DATE_ANY (time_t)-1 |
ae71f5de | 58 | # define CUPS_EXCLUDE_NONE (const char *)0 |
3d052e43 | 59 | # define CUPS_FORMAT_AUTO "application/octet-stream" |
1f6f3dbc | 60 | # define CUPS_FORMAT_COMMAND "application/vnd.cups-command" |
3d052e43 MS |
61 | # define CUPS_FORMAT_PDF "application/pdf" |
62 | # define CUPS_FORMAT_POSTSCRIPT "application/postscript" | |
63 | # define CUPS_FORMAT_RAW "application/vnd.cups-raw" | |
64 | # define CUPS_FORMAT_TEXT "text/plain" | |
65 | # define CUPS_HTTP_DEFAULT (http_t *)0 | |
ed6e7faf | 66 | # define CUPS_INCLUDE_ALL (const char *)0 |
5a738aea MS |
67 | # define CUPS_JOBID_ALL -1 |
68 | # define CUPS_JOBID_CURRENT 0 | |
3d052e43 | 69 | # define CUPS_LENGTH_VARIABLE (ssize_t)0 |
ae71f5de | 70 | # define CUPS_TIMEOUT_DEFAULT 0 |
5a738aea MS |
71 | # define CUPS_WHICHJOBS_ALL -1 |
72 | # define CUPS_WHICHJOBS_ACTIVE 0 | |
73 | # define CUPS_WHICHJOBS_COMPLETED 1 | |
ef416fc2 | 74 | |
75 | ||
76 | /* | |
77 | * Types and structures... | |
78 | */ | |
79 | ||
5a738aea MS |
80 | typedef unsigned cups_ptype_t; /**** Printer type/capability bits ****/ |
81 | enum cups_ptype_e /**** Printer type/capability bit constants ****/ | |
82 | { /* Not a typedef'd enum so we can OR */ | |
ef416fc2 | 83 | CUPS_PRINTER_LOCAL = 0x0000, /* Local printer or class */ |
84 | CUPS_PRINTER_CLASS = 0x0001, /* Printer class */ | |
85 | CUPS_PRINTER_REMOTE = 0x0002, /* Remote printer or class */ | |
86 | CUPS_PRINTER_BW = 0x0004, /* Can do B&W printing */ | |
87 | CUPS_PRINTER_COLOR = 0x0008, /* Can do color printing */ | |
88 | CUPS_PRINTER_DUPLEX = 0x0010, /* Can do duplexing */ | |
89 | CUPS_PRINTER_STAPLE = 0x0020, /* Can staple output */ | |
90 | CUPS_PRINTER_COPIES = 0x0040, /* Can do copies */ | |
91 | CUPS_PRINTER_COLLATE = 0x0080, /* Can collage copies */ | |
92 | CUPS_PRINTER_PUNCH = 0x0100, /* Can punch output */ | |
93 | CUPS_PRINTER_COVER = 0x0200, /* Can cover output */ | |
94 | CUPS_PRINTER_BIND = 0x0400, /* Can bind output */ | |
95 | CUPS_PRINTER_SORT = 0x0800, /* Can sort output */ | |
96 | CUPS_PRINTER_SMALL = 0x1000, /* Can do Letter/Legal/A4 */ | |
97 | CUPS_PRINTER_MEDIUM = 0x2000, /* Can do Tabloid/B/C/A3/A2 */ | |
98 | CUPS_PRINTER_LARGE = 0x4000, /* Can do D/E/A1/A0 */ | |
99 | CUPS_PRINTER_VARIABLE = 0x8000, /* Can do variable sizes */ | |
100 | CUPS_PRINTER_IMPLICIT = 0x10000, /* Implicit class */ | |
101 | CUPS_PRINTER_DEFAULT = 0x20000, /* Default printer on network */ | |
102 | CUPS_PRINTER_FAX = 0x40000, /* Fax queue */ | |
103 | CUPS_PRINTER_REJECTING = 0x80000, /* Printer is rejecting jobs */ | |
426c6a59 MS |
104 | CUPS_PRINTER_DELETE = 0x100000, /* Delete printer @since CUPS 1.2/Mac OS X 10.5@ */ |
105 | CUPS_PRINTER_NOT_SHARED = 0x200000, /* Printer is not shared @since CUPS 1.2/Mac OS X 10.5@ */ | |
106 | CUPS_PRINTER_AUTHENTICATED = 0x400000,/* Printer requires authentication @since CUPS 1.2/Mac OS X 10.5@ */ | |
107 | CUPS_PRINTER_COMMANDS = 0x800000, /* Printer supports maintenance commands @since CUPS 1.2/Mac OS X 10.5@ */ | |
108 | CUPS_PRINTER_DISCOVERED = 0x1000000, /* Printer was automatically discovered and added @since CUPS 1.3/Mac OS X 10.5@ */ | |
178cb736 MS |
109 | CUPS_PRINTER_SCANNER = 0x2000000, /* Scanner-only device @since CUPS 1.4/Mac OS X 10.6@ */ |
110 | CUPS_PRINTER_MFP = 0x4000000, /* Printer with scanning capabilities @since CUPS 1.4/Mac OS X 10.6@ */ | |
5a738aea | 111 | CUPS_PRINTER_OPTIONS = 0x6fffc /* ~(CLASS | REMOTE | IMPLICIT | DEFAULT | FAX | REJECTING | DELETE | NOT_SHARED | AUTHENTICATED | COMMANDS | DISCOVERED) @private@ */ |
ef416fc2 | 112 | }; |
113 | ||
ae71f5de | 114 | typedef const char *(*cups_password_cb_t)(const char *prompt); |
ecdc0628 | 115 | /**** Password callback ****/ |
ef416fc2 | 116 | |
f11a948a MS |
117 | typedef const char *(*cups_password_cb2_t)(const char *prompt, http_t *http, |
118 | const char *method, | |
119 | const char *resource, | |
120 | void *user_data); | |
178cb736 | 121 | /**** New password callback @since CUPS 1.4/Mac OS X 10.6@ ****/ |
f11a948a | 122 | |
ae71f5de MS |
123 | typedef void (*cups_device_cb_t)(const char *device_class, |
124 | const char *device_id, const char *device_info, | |
125 | const char *device_make_and_model, | |
749b1e90 MS |
126 | const char *device_uri, |
127 | const char *device_location, void *user_data); | |
178cb736 | 128 | /**** Device callback @since CUPS 1.4/Mac OS X 10.6@ ****/ |
ae71f5de | 129 | |
ef416fc2 | 130 | typedef struct cups_option_s /**** Printer Options ****/ |
131 | { | |
132 | char *name; /* Name of option */ | |
133 | char *value; /* Value of option */ | |
134 | } cups_option_t; | |
135 | ||
136 | typedef struct cups_dest_s /**** Destination ****/ | |
137 | { | |
138 | char *name, /* Printer or class name */ | |
139 | *instance; /* Local instance name or NULL */ | |
140 | int is_default; /* Is this printer the default? */ | |
141 | int num_options; /* Number of options */ | |
142 | cups_option_t *options; /* Options */ | |
143 | } cups_dest_t; | |
144 | ||
145 | typedef struct cups_job_s /**** Job ****/ | |
146 | { | |
147 | int id; /* The job ID */ | |
ecdc0628 | 148 | char *dest; /* Printer or class name */ |
149 | char *title; /* Title/job name */ | |
150 | char *user; /* User the submitted the job */ | |
151 | char *format; /* Document format */ | |
ef416fc2 | 152 | ipp_jstate_t state; /* Job state */ |
ecdc0628 | 153 | int size; /* Size in kilobytes */ |
154 | int priority; /* Priority (1-100) */ | |
155 | time_t completed_time; /* Time the job was completed */ | |
156 | time_t creation_time; /* Time the job was created */ | |
157 | time_t processing_time; /* Time the job was processed */ | |
ef416fc2 | 158 | } cups_job_t; |
159 | ||
7cf5915e | 160 | typedef int (*cups_client_cert_cb_t)(http_t *http, void *tls, |
321d8d57 | 161 | cups_array_t *distinguished_names, |
7cf5915e | 162 | void *user_data); |
321d8d57 | 163 | /**** Client credentials callback @since CUPS 1.5/Mac OS X 10.7@ ****/ |
7cf5915e MS |
164 | |
165 | typedef int (*cups_server_cert_cb_t)(http_t *http, void *tls, | |
166 | cups_array_t *certs, void *user_data); | |
321d8d57 | 167 | /**** Server credentials callback @since CUPS 1.5/Mac OS X 10.7@ ****/ |
7cf5915e | 168 | |
ef416fc2 | 169 | |
170 | /* | |
171 | * Functions... | |
172 | */ | |
173 | ||
3d052e43 | 174 | extern int cupsCancelJob(const char *name, int job_id); |
ef416fc2 | 175 | extern ipp_t *cupsDoFileRequest(http_t *http, ipp_t *request, |
ecdc0628 | 176 | const char *resource, |
177 | const char *filename); | |
178 | extern ipp_t *cupsDoRequest(http_t *http, ipp_t *request, | |
179 | const char *resource); | |
ef416fc2 | 180 | extern http_encryption_t cupsEncryption(void); |
181 | extern void cupsFreeJobs(int num_jobs, cups_job_t *jobs); | |
182 | extern int cupsGetClasses(char ***classes) _CUPS_DEPRECATED; | |
183 | extern const char *cupsGetDefault(void); | |
5a738aea MS |
184 | extern int cupsGetJobs(cups_job_t **jobs, const char *name, |
185 | int myjobs, int whichjobs); | |
3d052e43 | 186 | extern const char *cupsGetPPD(const char *name); |
ef416fc2 | 187 | extern int cupsGetPrinters(char ***printers) _CUPS_DEPRECATED; |
188 | extern ipp_status_t cupsLastError(void); | |
3d052e43 | 189 | extern int cupsPrintFile(const char *name, const char *filename, |
ef416fc2 | 190 | const char *title, int num_options, |
191 | cups_option_t *options); | |
3d052e43 | 192 | extern int cupsPrintFiles(const char *name, int num_files, |
ef416fc2 | 193 | const char **files, const char *title, |
194 | int num_options, cups_option_t *options); | |
195 | extern char *cupsTempFile(char *filename, int len) _CUPS_DEPRECATED; | |
196 | extern int cupsTempFd(char *filename, int len); | |
197 | ||
198 | extern int cupsAddDest(const char *name, const char *instance, | |
199 | int num_dests, cups_dest_t **dests); | |
200 | extern void cupsFreeDests(int num_dests, cups_dest_t *dests); | |
201 | extern cups_dest_t *cupsGetDest(const char *name, const char *instance, | |
202 | int num_dests, cups_dest_t *dests); | |
203 | extern int cupsGetDests(cups_dest_t **dests); | |
204 | extern void cupsSetDests(int num_dests, cups_dest_t *dests); | |
205 | ||
206 | extern int cupsAddOption(const char *name, const char *value, | |
207 | int num_options, cups_option_t **options); | |
208 | extern void cupsEncodeOptions(ipp_t *ipp, int num_options, | |
209 | cups_option_t *options); | |
210 | extern void cupsFreeOptions(int num_options, cups_option_t *options); | |
211 | extern const char *cupsGetOption(const char *name, int num_options, | |
212 | cups_option_t *options); | |
b423cd4c | 213 | extern int cupsParseOptions(const char *arg, int num_options, |
214 | cups_option_t **options); | |
ef416fc2 | 215 | |
216 | extern const char *cupsGetPassword(const char *prompt); | |
217 | extern const char *cupsServer(void); | |
218 | extern void cupsSetEncryption(http_encryption_t e); | |
219 | extern void cupsSetPasswordCB(cups_password_cb_t cb); | |
220 | extern void cupsSetServer(const char *server); | |
221 | extern void cupsSetUser(const char *user); | |
222 | extern const char *cupsUser(void); | |
223 | ||
224 | /**** New in CUPS 1.1.20 ****/ | |
225 | extern int cupsDoAuthentication(http_t *http, const char *method, | |
2fb76298 | 226 | const char *resource) _CUPS_API_1_1_20; |
ef416fc2 | 227 | extern http_status_t cupsGetFile(http_t *http, const char *resource, |
2fb76298 | 228 | const char *filename) _CUPS_API_1_1_20; |
ef416fc2 | 229 | extern http_status_t cupsGetFd(http_t *http, const char *resource, int fd); |
230 | extern http_status_t cupsPutFile(http_t *http, const char *resource, | |
2fb76298 MS |
231 | const char *filename) _CUPS_API_1_1_20; |
232 | extern http_status_t cupsPutFd(http_t *http, const char *resource, int fd) _CUPS_API_1_1_20; | |
ef416fc2 | 233 | |
234 | /**** New in CUPS 1.1.21 ****/ | |
2fb76298 MS |
235 | extern const char *cupsGetDefault2(http_t *http) _CUPS_API_1_1_21; |
236 | extern int cupsGetDests2(http_t *http, cups_dest_t **dests) _CUPS_API_1_1_21; | |
ef416fc2 | 237 | extern int cupsGetJobs2(http_t *http, cups_job_t **jobs, |
3d052e43 | 238 | const char *name, int myjobs, |
5a738aea | 239 | int whichjobs) _CUPS_API_1_1_21; |
3d052e43 MS |
240 | extern const char *cupsGetPPD2(http_t *http, const char *name) _CUPS_API_1_1_21; |
241 | extern int cupsPrintFile2(http_t *http, const char *name, | |
ef416fc2 | 242 | const char *filename, |
243 | const char *title, int num_options, | |
2fb76298 | 244 | cups_option_t *options) _CUPS_API_1_1_21; |
3d052e43 | 245 | extern int cupsPrintFiles2(http_t *http, const char *name, |
ef416fc2 | 246 | int num_files, const char **files, |
247 | const char *title, int num_options, | |
2fb76298 | 248 | cups_option_t *options) _CUPS_API_1_1_21; |
ef416fc2 | 249 | extern int cupsSetDests2(http_t *http, int num_dests, |
2fb76298 | 250 | cups_dest_t *dests) _CUPS_API_1_1_21; |
ef416fc2 | 251 | |
b0f6947b | 252 | /**** New in CUPS 1.2/Mac OS X 10.5 ****/ |
ecdc0628 | 253 | extern ssize_t cupsBackChannelRead(char *buffer, size_t bytes, |
2fb76298 | 254 | double timeout) _CUPS_API_1_2; |
ecdc0628 | 255 | extern ssize_t cupsBackChannelWrite(const char *buffer, size_t bytes, |
2fb76298 | 256 | double timeout) _CUPS_API_1_2; |
ef416fc2 | 257 | extern void cupsEncodeOptions2(ipp_t *ipp, int num_options, |
258 | cups_option_t *options, | |
2fb76298 MS |
259 | ipp_tag_t group_tag) _CUPS_API_1_2; |
260 | extern const char *cupsLastErrorString(void) _CUPS_API_1_2; | |
261 | extern char *cupsNotifySubject(cups_lang_t *lang, ipp_t *event) _CUPS_API_1_2; | |
262 | extern char *cupsNotifyText(cups_lang_t *lang, ipp_t *event) _CUPS_API_1_2; | |
b423cd4c | 263 | extern int cupsRemoveOption(const char *name, int num_options, |
2fb76298 MS |
264 | cups_option_t **options) _CUPS_API_1_2; |
265 | extern cups_file_t *cupsTempFile2(char *filename, int len) _CUPS_API_1_2; | |
ef416fc2 | 266 | |
b0f6947b | 267 | /**** New in CUPS 1.3/Mac OS X 10.5 ****/ |
b94498cf | 268 | extern ipp_t *cupsDoIORequest(http_t *http, ipp_t *request, |
269 | const char *resource, int infile, | |
2fb76298 MS |
270 | int outfile) _CUPS_API_1_3; |
271 | extern char *cupsGetServerPPD(http_t *http, const char *name) _CUPS_API_1_3; | |
f7deaa1a | 272 | extern int cupsRemoveDest(const char *name, |
273 | const char *instance, | |
2fb76298 | 274 | int num_dests, cups_dest_t **dests) _CUPS_API_1_3; |
f7deaa1a | 275 | extern void cupsSetDefaultDest(const char *name, |
276 | const char *instance, | |
277 | int num_dests, | |
2fb76298 | 278 | cups_dest_t *dests) _CUPS_API_1_3; |
f7deaa1a | 279 | |
b0f6947b | 280 | /**** New in CUPS 1.4/Mac OS X 10.6 ****/ |
5a738aea MS |
281 | extern ipp_status_t cupsCancelJob2(http_t *http, const char *name, |
282 | int job_id, int purge) _CUPS_API_1_4; | |
3d052e43 MS |
283 | extern int cupsCreateJob(http_t *http, const char *name, |
284 | const char *title, int num_options, | |
285 | cups_option_t *options) _CUPS_API_1_4; | |
286 | extern ipp_status_t cupsFinishDocument(http_t *http, | |
287 | const char *name) _CUPS_API_1_4; | |
ae71f5de | 288 | extern ipp_status_t cupsGetDevices(http_t *http, int timeout, |
ed6e7faf | 289 | const char *include_schemes, |
38e73f87 | 290 | const char *exclude_schemes, |
ae71f5de MS |
291 | cups_device_cb_t callback, |
292 | void *user_data) _CUPS_API_1_4; | |
a4924f6c MS |
293 | extern cups_dest_t *cupsGetNamedDest(http_t *http, const char *name, |
294 | const char *instance) _CUPS_API_1_4; | |
f11a948a MS |
295 | extern const char *cupsGetPassword2(const char *prompt, http_t *http, |
296 | const char *method, | |
297 | const char *resource) _CUPS_API_1_4; | |
2e4ff8af MS |
298 | extern http_status_t cupsGetPPD3(http_t *http, const char *name, |
299 | time_t *modtime, char *buffer, | |
2fb76298 | 300 | size_t bufsize) _CUPS_API_1_4; |
3d052e43 MS |
301 | extern ipp_t *cupsGetResponse(http_t *http, |
302 | const char *resource) _CUPS_API_1_4; | |
303 | extern ssize_t cupsReadResponseData(http_t *http, char *buffer, | |
304 | size_t length) _CUPS_API_1_4; | |
305 | extern http_status_t cupsSendRequest(http_t *http, ipp_t *request, | |
306 | const char *resource, | |
307 | size_t length) _CUPS_API_1_4; | |
f11a948a MS |
308 | extern void cupsSetPasswordCB2(cups_password_cb2_t cb, |
309 | void *user_data) _CUPS_API_1_4; | |
3d052e43 MS |
310 | extern http_status_t cupsStartDocument(http_t *http, const char *name, |
311 | int job_id, const char *docname, | |
312 | const char *format, | |
313 | int last_document) _CUPS_API_1_4; | |
314 | extern http_status_t cupsWriteRequestData(http_t *http, const char *buffer, | |
315 | size_t length) _CUPS_API_1_4; | |
ef416fc2 | 316 | |
7cf5915e MS |
317 | /**** New in CUPS 1.5 ****/ |
318 | extern void cupsSetClientCertCB(cups_client_cert_cb_t cb, | |
319 | void *user_data) _CUPS_API_1_5; | |
320 | extern int cupsSetCredentials(cups_array_t *certs) _CUPS_API_1_5; | |
321 | extern void cupsSetServerCertCB(cups_server_cert_cb_t cb, | |
322 | void *user_data) _CUPS_API_1_5; | |
323 | ||
324 | ||
ef416fc2 | 325 | # ifdef __cplusplus |
326 | } | |
327 | # endif /* __cplusplus */ | |
328 | ||
329 | #endif /* !_CUPS_CUPS_H_ */ | |
330 | ||
331 | /* | |
18ecb428 | 332 | * End of "$Id: cups.h 8781 2009-08-28 17:34:54Z mike $". |
ef416fc2 | 333 | */ |