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