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