]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/ipp.h
Merge changes from CUPS 1.6svn-r10437.
[thirdparty/cups.git] / cups / ipp.h
CommitLineData
ef416fc2 1/*
b19ccc9e 2 * "$Id: ipp.h 7847 2008-08-19 04:22:14Z mike $"
ef416fc2 3 *
5a6b583a 4 * Internet Printing Protocol definitions for CUPS.
ef416fc2 5 *
82cc1f9a 6 * Copyright 2007-2012 by Apple Inc.
ef416fc2 7 * Copyright 1997-2006 by Easy Software Products.
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_IPP_H_
19# define _CUPS_IPP_H_
20
21/*
22 * Include necessary headers...
23 */
24
25# include "http.h"
26
27
28/*
29 * C++ magic...
30 */
31
32# ifdef __cplusplus
33extern "C" {
34# endif /* __cplusplus */
35
36
37/*
38 * IPP version string...
39 */
40
5a6b583a 41# define IPP_VERSION "\002\001"
ef416fc2 42
43/*
44 * IPP registered port number...
45 *
46 * Note: Applications should never use IPP_PORT, but instead use the
47 * ippPort() function to allow overrides via the IPP_PORT environment
48 * variable and services file if needed!
49 */
50
51# define IPP_PORT 631
52
53/*
54 * Common limits...
55 */
56
a41f09e2
MS
57# define IPP_MAX_LENGTH 32767 /* Maximum size of any single value */
58# define IPP_MAX_NAME 256 /* Maximum length of common name values */
ef416fc2 59# define IPP_MAX_VALUES 8 /* Power-of-2 allocation increment */
60
61
62/*
63 * Types and structures...
64 */
65
a2326b5b 66typedef enum ipp_dstate_e /**** Document states ****/
ef416fc2 67{
a2326b5b
MS
68 IPP_DOCUMENT_PENDING = 3,
69 IPP_DOCUMENT_PROCESSING = 5,
70 IPP_DOCUMENT_CANCELED = 7,
71 IPP_DOCUMENT_ABORTED,
72 IPP_DOCUMENT_COMPLETED
73} ipp_dstate_t;
ef416fc2 74
5a6b583a 75typedef enum ipp_finish_e /**** Finishings ****/
ef416fc2 76{
ecdc0628 77 IPP_FINISHINGS_NONE = 3, /* No finishing */
78 IPP_FINISHINGS_STAPLE, /* Staple (any location) */
79 IPP_FINISHINGS_PUNCH, /* Punch (any location/count) */
80 IPP_FINISHINGS_COVER, /* Add cover */
81 IPP_FINISHINGS_BIND, /* Bind */
82 IPP_FINISHINGS_SADDLE_STITCH, /* Staple interior */
83 IPP_FINISHINGS_EDGE_STITCH, /* Stitch along any side */
84 IPP_FINISHINGS_FOLD, /* Fold (any type) */
85 IPP_FINISHINGS_TRIM, /* Trim (any type) */
86 IPP_FINISHINGS_BALE, /* Bale (any type) */
87 IPP_FINISHINGS_BOOKLET_MAKER, /* Fold to make booklet */
88 IPP_FINISHINGS_JOB_OFFSET, /* Offset for binding (any type) */
89 IPP_FINISHINGS_STAPLE_TOP_LEFT = 20, /* Staple top left corner */
90 IPP_FINISHINGS_STAPLE_BOTTOM_LEFT, /* Staple bottom left corner */
91 IPP_FINISHINGS_STAPLE_TOP_RIGHT, /* Staple top right corner */
92 IPP_FINISHINGS_STAPLE_BOTTOM_RIGHT, /* Staple bottom right corner */
93 IPP_FINISHINGS_EDGE_STITCH_LEFT, /* Stitch along left side */
94 IPP_FINISHINGS_EDGE_STITCH_TOP, /* Stitch along top edge */
95 IPP_FINISHINGS_EDGE_STITCH_RIGHT, /* Stitch along right side */
96 IPP_FINISHINGS_EDGE_STITCH_BOTTOM, /* Stitch along bottom edge */
97 IPP_FINISHINGS_STAPLE_DUAL_LEFT, /* Two staples on left */
98 IPP_FINISHINGS_STAPLE_DUAL_TOP, /* Two staples on top */
99 IPP_FINISHINGS_STAPLE_DUAL_RIGHT, /* Two staples on right */
100 IPP_FINISHINGS_STAPLE_DUAL_BOTTOM, /* Two staples on bottom */
101 IPP_FINISHINGS_BIND_LEFT = 50, /* Bind on left */
102 IPP_FINISHINGS_BIND_TOP, /* Bind on top */
103 IPP_FINISHINGS_BIND_RIGHT, /* Bind on right */
a2326b5b
MS
104 IPP_FINISHINGS_BIND_BOTTOM, /* Bind on bottom */
105 IPP_FINISHINGS_TRIM_AFTER_PAGES = 60, /* Trim output after each page */
106 IPP_FINISHINGS_TRIM_AFTER_DOCUMENTS, /* Trim output after each document */
107 IPP_FINISHINGS_TRIM_AFTER_COPIES, /* Trim output after each copy */
108 IPP_FINISHINGS_TRIM_AFTER_JOB /* Trim output after job */
ef416fc2 109} ipp_finish_t;
110
a2326b5b 111typedef enum ipp_jcollate_e /**** Job collation types ****/
ef416fc2 112{
a2326b5b
MS
113 IPP_JOB_UNCOLLATED_SHEETS = 3,
114 IPP_JOB_COLLATED_DOCUMENTS,
115 IPP_JOB_UNCOLLATED_DOCUMENTS
116} ipp_jcollate_t;
ef416fc2 117
5a6b583a 118typedef enum ipp_jstate_e /**** Job states ****/
ef416fc2 119{
ecdc0628 120 IPP_JOB_PENDING = 3, /* Job is waiting to be printed */
121 IPP_JOB_HELD, /* Job is held for printing */
122 IPP_JOB_PROCESSING, /* Job is currently printing */
123 IPP_JOB_STOPPED, /* Job has been stopped */
d09495fa 124 IPP_JOB_CANCELED, /* Job has been canceled */
ecdc0628 125 IPP_JOB_ABORTED, /* Job has aborted due to error */
126 IPP_JOB_COMPLETED /* Job has completed successfully */
a2326b5b 127 /* Legacy name for canceled state */
d09495fa 128#define IPP_JOB_CANCELLED IPP_JOB_CANCELED
a2326b5b 129} ipp_jstate_t;
ef416fc2 130
5a6b583a 131typedef enum ipp_op_e /**** IPP operations ****/
ef416fc2 132{
dcb445bc 133 IPP_OP_CUPS_INVALID = -1, /* Invalid operation name for @link ippOpValue@ */
ecdc0628 134 IPP_PRINT_JOB = 0x0002, /* Print a single file */
135 IPP_PRINT_URI, /* Print a single URL @private@ */
136 IPP_VALIDATE_JOB, /* Validate job options */
137 IPP_CREATE_JOB, /* Create an empty print job */
138 IPP_SEND_DOCUMENT, /* Add a file to a job */
139 IPP_SEND_URI, /* Add a URL to a job @private@ */
140 IPP_CANCEL_JOB, /* Cancel a job */
141 IPP_GET_JOB_ATTRIBUTES, /* Get job attributes */
142 IPP_GET_JOBS, /* Get a list of jobs */
143 IPP_GET_PRINTER_ATTRIBUTES, /* Get printer attributes */
144 IPP_HOLD_JOB, /* Hold a job for printing */
145 IPP_RELEASE_JOB, /* Release a job for printing */
146 IPP_RESTART_JOB, /* Reprint a job */
147 IPP_PAUSE_PRINTER = 0x0010, /* Stop a printer */
148 IPP_RESUME_PRINTER, /* Start a printer */
149 IPP_PURGE_JOBS, /* Cancel all jobs */
150 IPP_SET_PRINTER_ATTRIBUTES, /* Set printer attributes @private@ */
151 IPP_SET_JOB_ATTRIBUTES, /* Set job attributes */
152 IPP_GET_PRINTER_SUPPORTED_VALUES, /* Get supported attribute values */
f3c17241
MS
153 IPP_CREATE_PRINTER_SUBSCRIPTION, /* Create a printer subscription @since CUPS 1.2/OS X 10.5@ */
154 IPP_CREATE_JOB_SUBSCRIPTION, /* Create a job subscription @since CUPS 1.2/OS X 10.5@ */
155 IPP_GET_SUBSCRIPTION_ATTRIBUTES, /* Get subscription attributes @since CUPS 1.2/OS X 10.5@ */
156 IPP_GET_SUBSCRIPTIONS, /* Get list of subscriptions @since CUPS 1.2/OS X 10.5@ */
157 IPP_RENEW_SUBSCRIPTION, /* Renew a printer subscription @since CUPS 1.2/OS X 10.5@ */
158 IPP_CANCEL_SUBSCRIPTION, /* Cancel a subscription @since CUPS 1.2/OS X 10.5@ */
159 IPP_GET_NOTIFICATIONS, /* Get notification events @since CUPS 1.2/OS X 10.5@ */
ecdc0628 160 IPP_SEND_NOTIFICATIONS, /* Send notification events @private@ */
a2326b5b
MS
161 IPP_GET_RESOURCE_ATTRIBUTES, /* Get resource attributes @private@ */
162 IPP_GET_RESOURCE_DATA, /* Get resource data @private@ */
163 IPP_GET_RESOURCES, /* Get list of resources @private@ */
164 IPP_GET_PRINT_SUPPORT_FILES, /* Get printer support files @private@ */
ecdc0628 165 IPP_ENABLE_PRINTER, /* Start a printer */
166 IPP_DISABLE_PRINTER, /* Stop a printer */
167 IPP_PAUSE_PRINTER_AFTER_CURRENT_JOB, /* Stop printer after the current job @private@ */
168 IPP_HOLD_NEW_JOBS, /* Hold new jobs @private@ */
169 IPP_RELEASE_HELD_NEW_JOBS, /* Release new jobs @private@ */
170 IPP_DEACTIVATE_PRINTER, /* Stop a printer @private@ */
171 IPP_ACTIVATE_PRINTER, /* Start a printer @private@ */
172 IPP_RESTART_PRINTER, /* Restart a printer @private@ */
173 IPP_SHUTDOWN_PRINTER, /* Turn a printer off @private@ */
174 IPP_STARTUP_PRINTER, /* Turn a printer on @private@ */
175 IPP_REPROCESS_JOB, /* Reprint a job @private@ */
176 IPP_CANCEL_CURRENT_JOB, /* Cancel the current job @private@ */
177 IPP_SUSPEND_CURRENT_JOB, /* Suspend the current job @private@ */
178 IPP_RESUME_JOB, /* Resume the current job @private@ */
179 IPP_PROMOTE_JOB, /* Promote a job to print sooner @private@ */
180 IPP_SCHEDULE_JOB_AFTER, /* Schedule a job to print after another @private@ */
aaf19ab0
MS
181 IPP_CANCEL_DOCUMENT = 0x0033, /* Cancel-Document @private@ */
182 IPP_GET_DOCUMENT_ATTRIBUTES, /* Get-Document-Attributes @private@ */
183 IPP_GET_DOCUMENTS, /* Get-Documents @private@ */
184 IPP_DELETE_DOCUMENT, /* Delete-Document @private@ */
185 IPP_SET_DOCUMENT_ATTRIBUTES, /* Set-Document-Attributes @private@ */
186 IPP_CANCEL_JOBS, /* Cancel-Jobs */
187 IPP_CANCEL_MY_JOBS, /* Cancel-My-Jobs */
188 IPP_RESUBMIT_JOB, /* Resubmit-Job */
189 IPP_CLOSE_JOB, /* Close-Job */
771bd8cb 190 IPP_IDENTIFY_PRINTER, /* Identify-Printer (proposed IPP JPS3) */
82cc1f9a 191 IPP_VALIDATE_DOCUMENT, /* Validate-Document (proposed IPP JPS3) */
ecdc0628 192 IPP_PRIVATE = 0x4000, /* Reserved @private@ */
193 CUPS_GET_DEFAULT, /* Get the default printer */
194 CUPS_GET_PRINTERS, /* Get a list of printers and/or classes */
195 CUPS_ADD_MODIFY_PRINTER, /* Add or modify a printer */
196 CUPS_DELETE_PRINTER, /* Delete a printer */
197 CUPS_GET_CLASSES, /* Get a list of classes @deprecated@ */
198 CUPS_ADD_MODIFY_CLASS, /* Add or modify a class */
199 CUPS_DELETE_CLASS, /* Delete a class */
200 CUPS_ACCEPT_JOBS, /* Accept new jobs on a printer */
201 CUPS_REJECT_JOBS, /* Reject new jobs on a printer */
202 CUPS_SET_DEFAULT, /* Set the default printer */
203 CUPS_GET_DEVICES, /* Get a list of supported devices */
204 CUPS_GET_PPDS, /* Get a list of supported drivers */
205 CUPS_MOVE_JOB, /* Move a job to a different printer */
f3c17241
MS
206 CUPS_AUTHENTICATE_JOB, /* Authenticate a job @since CUPS 1.2/OS X 10.5@ */
207 CUPS_GET_PPD, /* Get a PPD file @since CUPS 1.3/OS X 10.5@ */
208 CUPS_GET_DOCUMENT = 0x4027 /* Get a document file @since CUPS 1.4/OS X 10.6@ */
ef416fc2 209
a2326b5b 210 /* Legacy names for the add operations */
fa73b229 211#define CUPS_ADD_PRINTER CUPS_ADD_MODIFY_PRINTER
212#define CUPS_ADD_CLASS CUPS_ADD_MODIFY_CLASS
a2326b5b
MS
213} ipp_op_t;
214
215typedef enum ipp_orient_e /**** Orientation values ****/
216{
217 IPP_PORTRAIT = 3, /* No rotation */
218 IPP_LANDSCAPE, /* 90 degrees counter-clockwise */
219 IPP_REVERSE_LANDSCAPE, /* 90 degrees clockwise */
220 IPP_REVERSE_PORTRAIT /* 180 degrees */
221} ipp_orient_t;
222
223typedef enum ipp_pstate_e /**** Printer states ****/
224{
225 IPP_PRINTER_IDLE = 3, /* Printer is idle */
226 IPP_PRINTER_PROCESSING, /* Printer is working */
227 IPP_PRINTER_STOPPED /* Printer is stopped */
228} ipp_pstate_t;
229
230typedef enum ipp_quality_e /**** Qualities ****/
231{
232 IPP_QUALITY_DRAFT = 3, /* Draft quality */
233 IPP_QUALITY_NORMAL, /* Normal quality */
234 IPP_QUALITY_HIGH /* High quality */
235} ipp_quality_t;
236
237typedef enum ipp_res_e /**** Resolution units ****/
238{
239 IPP_RES_PER_INCH = 3, /* Pixels per inch */
240 IPP_RES_PER_CM /* Pixels per centimeter */
241} ipp_res_t;
242
243typedef enum ipp_state_e /**** IPP states ****/
244{
245 IPP_ERROR = -1, /* An error occurred */
246 IPP_IDLE, /* Nothing is happening/request completed */
247 IPP_HEADER, /* The request header needs to be sent/received */
248 IPP_ATTRIBUTE, /* One or more attributes need to be sent/received */
249 IPP_DATA /* IPP request data needs to be sent/received */
250} ipp_state_t;
fa73b229 251
5a6b583a 252typedef enum ipp_status_e /**** IPP status codes ****/
ef416fc2 253{
dcb445bc 254 IPP_STATUS_CUPS_INVALID = -1, /* Invalid status name for @link ippErrorValue@ */
ecdc0628 255 IPP_OK = 0x0000, /* successful-ok */
256 IPP_OK_SUBST, /* successful-ok-ignored-or-substituted-attributes */
257 IPP_OK_CONFLICT, /* successful-ok-conflicting-attributes */
258 IPP_OK_IGNORED_SUBSCRIPTIONS, /* successful-ok-ignored-subscriptions */
a2326b5b 259 IPP_OK_IGNORED_NOTIFICATIONS, /* successful-ok-ignored-notifications @private@ */
ecdc0628 260 IPP_OK_TOO_MANY_EVENTS, /* successful-ok-too-many-events */
a2326b5b 261 IPP_OK_BUT_CANCEL_SUBSCRIPTION, /* successful-ok-but-cancel-subscription @private@ */
ecdc0628 262 IPP_OK_EVENTS_COMPLETE, /* successful-ok-events-complete */
5a738aea 263 IPP_REDIRECTION_OTHER_SITE = 0x200, /* redirection-other-site @private@ */
b94498cf 264 CUPS_SEE_OTHER = 0x280, /* cups-see-other */
ecdc0628 265 IPP_BAD_REQUEST = 0x0400, /* client-error-bad-request */
266 IPP_FORBIDDEN, /* client-error-forbidden */
267 IPP_NOT_AUTHENTICATED, /* client-error-not-authenticated */
268 IPP_NOT_AUTHORIZED, /* client-error-not-authorized */
269 IPP_NOT_POSSIBLE, /* client-error-not-possible */
270 IPP_TIMEOUT, /* client-error-timeout */
271 IPP_NOT_FOUND, /* client-error-not-found */
272 IPP_GONE, /* client-error-gone */
273 IPP_REQUEST_ENTITY, /* client-error-request-entity-too-large */
274 IPP_REQUEST_VALUE, /* client-error-request-value-too-long */
275 IPP_DOCUMENT_FORMAT, /* client-error-document-format-not-supported */
276 IPP_ATTRIBUTES, /* client-error-attributes-or-values-not-supported */
277 IPP_URI_SCHEME, /* client-error-uri-scheme-not-supported */
278 IPP_CHARSET, /* client-error-charset-not-supported */
279 IPP_CONFLICT, /* client-error-conflicting-attributes */
280 IPP_COMPRESSION_NOT_SUPPORTED, /* client-error-compression-not-supported */
281 IPP_COMPRESSION_ERROR, /* client-error-compression-error */
282 IPP_DOCUMENT_FORMAT_ERROR, /* client-error-document-format-error */
283 IPP_DOCUMENT_ACCESS_ERROR, /* client-error-document-access-error */
284 IPP_ATTRIBUTES_NOT_SETTABLE, /* client-error-attributes-not-settable */
285 IPP_IGNORED_ALL_SUBSCRIPTIONS, /* client-error-ignored-all-subscriptions */
286 IPP_TOO_MANY_SUBSCRIPTIONS, /* client-error-too-many-subscriptions */
a2326b5b
MS
287 IPP_IGNORED_ALL_NOTIFICATIONS, /* client-error-ignored-all-notifications @private@ */
288 IPP_PRINT_SUPPORT_FILE_NOT_FOUND, /* client-error-print-support-file-not-found @private@ */
289 IPP_DOCUMENT_PASSWORD_ERROR, /* client-error-document-password-error */
290 IPP_DOCUMENT_PERMISSION_ERROR, /* client-error-document-permission-error */
291 IPP_DOCUMENT_SECURITY_ERROR, /* client-error-document-security-error */
292 IPP_DOCUMENT_UNPRINTABLE_ERROR, /* client-error-document-unprintable-error */
ecdc0628 293
294 IPP_INTERNAL_ERROR = 0x0500, /* server-error-internal-error */
295 IPP_OPERATION_NOT_SUPPORTED, /* server-error-operation-not-supported */
296 IPP_SERVICE_UNAVAILABLE, /* server-error-service-unavailable */
297 IPP_VERSION_NOT_SUPPORTED, /* server-error-version-not-supported */
298 IPP_DEVICE_ERROR, /* server-error-device-error */
299 IPP_TEMPORARY_ERROR, /* server-error-temporary-error */
300 IPP_NOT_ACCEPTING, /* server-error-not-accepting-jobs */
301 IPP_PRINTER_BUSY, /* server-error-busy */
d09495fa 302 IPP_ERROR_JOB_CANCELED, /* server-error-job-canceled */
ecdc0628 303 IPP_MULTIPLE_JOBS_NOT_SUPPORTED, /* server-error-multiple-document-jobs-not-supported */
7cf5915e 304 IPP_PRINTER_IS_DEACTIVATED, /* server-error-printer-is-deactivated */
a2326b5b
MS
305 IPP_TOO_MANY_JOBS, /* server-error-too-many-jobs */
306 IPP_TOO_MANY_DOCUMENTS, /* server-error-too-many-documents */
7cf5915e 307
f3c17241
MS
308 IPP_AUTHENTICATION_CANCELED = 0x1000, /* Authentication canceled by user @since CUPS 1.5/OS X 10.7@ */
309 IPP_PKI_ERROR, /* Error negotiating a secure connection @since CUPS 1.5/OS X 10.7@ */
7cf5915e 310 IPP_UPGRADE_REQUIRED /* TLS upgrade required */
ef416fc2 311
a2326b5b
MS
312 /* Legacy name for canceled status */
313#define IPP_ERROR_JOB_CANCELLED IPP_ERROR_JOB_CANCELED
ef416fc2 314
a2326b5b 315} ipp_status_t;
ef416fc2 316
a2326b5b 317typedef enum ipp_tag_e /**** Format tags for attributes ****/
ef416fc2 318{
dcb445bc 319 IPP_TAG_CUPS_INVALID = -1, /* Invalid tag name for @link ippTagValue@ */
a2326b5b
MS
320 IPP_TAG_ZERO = 0x00, /* Zero tag - used for separators */
321 IPP_TAG_OPERATION, /* Operation group */
322 IPP_TAG_JOB, /* Job group */
323 IPP_TAG_END, /* End-of-attributes */
324 IPP_TAG_PRINTER, /* Printer group */
325 IPP_TAG_UNSUPPORTED_GROUP, /* Unsupported attributes group */
326 IPP_TAG_SUBSCRIPTION, /* Subscription group */
327 IPP_TAG_EVENT_NOTIFICATION, /* Event group */
328 IPP_TAG_RESOURCE, /* Resource group @private@ */
329 IPP_TAG_DOCUMENT, /* Document group */
330 IPP_TAG_UNSUPPORTED_VALUE = 0x10, /* Unsupported value */
331 IPP_TAG_DEFAULT, /* Default value */
332 IPP_TAG_UNKNOWN, /* Unknown value */
333 IPP_TAG_NOVALUE, /* No-value value */
334 IPP_TAG_NOTSETTABLE = 0x15, /* Not-settable value */
335 IPP_TAG_DELETEATTR, /* Delete-attribute value */
336 IPP_TAG_ADMINDEFINE, /* Admin-defined value */
337 IPP_TAG_INTEGER = 0x21, /* Integer value */
338 IPP_TAG_BOOLEAN, /* Boolean value */
339 IPP_TAG_ENUM, /* Enumeration value */
340 IPP_TAG_STRING = 0x30, /* Octet string value */
341 IPP_TAG_DATE, /* Date/time value */
342 IPP_TAG_RESOLUTION, /* Resolution value */
343 IPP_TAG_RANGE, /* Range value */
344 IPP_TAG_BEGIN_COLLECTION, /* Beginning of collection value */
345 IPP_TAG_TEXTLANG, /* Text-with-language value */
346 IPP_TAG_NAMELANG, /* Name-with-language value */
347 IPP_TAG_END_COLLECTION, /* End of collection value */
348 IPP_TAG_TEXT = 0x41, /* Text value */
349 IPP_TAG_NAME, /* Name value */
350 IPP_TAG_RESERVED_STRING, /* Reserved for future string value @private@ */
351 IPP_TAG_KEYWORD, /* Keyword value */
352 IPP_TAG_URI, /* URI value */
353 IPP_TAG_URISCHEME, /* URI scheme value */
354 IPP_TAG_CHARSET, /* Character set value */
355 IPP_TAG_LANGUAGE, /* Language value */
356 IPP_TAG_MIMETYPE, /* MIME media type value */
357 IPP_TAG_MEMBERNAME, /* Collection member name value */
358 IPP_TAG_EXTENSION = 0x7f, /* Extension point for 32-bit tags */
359 IPP_TAG_MASK = 0x7fffffff, /* Mask for copied attribute values @private@ */
360 /* The following expression is used to avoid compiler warnings with +/-0x80000000 */
361 IPP_TAG_COPY = -0x7fffffff-1 /* Bitflag for copied attribute values @private@ */
362} ipp_tag_t;
ef416fc2 363
a2326b5b
MS
364typedef unsigned char ipp_uchar_t; /**** Unsigned 8-bit integer/character ****/
365typedef struct _ipp_s ipp_t; /**** IPP request/response data ****/
366typedef struct _ipp_attribute_s ipp_attribute_t;
367 /**** IPP attribute ****/
ef416fc2 368
f3c17241 369/**** New in CUPS 1.2/OS X 10.5 ****/
a2326b5b 370typedef ssize_t (*ipp_iocb_t)(void *context, ipp_uchar_t *buffer, size_t bytes);
f3c17241 371 /**** IPP IO Callback Function @since CUPS 1.2/OS X 10.5@ ****/
aaf19ab0 372
f3c17241 373/**** New in CUPS 1.6/OS X 10.8 ****/
a2326b5b 374typedef int (*ipp_copycb_t)(void *context, ipp_t *dst, ipp_attribute_t *attr);
ef416fc2 375
376
82cc1f9a 377/*
f3c17241
MS
378 * The following structures are PRIVATE starting with CUPS 1.6/OS X 10.8.
379 * Please use the new accessor functions available in CUPS 1.6 and later, as
380 * these definitions will be moved to a private header file in a future release.
82cc1f9a
MS
381 *
382 * Define _IPP_PRIVATE_STRUCTURES to cause the private IPP structures to be
f3c17241
MS
383 * exposed in CUPS 1.6. This happens automatically on OS X when compiling for
384 * a deployment target of 10.7 or earlier.
82cc1f9a
MS
385 */
386
387# if defined(_CUPS_SOURCE) || defined(_CUPS_IPP_PRIVATE_H_)
388 /* Building CUPS */
389# define _IPP_PRIVATE_STRUCTURES 1
390# elif defined(__APPLE__)
391# if defined(MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
392 /* Building for 10.7 and earlier */
393# define _IPP_PRIVATE_STRUCTURES 1
394# elif !defined(MAC_OS_X_VERSION_10_8)
395 /* Building for 10.7 and earlier */
396# define _IPP_PRIVATE_STRUCTURES 1
397# endif /* MAC_OS_X_VERSION_10_8 && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8 */
398# endif /* _CUPS_SOURCE || _CUPS_IPP_PRIVATE_H_ */
399
400# ifdef _IPP_PRIVATE_STRUCTURES
401typedef union _ipp_request_u /**** Request Header ****/
402{
403 struct /* Any Header */
404 {
405 ipp_uchar_t version[2]; /* Protocol version number */
406 int op_status; /* Operation ID or status code*/
407 int request_id; /* Request ID */
408 } any;
409
410 struct /* Operation Header */
411 {
412 ipp_uchar_t version[2]; /* Protocol version number */
413 ipp_op_t operation_id; /* Operation ID */
414 int request_id; /* Request ID */
415 } op;
416
417 struct /* Status Header */
418 {
419 ipp_uchar_t version[2]; /* Protocol version number */
420 ipp_status_t status_code; /* Status code */
421 int request_id; /* Request ID */
422 } status;
423
424 /**** New in CUPS 1.1.19 ****/
f3c17241 425 struct /* Event Header @since CUPS 1.1.19/OS X 10.3@ */
82cc1f9a
MS
426 {
427 ipp_uchar_t version[2]; /* Protocol version number */
428 ipp_status_t status_code; /* Status code */
429 int request_id; /* Request ID */
430 } event;
431} _ipp_request_t;
432
433/**** New in CUPS 1.1.19 ****/
434
435typedef union _ipp_value_u /**** Attribute Value ****/
436{
437 int integer; /* Integer/enumerated value */
438
439 char boolean; /* Boolean value */
440
441 ipp_uchar_t date[11]; /* Date/time value */
442
443 struct
444 {
445 int xres, /* Horizontal resolution */
446 yres; /* Vertical resolution */
447 ipp_res_t units; /* Resolution units */
448 } resolution; /* Resolution value */
449
450 struct
451 {
452 int lower, /* Lower value */
453 upper; /* Upper value */
454 } range; /* Range of integers value */
455
456 struct
457 {
458 char *language; /* Language code */
459 char *text; /* String */
460 } string; /* String with language value */
461
462 struct
463 {
464 int length; /* Length of attribute */
465 void *data; /* Data in attribute */
466 } unknown; /* Unknown attribute type */
467
468/**** New in CUPS 1.1.19 ****/
f3c17241 469 ipp_t *collection; /* Collection value @since CUPS 1.1.19/OS X 10.3@ */
82cc1f9a
MS
470} _ipp_value_t;
471typedef _ipp_value_t ipp_value_t; /**** Convenience typedef that will be removed @private@ ****/
472
473struct _ipp_attribute_s /**** Attribute ****/
474{
475 ipp_attribute_t *next; /* Next attribute in list */
476 ipp_tag_t group_tag, /* Job/Printer/Operation group tag */
477 value_tag; /* What type of value is it? */
478 char *name; /* Name of attribute */
479 int num_values; /* Number of values */
480 _ipp_value_t values[1]; /* Values */
481};
482
483struct _ipp_s /**** IPP Request/Response/Notification ****/
484{
485 ipp_state_t state; /* State of request */
486 _ipp_request_t request; /* Request header */
487 ipp_attribute_t *attrs; /* Attributes */
488 ipp_attribute_t *last; /* Last attribute in list */
489 ipp_attribute_t *current; /* Current attribute (for read/write) */
490 ipp_tag_t curtag; /* Current attribute group tag */
491
492/**** New in CUPS 1.2 ****/
f3c17241 493 ipp_attribute_t *prev; /* Previous attribute (for read) @since CUPS 1.2/OS X 10.5@ */
82cc1f9a
MS
494
495/**** New in CUPS 1.4.4 ****/
f3c17241 496 int use; /* Use count @since CUPS 1.4.4/OS X 10.6.?@ */
82cc1f9a
MS
497};
498# endif /* _IPP_PRIVATE_STRUCTURES */
499
500
ef416fc2 501/*
502 * Prototypes...
503 */
504
fa73b229 505extern ipp_attribute_t *ippAddBoolean(ipp_t *ipp, ipp_tag_t group,
506 const char *name, char value);
507extern ipp_attribute_t *ippAddBooleans(ipp_t *ipp, ipp_tag_t group,
508 const char *name, int num_values,
509 const char *values);
510extern ipp_attribute_t *ippAddDate(ipp_t *ipp, ipp_tag_t group,
511 const char *name, const ipp_uchar_t *value);
512extern ipp_attribute_t *ippAddInteger(ipp_t *ipp, ipp_tag_t group,
a2326b5b 513 ipp_tag_t value_tag, const char *name,
fa73b229 514 int value);
515extern ipp_attribute_t *ippAddIntegers(ipp_t *ipp, ipp_tag_t group,
a2326b5b 516 ipp_tag_t value_tag, const char *name,
fa73b229 517 int num_values, const int *values);
518extern ipp_attribute_t *ippAddRange(ipp_t *ipp, ipp_tag_t group,
519 const char *name, int lower, int upper);
520extern ipp_attribute_t *ippAddRanges(ipp_t *ipp, ipp_tag_t group,
521 const char *name, int num_values,
522 const int *lower, const int *upper);
523extern ipp_attribute_t *ippAddResolution(ipp_t *ipp, ipp_tag_t group,
524 const char *name, ipp_res_t units,
525 int xres, int yres);
526extern ipp_attribute_t *ippAddResolutions(ipp_t *ipp, ipp_tag_t group,
527 const char *name, int num_values,
528 ipp_res_t units, const int *xres,
529 const int *yres);
ef416fc2 530extern ipp_attribute_t *ippAddSeparator(ipp_t *ipp);
fa73b229 531extern ipp_attribute_t *ippAddString(ipp_t *ipp, ipp_tag_t group,
a2326b5b
MS
532 ipp_tag_t value_tag, const char *name,
533 const char *language, const char *value);
fa73b229 534extern ipp_attribute_t *ippAddStrings(ipp_t *ipp, ipp_tag_t group,
a2326b5b
MS
535 ipp_tag_t value_tag, const char *name,
536 int num_values, const char *language,
fa73b229 537 const char * const *values);
ef416fc2 538extern time_t ippDateToTime(const ipp_uchar_t *date);
539extern void ippDelete(ipp_t *ipp);
540extern const char *ippErrorString(ipp_status_t error);
541extern ipp_attribute_t *ippFindAttribute(ipp_t *ipp, const char *name,
a2326b5b 542 ipp_tag_t value_tag);
ef416fc2 543extern ipp_attribute_t *ippFindNextAttribute(ipp_t *ipp, const char *name,
a2326b5b 544 ipp_tag_t value_tag);
ef416fc2 545extern size_t ippLength(ipp_t *ipp);
546extern ipp_t *ippNew(void);
547extern ipp_state_t ippRead(http_t *http, ipp_t *ipp);
548extern const ipp_uchar_t *ippTimeToDate(time_t t);
549extern ipp_state_t ippWrite(http_t *http, ipp_t *ipp);
550extern int ippPort(void);
551extern void ippSetPort(int p);
552
553/**** New in CUPS 1.1.19 ****/
fa73b229 554extern ipp_attribute_t *ippAddCollection(ipp_t *ipp, ipp_tag_t group,
2fb76298 555 const char *name, ipp_t *value) _CUPS_API_1_1_19;
fa73b229 556extern ipp_attribute_t *ippAddCollections(ipp_t *ipp, ipp_tag_t group,
557 const char *name, int num_values,
2fb76298
MS
558 const ipp_t **values) _CUPS_API_1_1_19;
559extern void ippDeleteAttribute(ipp_t *ipp, ipp_attribute_t *attr) _CUPS_API_1_1_19;
560extern ipp_state_t ippReadFile(int fd, ipp_t *ipp) _CUPS_API_1_1_19;
561extern ipp_state_t ippWriteFile(int fd, ipp_t *ipp) _CUPS_API_1_1_19;
ef416fc2 562
f3c17241 563/**** New in CUPS 1.2/OS X 10.5 ****/
ef416fc2 564extern ipp_attribute_t *ippAddOctetString(ipp_t *ipp, ipp_tag_t group,
565 const char *name,
2fb76298
MS
566 const void *data, int datalen) _CUPS_API_1_2;
567extern ipp_status_t ippErrorValue(const char *name) _CUPS_API_1_2;
568extern ipp_t *ippNewRequest(ipp_op_t op) _CUPS_API_1_2;
569extern const char *ippOpString(ipp_op_t op) _CUPS_API_1_2;
570extern ipp_op_t ippOpValue(const char *name) _CUPS_API_1_2;
a4d04587 571extern ipp_state_t ippReadIO(void *src, ipp_iocb_t cb, int blocking,
2fb76298 572 ipp_t *parent, ipp_t *ipp) _CUPS_API_1_2;
a4d04587 573extern ipp_state_t ippWriteIO(void *dst, ipp_iocb_t cb, int blocking,
2fb76298 574 ipp_t *parent, ipp_t *ipp) _CUPS_API_1_2;
ef416fc2 575
f3c17241 576/**** New in CUPS 1.4/OS X 10.6 ****/
1ff0402e
MS
577extern const char *ippTagString(ipp_tag_t tag) _CUPS_API_1_4;
578extern ipp_tag_t ippTagValue(const char *name) _CUPS_API_1_4;
579
f3c17241 580/**** New in CUPS 1.6/OS X 10.8 ****/
9c80ffa2
MS
581extern ipp_attribute_t *ippAddOutOfBand(ipp_t *ipp, ipp_tag_t group,
582 ipp_tag_t value_tag, const char *name)
583 _CUPS_API_1_6;
a2326b5b
MS
584extern size_t ippAttributeString(ipp_attribute_t *attr, char *buffer,
585 size_t bufsize) _CUPS_API_1_6;
586extern ipp_attribute_t *ippCopyAttribute(ipp_t *dst, ipp_attribute_t *attr,
587 int quickcopy) _CUPS_API_1_6;
588extern int ippCopyAttributes(ipp_t *dst, ipp_t *src,
9c80ffa2
MS
589 int quickcopy, ipp_copycb_t cb,
590 void *context) _CUPS_API_1_6;
591extern int ippDeleteValues(ipp_t *ipp, ipp_attribute_t **attr,
592 int element, int count) _CUPS_API_1_6;
593extern const char *ippEnumString(const char *attrname, int enumvalue)
594 _CUPS_API_1_6;
595extern int ippEnumValue(const char *attrname,
596 const char *enumstring) _CUPS_API_1_6;
a2326b5b
MS
597extern ipp_attribute_t *ippFirstAttribute(ipp_t *ipp) _CUPS_API_1_6;
598extern int ippGetBoolean(ipp_attribute_t *attr, int element)
599 _CUPS_API_1_6;
600extern ipp_t *ippGetCollection(ipp_attribute_t *attr,
601 int element) _CUPS_API_1_6;
602extern int ippGetCount(ipp_attribute_t *attr) _CUPS_API_1_6;
9c80ffa2
MS
603extern const ipp_uchar_t *ippGetDate(ipp_attribute_t *attr, int element)
604 _CUPS_API_1_6;
a2326b5b
MS
605extern ipp_tag_t ippGetGroupTag(ipp_attribute_t *attr) _CUPS_API_1_6;
606extern int ippGetInteger(ipp_attribute_t *attr, int element)
607 _CUPS_API_1_6;
608extern const char *ippGetName(ipp_attribute_t *attr) _CUPS_API_1_6;
609extern ipp_op_t ippGetOperation(ipp_t *ipp) _CUPS_API_1_6;
9c80ffa2
MS
610extern int ippGetRange(ipp_attribute_t *attr, int element,
611 int *upper) _CUPS_API_1_6;
a2326b5b
MS
612extern int ippGetRequestId(ipp_t *ipp) _CUPS_API_1_6;
613extern int ippGetResolution(ipp_attribute_t *attr, int element,
9c80ffa2
MS
614 int *yres, ipp_res_t *units)
615 _CUPS_API_1_6;
616extern ipp_state_t ippGetState(ipp_t *ipp) _CUPS_API_1_6;
a2326b5b
MS
617extern ipp_status_t ippGetStatusCode(ipp_t *ipp) _CUPS_API_1_6;
618extern const char *ippGetString(ipp_attribute_t *attr, int element,
619 const char **language) _CUPS_API_1_6;
620extern ipp_tag_t ippGetValueTag(ipp_attribute_t *attr) _CUPS_API_1_6;
621extern int ippGetVersion(ipp_t *ipp, int *minor) _CUPS_API_1_6;
622extern ipp_attribute_t *ippNextAttribute(ipp_t *ipp) _CUPS_API_1_6;
623extern int ippSetBoolean(ipp_t *ipp, ipp_attribute_t **attr,
624 int element, int boolvalue) _CUPS_API_1_6;
625extern int ippSetCollection(ipp_t *ipp, ipp_attribute_t **attr,
9c80ffa2
MS
626 int element, ipp_t *colvalue)
627 _CUPS_API_1_6;
628extern int ippSetDate(ipp_t *ipp, ipp_attribute_t **attr,
629 int element, const ipp_uchar_t *datevalue)
630 _CUPS_API_1_6;
a2326b5b
MS
631extern int ippSetGroupTag(ipp_t *ipp, ipp_attribute_t **attr,
632 ipp_tag_t group_tag) _CUPS_API_1_6;
633extern int ippSetInteger(ipp_t *ipp, ipp_attribute_t **attr,
634 int element, int intvalue) _CUPS_API_1_6;
9c80ffa2
MS
635extern int ippSetName(ipp_t *ipp, ipp_attribute_t **attr,
636 const char *name) _CUPS_API_1_6;
a2326b5b 637extern int ippSetOperation(ipp_t *ipp, ipp_op_t op) _CUPS_API_1_6;
9c80ffa2
MS
638extern int ippSetRange(ipp_t *ipp, ipp_attribute_t **attr,
639 int element, int lowervalue, int uppervalue)
640 _CUPS_API_1_6;
a2326b5b
MS
641extern int ippSetRequestId(ipp_t *ipp, int request_id)
642 _CUPS_API_1_6;
643extern int ippSetResolution(ipp_t *ipp, ipp_attribute_t **attr,
644 int element, ipp_res_t unitsvalue,
9c80ffa2
MS
645 int xresvalue, int yresvalue)
646 _CUPS_API_1_6;
647extern int ippSetState(ipp_t *ipp, ipp_state_t state)
648 _CUPS_API_1_6;
649extern int ippSetStatusCode(ipp_t *ipp, ipp_status_t status)
650 _CUPS_API_1_6;
a2326b5b 651extern int ippSetString(ipp_t *ipp, ipp_attribute_t **attr,
9c80ffa2
MS
652 int element, const char *strvalue)
653 _CUPS_API_1_6;
a2326b5b
MS
654extern int ippSetValueTag(ipp_t *ipp, ipp_attribute_t **attr,
655 ipp_tag_t value_tag) _CUPS_API_1_6;
9c80ffa2
MS
656extern int ippSetVersion(ipp_t *ipp, int major, int minor)
657 _CUPS_API_1_6;
a2326b5b 658
ef416fc2 659
660/*
661 * C++ magic...
662 */
663
664# ifdef __cplusplus
665}
666# endif /* __cplusplus */
667#endif /* !_CUPS_IPP_H_ */
668
669/*
b19ccc9e 670 * End of "$Id: ipp.h 7847 2008-08-19 04:22:14Z mike $".
ef416fc2 671 */