Home | History | Annotate | Download | only in cups
      1 /*
      2  * API definitions for CUPS.
      3  *
      4  * Copyright 2007-2017 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  * 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.0206
     51 #  define CUPS_VERSION_MAJOR		2
     52 #  define CUPS_VERSION_MINOR		2
     53 #  define CUPS_VERSION_PATCH		6
     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 no 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 #  define CUPS_DEST_FLAGS_DEVICE        0x80
     96                                         /* For @link cupsConnectDest@: Connect to device */
     97 
     98 /* Flags for cupsGetDestMediaByName/Size */
     99 #  define CUPS_MEDIA_FLAGS_DEFAULT 	0x00
    100 					/* Find the closest size supported by
    101 					 * the printer */
    102 #  define CUPS_MEDIA_FLAGS_BORDERLESS	0x01
    103 					/* Find a borderless size */
    104 #  define CUPS_MEDIA_FLAGS_DUPLEX	0x02
    105 					/* Find a size compatible with 2-sided
    106 					 * printing */
    107 #  define CUPS_MEDIA_FLAGS_EXACT	0x04
    108 					/* Find an exact match for the size */
    109 #  define CUPS_MEDIA_FLAGS_READY	0x08
    110 					/* If the printer supports media
    111 					 * sensing, find the size amongst the
    112 					 * "ready" media. */
    113 
    114 /* Options and values */
    115 #  define CUPS_COPIES			"copies"
    116 #  define CUPS_COPIES_SUPPORTED		"copies-supported"
    117 
    118 #  define CUPS_FINISHINGS		"finishings"
    119 #  define CUPS_FINISHINGS_SUPPORTED	"finishings-supported"
    120 
    121 #  define CUPS_FINISHINGS_BIND		"7"
    122 #  define CUPS_FINISHINGS_COVER		"6"
    123 #  define CUPS_FINISHINGS_FOLD		"10"
    124 #  define CUPS_FINISHINGS_NONE		"3"
    125 #  define CUPS_FINISHINGS_PUNCH		"5"
    126 #  define CUPS_FINISHINGS_STAPLE	"4"
    127 #  define CUPS_FINISHINGS_TRIM		"11"
    128 
    129 #  define CUPS_MEDIA			"media"
    130 #  define CUPS_MEDIA_READY		"media-ready"
    131 #  define CUPS_MEDIA_SUPPORTED		"media-supported"
    132 
    133 #  define CUPS_MEDIA_3X5		"na_index-3x5_3x5in"
    134 #  define CUPS_MEDIA_4X6		"na_index-4x6_4x6in"
    135 #  define CUPS_MEDIA_5X7		"na_5x7_5x7in"
    136 #  define CUPS_MEDIA_8X10		"na_govt-letter_8x10in"
    137 #  define CUPS_MEDIA_A3			"iso_a3_297x420mm"
    138 #  define CUPS_MEDIA_A4			"iso_a4_210x297mm"
    139 #  define CUPS_MEDIA_A5			"iso_a5_148x210mm"
    140 #  define CUPS_MEDIA_A6			"iso_a6_105x148mm"
    141 #  define CUPS_MEDIA_ENV10		"na_number-10_4.125x9.5in"
    142 #  define CUPS_MEDIA_ENVDL		"iso_dl_110x220mm"
    143 #  define CUPS_MEDIA_LEGAL		"na_legal_8.5x14in"
    144 #  define CUPS_MEDIA_LETTER		"na_letter_8.5x11in"
    145 #  define CUPS_MEDIA_PHOTO_L		"oe_photo-l_3.5x5in"
    146 #  define CUPS_MEDIA_SUPERBA3		"na_super-b_13x19in"
    147 #  define CUPS_MEDIA_TABLOID		"na_ledger_11x17in"
    148 
    149 #  define CUPS_MEDIA_SOURCE		"media-source"
    150 #  define CUPS_MEDIA_SOURCE_SUPPORTED	"media-source-supported"
    151 
    152 #  define CUPS_MEDIA_SOURCE_AUTO	"auto"
    153 #  define CUPS_MEDIA_SOURCE_MANUAL	"manual"
    154 
    155 #  define CUPS_MEDIA_TYPE		"media-type"
    156 #  define CUPS_MEDIA_TYPE_SUPPORTED	"media-type-supported"
    157 
    158 #  define CUPS_MEDIA_TYPE_AUTO		"auto"
    159 #  define CUPS_MEDIA_TYPE_ENVELOPE	"envelope"
    160 #  define CUPS_MEDIA_TYPE_LABELS	"labels"
    161 #  define CUPS_MEDIA_TYPE_LETTERHEAD	"stationery-letterhead"
    162 #  define CUPS_MEDIA_TYPE_PHOTO		"photographic"
    163 #  define CUPS_MEDIA_TYPE_PHOTO_GLOSSY	"photographic-glossy"
    164 #  define CUPS_MEDIA_TYPE_PHOTO_MATTE	"photographic-matte"
    165 #  define CUPS_MEDIA_TYPE_PLAIN		"stationery"
    166 #  define CUPS_MEDIA_TYPE_TRANSPARENCY	"transparency"
    167 
    168 #  define CUPS_NUMBER_UP		"number-up"
    169 #  define CUPS_NUMBER_UP_SUPPORTED	"number-up-supported"
    170 
    171 #  define CUPS_ORIENTATION		"orientation-requested"
    172 #  define CUPS_ORIENTATION_SUPPORTED	"orientation-requested-supported"
    173 
    174 #  define CUPS_ORIENTATION_PORTRAIT	"3"
    175 #  define CUPS_ORIENTATION_LANDSCAPE	"4"
    176 
    177 #  define CUPS_PRINT_COLOR_MODE		"print-color-mode"
    178 #  define CUPS_PRINT_COLOR_MODE_SUPPORTED "print-color-mode-supported"
    179 
    180 #  define CUPS_PRINT_COLOR_MODE_AUTO	"auto"
    181 #  define CUPS_PRINT_COLOR_MODE_MONOCHROME "monochrome"
    182 #  define CUPS_PRINT_COLOR_MODE_COLOR	"color"
    183 
    184 #  define CUPS_PRINT_QUALITY		"print-quality"
    185 #  define CUPS_PRINT_QUALITY_SUPPORTED	"print-quality-supported"
    186 
    187 #  define CUPS_PRINT_QUALITY_DRAFT	"3"
    188 #  define CUPS_PRINT_QUALITY_NORMAL	"4"
    189 #  define CUPS_PRINT_QUALITY_HIGH	"5"
    190 
    191 #  define CUPS_SIDES			"sides"
    192 #  define CUPS_SIDES_SUPPORTED		"sides-supported"
    193 
    194 #  define CUPS_SIDES_ONE_SIDED		"one-sided"
    195 #  define CUPS_SIDES_TWO_SIDED_PORTRAIT	"two-sided-long-edge"
    196 #  define CUPS_SIDES_TWO_SIDED_LANDSCAPE "two-sided-short-edge"
    197 
    198 
    199 /*
    200  * Types and structures...
    201  */
    202 
    203 typedef unsigned cups_ptype_t;		/* Printer type/capability bits */
    204 enum cups_ptype_e			/* Printer type/capability bit
    205 					 * constants */
    206 {					/* Not a typedef'd enum so we can OR */
    207   CUPS_PRINTER_LOCAL = 0x0000,		/* Local printer or class */
    208   CUPS_PRINTER_CLASS = 0x0001,		/* Printer class */
    209   CUPS_PRINTER_REMOTE = 0x0002,		/* Remote printer or class */
    210   CUPS_PRINTER_BW = 0x0004,		/* Can do B&W printing */
    211   CUPS_PRINTER_COLOR = 0x0008,		/* Can do color printing */
    212   CUPS_PRINTER_DUPLEX = 0x0010,		/* Can do two-sided printing */
    213   CUPS_PRINTER_STAPLE = 0x0020,		/* Can staple output */
    214   CUPS_PRINTER_COPIES = 0x0040,		/* Can do copies in hardware */
    215   CUPS_PRINTER_COLLATE = 0x0080,	/* Can quickly collate copies */
    216   CUPS_PRINTER_PUNCH = 0x0100,		/* Can punch output */
    217   CUPS_PRINTER_COVER = 0x0200,		/* Can cover output */
    218   CUPS_PRINTER_BIND = 0x0400,		/* Can bind output */
    219   CUPS_PRINTER_SORT = 0x0800,		/* Can sort output */
    220   CUPS_PRINTER_SMALL = 0x1000,		/* Can print on Letter/Legal/A4-size media */
    221   CUPS_PRINTER_MEDIUM = 0x2000,		/* Can print on Tabloid/B/C/A3/A2-size media */
    222   CUPS_PRINTER_LARGE = 0x4000,		/* Can print on D/E/A1/A0-size media */
    223   CUPS_PRINTER_VARIABLE = 0x8000,	/* Can print on rolls and custom-size media */
    224   CUPS_PRINTER_IMPLICIT = 0x10000,	/* Implicit class @private@
    225 					 * @since Deprecated@ */
    226   CUPS_PRINTER_DEFAULT = 0x20000,	/* Default printer on network */
    227   CUPS_PRINTER_FAX = 0x40000,		/* Fax queue */
    228   CUPS_PRINTER_REJECTING = 0x80000,	/* Printer is rejecting jobs */
    229   CUPS_PRINTER_DELETE = 0x100000,	/* Delete printer
    230 					 * @deprecated@ @exclude all@ */
    231   CUPS_PRINTER_NOT_SHARED = 0x200000,	/* Printer is not shared
    232 					 * @since CUPS 1.2/macOS 10.5@ */
    233   CUPS_PRINTER_AUTHENTICATED = 0x400000,/* Printer requires authentication
    234 					 * @since CUPS 1.2/macOS 10.5@ */
    235   CUPS_PRINTER_COMMANDS = 0x800000,	/* Printer supports maintenance commands
    236 					 * @since CUPS 1.2/macOS 10.5@ */
    237   CUPS_PRINTER_DISCOVERED = 0x1000000,	/* Printer was discovered @since CUPS 1.2/macOS 10.5@ */
    238   CUPS_PRINTER_SCANNER = 0x2000000,	/* Scanner-only device
    239 					 * @since CUPS 1.4/macOS 10.6@ @private@ */
    240   CUPS_PRINTER_MFP = 0x4000000,		/* Printer with scanning capabilities
    241 					 * @since CUPS 1.4/macOS 10.6@ @private@ */
    242   CUPS_PRINTER_3D = 0x8000000,		/* Printer with 3D capabilities @exclude all@ @private@ */
    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 that 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                                          * @exclude all@ */
    315 #  endif /* __BLOCKS__ */
    316 
    317 typedef const char *(*cups_password_cb_t)(const char *prompt);
    318 					/* Password callback @exclude all@ */
    319 
    320 typedef const char *(*cups_password_cb2_t)(const char *prompt, http_t *http,
    321 					   const char *method,
    322 					   const char *resource,
    323 					   void *user_data);
    324 					/* New password callback
    325 					 * @since CUPS 1.4/macOS 10.6@ */
    326 
    327 typedef int (*cups_server_cert_cb_t)(http_t *http, void *tls,
    328 				     cups_array_t *certs, void *user_data);
    329 					/* Server credentials callback
    330 					 * @since CUPS 1.5/macOS 10.7@ */
    331 
    332 
    333 /*
    334  * Functions...
    335  */
    336 
    337 extern int		cupsCancelJob(const char *name, int job_id);
    338 extern ipp_t		*cupsDoFileRequest(http_t *http, ipp_t *request,
    339 			                   const char *resource,
    340 					   const char *filename);
    341 extern ipp_t		*cupsDoRequest(http_t *http, ipp_t *request,
    342 			               const char *resource);
    343 extern http_encryption_t cupsEncryption(void);
    344 extern void		cupsFreeJobs(int num_jobs, cups_job_t *jobs);
    345 extern int		cupsGetClasses(char ***classes) _CUPS_DEPRECATED_MSG("Use cupsEnumDests instead.");
    346 extern const char	*cupsGetDefault(void);
    347 extern int		cupsGetJobs(cups_job_t **jobs, const char *name,
    348 			            int myjobs, int whichjobs);
    349 extern int		cupsGetPrinters(char ***printers) _CUPS_DEPRECATED_MSG("Use cupsEnumDests instead.");
    350 extern ipp_status_t	cupsLastError(void);
    351 extern int		cupsPrintFile(const char *name, const char *filename,
    352 			              const char *title, int num_options,
    353 				      cups_option_t *options);
    354 extern int		cupsPrintFiles(const char *name, int num_files,
    355 			               const char **files, const char *title,
    356 				       int num_options, cups_option_t *options);
    357 extern char		*cupsTempFile(char *filename, int len) _CUPS_DEPRECATED_MSG("Use cupsTempFd or cupsTempFile2 instead.");
    358 extern int		cupsTempFd(char *filename, int len);
    359 
    360 extern int		cupsAddDest(const char *name, const char *instance,
    361 			            int num_dests, cups_dest_t **dests);
    362 extern void		cupsFreeDests(int num_dests, cups_dest_t *dests);
    363 extern cups_dest_t	*cupsGetDest(const char *name, const char *instance,
    364 			             int num_dests, cups_dest_t *dests);
    365 extern int		cupsGetDests(cups_dest_t **dests);
    366 extern void		cupsSetDests(int num_dests, cups_dest_t *dests);
    367 
    368 extern int		cupsAddOption(const char *name, const char *value,
    369 			              int num_options, cups_option_t **options);
    370 extern void		cupsEncodeOptions(ipp_t *ipp, int num_options,
    371 					  cups_option_t *options);
    372 extern void		cupsFreeOptions(int num_options,
    373 			                cups_option_t *options);
    374 extern const char	*cupsGetOption(const char *name, int num_options,
    375 			               cups_option_t *options);
    376 extern int		cupsParseOptions(const char *arg, int num_options,
    377 			                 cups_option_t **options);
    378 
    379 extern const char	*cupsGetPassword(const char *prompt);
    380 extern const char	*cupsServer(void);
    381 extern void		cupsSetEncryption(http_encryption_t e);
    382 extern void		cupsSetPasswordCB(cups_password_cb_t cb);
    383 extern void		cupsSetServer(const char *server);
    384 extern void		cupsSetUser(const char *user);
    385 extern const char	*cupsUser(void);
    386 
    387 /**** New in CUPS 1.1.20 ****/
    388 extern int		cupsDoAuthentication(http_t *http, const char *method,
    389 			                     const char *resource)
    390 			                     _CUPS_API_1_1_20;
    391 extern http_status_t	cupsGetFile(http_t *http, const char *resource,
    392 			            const char *filename) _CUPS_API_1_1_20;
    393 extern http_status_t	cupsGetFd(http_t *http, const char *resource, int fd);
    394 extern http_status_t	cupsPutFile(http_t *http, const char *resource,
    395 			            const char *filename) _CUPS_API_1_1_20;
    396 extern http_status_t	cupsPutFd(http_t *http, const char *resource, int fd)
    397 			          _CUPS_API_1_1_20;
    398 
    399 /**** New in CUPS 1.1.21 ****/
    400 extern const char	*cupsGetDefault2(http_t *http) _CUPS_API_1_1_21;
    401 extern int		cupsGetDests2(http_t *http, cups_dest_t **dests)
    402 			              _CUPS_API_1_1_21;
    403 extern int		cupsGetJobs2(http_t *http, cups_job_t **jobs,
    404 			             const char *name, int myjobs,
    405 				     int whichjobs) _CUPS_API_1_1_21;
    406 extern int		cupsPrintFile2(http_t *http, const char *name,
    407 			               const char *filename,
    408 				       const char *title, int num_options,
    409 				       cups_option_t *options) _CUPS_API_1_1_21;
    410 extern int		cupsPrintFiles2(http_t *http, const char *name,
    411 			                int num_files, const char **files,
    412 					const char *title, int num_options,
    413 					cups_option_t *options)
    414 					_CUPS_API_1_1_21;
    415 extern int		cupsSetDests2(http_t *http, int num_dests,
    416 			              cups_dest_t *dests) _CUPS_API_1_1_21;
    417 
    418 /**** New in CUPS 1.2/macOS 10.5 ****/
    419 extern ssize_t		cupsBackChannelRead(char *buffer, size_t bytes,
    420 			                    double timeout) _CUPS_API_1_2;
    421 extern ssize_t		cupsBackChannelWrite(const char *buffer, size_t bytes,
    422 			                     double timeout) _CUPS_API_1_2;
    423 extern void		cupsEncodeOptions2(ipp_t *ipp, int num_options,
    424 					   cups_option_t *options,
    425 					   ipp_tag_t group_tag) _CUPS_API_1_2;
    426 extern const char	*cupsLastErrorString(void) _CUPS_API_1_2;
    427 extern char		*cupsNotifySubject(cups_lang_t *lang, ipp_t *event)
    428 			                   _CUPS_API_1_2;
    429 extern char		*cupsNotifyText(cups_lang_t *lang, ipp_t *event)
    430 			                _CUPS_API_1_2;
    431 extern int		cupsRemoveOption(const char *name, int num_options,
    432 			                 cups_option_t **options) _CUPS_API_1_2;
    433 extern cups_file_t	*cupsTempFile2(char *filename, int len) _CUPS_API_1_2;
    434 
    435 /**** New in CUPS 1.3/macOS 10.5 ****/
    436 extern ipp_t		*cupsDoIORequest(http_t *http, ipp_t *request,
    437 			                 const char *resource, int infile,
    438 					 int outfile) _CUPS_API_1_3;
    439 extern int		cupsRemoveDest(const char *name,
    440 			               const char *instance,
    441 				       int num_dests, cups_dest_t **dests)
    442 				       _CUPS_API_1_3;
    443 extern void		cupsSetDefaultDest(const char *name,
    444 			                   const char *instance,
    445 					   int num_dests,
    446 					   cups_dest_t *dests) _CUPS_API_1_3;
    447 
    448 /**** New in CUPS 1.4/macOS 10.6 ****/
    449 extern ipp_status_t	cupsCancelJob2(http_t *http, const char *name,
    450 			               int job_id, int purge) _CUPS_API_1_4;
    451 extern int		cupsCreateJob(http_t *http, const char *name,
    452 				      const char *title, int num_options,
    453 				      cups_option_t *options) _CUPS_API_1_4;
    454 extern ipp_status_t	cupsFinishDocument(http_t *http,
    455 			                   const char *name) _CUPS_API_1_4;
    456 extern cups_dest_t	*cupsGetNamedDest(http_t *http, const char *name,
    457 			                  const char *instance) _CUPS_API_1_4;
    458 extern const char	*cupsGetPassword2(const char *prompt, http_t *http,
    459 					  const char *method,
    460 					  const char *resource) _CUPS_API_1_4;
    461 extern ipp_t		*cupsGetResponse(http_t *http,
    462 			                 const char *resource) _CUPS_API_1_4;
    463 extern ssize_t		cupsReadResponseData(http_t *http, char *buffer,
    464 			                     size_t length) _CUPS_API_1_4;
    465 extern http_status_t	cupsSendRequest(http_t *http, ipp_t *request,
    466 			                const char *resource,
    467 					size_t length) _CUPS_API_1_4;
    468 extern void		cupsSetPasswordCB2(cups_password_cb2_t cb,
    469 			                   void *user_data) _CUPS_API_1_4;
    470 extern http_status_t	cupsStartDocument(http_t *http, const char *name,
    471 			                  int job_id, const char *docname,
    472 					  const char *format,
    473 					  int last_document) _CUPS_API_1_4;
    474 extern http_status_t	cupsWriteRequestData(http_t *http, const char *buffer,
    475 			                     size_t length) _CUPS_API_1_4;
    476 
    477 /**** New in CUPS 1.5/macOS 10.7 ****/
    478 extern void		cupsSetClientCertCB(cups_client_cert_cb_t cb,
    479 					    void *user_data) _CUPS_API_1_5;
    480 extern int		cupsSetCredentials(cups_array_t *certs) _CUPS_API_1_5;
    481 extern void		cupsSetServerCertCB(cups_server_cert_cb_t cb,
    482 					    void *user_data) _CUPS_API_1_5;
    483 
    484 /**** New in CUPS 1.6/macOS 10.8 ****/
    485 extern ipp_status_t	cupsCancelDestJob(http_t *http, cups_dest_t *dest,
    486 			                  int job_id) _CUPS_API_1_6;
    487 extern int		cupsCheckDestSupported(http_t *http, cups_dest_t *dest,
    488 					       cups_dinfo_t *info,
    489 			                       const char *option,
    490 					       const char *value) _CUPS_API_1_6;
    491 extern ipp_status_t	cupsCloseDestJob(http_t *http, cups_dest_t *dest,
    492 			                 cups_dinfo_t *info, int job_id)
    493 			                 _CUPS_API_1_6;
    494 extern http_t		*cupsConnectDest(cups_dest_t *dest, unsigned flags,
    495 			                 int msec, int *cancel,
    496 					 char *resource, size_t resourcesize,
    497 					 cups_dest_cb_t cb, void *user_data)
    498 					 _CUPS_API_1_6;
    499 #  ifdef __BLOCKS__
    500 extern http_t		*cupsConnectDestBlock(cups_dest_t *dest,
    501 					      unsigned flags, int msec,
    502 					      int *cancel, char *resource,
    503 					      size_t resourcesize,
    504 					      cups_dest_block_t block)
    505 					      _CUPS_API_1_6;
    506 #  endif /* __BLOCKS__ */
    507 extern int		cupsCopyDest(cups_dest_t *dest, int num_dests,
    508 			             cups_dest_t **dests) _CUPS_API_1_6;
    509 extern cups_dinfo_t	*cupsCopyDestInfo(http_t *http, cups_dest_t *dest)
    510 					  _CUPS_API_1_6;
    511 extern int		cupsCopyDestConflicts(http_t *http, cups_dest_t *dest,
    512 					      cups_dinfo_t *info,
    513 					      int num_options,
    514 					      cups_option_t *options,
    515 					      const char *new_option,
    516 					      const char *new_value,
    517 					      int *num_conflicts,
    518 					      cups_option_t **conflicts,
    519 					      int *num_resolved,
    520 					      cups_option_t **resolved)
    521 					      _CUPS_API_1_6;
    522 extern ipp_status_t	cupsCreateDestJob(http_t *http, cups_dest_t *dest,
    523 					  cups_dinfo_t *info, int *job_id,
    524 					  const char *title, int num_options,
    525 			                  cups_option_t *options) _CUPS_API_1_6;
    526 extern int		cupsEnumDests(unsigned flags, int msec, int *cancel,
    527 				      cups_ptype_t type, cups_ptype_t mask,
    528 				      cups_dest_cb_t cb, void *user_data)
    529 				      _CUPS_API_1_6;
    530 #  ifdef __BLOCKS__
    531 extern int		cupsEnumDestsBlock(unsigned flags, int msec,
    532 					   int *cancel, cups_ptype_t type,
    533 					   cups_ptype_t mask,
    534 					   cups_dest_block_t block)
    535 					   _CUPS_API_1_6;
    536 #  endif /* __BLOCKS__ */
    537 extern ipp_status_t	cupsFinishDestDocument(http_t *http,
    538 			                       cups_dest_t *dest,
    539 			                       cups_dinfo_t *info)
    540 			                       _CUPS_API_1_6;
    541 extern void		cupsFreeDestInfo(cups_dinfo_t *dinfo) _CUPS_API_1_6;
    542 extern int		cupsGetDestMediaByName(http_t *http, cups_dest_t *dest,
    543 			                       cups_dinfo_t *dinfo,
    544 					       const char *media,
    545 					       unsigned flags,
    546 					       cups_size_t *size) _CUPS_API_1_6;
    547 extern int		cupsGetDestMediaBySize(http_t *http, cups_dest_t *dest,
    548 			                       cups_dinfo_t *dinfo,
    549 					       int width, int length,
    550 					       unsigned flags,
    551 					       cups_size_t *size) _CUPS_API_1_6;
    552 extern const char	*cupsLocalizeDestOption(http_t *http, cups_dest_t *dest,
    553 			                        cups_dinfo_t *info,
    554 			                        const char *option)
    555 			                        _CUPS_API_1_6;
    556 extern const char	*cupsLocalizeDestValue(http_t *http, cups_dest_t *dest,
    557 					       cups_dinfo_t *info,
    558 					       const char *option,
    559 					       const char *value)
    560 					       _CUPS_API_1_6;
    561 extern http_status_t	cupsStartDestDocument(http_t *http, cups_dest_t *dest,
    562 					      cups_dinfo_t *info, int job_id,
    563 					      const char *docname,
    564 					      const char *format,
    565 					      int num_options,
    566 					      cups_option_t *options,
    567 					      int last_document) _CUPS_API_1_6;
    568 
    569 /* New in CUPS 1.7 */
    570 extern ipp_attribute_t	*cupsFindDestDefault(http_t *http, cups_dest_t *dest,
    571 			                     cups_dinfo_t *dinfo,
    572 			                     const char *option) _CUPS_API_1_7;
    573 extern ipp_attribute_t	*cupsFindDestReady(http_t *http, cups_dest_t *dest,
    574 					   cups_dinfo_t *dinfo,
    575 					   const char *option) _CUPS_API_1_7;
    576 extern ipp_attribute_t	*cupsFindDestSupported(http_t *http, cups_dest_t *dest,
    577 			                       cups_dinfo_t *dinfo,
    578 			                       const char *option)
    579 			                       _CUPS_API_1_7;
    580 extern int		cupsGetDestMediaByIndex(http_t *http, cups_dest_t *dest,
    581 			                        cups_dinfo_t *dinfo, int n,
    582 			                        unsigned flags,
    583 			                        cups_size_t *size)
    584 			                        _CUPS_API_1_7;
    585 extern int		cupsGetDestMediaCount(http_t *http, cups_dest_t *dest,
    586 			                      cups_dinfo_t *dinfo,
    587 			                      unsigned flags) _CUPS_API_1_7;
    588 extern int		cupsGetDestMediaDefault(http_t *http, cups_dest_t *dest,
    589 			                        cups_dinfo_t *dinfo,
    590 			                        unsigned flags,
    591 			                        cups_size_t *size)
    592 			                        _CUPS_API_1_7;
    593 extern void		cupsSetUserAgent(const char *user_agent) _CUPS_API_1_7;
    594 extern const char	*cupsUserAgent(void) _CUPS_API_1_7;
    595 
    596 /* New in CUPS 2.0/macOS 10.10 */
    597 extern cups_dest_t	*cupsGetDestWithURI(const char *name, const char *uri) _CUPS_API_2_0;
    598 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;
    599 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;
    600 extern int		cupsSetServerCredentials(const char *path, const char *common_name, int auto_create) _CUPS_API_2_0;
    601 
    602 /* New in CUPS 2.2/macOS 10.12 */
    603 extern ssize_t		cupsHashData(const char *algorithm, const void *data, size_t datalen, unsigned char *hash, size_t hashsize) _CUPS_API_2_2;
    604 
    605 /* New in CUPS 2.2.4 */
    606 extern int		cupsAddIntegerOption(const char *name, int value, int num_options, cups_option_t **options) _CUPS_API_2_2_4;
    607 extern int		cupsGetIntegerOption(const char *name, int num_options, cups_option_t *options) _CUPS_API_2_2_4;
    608 
    609 #  ifdef __cplusplus
    610 }
    611 #  endif /* __cplusplus */
    612 
    613 #endif /* !_CUPS_CUPS_H_ */
    614