2 * "$Id: cups.h 6092 2006-11-14 16:36:36Z mike $"
4 * API definitions for the Common UNIX Printing System (CUPS).
6 * Copyright 1997-2006 by Easy Software Products.
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
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
17 * 44141 Airport View Drive, Suite 204
18 * Hollywood, Maryland 20636 USA
20 * Voice: (301) 373-9600
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
24 * This file is subject to the Apple OS-Developed Software exception.
28 # define _CUPS_CUPS_H_
31 * Include necessary headers...
36 # include "language.h"
40 * With GCC 3.0 and higher, we can mark old APIs "deprecated" so you get
41 * a warning at compile-time.
44 # if defined(__GNUC__) && __GNUC__ > 2
45 # define _CUPS_DEPRECATED __attribute__ ((__deprecated__))
47 # define _CUPS_DEPRECATED
48 # endif /* __GNUC__ && __GNUC__ > 2 */
57 # endif /* __cplusplus */
64 # define CUPS_VERSION 1.0207
65 # define CUPS_VERSION_MAJOR 1
66 # define CUPS_VERSION_MINOR 2
67 # define CUPS_VERSION_PATCH 7
68 # define CUPS_DATE_ANY -1
72 * Types and structures...
75 typedef unsigned cups_ptype_t
; /**** Printer Type/Capability Bits ****/
76 enum cups_ptype_e
/* Not a typedef'd enum so we can OR */
78 CUPS_PRINTER_LOCAL
= 0x0000, /* Local printer or class */
79 CUPS_PRINTER_CLASS
= 0x0001, /* Printer class */
80 CUPS_PRINTER_REMOTE
= 0x0002, /* Remote printer or class */
81 CUPS_PRINTER_BW
= 0x0004, /* Can do B&W printing */
82 CUPS_PRINTER_COLOR
= 0x0008, /* Can do color printing */
83 CUPS_PRINTER_DUPLEX
= 0x0010, /* Can do duplexing */
84 CUPS_PRINTER_STAPLE
= 0x0020, /* Can staple output */
85 CUPS_PRINTER_COPIES
= 0x0040, /* Can do copies */
86 CUPS_PRINTER_COLLATE
= 0x0080, /* Can collage copies */
87 CUPS_PRINTER_PUNCH
= 0x0100, /* Can punch output */
88 CUPS_PRINTER_COVER
= 0x0200, /* Can cover output */
89 CUPS_PRINTER_BIND
= 0x0400, /* Can bind output */
90 CUPS_PRINTER_SORT
= 0x0800, /* Can sort output */
91 CUPS_PRINTER_SMALL
= 0x1000, /* Can do Letter/Legal/A4 */
92 CUPS_PRINTER_MEDIUM
= 0x2000, /* Can do Tabloid/B/C/A3/A2 */
93 CUPS_PRINTER_LARGE
= 0x4000, /* Can do D/E/A1/A0 */
94 CUPS_PRINTER_VARIABLE
= 0x8000, /* Can do variable sizes */
95 CUPS_PRINTER_IMPLICIT
= 0x10000, /* Implicit class */
96 CUPS_PRINTER_DEFAULT
= 0x20000, /* Default printer on network */
97 CUPS_PRINTER_FAX
= 0x40000, /* Fax queue */
98 CUPS_PRINTER_REJECTING
= 0x80000, /* Printer is rejecting jobs */
99 CUPS_PRINTER_DELETE
= 0x100000, /* Delete printer @since CUPS 1.2@ */
100 CUPS_PRINTER_NOT_SHARED
= 0x200000, /* Printer is not shared @since CUPS 1.2@ */
101 CUPS_PRINTER_AUTHENTICATED
= 0x400000,/* Printer requires authentication @since CUPS 1.2@ */
102 CUPS_PRINTER_COMMANDS
= 0x800000, /* Printer supports maintenance commands @since CUPS 1.2@ */
103 CUPS_PRINTER_OPTIONS
= 0xe6fffc /* ~(CLASS | REMOTE | IMPLICIT) */
106 typedef const char *(*cups_password_cb_t
)(const char *);
107 /**** Password callback ****/
109 typedef struct cups_option_s
/**** Printer Options ****/
111 char *name
; /* Name of option */
112 char *value
; /* Value of option */
115 typedef struct cups_dest_s
/**** Destination ****/
117 char *name
, /* Printer or class name */
118 *instance
; /* Local instance name or NULL */
119 int is_default
; /* Is this printer the default? */
120 int num_options
; /* Number of options */
121 cups_option_t
*options
; /* Options */
124 typedef struct cups_job_s
/**** Job ****/
126 int id
; /* The job ID */
127 char *dest
; /* Printer or class name */
128 char *title
; /* Title/job name */
129 char *user
; /* User the submitted the job */
130 char *format
; /* Document format */
131 ipp_jstate_t state
; /* Job state */
132 int size
; /* Size in kilobytes */
133 int priority
; /* Priority (1-100) */
134 time_t completed_time
; /* Time the job was completed */
135 time_t creation_time
; /* Time the job was created */
136 time_t processing_time
; /* Time the job was processed */
144 extern int cupsCancelJob(const char *printer
, int job
);
145 extern ipp_t
*cupsDoFileRequest(http_t
*http
, ipp_t
*request
,
146 const char *resource
,
147 const char *filename
);
148 extern ipp_t
*cupsDoRequest(http_t
*http
, ipp_t
*request
,
149 const char *resource
);
150 extern http_encryption_t
cupsEncryption(void);
151 extern void cupsFreeJobs(int num_jobs
, cups_job_t
*jobs
);
152 extern int cupsGetClasses(char ***classes
) _CUPS_DEPRECATED
;
153 extern const char *cupsGetDefault(void);
154 extern int cupsGetJobs(cups_job_t
**jobs
, const char *dest
,
155 int myjobs
, int completed
);
156 extern const char *cupsGetPPD(const char *printer
);
157 extern int cupsGetPrinters(char ***printers
) _CUPS_DEPRECATED
;
158 extern ipp_status_t
cupsLastError(void);
159 extern int cupsPrintFile(const char *printer
, const char *filename
,
160 const char *title
, int num_options
,
161 cups_option_t
*options
);
162 extern int cupsPrintFiles(const char *printer
, int num_files
,
163 const char **files
, const char *title
,
164 int num_options
, cups_option_t
*options
);
165 extern char *cupsTempFile(char *filename
, int len
) _CUPS_DEPRECATED
;
166 extern int cupsTempFd(char *filename
, int len
);
168 extern int cupsAddDest(const char *name
, const char *instance
,
169 int num_dests
, cups_dest_t
**dests
);
170 extern void cupsFreeDests(int num_dests
, cups_dest_t
*dests
);
171 extern cups_dest_t
*cupsGetDest(const char *name
, const char *instance
,
172 int num_dests
, cups_dest_t
*dests
);
173 extern int cupsGetDests(cups_dest_t
**dests
);
174 extern void cupsSetDests(int num_dests
, cups_dest_t
*dests
);
176 extern int cupsAddOption(const char *name
, const char *value
,
177 int num_options
, cups_option_t
**options
);
178 extern void cupsEncodeOptions(ipp_t
*ipp
, int num_options
,
179 cups_option_t
*options
);
180 extern void cupsFreeOptions(int num_options
, cups_option_t
*options
);
181 extern const char *cupsGetOption(const char *name
, int num_options
,
182 cups_option_t
*options
);
183 extern int cupsMarkOptions(ppd_file_t
*ppd
, int num_options
,
184 cups_option_t
*options
);
185 extern int cupsParseOptions(const char *arg
, int num_options
,
186 cups_option_t
**options
);
188 extern const char *cupsGetPassword(const char *prompt
);
189 extern const char *cupsServer(void);
190 extern void cupsSetEncryption(http_encryption_t e
);
191 extern void cupsSetPasswordCB(cups_password_cb_t cb
);
192 extern void cupsSetServer(const char *server
);
193 extern void cupsSetUser(const char *user
);
194 extern const char *cupsUser(void);
196 /**** New in CUPS 1.1.20 ****/
197 extern int cupsDoAuthentication(http_t
*http
, const char *method
,
198 const char *resource
);
199 extern http_status_t
cupsGetFile(http_t
*http
, const char *resource
,
200 const char *filename
);
201 extern http_status_t
cupsGetFd(http_t
*http
, const char *resource
, int fd
);
202 extern http_status_t
cupsPutFile(http_t
*http
, const char *resource
,
203 const char *filename
);
204 extern http_status_t
cupsPutFd(http_t
*http
, const char *resource
, int fd
);
206 /**** New in CUPS 1.1.21 ****/
207 extern const char *cupsGetDefault2(http_t
*http
);
208 extern int cupsGetDests2(http_t
*http
, cups_dest_t
**dests
);
209 extern int cupsGetJobs2(http_t
*http
, cups_job_t
**jobs
,
210 const char *dest
, int myjobs
,
212 extern const char *cupsGetPPD2(http_t
*http
, const char *printer
);
213 extern int cupsPrintFile2(http_t
*http
, const char *printer
,
214 const char *filename
,
215 const char *title
, int num_options
,
216 cups_option_t
*options
);
217 extern int cupsPrintFiles2(http_t
*http
, const char *printer
,
218 int num_files
, const char **files
,
219 const char *title
, int num_options
,
220 cups_option_t
*options
);
221 extern int cupsSetDests2(http_t
*http
, int num_dests
,
224 /**** New in CUPS 1.2 ****/
225 extern ssize_t
cupsBackChannelRead(char *buffer
, size_t bytes
,
227 extern ssize_t
cupsBackChannelWrite(const char *buffer
, size_t bytes
,
229 extern void cupsEncodeOptions2(ipp_t
*ipp
, int num_options
,
230 cups_option_t
*options
,
231 ipp_tag_t group_tag
);
232 extern const char *cupsLastErrorString(void);
233 extern char *cupsNotifySubject(cups_lang_t
*lang
, ipp_t
*event
);
234 extern char *cupsNotifyText(cups_lang_t
*lang
, ipp_t
*event
);
235 extern int cupsRemoveOption(const char *name
, int num_options
,
236 cups_option_t
**options
);
237 extern cups_file_t
*cupsTempFile2(char *filename
, int len
);
242 # endif /* __cplusplus */
244 #endif /* !_CUPS_CUPS_H_ */
247 * End of "$Id: cups.h 6092 2006-11-14 16:36:36Z mike $".