]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
b86bc4cf | 2 | * "$Id: cups.h 6188 2007-01-10 16:23:06Z mike $" |
ef416fc2 | 3 | * |
4 | * API definitions for the Common UNIX Printing System (CUPS). | |
5 | * | |
b86bc4cf | 6 | * Copyright 1997-2007 by Easy Software Products. |
ef416fc2 | 7 | * |
8 | * These coded instructions, statements, and computer programs are the | |
9 | * property of Easy Software Products and are protected by Federal | |
10 | * copyright law. Distribution and use rights are outlined in the file | |
11 | * "LICENSE.txt" which should have been included with this file. If this | |
12 | * file is missing or damaged please contact Easy Software Products | |
13 | * at: | |
14 | * | |
15 | * Attn: CUPS Licensing Information | |
16 | * Easy Software Products | |
17 | * 44141 Airport View Drive, Suite 204 | |
18 | * Hollywood, Maryland 20636 USA | |
19 | * | |
20 | * Voice: (301) 373-9600 | |
21 | * EMail: cups-info@cups.org | |
22 | * WWW: http://www.cups.org | |
23 | * | |
24 | * This file is subject to the Apple OS-Developed Software exception. | |
25 | */ | |
26 | ||
27 | #ifndef _CUPS_CUPS_H_ | |
28 | # define _CUPS_CUPS_H_ | |
29 | ||
30 | /* | |
31 | * Include necessary headers... | |
32 | */ | |
33 | ||
b86bc4cf | 34 | # include <sys/types.h> |
35 | # if defined(WIN32) && !defined(__CUPS_SSIZE_T_DEFINED) | |
36 | # define __CUPS_SSIZE_T_DEFINED | |
37 | /* Windows does not support the ssize_t type, so map it to off_t... */ | |
38 | typedef off_t ssize_t; /* @private@ */ | |
39 | # endif /* WIN32 && !__CUPS_SSIZE_T_DEFINED */ | |
40 | ||
ef416fc2 | 41 | # include "ipp.h" |
42 | # include "ppd.h" | |
fa73b229 | 43 | # include "language.h" |
44 | ||
ef416fc2 | 45 | |
46 | /* | |
47 | * With GCC 3.0 and higher, we can mark old APIs "deprecated" so you get | |
fa73b229 | 48 | * a warning at compile-time. |
ef416fc2 | 49 | */ |
50 | ||
51 | # if defined(__GNUC__) && __GNUC__ > 2 | |
52 | # define _CUPS_DEPRECATED __attribute__ ((__deprecated__)) | |
53 | # else | |
54 | # define _CUPS_DEPRECATED | |
55 | # endif /* __GNUC__ && __GNUC__ > 2 */ | |
56 | ||
57 | ||
58 | /* | |
59 | * C++ magic... | |
60 | */ | |
61 | ||
62 | # ifdef __cplusplus | |
63 | extern "C" { | |
64 | # endif /* __cplusplus */ | |
65 | ||
66 | ||
67 | /* | |
68 | * Constants... | |
69 | */ | |
70 | ||
b86bc4cf | 71 | # define CUPS_VERSION 1.0208 |
ef416fc2 | 72 | # define CUPS_VERSION_MAJOR 1 |
f7faf1f5 | 73 | # define CUPS_VERSION_MINOR 2 |
b86bc4cf | 74 | # define CUPS_VERSION_PATCH 8 |
ef416fc2 | 75 | # define CUPS_DATE_ANY -1 |
76 | ||
77 | ||
78 | /* | |
79 | * Types and structures... | |
80 | */ | |
81 | ||
82 | typedef unsigned cups_ptype_t; /**** Printer Type/Capability Bits ****/ | |
83 | enum cups_ptype_e /* Not a typedef'd enum so we can OR */ | |
84 | { | |
85 | CUPS_PRINTER_LOCAL = 0x0000, /* Local printer or class */ | |
86 | CUPS_PRINTER_CLASS = 0x0001, /* Printer class */ | |
87 | CUPS_PRINTER_REMOTE = 0x0002, /* Remote printer or class */ | |
88 | CUPS_PRINTER_BW = 0x0004, /* Can do B&W printing */ | |
89 | CUPS_PRINTER_COLOR = 0x0008, /* Can do color printing */ | |
90 | CUPS_PRINTER_DUPLEX = 0x0010, /* Can do duplexing */ | |
91 | CUPS_PRINTER_STAPLE = 0x0020, /* Can staple output */ | |
92 | CUPS_PRINTER_COPIES = 0x0040, /* Can do copies */ | |
93 | CUPS_PRINTER_COLLATE = 0x0080, /* Can collage copies */ | |
94 | CUPS_PRINTER_PUNCH = 0x0100, /* Can punch output */ | |
95 | CUPS_PRINTER_COVER = 0x0200, /* Can cover output */ | |
96 | CUPS_PRINTER_BIND = 0x0400, /* Can bind output */ | |
97 | CUPS_PRINTER_SORT = 0x0800, /* Can sort output */ | |
98 | CUPS_PRINTER_SMALL = 0x1000, /* Can do Letter/Legal/A4 */ | |
99 | CUPS_PRINTER_MEDIUM = 0x2000, /* Can do Tabloid/B/C/A3/A2 */ | |
100 | CUPS_PRINTER_LARGE = 0x4000, /* Can do D/E/A1/A0 */ | |
101 | CUPS_PRINTER_VARIABLE = 0x8000, /* Can do variable sizes */ | |
102 | CUPS_PRINTER_IMPLICIT = 0x10000, /* Implicit class */ | |
103 | CUPS_PRINTER_DEFAULT = 0x20000, /* Default printer on network */ | |
104 | CUPS_PRINTER_FAX = 0x40000, /* Fax queue */ | |
105 | CUPS_PRINTER_REJECTING = 0x80000, /* Printer is rejecting jobs */ | |
106 | CUPS_PRINTER_DELETE = 0x100000, /* Delete printer @since CUPS 1.2@ */ | |
107 | CUPS_PRINTER_NOT_SHARED = 0x200000, /* Printer is not shared @since CUPS 1.2@ */ | |
108 | CUPS_PRINTER_AUTHENTICATED = 0x400000,/* Printer requires authentication @since CUPS 1.2@ */ | |
b423cd4c | 109 | CUPS_PRINTER_COMMANDS = 0x800000, /* Printer supports maintenance commands @since CUPS 1.2@ */ |
110 | CUPS_PRINTER_OPTIONS = 0xe6fffc /* ~(CLASS | REMOTE | IMPLICIT) */ | |
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 | ||
151 | extern int cupsCancelJob(const char *printer, int job); | |
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); | |
163 | extern const char *cupsGetPPD(const char *printer); | |
164 | extern int cupsGetPrinters(char ***printers) _CUPS_DEPRECATED; | |
165 | extern ipp_status_t cupsLastError(void); | |
166 | extern int cupsPrintFile(const char *printer, const char *filename, | |
167 | const char *title, int num_options, | |
168 | cups_option_t *options); | |
169 | extern int cupsPrintFiles(const char *printer, int num_files, | |
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, | |
205 | const char *resource); | |
206 | extern http_status_t cupsGetFile(http_t *http, const char *resource, | |
207 | const char *filename); | |
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, | |
210 | const char *filename); | |
211 | extern http_status_t cupsPutFd(http_t *http, const char *resource, int fd); | |
212 | ||
213 | /**** New in CUPS 1.1.21 ****/ | |
214 | extern const char *cupsGetDefault2(http_t *http); | |
215 | extern int cupsGetDests2(http_t *http, cups_dest_t **dests); | |
216 | extern int cupsGetJobs2(http_t *http, cups_job_t **jobs, | |
217 | const char *dest, int myjobs, | |
218 | int completed); | |
219 | extern const char *cupsGetPPD2(http_t *http, const char *printer); | |
220 | extern int cupsPrintFile2(http_t *http, const char *printer, | |
221 | const char *filename, | |
222 | const char *title, int num_options, | |
223 | cups_option_t *options); | |
224 | extern int cupsPrintFiles2(http_t *http, const char *printer, | |
225 | int num_files, const char **files, | |
226 | const char *title, int num_options, | |
227 | cups_option_t *options); | |
228 | extern int cupsSetDests2(http_t *http, int num_dests, | |
229 | cups_dest_t *dests); | |
230 | ||
231 | /**** New in CUPS 1.2 ****/ | |
ecdc0628 | 232 | extern ssize_t cupsBackChannelRead(char *buffer, size_t bytes, |
233 | double timeout); | |
234 | extern ssize_t cupsBackChannelWrite(const char *buffer, size_t bytes, | |
ef416fc2 | 235 | double timeout); |
236 | extern void cupsEncodeOptions2(ipp_t *ipp, int num_options, | |
237 | cups_option_t *options, | |
238 | ipp_tag_t group_tag); | |
239 | extern const char *cupsLastErrorString(void); | |
fa73b229 | 240 | extern char *cupsNotifySubject(cups_lang_t *lang, ipp_t *event); |
241 | extern char *cupsNotifyText(cups_lang_t *lang, ipp_t *event); | |
b423cd4c | 242 | extern int cupsRemoveOption(const char *name, int num_options, |
243 | cups_option_t **options); | |
ef416fc2 | 244 | extern cups_file_t *cupsTempFile2(char *filename, int len); |
245 | ||
246 | ||
247 | # ifdef __cplusplus | |
248 | } | |
249 | # endif /* __cplusplus */ | |
250 | ||
251 | #endif /* !_CUPS_CUPS_H_ */ | |
252 | ||
253 | /* | |
b86bc4cf | 254 | * End of "$Id: cups.h 6188 2007-01-10 16:23:06Z mike $". |
ef416fc2 | 255 | */ |