Imported Upstream version 2.2.1
[platform/upstream/cups.git] / cups / cups.h
1 /*
2  * API definitions for CUPS.
3  *
4  * Copyright 2007-2016 by Apple Inc.
5  * Copyright 1997-2007 by Easy Software Products.
6  *
7  * These coded instructions, statements, and computer programs are the
8  * property of Apple Inc. and are protected by Federal copyright
9  * law.  Distribution and use rights are outlined in the file "LICENSE.txt"
10  * which should have been included with this file.  If this file is
11  * file is missing or damaged, see the license at "http://www.cups.org/".
12  *
13  * This file is subject to the Apple OS-Developed Software exception.
14  */
15
16 #ifndef _CUPS_CUPS_H_
17 #  define _CUPS_CUPS_H_
18
19 /*
20  * Include necessary headers...
21  */
22
23 #  include <sys/types.h>
24 #  if defined(WIN32) && !defined(__CUPS_SSIZE_T_DEFINED)
25 #    define __CUPS_SSIZE_T_DEFINED
26 #    include <stddef.h>
27 /* Windows does not support the ssize_t type, so map it to long... */
28 typedef long ssize_t;                   /* @private@ */
29 #  endif /* WIN32 && !__CUPS_SSIZE_T_DEFINED */
30
31 #  include "file.h"
32 #  include "ipp.h"
33 #  include "language.h"
34 #  include "pwg.h"
35
36
37 /*
38  * C++ magic...
39  */
40
41 #  ifdef __cplusplus
42 extern "C" {
43 #  endif /* __cplusplus */
44
45
46 /*
47  * Constants...
48  */
49
50 #  define CUPS_VERSION                  2.0201
51 #  define CUPS_VERSION_MAJOR            2
52 #  define CUPS_VERSION_MINOR            2
53 #  define CUPS_VERSION_PATCH            1
54
55 #  define CUPS_BC_FD                    3
56                                         /* Back-channel file descriptor for
57                                          * select/poll */
58 #  define CUPS_DATE_ANY                 (time_t)-1
59 #  define CUPS_EXCLUDE_NONE             (const char *)0
60 #  define CUPS_FORMAT_AUTO              "application/octet-stream"
61 #  define CUPS_FORMAT_COMMAND           "application/vnd.cups-command"
62 #  define CUPS_FORMAT_JPEG              "image/jpeg"
63 #  define CUPS_FORMAT_PDF               "application/pdf"
64 #  define CUPS_FORMAT_POSTSCRIPT        "application/postscript"
65 #  define CUPS_FORMAT_RAW               "application/vnd.cups-raw"
66 #  define CUPS_FORMAT_TEXT              "text/plain"
67 #  define CUPS_HTTP_DEFAULT             (http_t *)0
68 #  define CUPS_INCLUDE_ALL              (const char *)0
69 #  define CUPS_JOBID_ALL                -1
70 #  define CUPS_JOBID_CURRENT            0
71 #  define CUPS_LENGTH_VARIABLE          (ssize_t)0
72 #  define CUPS_TIMEOUT_DEFAULT          0
73 #  define CUPS_WHICHJOBS_ALL            -1
74 #  define CUPS_WHICHJOBS_ACTIVE         0
75 #  define CUPS_WHICHJOBS_COMPLETED      1
76
77 /* Flags for cupsConnectDest and cupsEnumDests */
78 #  define CUPS_DEST_FLAGS_NONE          0x00
79                                         /* No flags are set */
80 #  define CUPS_DEST_FLAGS_UNCONNECTED   0x01
81                                         /* There is not connection */
82 #  define CUPS_DEST_FLAGS_MORE          0x02
83                                         /* There are more destinations */
84 #  define CUPS_DEST_FLAGS_REMOVED       0x04
85                                         /* The destination has gone away */
86 #  define CUPS_DEST_FLAGS_ERROR         0x08
87                                         /* An error occurred */
88 #  define CUPS_DEST_FLAGS_RESOLVING     0x10
89                                         /* The destination address is being
90                                          * resolved */
91 #  define CUPS_DEST_FLAGS_CONNECTING    0x20
92                                         /* A connection is being established */
93 #  define CUPS_DEST_FLAGS_CANCELED      0x40
94                                         /* Operation was canceled */
95
96 /* Flags for cupsGetDestMediaByName/Size */
97 #  define CUPS_MEDIA_FLAGS_DEFAULT      0x00
98                                         /* Find the closest size supported by
99                                          * the printer */
100 #  define CUPS_MEDIA_FLAGS_BORDERLESS   0x01
101                                         /* Find a borderless size */
102 #  define CUPS_MEDIA_FLAGS_DUPLEX       0x02
103                                         /* Find a size compatible with 2-sided
104                                          * printing */
105 #  define CUPS_MEDIA_FLAGS_EXACT        0x04
106                                         /* Find an exact match for the size */
107 #  define CUPS_MEDIA_FLAGS_READY        0x08
108                                         /* If the printer supports media
109                                          * sensing, find the size amongst the
110                                          * "ready" media. */
111
112 /* Options and values */
113 #  define CUPS_COPIES                   "copies"
114 #  define CUPS_COPIES_SUPPORTED         "copies-supported"
115
116 #  define CUPS_FINISHINGS               "finishings"
117 #  define CUPS_FINISHINGS_SUPPORTED     "finishings-supported"
118
119 #  define CUPS_FINISHINGS_BIND          "7"
120 #  define CUPS_FINISHINGS_COVER         "6"
121 #  define CUPS_FINISHINGS_FOLD          "10"
122 #  define CUPS_FINISHINGS_NONE          "3"
123 #  define CUPS_FINISHINGS_PUNCH         "5"
124 #  define CUPS_FINISHINGS_STAPLE        "4"
125 #  define CUPS_FINISHINGS_TRIM          "11"
126
127 #  define CUPS_MEDIA                    "media"
128 #  define CUPS_MEDIA_READY              "media-ready"
129 #  define CUPS_MEDIA_SUPPORTED          "media-supported"
130
131 #  define CUPS_MEDIA_3X5                "na_index-3x5_3x5in"
132 #  define CUPS_MEDIA_4X6                "na_index-4x6_4x6in"
133 #  define CUPS_MEDIA_5X7                "na_5x7_5x7in"
134 #  define CUPS_MEDIA_8X10               "na_govt-letter_8x10in"
135 #  define CUPS_MEDIA_A3                 "iso_a3_297x420mm"
136 #  define CUPS_MEDIA_A4                 "iso_a4_210x297mm"
137 #  define CUPS_MEDIA_A5                 "iso_a5_148x210mm"
138 #  define CUPS_MEDIA_A6                 "iso_a6_105x148mm"
139 #  define CUPS_MEDIA_ENV10              "na_number-10_4.125x9.5in"
140 #  define CUPS_MEDIA_ENVDL              "iso_dl_110x220mm"
141 #  define CUPS_MEDIA_LEGAL              "na_legal_8.5x14in"
142 #  define CUPS_MEDIA_LETTER             "na_letter_8.5x11in"
143 #  define CUPS_MEDIA_PHOTO_L            "oe_photo-l_3.5x5in"
144 #  define CUPS_MEDIA_SUPERBA3           "na_super-b_13x19in"
145 #  define CUPS_MEDIA_TABLOID            "na_ledger_11x17in"
146
147 #  define CUPS_MEDIA_SOURCE             "media-source"
148 #  define CUPS_MEDIA_SOURCE_SUPPORTED   "media-source-supported"
149
150 #  define CUPS_MEDIA_SOURCE_AUTO        "auto"
151 #  define CUPS_MEDIA_SOURCE_MANUAL      "manual"
152
153 #  define CUPS_MEDIA_TYPE               "media-type"
154 #  define CUPS_MEDIA_TYPE_SUPPORTED     "media-type-supported"
155
156 #  define CUPS_MEDIA_TYPE_AUTO          "auto"
157 #  define CUPS_MEDIA_TYPE_ENVELOPE      "envelope"
158 #  define CUPS_MEDIA_TYPE_LABELS        "labels"
159 #  define CUPS_MEDIA_TYPE_LETTERHEAD    "stationery-letterhead"
160 #  define CUPS_MEDIA_TYPE_PHOTO         "photographic"
161 #  define CUPS_MEDIA_TYPE_PHOTO_GLOSSY  "photographic-glossy"
162 #  define CUPS_MEDIA_TYPE_PHOTO_MATTE   "photographic-matte"
163 #  define CUPS_MEDIA_TYPE_PLAIN         "stationery"
164 #  define CUPS_MEDIA_TYPE_TRANSPARENCY  "transparency"
165
166 #  define CUPS_NUMBER_UP                "number-up"
167 #  define CUPS_NUMBER_UP_SUPPORTED      "number-up-supported"
168
169 #  define CUPS_ORIENTATION              "orientation-requested"
170 #  define CUPS_ORIENTATION_SUPPORTED    "orientation-requested-supported"
171
172 #  define CUPS_ORIENTATION_PORTRAIT     "3"
173 #  define CUPS_ORIENTATION_LANDSCAPE    "4"
174
175 #  define CUPS_PRINT_COLOR_MODE         "print-color-mode"
176 #  define CUPS_PRINT_COLOR_MODE_SUPPORTED "print-color-mode-supported"
177
178 #  define CUPS_PRINT_COLOR_MODE_AUTO    "auto"
179 #  define CUPS_PRINT_COLOR_MODE_MONOCHROME "monochrome"
180 #  define CUPS_PRINT_COLOR_MODE_COLOR   "color"
181
182 #  define CUPS_PRINT_QUALITY            "print-quality"
183 #  define CUPS_PRINT_QUALITY_SUPPORTED  "print-quality-supported"
184
185 #  define CUPS_PRINT_QUALITY_DRAFT      "3"
186 #  define CUPS_PRINT_QUALITY_NORMAL     "4"
187 #  define CUPS_PRINT_QUALITY_HIGH       "5"
188
189 #  define CUPS_SIDES                    "sides"
190 #  define CUPS_SIDES_SUPPORTED          "sides-supported"
191
192 #  define CUPS_SIDES_ONE_SIDED          "one-sided"
193 #  define CUPS_SIDES_TWO_SIDED_PORTRAIT "two-sided-long-edge"
194 #  define CUPS_SIDES_TWO_SIDED_LANDSCAPE "two-sided-short-edge"
195
196
197 /*
198  * Types and structures...
199  */
200
201 typedef unsigned cups_ptype_t;          /* Printer type/capability bits */
202 enum cups_ptype_e                       /* Printer type/capability bit
203                                          * constants */
204 {                                       /* Not a typedef'd enum so we can OR */
205   CUPS_PRINTER_LOCAL = 0x0000,          /* Local printer or class */
206   CUPS_PRINTER_CLASS = 0x0001,          /* Printer class */
207   CUPS_PRINTER_REMOTE = 0x0002,         /* Remote printer or class */
208   CUPS_PRINTER_BW = 0x0004,             /* Can do B&W printing */
209   CUPS_PRINTER_COLOR = 0x0008,          /* Can do color printing */
210   CUPS_PRINTER_DUPLEX = 0x0010,         /* Can do duplexing */
211   CUPS_PRINTER_STAPLE = 0x0020,         /* Can staple output */
212   CUPS_PRINTER_COPIES = 0x0040,         /* Can do copies */
213   CUPS_PRINTER_COLLATE = 0x0080,        /* Can collage copies */
214   CUPS_PRINTER_PUNCH = 0x0100,          /* Can punch output */
215   CUPS_PRINTER_COVER = 0x0200,          /* Can cover output */
216   CUPS_PRINTER_BIND = 0x0400,           /* Can bind output */
217   CUPS_PRINTER_SORT = 0x0800,           /* Can sort output */
218   CUPS_PRINTER_SMALL = 0x1000,          /* Can do Letter/Legal/A4 */
219   CUPS_PRINTER_MEDIUM = 0x2000,         /* Can do Tabloid/B/C/A3/A2 */
220   CUPS_PRINTER_LARGE = 0x4000,          /* Can do D/E/A1/A0 */
221   CUPS_PRINTER_VARIABLE = 0x8000,       /* Can do variable sizes */
222   CUPS_PRINTER_IMPLICIT = 0x10000,      /* Implicit class @private@
223                                          * @since Deprecated@ */
224   CUPS_PRINTER_DEFAULT = 0x20000,       /* Default printer on network */
225   CUPS_PRINTER_FAX = 0x40000,           /* Fax queue */
226   CUPS_PRINTER_REJECTING = 0x80000,     /* Printer is rejecting jobs */
227   CUPS_PRINTER_DELETE = 0x100000,       /* Delete printer
228                                          * @since CUPS 1.2/macOS 10.5@ */
229   CUPS_PRINTER_NOT_SHARED = 0x200000,   /* Printer is not shared
230                                          * @since CUPS 1.2/macOS 10.5@ */
231   CUPS_PRINTER_AUTHENTICATED = 0x400000,/* Printer requires authentication
232                                          * @since CUPS 1.2/macOS 10.5@ */
233   CUPS_PRINTER_COMMANDS = 0x800000,     /* Printer supports maintenance commands
234                                          * @since CUPS 1.2/macOS 10.5@ */
235   CUPS_PRINTER_DISCOVERED = 0x1000000,  /* Printer was automatically discovered
236                                          * and added @private@
237                                          * @since Deprecated@ */
238   CUPS_PRINTER_SCANNER = 0x2000000,     /* Scanner-only device
239                                          * @since CUPS 1.4/macOS 10.6@ */
240   CUPS_PRINTER_MFP = 0x4000000,         /* Printer with scanning capabilities
241                                          * @since CUPS 1.4/macOS 10.6@ */
242   CUPS_PRINTER_3D = 0x8000000,          /* Printer with 3D capabilities @since CUPS 2.1@ */
243   CUPS_PRINTER_OPTIONS = 0x6fffc        /* ~(CLASS | REMOTE | IMPLICIT |
244                                          * DEFAULT | FAX | REJECTING | DELETE |
245                                          * NOT_SHARED | AUTHENTICATED |
246                                          * COMMANDS | DISCOVERED) @private@ */
247 };
248
249 typedef struct cups_option_s            /**** Printer Options ****/
250 {
251   char          *name;                  /* Name of option */
252   char          *value;                 /* Value of option */
253 } cups_option_t;
254
255 typedef struct cups_dest_s              /**** Destination ****/
256 {
257   char          *name,                  /* Printer or class name */
258                 *instance;              /* Local instance name or NULL */
259   int           is_default;             /* Is this printer the default? */
260   int           num_options;            /* Number of options */
261   cups_option_t *options;               /* Options */
262 } cups_dest_t;
263
264 typedef struct _cups_dinfo_s cups_dinfo_t;
265                                         /* Destination capability and status
266                                          * information @since CUPS 1.6/macOS 10.8@ */
267
268 typedef struct cups_job_s               /**** Job ****/
269 {
270   int           id;                     /* The job ID */
271   char          *dest;                  /* Printer or class name */
272   char          *title;                 /* Title/job name */
273   char          *user;                  /* User the submitted the job */
274   char          *format;                /* Document format */
275   ipp_jstate_t  state;                  /* Job state */
276   int           size;                   /* Size in kilobytes */
277   int           priority;               /* Priority (1-100) */
278   time_t        completed_time;         /* Time the job was completed */
279   time_t        creation_time;          /* Time the job was created */
280   time_t        processing_time;        /* Time the job was processed */
281 } cups_job_t;
282
283 typedef struct cups_size_s              /**** Media Size @since CUPS 1.6/macOS 10.8@ ****/
284 {
285   char          media[128];             /* Media name to use */
286   int           width,                  /* Width in hundredths of millimeters */
287                 length,                 /* Length in hundredths of
288                                          * millimeters */
289                 bottom,                 /* Bottom margin in hundredths of
290                                          * millimeters */
291                 left,                   /* Left margin in hundredths of
292                                          * millimeters */
293                 right,                  /* Right margin in hundredths of
294                                          * millimeters */
295                 top;                    /* Top margin in hundredths of
296                                          * millimeters */
297 } cups_size_t;
298
299 typedef int (*cups_client_cert_cb_t)(http_t *http, void *tls,
300                                      cups_array_t *distinguished_names,
301                                      void *user_data);
302                                         /* Client credentials callback
303                                          * @since CUPS 1.5/macOS 10.7@ */
304
305 typedef int (*cups_dest_cb_t)(void *user_data, unsigned flags,
306                               cups_dest_t *dest);
307                                         /* Destination enumeration callback
308                                          * @since CUPS 1.6/macOS 10.8@ */
309
310 #  ifdef __BLOCKS__
311 typedef int (^cups_dest_block_t)(unsigned flags, cups_dest_t *dest);
312                                         /* Destination enumeration block
313                                          * @since CUPS 1.6/macOS 10.8@ */
314 #  endif /* __BLOCKS__ */
315
316 typedef const char *(*cups_password_cb_t)(const char *prompt);
317                                         /* Password callback */
318
319 typedef const char *(*cups_password_cb2_t)(const char *prompt, http_t *http,
320                                            const char *method,
321                                            const char *resource,
322                                            void *user_data);
323                                         /* New password callback
324                                          * @since CUPS 1.4/macOS 10.6@ */
325
326 typedef int (*cups_server_cert_cb_t)(http_t *http, void *tls,
327                                      cups_array_t *certs, void *user_data);
328                                         /* Server credentials callback
329                                          * @since CUPS 1.5/macOS 10.7@ */
330
331
332 /*
333  * Functions...
334  */
335
336 extern int              cupsCancelJob(const char *name, int job_id);
337 extern ipp_t            *cupsDoFileRequest(http_t *http, ipp_t *request,
338                                            const char *resource,
339                                            const char *filename);
340 extern ipp_t            *cupsDoRequest(http_t *http, ipp_t *request,
341                                        const char *resource);
342 extern http_encryption_t cupsEncryption(void);
343 extern void             cupsFreeJobs(int num_jobs, cups_job_t *jobs);
344 extern int              cupsGetClasses(char ***classes) _CUPS_DEPRECATED_MSG("Use cupsGetDests instead.");
345 extern const char       *cupsGetDefault(void);
346 extern int              cupsGetJobs(cups_job_t **jobs, const char *name,
347                                     int myjobs, int whichjobs);
348 extern int              cupsGetPrinters(char ***printers) _CUPS_DEPRECATED_MSG("Use cupsGetDests instead.");
349 extern ipp_status_t     cupsLastError(void);
350 extern int              cupsPrintFile(const char *name, const char *filename,
351                                       const char *title, int num_options,
352                                       cups_option_t *options);
353 extern int              cupsPrintFiles(const char *name, int num_files,
354                                        const char **files, const char *title,
355                                        int num_options, cups_option_t *options);
356 extern char             *cupsTempFile(char *filename, int len) _CUPS_DEPRECATED_MSG("Use cupsTempFd or cupsTempFile2 instead.");
357 extern int              cupsTempFd(char *filename, int len);
358
359 extern int              cupsAddDest(const char *name, const char *instance,
360                                     int num_dests, cups_dest_t **dests);
361 extern void             cupsFreeDests(int num_dests, cups_dest_t *dests);
362 extern cups_dest_t      *cupsGetDest(const char *name, const char *instance,
363                                      int num_dests, cups_dest_t *dests);
364 extern int              cupsGetDests(cups_dest_t **dests);
365 extern void             cupsSetDests(int num_dests, cups_dest_t *dests);
366
367 extern int              cupsAddOption(const char *name, const char *value,
368                                       int num_options, cups_option_t **options);
369 extern void             cupsEncodeOptions(ipp_t *ipp, int num_options,
370                                           cups_option_t *options);
371 extern void             cupsFreeOptions(int num_options,
372                                         cups_option_t *options);
373 extern const char       *cupsGetOption(const char *name, int num_options,
374                                        cups_option_t *options);
375 extern int              cupsParseOptions(const char *arg, int num_options,
376                                          cups_option_t **options);
377
378 extern const char       *cupsGetPassword(const char *prompt);
379 extern const char       *cupsServer(void);
380 extern void             cupsSetEncryption(http_encryption_t e);
381 extern void             cupsSetPasswordCB(cups_password_cb_t cb);
382 extern void             cupsSetServer(const char *server);
383 extern void             cupsSetUser(const char *user);
384 extern const char       *cupsUser(void);
385
386 /**** New in CUPS 1.1.20 ****/
387 extern int              cupsDoAuthentication(http_t *http, const char *method,
388                                              const char *resource)
389                                              _CUPS_API_1_1_20;
390 extern http_status_t    cupsGetFile(http_t *http, const char *resource,
391                                     const char *filename) _CUPS_API_1_1_20;
392 extern http_status_t    cupsGetFd(http_t *http, const char *resource, int fd);
393 extern http_status_t    cupsPutFile(http_t *http, const char *resource,
394                                     const char *filename) _CUPS_API_1_1_20;
395 extern http_status_t    cupsPutFd(http_t *http, const char *resource, int fd)
396                                   _CUPS_API_1_1_20;
397
398 /**** New in CUPS 1.1.21 ****/
399 extern const char       *cupsGetDefault2(http_t *http) _CUPS_API_1_1_21;
400 extern int              cupsGetDests2(http_t *http, cups_dest_t **dests)
401                                       _CUPS_API_1_1_21;
402 extern int              cupsGetJobs2(http_t *http, cups_job_t **jobs,
403                                      const char *name, int myjobs,
404                                      int whichjobs) _CUPS_API_1_1_21;
405 extern int              cupsPrintFile2(http_t *http, const char *name,
406                                        const char *filename,
407                                        const char *title, int num_options,
408                                        cups_option_t *options) _CUPS_API_1_1_21;
409 extern int              cupsPrintFiles2(http_t *http, const char *name,
410                                         int num_files, const char **files,
411                                         const char *title, int num_options,
412                                         cups_option_t *options)
413                                         _CUPS_API_1_1_21;
414 extern int              cupsSetDests2(http_t *http, int num_dests,
415                                       cups_dest_t *dests) _CUPS_API_1_1_21;
416
417 /**** New in CUPS 1.2/macOS 10.5 ****/
418 extern ssize_t          cupsBackChannelRead(char *buffer, size_t bytes,
419                                             double timeout) _CUPS_API_1_2;
420 extern ssize_t          cupsBackChannelWrite(const char *buffer, size_t bytes,
421                                              double timeout) _CUPS_API_1_2;
422 extern void             cupsEncodeOptions2(ipp_t *ipp, int num_options,
423                                            cups_option_t *options,
424                                            ipp_tag_t group_tag) _CUPS_API_1_2;
425 extern const char       *cupsLastErrorString(void) _CUPS_API_1_2;
426 extern char             *cupsNotifySubject(cups_lang_t *lang, ipp_t *event)
427                                            _CUPS_API_1_2;
428 extern char             *cupsNotifyText(cups_lang_t *lang, ipp_t *event)
429                                         _CUPS_API_1_2;
430 extern int              cupsRemoveOption(const char *name, int num_options,
431                                          cups_option_t **options) _CUPS_API_1_2;
432 extern cups_file_t      *cupsTempFile2(char *filename, int len) _CUPS_API_1_2;
433
434 /**** New in CUPS 1.3/macOS 10.5 ****/
435 extern ipp_t            *cupsDoIORequest(http_t *http, ipp_t *request,
436                                          const char *resource, int infile,
437                                          int outfile) _CUPS_API_1_3;
438 extern int              cupsRemoveDest(const char *name,
439                                        const char *instance,
440                                        int num_dests, cups_dest_t **dests)
441                                        _CUPS_API_1_3;
442 extern void             cupsSetDefaultDest(const char *name,
443                                            const char *instance,
444                                            int num_dests,
445                                            cups_dest_t *dests) _CUPS_API_1_3;
446
447 /**** New in CUPS 1.4/macOS 10.6 ****/
448 extern ipp_status_t     cupsCancelJob2(http_t *http, const char *name,
449                                        int job_id, int purge) _CUPS_API_1_4;
450 extern int              cupsCreateJob(http_t *http, const char *name,
451                                       const char *title, int num_options,
452                                       cups_option_t *options) _CUPS_API_1_4;
453 extern ipp_status_t     cupsFinishDocument(http_t *http,
454                                            const char *name) _CUPS_API_1_4;
455 extern cups_dest_t      *cupsGetNamedDest(http_t *http, const char *name,
456                                           const char *instance) _CUPS_API_1_4;
457 extern const char       *cupsGetPassword2(const char *prompt, http_t *http,
458                                           const char *method,
459                                           const char *resource) _CUPS_API_1_4;
460 extern ipp_t            *cupsGetResponse(http_t *http,
461                                          const char *resource) _CUPS_API_1_4;
462 extern ssize_t          cupsReadResponseData(http_t *http, char *buffer,
463                                              size_t length) _CUPS_API_1_4;
464 extern http_status_t    cupsSendRequest(http_t *http, ipp_t *request,
465                                         const char *resource,
466                                         size_t length) _CUPS_API_1_4;
467 extern void             cupsSetPasswordCB2(cups_password_cb2_t cb,
468                                            void *user_data) _CUPS_API_1_4;
469 extern http_status_t    cupsStartDocument(http_t *http, const char *name,
470                                           int job_id, const char *docname,
471                                           const char *format,
472                                           int last_document) _CUPS_API_1_4;
473 extern http_status_t    cupsWriteRequestData(http_t *http, const char *buffer,
474                                              size_t length) _CUPS_API_1_4;
475
476 /**** New in CUPS 1.5/macOS 10.7 ****/
477 extern void             cupsSetClientCertCB(cups_client_cert_cb_t cb,
478                                             void *user_data) _CUPS_API_1_5;
479 extern int              cupsSetCredentials(cups_array_t *certs) _CUPS_API_1_5;
480 extern void             cupsSetServerCertCB(cups_server_cert_cb_t cb,
481                                             void *user_data) _CUPS_API_1_5;
482
483 /**** New in CUPS 1.6/macOS 10.8 ****/
484 extern ipp_status_t     cupsCancelDestJob(http_t *http, cups_dest_t *dest,
485                                           int job_id) _CUPS_API_1_6;
486 extern int              cupsCheckDestSupported(http_t *http, cups_dest_t *dest,
487                                                cups_dinfo_t *info,
488                                                const char *option,
489                                                const char *value) _CUPS_API_1_6;
490 extern ipp_status_t     cupsCloseDestJob(http_t *http, cups_dest_t *dest,
491                                          cups_dinfo_t *info, int job_id)
492                                          _CUPS_API_1_6;
493 extern http_t           *cupsConnectDest(cups_dest_t *dest, unsigned flags,
494                                          int msec, int *cancel,
495                                          char *resource, size_t resourcesize,
496                                          cups_dest_cb_t cb, void *user_data)
497                                          _CUPS_API_1_6;
498 #  ifdef __BLOCKS__
499 extern http_t           *cupsConnectDestBlock(cups_dest_t *dest,
500                                               unsigned flags, int msec,
501                                               int *cancel, char *resource,
502                                               size_t resourcesize,
503                                               cups_dest_block_t block)
504                                               _CUPS_API_1_6;
505 #  endif /* __BLOCKS__ */
506 extern int              cupsCopyDest(cups_dest_t *dest, int num_dests,
507                                      cups_dest_t **dests) _CUPS_API_1_6;
508 extern cups_dinfo_t     *cupsCopyDestInfo(http_t *http, cups_dest_t *dest)
509                                           _CUPS_API_1_6;
510 extern int              cupsCopyDestConflicts(http_t *http, cups_dest_t *dest,
511                                               cups_dinfo_t *info,
512                                               int num_options,
513                                               cups_option_t *options,
514                                               const char *new_option,
515                                               const char *new_value,
516                                               int *num_conflicts,
517                                               cups_option_t **conflicts,
518                                               int *num_resolved,
519                                               cups_option_t **resolved)
520                                               _CUPS_API_1_6;
521 extern ipp_status_t     cupsCreateDestJob(http_t *http, cups_dest_t *dest,
522                                           cups_dinfo_t *info, int *job_id,
523                                           const char *title, int num_options,
524                                           cups_option_t *options) _CUPS_API_1_6;
525 extern int              cupsEnumDests(unsigned flags, int msec, int *cancel,
526                                       cups_ptype_t type, cups_ptype_t mask,
527                                       cups_dest_cb_t cb, void *user_data)
528                                       _CUPS_API_1_6;
529 #  ifdef __BLOCKS__
530 extern int              cupsEnumDestsBlock(unsigned flags, int msec,
531                                            int *cancel, cups_ptype_t type,
532                                            cups_ptype_t mask,
533                                            cups_dest_block_t block)
534                                            _CUPS_API_1_6;
535 #  endif /* __BLOCKS__ */
536 extern ipp_status_t     cupsFinishDestDocument(http_t *http,
537                                                cups_dest_t *dest,
538                                                cups_dinfo_t *info)
539                                                _CUPS_API_1_6;
540 extern void             cupsFreeDestInfo(cups_dinfo_t *dinfo) _CUPS_API_1_6;
541 extern int              cupsGetDestMediaByName(http_t *http, cups_dest_t *dest,
542                                                cups_dinfo_t *dinfo,
543                                                const char *media,
544                                                unsigned flags,
545                                                cups_size_t *size) _CUPS_API_1_6;
546 extern int              cupsGetDestMediaBySize(http_t *http, cups_dest_t *dest,
547                                                cups_dinfo_t *dinfo,
548                                                int width, int length,
549                                                unsigned flags,
550                                                cups_size_t *size) _CUPS_API_1_6;
551 extern const char       *cupsLocalizeDestOption(http_t *http, cups_dest_t *dest,
552                                                 cups_dinfo_t *info,
553                                                 const char *option)
554                                                 _CUPS_API_1_6;
555 extern const char       *cupsLocalizeDestValue(http_t *http, cups_dest_t *dest,
556                                                cups_dinfo_t *info,
557                                                const char *option,
558                                                const char *value)
559                                                _CUPS_API_1_6;
560 extern http_status_t    cupsStartDestDocument(http_t *http, cups_dest_t *dest,
561                                               cups_dinfo_t *info, int job_id,
562                                               const char *docname,
563                                               const char *format,
564                                               int num_options,
565                                               cups_option_t *options,
566                                               int last_document) _CUPS_API_1_6;
567
568 /* New in CUPS 1.7 */
569 extern ipp_attribute_t  *cupsFindDestDefault(http_t *http, cups_dest_t *dest,
570                                              cups_dinfo_t *dinfo,
571                                              const char *option) _CUPS_API_1_7;
572 extern ipp_attribute_t  *cupsFindDestReady(http_t *http, cups_dest_t *dest,
573                                            cups_dinfo_t *dinfo,
574                                            const char *option) _CUPS_API_1_7;
575 extern ipp_attribute_t  *cupsFindDestSupported(http_t *http, cups_dest_t *dest,
576                                                cups_dinfo_t *dinfo,
577                                                const char *option)
578                                                _CUPS_API_1_7;
579 extern int              cupsGetDestMediaByIndex(http_t *http, cups_dest_t *dest,
580                                                 cups_dinfo_t *dinfo, int n,
581                                                 unsigned flags,
582                                                 cups_size_t *size)
583                                                 _CUPS_API_1_7;
584 extern int              cupsGetDestMediaCount(http_t *http, cups_dest_t *dest,
585                                               cups_dinfo_t *dinfo,
586                                               unsigned flags) _CUPS_API_1_7;
587 extern int              cupsGetDestMediaDefault(http_t *http, cups_dest_t *dest,
588                                                 cups_dinfo_t *dinfo,
589                                                 unsigned flags,
590                                                 cups_size_t *size)
591                                                 _CUPS_API_1_7;
592 extern void             cupsSetUserAgent(const char *user_agent) _CUPS_API_1_7;
593 extern const char       *cupsUserAgent(void) _CUPS_API_1_7;
594
595 /* New in CUPS 2.0/macOS 10.10 */
596 extern cups_dest_t      *cupsGetDestWithURI(const char *name, const char *uri) _CUPS_API_2_0;
597 extern const char       *cupsLocalizeDestMedia(http_t *http, cups_dest_t *dest, cups_dinfo_t *info, unsigned flags, cups_size_t *size) _CUPS_API_2_0;
598 extern int              cupsMakeServerCredentials(const char *path, const char *common_name, int num_alt_names, const char **alt_names, time_t expiration_date) _CUPS_API_2_0;
599 extern int              cupsSetServerCredentials(const char *path, const char *common_name, int auto_create) _CUPS_API_2_0;
600
601 /* New in CUPS 2.2/macOS 10.12 */
602 extern ssize_t          cupsHashData(const char *algorithm, const void *data, size_t datalen, unsigned char *hash, size_t hashsize) _CUPS_API_2_2;
603
604 #  ifdef __cplusplus
605 }
606 #  endif /* __cplusplus */
607
608 #endif /* !_CUPS_CUPS_H_ */