2 * "$Id: ipp.h 7847 2008-08-19 04:22:14Z mike $"
4 * Internet Printing Protocol definitions for CUPS.
6 * Copyright 2007-2012 by Apple Inc.
7 * Copyright 1997-2006 by Easy Software Products.
9 * These coded instructions, statements, and computer programs are the
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/".
15 * This file is subject to the Apple OS-Developed Software exception.
22 * Include necessary headers...
34 # endif /* __cplusplus */
38 * IPP version string...
41 # define IPP_VERSION "\002\001"
44 * IPP registered port number...
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!
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 */
60 # define IPP_MAX_LENGTH 32767 /* Maximum size of any single value */
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 */
67 # define IPP_MAX_VALUES 8 /* Power-of-2 allocation increment */
71 * Types and structures...
74 typedef enum ipp_dstate_e
/**** Document states ****/
76 IPP_DOCUMENT_PENDING
= 3,
77 IPP_DOCUMENT_PROCESSING
= 5,
78 IPP_DOCUMENT_CANCELED
= 7,
80 IPP_DOCUMENT_COMPLETED
83 typedef enum ipp_finish_e
/**** Finishings ****/
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 */
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 */
119 typedef enum ipp_jcollate_e
/**** Job collation types ****/
121 IPP_JOB_UNCOLLATED_SHEETS
= 3,
122 IPP_JOB_COLLATED_DOCUMENTS
,
123 IPP_JOB_UNCOLLATED_DOCUMENTS
126 typedef enum ipp_jstate_e
/**** Job states ****/
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 */
132 IPP_JOB_CANCELED
, /* Job has been canceled */
133 IPP_JOB_ABORTED
, /* Job has aborted due to error */
134 IPP_JOB_COMPLETED
/* Job has completed successfully */
135 /* Legacy name for canceled state */
136 #define IPP_JOB_CANCELLED IPP_JOB_CANCELED
139 typedef enum ipp_op_e
/**** IPP operations ****/
141 IPP_OP_CUPS_INVALID
= -1, /* Invalid operation name for @link ippOpValue@ */
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 */
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@ */
168 IPP_SEND_NOTIFICATIONS
, /* Send notification events @private@ */
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@ */
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@ */
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 */
198 IPP_IDENTIFY_PRINTER
, /* Identify-Printer (proposed IPP JPS3) */
199 IPP_VALIDATE_DOCUMENT
, /* Validate-Document (proposed IPP JPS3) */
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 */
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@ */
218 /* Legacy names for the add operations */
219 #define CUPS_ADD_PRINTER CUPS_ADD_MODIFY_PRINTER
220 #define CUPS_ADD_CLASS CUPS_ADD_MODIFY_CLASS
223 typedef enum ipp_orient_e
/**** Orientation values ****/
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 */
231 typedef enum ipp_pstate_e
/**** Printer states ****/
233 IPP_PRINTER_IDLE
= 3, /* Printer is idle */
234 IPP_PRINTER_PROCESSING
, /* Printer is working */
235 IPP_PRINTER_STOPPED
/* Printer is stopped */
238 typedef enum ipp_quality_e
/**** Qualities ****/
240 IPP_QUALITY_DRAFT
= 3, /* Draft quality */
241 IPP_QUALITY_NORMAL
, /* Normal quality */
242 IPP_QUALITY_HIGH
/* High quality */
245 typedef enum ipp_res_e
/**** Resolution units ****/
247 IPP_RES_PER_INCH
= 3, /* Pixels per inch */
248 IPP_RES_PER_CM
/* Pixels per centimeter */
251 typedef enum ipp_state_e
/**** IPP states ****/
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 */
260 typedef enum ipp_status_e
/**** IPP status codes ****/
262 IPP_STATUS_CUPS_INVALID
= -1, /* Invalid status name for @link ippErrorValue@ */
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 */
267 IPP_OK_IGNORED_NOTIFICATIONS
, /* successful-ok-ignored-notifications @private@ */
268 IPP_OK_TOO_MANY_EVENTS
, /* successful-ok-too-many-events */
269 IPP_OK_BUT_CANCEL_SUBSCRIPTION
, /* successful-ok-but-cancel-subscription @private@ */
270 IPP_OK_EVENTS_COMPLETE
, /* successful-ok-events-complete */
271 IPP_REDIRECTION_OTHER_SITE
= 0x200, /* redirection-other-site @private@ */
272 CUPS_SEE_OTHER
= 0x280, /* cups-see-other */
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 */
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 */
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 */
310 IPP_ERROR_JOB_CANCELED
, /* server-error-job-canceled */
311 IPP_MULTIPLE_JOBS_NOT_SUPPORTED
, /* server-error-multiple-document-jobs-not-supported */
312 IPP_PRINTER_IS_DEACTIVATED
, /* server-error-printer-is-deactivated */
313 IPP_TOO_MANY_JOBS
, /* server-error-too-many-jobs */
314 IPP_TOO_MANY_DOCUMENTS
, /* server-error-too-many-documents */
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@ */
318 IPP_UPGRADE_REQUIRED
/* TLS upgrade required */
320 /* Legacy name for canceled status */
321 #define IPP_ERROR_JOB_CANCELLED IPP_ERROR_JOB_CANCELED
325 typedef enum ipp_tag_e
/**** Format tags for attributes ****/
327 IPP_TAG_CUPS_INVALID
= -1, /* Invalid tag name for @link ippTagValue@ */
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@ */
372 typedef unsigned char ipp_uchar_t
; /**** Unsigned 8-bit integer/character ****/
373 typedef struct _ipp_s ipp_t
; /**** IPP request/response data ****/
374 typedef struct _ipp_attribute_s ipp_attribute_t
;
375 /**** IPP attribute ****/
377 /**** New in CUPS 1.2/OS X 10.5 ****/
378 typedef ssize_t (*ipp_iocb_t
)(void *context
, ipp_uchar_t
*buffer
, size_t bytes
);
379 /**** IPP IO Callback Function @since CUPS 1.2/OS X 10.5@ ****/
381 /**** New in CUPS 1.6/OS X 10.8 ****/
382 typedef int (*ipp_copycb_t
)(void *context
, ipp_t
*dst
, ipp_attribute_t
*attr
);
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.
390 * Define _IPP_PRIVATE_STRUCTURES to cause the private IPP structures to be
391 * exposed in CUPS 1.6. This happens automatically on OS X when compiling for
392 * a deployment target of 10.7 or earlier.
395 # if defined(_CUPS_SOURCE) || defined(_CUPS_IPP_PRIVATE_H_)
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_ */
408 # ifdef _IPP_PRIVATE_STRUCTURES
409 typedef union _ipp_request_u
/**** Request Header ****/
411 struct /* Any Header */
413 ipp_uchar_t version
[2]; /* Protocol version number */
414 int op_status
; /* Operation ID or status code*/
415 int request_id
; /* Request ID */
418 struct /* Operation Header */
420 ipp_uchar_t version
[2]; /* Protocol version number */
421 ipp_op_t operation_id
; /* Operation ID */
422 int request_id
; /* Request ID */
425 struct /* Status Header */
427 ipp_uchar_t version
[2]; /* Protocol version number */
428 ipp_status_t status_code
; /* Status code */
429 int request_id
; /* Request ID */
432 /**** New in CUPS 1.1.19 ****/
433 struct /* Event Header @since CUPS 1.1.19/OS X 10.3@ */
435 ipp_uchar_t version
[2]; /* Protocol version number */
436 ipp_status_t status_code
; /* Status code */
437 int request_id
; /* Request ID */
441 /**** New in CUPS 1.1.19 ****/
443 typedef union _ipp_value_u
/**** Attribute Value ****/
445 int integer
; /* Integer/enumerated value */
447 char boolean
; /* Boolean value */
449 ipp_uchar_t date
[11]; /* Date/time value */
453 int xres
, /* Horizontal resolution */
454 yres
; /* Vertical resolution */
455 ipp_res_t units
; /* Resolution units */
456 } resolution
; /* Resolution value */
460 int lower
, /* Lower value */
461 upper
; /* Upper value */
462 } range
; /* Range of integers value */
466 char *language
; /* Language code */
467 char *text
; /* String */
468 } string
; /* String with language value */
472 int length
; /* Length of attribute */
473 void *data
; /* Data in attribute */
474 } unknown
; /* Unknown attribute type */
476 /**** New in CUPS 1.1.19 ****/
477 ipp_t
*collection
; /* Collection value @since CUPS 1.1.19/OS X 10.3@ */
479 typedef _ipp_value_t ipp_value_t
; /**** Convenience typedef that will be removed @private@ ****/
481 struct _ipp_attribute_s
/**** Attribute ****/
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 */
491 struct _ipp_s
/**** IPP Request/Response/Notification ****/
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 */
500 /**** New in CUPS 1.2 ****/
501 ipp_attribute_t
*prev
; /* Previous attribute (for read) @since CUPS 1.2/OS X 10.5@ */
503 /**** New in CUPS 1.4.4 ****/
504 int use
; /* Use count @since CUPS 1.4.4/OS X 10.6.?@ */
506 # endif /* _IPP_PRIVATE_STRUCTURES */
513 extern ipp_attribute_t
*ippAddBoolean(ipp_t
*ipp
, ipp_tag_t group
,
514 const char *name
, char value
);
515 extern ipp_attribute_t
*ippAddBooleans(ipp_t
*ipp
, ipp_tag_t group
,
516 const char *name
, int num_values
,
518 extern ipp_attribute_t
*ippAddDate(ipp_t
*ipp
, ipp_tag_t group
,
519 const char *name
, const ipp_uchar_t
*value
);
520 extern ipp_attribute_t
*ippAddInteger(ipp_t
*ipp
, ipp_tag_t group
,
521 ipp_tag_t value_tag
, const char *name
,
523 extern ipp_attribute_t
*ippAddIntegers(ipp_t
*ipp
, ipp_tag_t group
,
524 ipp_tag_t value_tag
, const char *name
,
525 int num_values
, const int *values
);
526 extern ipp_attribute_t
*ippAddRange(ipp_t
*ipp
, ipp_tag_t group
,
527 const char *name
, int lower
, int upper
);
528 extern 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
);
531 extern ipp_attribute_t
*ippAddResolution(ipp_t
*ipp
, ipp_tag_t group
,
532 const char *name
, ipp_res_t units
,
534 extern 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
,
538 extern ipp_attribute_t
*ippAddSeparator(ipp_t
*ipp
);
539 extern ipp_attribute_t
*ippAddString(ipp_t
*ipp
, ipp_tag_t group
,
540 ipp_tag_t value_tag
, const char *name
,
541 const char *language
, const char *value
);
542 extern ipp_attribute_t
*ippAddStrings(ipp_t
*ipp
, ipp_tag_t group
,
543 ipp_tag_t value_tag
, const char *name
,
544 int num_values
, const char *language
,
545 const char * const *values
);
546 extern time_t ippDateToTime(const ipp_uchar_t
*date
);
547 extern void ippDelete(ipp_t
*ipp
);
548 extern const char *ippErrorString(ipp_status_t error
);
549 extern ipp_attribute_t
*ippFindAttribute(ipp_t
*ipp
, const char *name
,
550 ipp_tag_t value_tag
);
551 extern ipp_attribute_t
*ippFindNextAttribute(ipp_t
*ipp
, const char *name
,
552 ipp_tag_t value_tag
);
553 extern size_t ippLength(ipp_t
*ipp
);
554 extern ipp_t
*ippNew(void);
555 extern ipp_state_t
ippRead(http_t
*http
, ipp_t
*ipp
);
556 extern const ipp_uchar_t
*ippTimeToDate(time_t t
);
557 extern ipp_state_t
ippWrite(http_t
*http
, ipp_t
*ipp
);
558 extern int ippPort(void);
559 extern void ippSetPort(int p
);
561 /**** New in CUPS 1.1.19 ****/
562 extern ipp_attribute_t
*ippAddCollection(ipp_t
*ipp
, ipp_tag_t group
,
563 const char *name
, ipp_t
*value
) _CUPS_API_1_1_19
;
564 extern ipp_attribute_t
*ippAddCollections(ipp_t
*ipp
, ipp_tag_t group
,
565 const char *name
, int num_values
,
566 const ipp_t
**values
) _CUPS_API_1_1_19
;
567 extern void ippDeleteAttribute(ipp_t
*ipp
, ipp_attribute_t
*attr
) _CUPS_API_1_1_19
;
568 extern ipp_state_t
ippReadFile(int fd
, ipp_t
*ipp
) _CUPS_API_1_1_19
;
569 extern ipp_state_t
ippWriteFile(int fd
, ipp_t
*ipp
) _CUPS_API_1_1_19
;
571 /**** New in CUPS 1.2/OS X 10.5 ****/
572 extern ipp_attribute_t
*ippAddOctetString(ipp_t
*ipp
, ipp_tag_t group
,
574 const void *data
, int datalen
) _CUPS_API_1_2
;
575 extern ipp_status_t
ippErrorValue(const char *name
) _CUPS_API_1_2
;
576 extern ipp_t
*ippNewRequest(ipp_op_t op
) _CUPS_API_1_2
;
577 extern const char *ippOpString(ipp_op_t op
) _CUPS_API_1_2
;
578 extern ipp_op_t
ippOpValue(const char *name
) _CUPS_API_1_2
;
579 extern ipp_state_t
ippReadIO(void *src
, ipp_iocb_t cb
, int blocking
,
580 ipp_t
*parent
, ipp_t
*ipp
) _CUPS_API_1_2
;
581 extern ipp_state_t
ippWriteIO(void *dst
, ipp_iocb_t cb
, int blocking
,
582 ipp_t
*parent
, ipp_t
*ipp
) _CUPS_API_1_2
;
584 /**** New in CUPS 1.4/OS X 10.6 ****/
585 extern const char *ippTagString(ipp_tag_t tag
) _CUPS_API_1_4
;
586 extern ipp_tag_t
ippTagValue(const char *name
) _CUPS_API_1_4
;
588 /**** New in CUPS 1.6/OS X 10.8 ****/
589 extern ipp_attribute_t
*ippAddOutOfBand(ipp_t
*ipp
, ipp_tag_t group
,
590 ipp_tag_t value_tag
, const char *name
)
592 extern size_t ippAttributeString(ipp_attribute_t
*attr
, char *buffer
,
593 size_t bufsize
) _CUPS_API_1_6
;
594 extern ipp_attribute_t
*ippCopyAttribute(ipp_t
*dst
, ipp_attribute_t
*attr
,
595 int quickcopy
) _CUPS_API_1_6
;
596 extern int ippCopyAttributes(ipp_t
*dst
, ipp_t
*src
,
597 int quickcopy
, ipp_copycb_t cb
,
598 void *context
) _CUPS_API_1_6
;
599 extern int ippDeleteValues(ipp_t
*ipp
, ipp_attribute_t
**attr
,
600 int element
, int count
) _CUPS_API_1_6
;
601 extern const char *ippEnumString(const char *attrname
, int enumvalue
)
603 extern int ippEnumValue(const char *attrname
,
604 const char *enumstring
) _CUPS_API_1_6
;
605 extern ipp_attribute_t
*ippFirstAttribute(ipp_t
*ipp
) _CUPS_API_1_6
;
606 extern int ippGetBoolean(ipp_attribute_t
*attr
, int element
)
608 extern ipp_t
*ippGetCollection(ipp_attribute_t
*attr
,
609 int element
) _CUPS_API_1_6
;
610 extern int ippGetCount(ipp_attribute_t
*attr
) _CUPS_API_1_6
;
611 extern const ipp_uchar_t
*ippGetDate(ipp_attribute_t
*attr
, int element
)
613 extern ipp_tag_t
ippGetGroupTag(ipp_attribute_t
*attr
) _CUPS_API_1_6
;
614 extern int ippGetInteger(ipp_attribute_t
*attr
, int element
)
616 extern const char *ippGetName(ipp_attribute_t
*attr
) _CUPS_API_1_6
;
617 extern ipp_op_t
ippGetOperation(ipp_t
*ipp
) _CUPS_API_1_6
;
618 extern int ippGetRange(ipp_attribute_t
*attr
, int element
,
619 int *upper
) _CUPS_API_1_6
;
620 extern int ippGetRequestId(ipp_t
*ipp
) _CUPS_API_1_6
;
621 extern int ippGetResolution(ipp_attribute_t
*attr
, int element
,
622 int *yres
, ipp_res_t
*units
)
624 extern ipp_state_t
ippGetState(ipp_t
*ipp
) _CUPS_API_1_6
;
625 extern ipp_status_t
ippGetStatusCode(ipp_t
*ipp
) _CUPS_API_1_6
;
626 extern const char *ippGetString(ipp_attribute_t
*attr
, int element
,
627 const char **language
) _CUPS_API_1_6
;
628 extern ipp_tag_t
ippGetValueTag(ipp_attribute_t
*attr
) _CUPS_API_1_6
;
629 extern int ippGetVersion(ipp_t
*ipp
, int *minor
) _CUPS_API_1_6
;
630 extern ipp_attribute_t
*ippNextAttribute(ipp_t
*ipp
) _CUPS_API_1_6
;
631 extern int ippSetBoolean(ipp_t
*ipp
, ipp_attribute_t
**attr
,
632 int element
, int boolvalue
) _CUPS_API_1_6
;
633 extern int ippSetCollection(ipp_t
*ipp
, ipp_attribute_t
**attr
,
634 int element
, ipp_t
*colvalue
)
636 extern int ippSetDate(ipp_t
*ipp
, ipp_attribute_t
**attr
,
637 int element
, const ipp_uchar_t
*datevalue
)
639 extern int ippSetGroupTag(ipp_t
*ipp
, ipp_attribute_t
**attr
,
640 ipp_tag_t group_tag
) _CUPS_API_1_6
;
641 extern int ippSetInteger(ipp_t
*ipp
, ipp_attribute_t
**attr
,
642 int element
, int intvalue
) _CUPS_API_1_6
;
643 extern int ippSetName(ipp_t
*ipp
, ipp_attribute_t
**attr
,
644 const char *name
) _CUPS_API_1_6
;
645 extern int ippSetOperation(ipp_t
*ipp
, ipp_op_t op
) _CUPS_API_1_6
;
646 extern int ippSetRange(ipp_t
*ipp
, ipp_attribute_t
**attr
,
647 int element
, int lowervalue
, int uppervalue
)
649 extern int ippSetRequestId(ipp_t
*ipp
, int request_id
)
651 extern int ippSetResolution(ipp_t
*ipp
, ipp_attribute_t
**attr
,
652 int element
, ipp_res_t unitsvalue
,
653 int xresvalue
, int yresvalue
)
655 extern int ippSetState(ipp_t
*ipp
, ipp_state_t state
)
657 extern int ippSetStatusCode(ipp_t
*ipp
, ipp_status_t status
)
659 extern int ippSetString(ipp_t
*ipp
, ipp_attribute_t
**attr
,
660 int element
, const char *strvalue
)
662 extern int ippSetValueTag(ipp_t
*ipp
, ipp_attribute_t
**attr
,
663 ipp_tag_t value_tag
) _CUPS_API_1_6
;
664 extern int ippSetVersion(ipp_t
*ipp
, int major
, int minor
)
674 # endif /* __cplusplus */
675 #endif /* !_CUPS_IPP_H_ */
678 * End of "$Id: ipp.h 7847 2008-08-19 04:22:14Z mike $".