]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
2e4ff8af | 2 | * "$Id: cups.h 6870 2007-08-27 21:13:35Z mike $" |
ef416fc2 | 3 | * |
4 | * API definitions for the Common UNIX Printing System (CUPS). | |
5 | * | |
bc44d920 | 6 | * Copyright 2007 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 | |
28 | /* Windows does not support the ssize_t type, so map it to off_t... */ | |
29 | typedef off_t ssize_t; /* @private@ */ | |
30 | # endif /* WIN32 && !__CUPS_SSIZE_T_DEFINED */ | |
31 | ||
ef416fc2 | 32 | # include "ipp.h" |
33 | # include "ppd.h" | |
fa73b229 | 34 | # include "language.h" |
35 | ||
ef416fc2 | 36 | |
37 | /* | |
38 | * With GCC 3.0 and higher, we can mark old APIs "deprecated" so you get | |
fa73b229 | 39 | * a warning at compile-time. |
ef416fc2 | 40 | */ |
41 | ||
42 | # if defined(__GNUC__) && __GNUC__ > 2 | |
43 | # define _CUPS_DEPRECATED __attribute__ ((__deprecated__)) | |
44 | # else | |
45 | # define _CUPS_DEPRECATED | |
46 | # endif /* __GNUC__ && __GNUC__ > 2 */ | |
47 | ||
48 | ||
49 | /* | |
50 | * C++ magic... | |
51 | */ | |
52 | ||
53 | # ifdef __cplusplus | |
54 | extern "C" { | |
55 | # endif /* __cplusplus */ | |
56 | ||
57 | ||
58 | /* | |
59 | * Constants... | |
60 | */ | |
61 | ||
3d052e43 | 62 | # define CUPS_VERSION 1.0399 |
ef416fc2 | 63 | # define CUPS_VERSION_MAJOR 1 |
2e4ff8af | 64 | # define CUPS_VERSION_MINOR 4 |
3d052e43 MS |
65 | # define CUPS_VERSION_PATCH -1 |
66 | ||
67 | # define CUPS_DATE_ANY (time_t)-1 | |
68 | # define CUPS_FORMAT_AUTO "application/octet-stream" | |
69 | # define CUPS_FORMAT_PDF "application/pdf" | |
70 | # define CUPS_FORMAT_POSTSCRIPT "application/postscript" | |
71 | # define CUPS_FORMAT_RAW "application/vnd.cups-raw" | |
72 | # define CUPS_FORMAT_TEXT "text/plain" | |
73 | # define CUPS_HTTP_DEFAULT (http_t *)0 | |
74 | # define CUPS_LENGTH_VARIABLE (ssize_t)0 | |
ef416fc2 | 75 | |
76 | ||
77 | /* | |
78 | * Types and structures... | |
79 | */ | |
80 | ||
81 | typedef unsigned cups_ptype_t; /**** Printer Type/Capability Bits ****/ | |
82 | enum cups_ptype_e /* Not a typedef'd enum so we can OR */ | |
83 | { | |
84 | CUPS_PRINTER_LOCAL = 0x0000, /* Local printer or class */ | |
85 | CUPS_PRINTER_CLASS = 0x0001, /* Printer class */ | |
86 | CUPS_PRINTER_REMOTE = 0x0002, /* Remote printer or class */ | |
87 | CUPS_PRINTER_BW = 0x0004, /* Can do B&W printing */ | |
88 | CUPS_PRINTER_COLOR = 0x0008, /* Can do color printing */ | |
89 | CUPS_PRINTER_DUPLEX = 0x0010, /* Can do duplexing */ | |
90 | CUPS_PRINTER_STAPLE = 0x0020, /* Can staple output */ | |
91 | CUPS_PRINTER_COPIES = 0x0040, /* Can do copies */ | |
92 | CUPS_PRINTER_COLLATE = 0x0080, /* Can collage copies */ | |
93 | CUPS_PRINTER_PUNCH = 0x0100, /* Can punch output */ | |
94 | CUPS_PRINTER_COVER = 0x0200, /* Can cover output */ | |
95 | CUPS_PRINTER_BIND = 0x0400, /* Can bind output */ | |
96 | CUPS_PRINTER_SORT = 0x0800, /* Can sort output */ | |
97 | CUPS_PRINTER_SMALL = 0x1000, /* Can do Letter/Legal/A4 */ | |
98 | CUPS_PRINTER_MEDIUM = 0x2000, /* Can do Tabloid/B/C/A3/A2 */ | |
99 | CUPS_PRINTER_LARGE = 0x4000, /* Can do D/E/A1/A0 */ | |
100 | CUPS_PRINTER_VARIABLE = 0x8000, /* Can do variable sizes */ | |
101 | CUPS_PRINTER_IMPLICIT = 0x10000, /* Implicit class */ | |
102 | CUPS_PRINTER_DEFAULT = 0x20000, /* Default printer on network */ | |
103 | CUPS_PRINTER_FAX = 0x40000, /* Fax queue */ | |
104 | CUPS_PRINTER_REJECTING = 0x80000, /* Printer is rejecting jobs */ | |
105 | CUPS_PRINTER_DELETE = 0x100000, /* Delete printer @since CUPS 1.2@ */ | |
106 | CUPS_PRINTER_NOT_SHARED = 0x200000, /* Printer is not shared @since CUPS 1.2@ */ | |
107 | CUPS_PRINTER_AUTHENTICATED = 0x400000,/* Printer requires authentication @since CUPS 1.2@ */ | |
b423cd4c | 108 | CUPS_PRINTER_COMMANDS = 0x800000, /* Printer supports maintenance commands @since CUPS 1.2@ */ |
09a101d6 | 109 | CUPS_PRINTER_DISCOVERED = 0x1000000, /* Printer was automatically discovered and added @since CUPS 1.3@ */ |
bc44d920 | 110 | CUPS_PRINTER_OPTIONS = 0x6fffc /* ~(CLASS | REMOTE | IMPLICIT | DEFAULT | FAX | REJECTING | DELETE | NOT_SHARED | AUTHENTICATED | COMMANDS | DISCOVERED) */ |
ef416fc2 | 111 | }; |
112 | ||
113 | typedef const char *(*cups_password_cb_t)(const char *); | |
ecdc0628 | 114 | /**** Password callback ****/ |
ef416fc2 | 115 | |
116 | typedef struct cups_option_s /**** Printer Options ****/ | |
117 | { | |
118 | char *name; /* Name of option */ | |
119 | char *value; /* Value of option */ | |
120 | } cups_option_t; | |
121 | ||
122 | typedef struct cups_dest_s /**** Destination ****/ | |
123 | { | |
124 | char *name, /* Printer or class name */ | |
125 | *instance; /* Local instance name or NULL */ | |
126 | int is_default; /* Is this printer the default? */ | |
127 | int num_options; /* Number of options */ | |
128 | cups_option_t *options; /* Options */ | |
129 | } cups_dest_t; | |
130 | ||
131 | typedef struct cups_job_s /**** Job ****/ | |
132 | { | |
133 | int id; /* The job ID */ | |
ecdc0628 | 134 | char *dest; /* Printer or class name */ |
135 | char *title; /* Title/job name */ | |
136 | char *user; /* User the submitted the job */ | |
137 | char *format; /* Document format */ | |
ef416fc2 | 138 | ipp_jstate_t state; /* Job state */ |
ecdc0628 | 139 | int size; /* Size in kilobytes */ |
140 | int priority; /* Priority (1-100) */ | |
141 | time_t completed_time; /* Time the job was completed */ | |
142 | time_t creation_time; /* Time the job was created */ | |
143 | time_t processing_time; /* Time the job was processed */ | |
ef416fc2 | 144 | } cups_job_t; |
145 | ||
146 | ||
147 | /* | |
148 | * Functions... | |
149 | */ | |
150 | ||
3d052e43 | 151 | extern int cupsCancelJob(const char *name, int job_id); |
ef416fc2 | 152 | extern ipp_t *cupsDoFileRequest(http_t *http, ipp_t *request, |
ecdc0628 | 153 | const char *resource, |
154 | const char *filename); | |
155 | extern ipp_t *cupsDoRequest(http_t *http, ipp_t *request, | |
156 | const char *resource); | |
ef416fc2 | 157 | extern http_encryption_t cupsEncryption(void); |
158 | extern void cupsFreeJobs(int num_jobs, cups_job_t *jobs); | |
159 | extern int cupsGetClasses(char ***classes) _CUPS_DEPRECATED; | |
160 | extern const char *cupsGetDefault(void); | |
161 | extern int cupsGetJobs(cups_job_t **jobs, const char *dest, | |
162 | int myjobs, int completed); | |
3d052e43 | 163 | extern const char *cupsGetPPD(const char *name); |
ef416fc2 | 164 | extern int cupsGetPrinters(char ***printers) _CUPS_DEPRECATED; |
165 | extern ipp_status_t cupsLastError(void); | |
3d052e43 | 166 | extern int cupsPrintFile(const char *name, const char *filename, |
ef416fc2 | 167 | const char *title, int num_options, |
168 | cups_option_t *options); | |
3d052e43 | 169 | extern int cupsPrintFiles(const char *name, int num_files, |
ef416fc2 | 170 | const char **files, const char *title, |
171 | int num_options, cups_option_t *options); | |
172 | extern char *cupsTempFile(char *filename, int len) _CUPS_DEPRECATED; | |
173 | extern int cupsTempFd(char *filename, int len); | |
174 | ||
175 | extern int cupsAddDest(const char *name, const char *instance, | |
176 | int num_dests, cups_dest_t **dests); | |
177 | extern void cupsFreeDests(int num_dests, cups_dest_t *dests); | |
178 | extern cups_dest_t *cupsGetDest(const char *name, const char *instance, | |
179 | int num_dests, cups_dest_t *dests); | |
180 | extern int cupsGetDests(cups_dest_t **dests); | |
181 | extern void cupsSetDests(int num_dests, cups_dest_t *dests); | |
182 | ||
183 | extern int cupsAddOption(const char *name, const char *value, | |
184 | int num_options, cups_option_t **options); | |
185 | extern void cupsEncodeOptions(ipp_t *ipp, int num_options, | |
186 | cups_option_t *options); | |
187 | extern void cupsFreeOptions(int num_options, cups_option_t *options); | |
188 | extern const char *cupsGetOption(const char *name, int num_options, | |
189 | cups_option_t *options); | |
ef416fc2 | 190 | extern int cupsMarkOptions(ppd_file_t *ppd, int num_options, |
191 | cups_option_t *options); | |
b423cd4c | 192 | extern int cupsParseOptions(const char *arg, int num_options, |
193 | cups_option_t **options); | |
ef416fc2 | 194 | |
195 | extern const char *cupsGetPassword(const char *prompt); | |
196 | extern const char *cupsServer(void); | |
197 | extern void cupsSetEncryption(http_encryption_t e); | |
198 | extern void cupsSetPasswordCB(cups_password_cb_t cb); | |
199 | extern void cupsSetServer(const char *server); | |
200 | extern void cupsSetUser(const char *user); | |
201 | extern const char *cupsUser(void); | |
202 | ||
203 | /**** New in CUPS 1.1.20 ****/ | |
204 | extern int cupsDoAuthentication(http_t *http, const char *method, | |
2fb76298 | 205 | const char *resource) _CUPS_API_1_1_20; |
ef416fc2 | 206 | extern http_status_t cupsGetFile(http_t *http, const char *resource, |
2fb76298 | 207 | const char *filename) _CUPS_API_1_1_20; |
ef416fc2 | 208 | extern http_status_t cupsGetFd(http_t *http, const char *resource, int fd); |
209 | extern http_status_t cupsPutFile(http_t *http, const char *resource, | |
2fb76298 MS |
210 | const char *filename) _CUPS_API_1_1_20; |
211 | extern http_status_t cupsPutFd(http_t *http, const char *resource, int fd) _CUPS_API_1_1_20; | |
ef416fc2 | 212 | |
213 | /**** New in CUPS 1.1.21 ****/ | |
2fb76298 MS |
214 | extern const char *cupsGetDefault2(http_t *http) _CUPS_API_1_1_21; |
215 | extern int cupsGetDests2(http_t *http, cups_dest_t **dests) _CUPS_API_1_1_21; | |
ef416fc2 | 216 | extern int cupsGetJobs2(http_t *http, cups_job_t **jobs, |
3d052e43 | 217 | const char *name, int myjobs, |
2fb76298 | 218 | int completed) _CUPS_API_1_1_21; |
3d052e43 MS |
219 | extern const char *cupsGetPPD2(http_t *http, const char *name) _CUPS_API_1_1_21; |
220 | extern int cupsPrintFile2(http_t *http, const char *name, | |
ef416fc2 | 221 | const char *filename, |
222 | const char *title, int num_options, | |
2fb76298 | 223 | cups_option_t *options) _CUPS_API_1_1_21; |
3d052e43 | 224 | extern int cupsPrintFiles2(http_t *http, const char *name, |
ef416fc2 | 225 | int num_files, const char **files, |
226 | const char *title, int num_options, | |
2fb76298 | 227 | cups_option_t *options) _CUPS_API_1_1_21; |
ef416fc2 | 228 | extern int cupsSetDests2(http_t *http, int num_dests, |
2fb76298 | 229 | cups_dest_t *dests) _CUPS_API_1_1_21; |
ef416fc2 | 230 | |
231 | /**** New in CUPS 1.2 ****/ | |
ecdc0628 | 232 | extern ssize_t cupsBackChannelRead(char *buffer, size_t bytes, |
2fb76298 | 233 | double timeout) _CUPS_API_1_2; |
ecdc0628 | 234 | extern ssize_t cupsBackChannelWrite(const char *buffer, size_t bytes, |
2fb76298 | 235 | double timeout) _CUPS_API_1_2; |
ef416fc2 | 236 | extern void cupsEncodeOptions2(ipp_t *ipp, int num_options, |
237 | cups_option_t *options, | |
2fb76298 MS |
238 | ipp_tag_t group_tag) _CUPS_API_1_2; |
239 | extern const char *cupsLastErrorString(void) _CUPS_API_1_2; | |
240 | extern char *cupsNotifySubject(cups_lang_t *lang, ipp_t *event) _CUPS_API_1_2; | |
241 | extern char *cupsNotifyText(cups_lang_t *lang, ipp_t *event) _CUPS_API_1_2; | |
b423cd4c | 242 | extern int cupsRemoveOption(const char *name, int num_options, |
2fb76298 MS |
243 | cups_option_t **options) _CUPS_API_1_2; |
244 | extern cups_file_t *cupsTempFile2(char *filename, int len) _CUPS_API_1_2; | |
ef416fc2 | 245 | |
f7deaa1a | 246 | /**** New in CUPS 1.3 ****/ |
b94498cf | 247 | extern ipp_t *cupsDoIORequest(http_t *http, ipp_t *request, |
248 | const char *resource, int infile, | |
2fb76298 MS |
249 | int outfile) _CUPS_API_1_3; |
250 | extern char *cupsGetServerPPD(http_t *http, const char *name) _CUPS_API_1_3; | |
f7deaa1a | 251 | extern int cupsRemoveDest(const char *name, |
252 | const char *instance, | |
2fb76298 | 253 | int num_dests, cups_dest_t **dests) _CUPS_API_1_3; |
f7deaa1a | 254 | extern void cupsSetDefaultDest(const char *name, |
255 | const char *instance, | |
256 | int num_dests, | |
2fb76298 | 257 | cups_dest_t *dests) _CUPS_API_1_3; |
f7deaa1a | 258 | |
2e4ff8af | 259 | /**** New in CUPS 1.4 ****/ |
3d052e43 MS |
260 | extern ipp_status_t cupsCancelJob2(http_t *http, int job_id, int purge); |
261 | extern int cupsCreateJob(http_t *http, const char *name, | |
262 | const char *title, int num_options, | |
263 | cups_option_t *options) _CUPS_API_1_4; | |
264 | extern ipp_status_t cupsFinishDocument(http_t *http, | |
265 | const char *name) _CUPS_API_1_4; | |
a4924f6c MS |
266 | extern cups_dest_t *cupsGetNamedDest(http_t *http, const char *name, |
267 | const char *instance) _CUPS_API_1_4; | |
2e4ff8af MS |
268 | extern http_status_t cupsGetPPD3(http_t *http, const char *name, |
269 | time_t *modtime, char *buffer, | |
2fb76298 | 270 | size_t bufsize) _CUPS_API_1_4; |
3d052e43 MS |
271 | extern ipp_t *cupsGetResponse(http_t *http, |
272 | const char *resource) _CUPS_API_1_4; | |
273 | extern ssize_t cupsReadResponseData(http_t *http, char *buffer, | |
274 | size_t length) _CUPS_API_1_4; | |
275 | extern http_status_t cupsSendRequest(http_t *http, ipp_t *request, | |
276 | const char *resource, | |
277 | size_t length) _CUPS_API_1_4; | |
278 | extern http_status_t cupsStartDocument(http_t *http, const char *name, | |
279 | int job_id, const char *docname, | |
280 | const char *format, | |
281 | int last_document) _CUPS_API_1_4; | |
282 | extern http_status_t cupsWriteRequestData(http_t *http, const char *buffer, | |
283 | size_t length) _CUPS_API_1_4; | |
ef416fc2 | 284 | |
285 | # ifdef __cplusplus | |
286 | } | |
287 | # endif /* __cplusplus */ | |
288 | ||
289 | #endif /* !_CUPS_CUPS_H_ */ | |
290 | ||
291 | /* | |
2e4ff8af | 292 | * End of "$Id: cups.h 6870 2007-08-27 21:13:35Z mike $". |
ef416fc2 | 293 | */ |