]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
db1f069b | 2 | * "$Id: cups.h 6946 2007-09-12 18:28:16Z 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 | ||
db1f069b | 62 | # define CUPS_VERSION 1.0301 |
ef416fc2 | 63 | # define CUPS_VERSION_MAJOR 1 |
f7deaa1a | 64 | # define CUPS_VERSION_MINOR 3 |
db1f069b | 65 | # define CUPS_VERSION_PATCH 1 |
ef416fc2 | 66 | # define CUPS_DATE_ANY -1 |
67 | ||
68 | ||
69 | /* | |
70 | * Types and structures... | |
71 | */ | |
72 | ||
73 | typedef unsigned cups_ptype_t; /**** Printer Type/Capability Bits ****/ | |
74 | enum cups_ptype_e /* Not a typedef'd enum so we can OR */ | |
75 | { | |
76 | CUPS_PRINTER_LOCAL = 0x0000, /* Local printer or class */ | |
77 | CUPS_PRINTER_CLASS = 0x0001, /* Printer class */ | |
78 | CUPS_PRINTER_REMOTE = 0x0002, /* Remote printer or class */ | |
79 | CUPS_PRINTER_BW = 0x0004, /* Can do B&W printing */ | |
80 | CUPS_PRINTER_COLOR = 0x0008, /* Can do color printing */ | |
81 | CUPS_PRINTER_DUPLEX = 0x0010, /* Can do duplexing */ | |
82 | CUPS_PRINTER_STAPLE = 0x0020, /* Can staple output */ | |
83 | CUPS_PRINTER_COPIES = 0x0040, /* Can do copies */ | |
84 | CUPS_PRINTER_COLLATE = 0x0080, /* Can collage copies */ | |
85 | CUPS_PRINTER_PUNCH = 0x0100, /* Can punch output */ | |
86 | CUPS_PRINTER_COVER = 0x0200, /* Can cover output */ | |
87 | CUPS_PRINTER_BIND = 0x0400, /* Can bind output */ | |
88 | CUPS_PRINTER_SORT = 0x0800, /* Can sort output */ | |
89 | CUPS_PRINTER_SMALL = 0x1000, /* Can do Letter/Legal/A4 */ | |
90 | CUPS_PRINTER_MEDIUM = 0x2000, /* Can do Tabloid/B/C/A3/A2 */ | |
91 | CUPS_PRINTER_LARGE = 0x4000, /* Can do D/E/A1/A0 */ | |
92 | CUPS_PRINTER_VARIABLE = 0x8000, /* Can do variable sizes */ | |
93 | CUPS_PRINTER_IMPLICIT = 0x10000, /* Implicit class */ | |
94 | CUPS_PRINTER_DEFAULT = 0x20000, /* Default printer on network */ | |
95 | CUPS_PRINTER_FAX = 0x40000, /* Fax queue */ | |
96 | CUPS_PRINTER_REJECTING = 0x80000, /* Printer is rejecting jobs */ | |
97 | CUPS_PRINTER_DELETE = 0x100000, /* Delete printer @since CUPS 1.2@ */ | |
98 | CUPS_PRINTER_NOT_SHARED = 0x200000, /* Printer is not shared @since CUPS 1.2@ */ | |
99 | CUPS_PRINTER_AUTHENTICATED = 0x400000,/* Printer requires authentication @since CUPS 1.2@ */ | |
b423cd4c | 100 | CUPS_PRINTER_COMMANDS = 0x800000, /* Printer supports maintenance commands @since CUPS 1.2@ */ |
09a101d6 | 101 | CUPS_PRINTER_DISCOVERED = 0x1000000, /* Printer was automatically discovered and added @since CUPS 1.3@ */ |
bc44d920 | 102 | CUPS_PRINTER_OPTIONS = 0x6fffc /* ~(CLASS | REMOTE | IMPLICIT | DEFAULT | FAX | REJECTING | DELETE | NOT_SHARED | AUTHENTICATED | COMMANDS | DISCOVERED) */ |
ef416fc2 | 103 | }; |
104 | ||
105 | typedef const char *(*cups_password_cb_t)(const char *); | |
ecdc0628 | 106 | /**** Password callback ****/ |
ef416fc2 | 107 | |
108 | typedef struct cups_option_s /**** Printer Options ****/ | |
109 | { | |
110 | char *name; /* Name of option */ | |
111 | char *value; /* Value of option */ | |
112 | } cups_option_t; | |
113 | ||
114 | typedef struct cups_dest_s /**** Destination ****/ | |
115 | { | |
116 | char *name, /* Printer or class name */ | |
117 | *instance; /* Local instance name or NULL */ | |
118 | int is_default; /* Is this printer the default? */ | |
119 | int num_options; /* Number of options */ | |
120 | cups_option_t *options; /* Options */ | |
121 | } cups_dest_t; | |
122 | ||
123 | typedef struct cups_job_s /**** Job ****/ | |
124 | { | |
125 | int id; /* The job ID */ | |
ecdc0628 | 126 | char *dest; /* Printer or class name */ |
127 | char *title; /* Title/job name */ | |
128 | char *user; /* User the submitted the job */ | |
129 | char *format; /* Document format */ | |
ef416fc2 | 130 | ipp_jstate_t state; /* Job state */ |
ecdc0628 | 131 | int size; /* Size in kilobytes */ |
132 | int priority; /* Priority (1-100) */ | |
133 | time_t completed_time; /* Time the job was completed */ | |
134 | time_t creation_time; /* Time the job was created */ | |
135 | time_t processing_time; /* Time the job was processed */ | |
ef416fc2 | 136 | } cups_job_t; |
137 | ||
138 | ||
139 | /* | |
140 | * Functions... | |
141 | */ | |
142 | ||
143 | extern int cupsCancelJob(const char *printer, int job); | |
ef416fc2 | 144 | extern ipp_t *cupsDoFileRequest(http_t *http, ipp_t *request, |
ecdc0628 | 145 | const char *resource, |
146 | const char *filename); | |
147 | extern ipp_t *cupsDoRequest(http_t *http, ipp_t *request, | |
148 | const char *resource); | |
ef416fc2 | 149 | extern http_encryption_t cupsEncryption(void); |
150 | extern void cupsFreeJobs(int num_jobs, cups_job_t *jobs); | |
151 | extern int cupsGetClasses(char ***classes) _CUPS_DEPRECATED; | |
152 | extern const char *cupsGetDefault(void); | |
153 | extern int cupsGetJobs(cups_job_t **jobs, const char *dest, | |
154 | int myjobs, int completed); | |
155 | extern const char *cupsGetPPD(const char *printer); | |
156 | extern int cupsGetPrinters(char ***printers) _CUPS_DEPRECATED; | |
157 | extern ipp_status_t cupsLastError(void); | |
158 | extern int cupsPrintFile(const char *printer, const char *filename, | |
159 | const char *title, int num_options, | |
160 | cups_option_t *options); | |
161 | extern int cupsPrintFiles(const char *printer, int num_files, | |
162 | const char **files, const char *title, | |
163 | int num_options, cups_option_t *options); | |
164 | extern char *cupsTempFile(char *filename, int len) _CUPS_DEPRECATED; | |
165 | extern int cupsTempFd(char *filename, int len); | |
166 | ||
167 | extern int cupsAddDest(const char *name, const char *instance, | |
168 | int num_dests, cups_dest_t **dests); | |
169 | extern void cupsFreeDests(int num_dests, cups_dest_t *dests); | |
170 | extern cups_dest_t *cupsGetDest(const char *name, const char *instance, | |
171 | int num_dests, cups_dest_t *dests); | |
172 | extern int cupsGetDests(cups_dest_t **dests); | |
173 | extern void cupsSetDests(int num_dests, cups_dest_t *dests); | |
174 | ||
175 | extern int cupsAddOption(const char *name, const char *value, | |
176 | int num_options, cups_option_t **options); | |
177 | extern void cupsEncodeOptions(ipp_t *ipp, int num_options, | |
178 | cups_option_t *options); | |
179 | extern void cupsFreeOptions(int num_options, cups_option_t *options); | |
180 | extern const char *cupsGetOption(const char *name, int num_options, | |
181 | cups_option_t *options); | |
ef416fc2 | 182 | extern int cupsMarkOptions(ppd_file_t *ppd, int num_options, |
183 | cups_option_t *options); | |
b423cd4c | 184 | extern int cupsParseOptions(const char *arg, int num_options, |
185 | cups_option_t **options); | |
ef416fc2 | 186 | |
187 | extern const char *cupsGetPassword(const char *prompt); | |
188 | extern const char *cupsServer(void); | |
189 | extern void cupsSetEncryption(http_encryption_t e); | |
190 | extern void cupsSetPasswordCB(cups_password_cb_t cb); | |
191 | extern void cupsSetServer(const char *server); | |
192 | extern void cupsSetUser(const char *user); | |
193 | extern const char *cupsUser(void); | |
194 | ||
195 | /**** New in CUPS 1.1.20 ****/ | |
196 | extern int cupsDoAuthentication(http_t *http, const char *method, | |
197 | const char *resource); | |
198 | extern http_status_t cupsGetFile(http_t *http, const char *resource, | |
199 | const char *filename); | |
200 | extern http_status_t cupsGetFd(http_t *http, const char *resource, int fd); | |
201 | extern http_status_t cupsPutFile(http_t *http, const char *resource, | |
202 | const char *filename); | |
203 | extern http_status_t cupsPutFd(http_t *http, const char *resource, int fd); | |
204 | ||
205 | /**** New in CUPS 1.1.21 ****/ | |
206 | extern const char *cupsGetDefault2(http_t *http); | |
207 | extern int cupsGetDests2(http_t *http, cups_dest_t **dests); | |
208 | extern int cupsGetJobs2(http_t *http, cups_job_t **jobs, | |
209 | const char *dest, int myjobs, | |
210 | int completed); | |
211 | extern const char *cupsGetPPD2(http_t *http, const char *printer); | |
212 | extern int cupsPrintFile2(http_t *http, const char *printer, | |
213 | const char *filename, | |
214 | const char *title, int num_options, | |
215 | cups_option_t *options); | |
216 | extern int cupsPrintFiles2(http_t *http, const char *printer, | |
217 | int num_files, const char **files, | |
218 | const char *title, int num_options, | |
219 | cups_option_t *options); | |
220 | extern int cupsSetDests2(http_t *http, int num_dests, | |
221 | cups_dest_t *dests); | |
222 | ||
223 | /**** New in CUPS 1.2 ****/ | |
ecdc0628 | 224 | extern ssize_t cupsBackChannelRead(char *buffer, size_t bytes, |
225 | double timeout); | |
226 | extern ssize_t cupsBackChannelWrite(const char *buffer, size_t bytes, | |
ef416fc2 | 227 | double timeout); |
228 | extern void cupsEncodeOptions2(ipp_t *ipp, int num_options, | |
229 | cups_option_t *options, | |
230 | ipp_tag_t group_tag); | |
231 | extern const char *cupsLastErrorString(void); | |
fa73b229 | 232 | extern char *cupsNotifySubject(cups_lang_t *lang, ipp_t *event); |
233 | extern char *cupsNotifyText(cups_lang_t *lang, ipp_t *event); | |
b423cd4c | 234 | extern int cupsRemoveOption(const char *name, int num_options, |
235 | cups_option_t **options); | |
ef416fc2 | 236 | extern cups_file_t *cupsTempFile2(char *filename, int len); |
237 | ||
f7deaa1a | 238 | /**** New in CUPS 1.3 ****/ |
b94498cf | 239 | extern ipp_t *cupsDoIORequest(http_t *http, ipp_t *request, |
240 | const char *resource, int infile, | |
241 | int outfile); | |
242 | extern char *cupsGetServerPPD(http_t *http, const char *name); | |
f7deaa1a | 243 | extern int cupsRemoveDest(const char *name, |
244 | const char *instance, | |
245 | int num_dests, cups_dest_t **dests); | |
246 | extern void cupsSetDefaultDest(const char *name, | |
247 | const char *instance, | |
248 | int num_dests, | |
249 | cups_dest_t *dests); | |
250 | ||
ef416fc2 | 251 | |
252 | # ifdef __cplusplus | |
253 | } | |
254 | # endif /* __cplusplus */ | |
255 | ||
256 | #endif /* !_CUPS_CUPS_H_ */ | |
257 | ||
258 | /* | |
db1f069b | 259 | * End of "$Id: cups.h 6946 2007-09-12 18:28:16Z mike $". |
ef416fc2 | 260 | */ |