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_LENGTH 32767 /* Maximum size of any single value */
58 # define IPP_MAX_NAME 256 /* Maximum length of common name values */
59 # define IPP_MAX_VALUES 8 /* Power-of-2 allocation increment */
63 * Types and structures...
66 typedef enum ipp_dstate_e
/**** Document states ****/
68 IPP_DOCUMENT_PENDING
= 3,
69 IPP_DOCUMENT_PROCESSING
= 5,
70 IPP_DOCUMENT_CANCELED
= 7,
72 IPP_DOCUMENT_COMPLETED
75 typedef enum ipp_finish_e
/**** Finishings ****/
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 */
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 */
111 typedef enum ipp_jcollate_e
/**** Job collation types ****/
113 IPP_JOB_UNCOLLATED_SHEETS
= 3,
114 IPP_JOB_COLLATED_DOCUMENTS
,
115 IPP_JOB_UNCOLLATED_DOCUMENTS
118 typedef enum ipp_jstate_e
/**** Job states ****/
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 */
124 IPP_JOB_CANCELED
, /* Job has been canceled */
125 IPP_JOB_ABORTED
, /* Job has aborted due to error */
126 IPP_JOB_COMPLETED
/* Job has completed successfully */
127 /* Legacy name for canceled state */
128 #define IPP_JOB_CANCELLED IPP_JOB_CANCELED
131 typedef enum ipp_op_e
/**** IPP operations ****/
133 IPP_OP_CUPS_INVALID
= -1, /* Invalid operation name for @link ippOpValue@ */
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 */
153 IPP_CREATE_PRINTER_SUBSCRIPTION
, /* Create a printer subscription @since CUPS 1.2/Mac OS X 10.5@ */
154 IPP_CREATE_JOB_SUBSCRIPTION
, /* Create a job subscription @since CUPS 1.2/Mac OS X 10.5@ */
155 IPP_GET_SUBSCRIPTION_ATTRIBUTES
, /* Get subscription attributes @since CUPS 1.2/Mac OS X 10.5@ */
156 IPP_GET_SUBSCRIPTIONS
, /* Get list of subscriptions @since CUPS 1.2/Mac OS X 10.5@ */
157 IPP_RENEW_SUBSCRIPTION
, /* Renew a printer subscription @since CUPS 1.2/Mac OS X 10.5@ */
158 IPP_CANCEL_SUBSCRIPTION
, /* Cancel a subscription @since CUPS 1.2/Mac OS X 10.5@ */
159 IPP_GET_NOTIFICATIONS
, /* Get notification events @since CUPS 1.2/Mac OS X 10.5@ */
160 IPP_SEND_NOTIFICATIONS
, /* Send notification events @private@ */
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@ */
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@ */
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 */
190 IPP_IDENTIFY_PRINTER
, /* Identify-Printer (proposed IPP JPS3) */
191 IPP_VALIDATE_DOCUMENT
, /* Validate-Document (proposed IPP JPS3) */
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 */
206 CUPS_AUTHENTICATE_JOB
, /* Authenticate a job @since CUPS 1.2/Mac OS X 10.5@ */
207 CUPS_GET_PPD
, /* Get a PPD file @since CUPS 1.3/Mac OS X 10.5@ */
208 CUPS_GET_DOCUMENT
= 0x4027 /* Get a document file @since CUPS 1.4/Mac OS X 10.6@ */
210 /* Legacy names for the add operations */
211 #define CUPS_ADD_PRINTER CUPS_ADD_MODIFY_PRINTER
212 #define CUPS_ADD_CLASS CUPS_ADD_MODIFY_CLASS
215 typedef enum ipp_orient_e
/**** Orientation values ****/
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 */
223 typedef enum ipp_pstate_e
/**** Printer states ****/
225 IPP_PRINTER_IDLE
= 3, /* Printer is idle */
226 IPP_PRINTER_PROCESSING
, /* Printer is working */
227 IPP_PRINTER_STOPPED
/* Printer is stopped */
230 typedef enum ipp_quality_e
/**** Qualities ****/
232 IPP_QUALITY_DRAFT
= 3, /* Draft quality */
233 IPP_QUALITY_NORMAL
, /* Normal quality */
234 IPP_QUALITY_HIGH
/* High quality */
237 typedef enum ipp_res_e
/**** Resolution units ****/
239 IPP_RES_PER_INCH
= 3, /* Pixels per inch */
240 IPP_RES_PER_CM
/* Pixels per centimeter */
243 typedef enum ipp_state_e
/**** IPP states ****/
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 */
252 typedef enum ipp_status_e
/**** IPP status codes ****/
254 IPP_STATUS_CUPS_INVALID
= -1, /* Invalid status name for @link ippErrorValue@ */
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 */
259 IPP_OK_IGNORED_NOTIFICATIONS
, /* successful-ok-ignored-notifications @private@ */
260 IPP_OK_TOO_MANY_EVENTS
, /* successful-ok-too-many-events */
261 IPP_OK_BUT_CANCEL_SUBSCRIPTION
, /* successful-ok-but-cancel-subscription @private@ */
262 IPP_OK_EVENTS_COMPLETE
, /* successful-ok-events-complete */
263 IPP_REDIRECTION_OTHER_SITE
= 0x200, /* redirection-other-site @private@ */
264 CUPS_SEE_OTHER
= 0x280, /* cups-see-other */
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 */
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 */
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 */
302 IPP_ERROR_JOB_CANCELED
, /* server-error-job-canceled */
303 IPP_MULTIPLE_JOBS_NOT_SUPPORTED
, /* server-error-multiple-document-jobs-not-supported */
304 IPP_PRINTER_IS_DEACTIVATED
, /* server-error-printer-is-deactivated */
305 IPP_TOO_MANY_JOBS
, /* server-error-too-many-jobs */
306 IPP_TOO_MANY_DOCUMENTS
, /* server-error-too-many-documents */
308 IPP_AUTHENTICATION_CANCELED
= 0x1000, /* Authentication canceled by user @since CUPS 1.5/Mac OS X 10.7@ */
309 IPP_PKI_ERROR
, /* Error negotiating a secure connection @since CUPS 1.5/Mac OS X 10.7@ */
310 IPP_UPGRADE_REQUIRED
/* TLS upgrade required */
312 /* Legacy name for canceled status */
313 #define IPP_ERROR_JOB_CANCELLED IPP_ERROR_JOB_CANCELED
317 typedef enum ipp_tag_e
/**** Format tags for attributes ****/
319 IPP_TAG_CUPS_INVALID
= -1, /* Invalid tag name for @link ippTagValue@ */
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@ */
364 typedef unsigned char ipp_uchar_t
; /**** Unsigned 8-bit integer/character ****/
365 typedef struct _ipp_s ipp_t
; /**** IPP request/response data ****/
366 typedef struct _ipp_attribute_s ipp_attribute_t
;
367 /**** IPP attribute ****/
369 /**** New in CUPS 1.2 ****/
370 typedef ssize_t (*ipp_iocb_t
)(void *context
, ipp_uchar_t
*buffer
, size_t bytes
);
371 /**** IPP IO Callback Function @since CUPS 1.2/Mac OS X 10.5@ ****/
373 /**** New in CUPS 1.6 ****/
374 typedef int (*ipp_copycb_t
)(void *context
, ipp_t
*dst
, ipp_attribute_t
*attr
);
378 * The following structures are PRIVATE starting with CUPS 1.6. Please use the
379 * new accessor functions available in CUPS 1.6 and later, as these definitions
380 * will be moved to a private header file in a future release.
382 * Define _IPP_PRIVATE_STRUCTURES to cause the private IPP structures to be
383 * exposed in CUPS 1.6.
386 # if defined(_CUPS_SOURCE) || defined(_CUPS_IPP_PRIVATE_H_)
388 # define _IPP_PRIVATE_STRUCTURES 1
389 # elif defined(__APPLE__)
390 # if defined(MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
391 /* Building for 10.7 and earlier */
392 # define _IPP_PRIVATE_STRUCTURES 1
393 # elif !defined(MAC_OS_X_VERSION_10_8)
394 /* Building for 10.7 and earlier */
395 # define _IPP_PRIVATE_STRUCTURES 1
396 # endif /* MAC_OS_X_VERSION_10_8 && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8 */
397 # endif /* _CUPS_SOURCE || _CUPS_IPP_PRIVATE_H_ */
399 # ifdef _IPP_PRIVATE_STRUCTURES
400 typedef union _ipp_request_u
/**** Request Header ****/
402 struct /* Any Header */
404 ipp_uchar_t version
[2]; /* Protocol version number */
405 int op_status
; /* Operation ID or status code*/
406 int request_id
; /* Request ID */
409 struct /* Operation Header */
411 ipp_uchar_t version
[2]; /* Protocol version number */
412 ipp_op_t operation_id
; /* Operation ID */
413 int request_id
; /* Request ID */
416 struct /* Status Header */
418 ipp_uchar_t version
[2]; /* Protocol version number */
419 ipp_status_t status_code
; /* Status code */
420 int request_id
; /* Request ID */
423 /**** New in CUPS 1.1.19 ****/
424 struct /* Event Header @since CUPS 1.1.19/Mac OS X 10.3@ */
426 ipp_uchar_t version
[2]; /* Protocol version number */
427 ipp_status_t status_code
; /* Status code */
428 int request_id
; /* Request ID */
432 /**** New in CUPS 1.1.19 ****/
434 typedef union _ipp_value_u
/**** Attribute Value ****/
436 int integer
; /* Integer/enumerated value */
438 char boolean
; /* Boolean value */
440 ipp_uchar_t date
[11]; /* Date/time value */
444 int xres
, /* Horizontal resolution */
445 yres
; /* Vertical resolution */
446 ipp_res_t units
; /* Resolution units */
447 } resolution
; /* Resolution value */
451 int lower
, /* Lower value */
452 upper
; /* Upper value */
453 } range
; /* Range of integers value */
457 char *language
; /* Language code */
458 char *text
; /* String */
459 } string
; /* String with language value */
463 int length
; /* Length of attribute */
464 void *data
; /* Data in attribute */
465 } unknown
; /* Unknown attribute type */
467 /**** New in CUPS 1.1.19 ****/
468 ipp_t
*collection
; /* Collection value @since CUPS 1.1.19/Mac OS X 10.3@ */
470 typedef _ipp_value_t ipp_value_t
; /**** Convenience typedef that will be removed @private@ ****/
472 struct _ipp_attribute_s
/**** Attribute ****/
474 ipp_attribute_t
*next
; /* Next attribute in list */
475 ipp_tag_t group_tag
, /* Job/Printer/Operation group tag */
476 value_tag
; /* What type of value is it? */
477 char *name
; /* Name of attribute */
478 int num_values
; /* Number of values */
479 _ipp_value_t values
[1]; /* Values */
482 struct _ipp_s
/**** IPP Request/Response/Notification ****/
484 ipp_state_t state
; /* State of request */
485 _ipp_request_t request
; /* Request header */
486 ipp_attribute_t
*attrs
; /* Attributes */
487 ipp_attribute_t
*last
; /* Last attribute in list */
488 ipp_attribute_t
*current
; /* Current attribute (for read/write) */
489 ipp_tag_t curtag
; /* Current attribute group tag */
491 /**** New in CUPS 1.2 ****/
492 ipp_attribute_t
*prev
; /* Previous attribute (for read) @since CUPS 1.2/Mac OS X 10.5@ */
494 /**** New in CUPS 1.4.4 ****/
495 int use
; /* Use count @since CUPS 1.4.4/Mac OS X 10.6.?@ */
497 # endif /* _IPP_PRIVATE_STRUCTURES */
504 extern ipp_attribute_t
*ippAddBoolean(ipp_t
*ipp
, ipp_tag_t group
,
505 const char *name
, char value
);
506 extern ipp_attribute_t
*ippAddBooleans(ipp_t
*ipp
, ipp_tag_t group
,
507 const char *name
, int num_values
,
509 extern ipp_attribute_t
*ippAddDate(ipp_t
*ipp
, ipp_tag_t group
,
510 const char *name
, const ipp_uchar_t
*value
);
511 extern ipp_attribute_t
*ippAddInteger(ipp_t
*ipp
, ipp_tag_t group
,
512 ipp_tag_t value_tag
, const char *name
,
514 extern ipp_attribute_t
*ippAddIntegers(ipp_t
*ipp
, ipp_tag_t group
,
515 ipp_tag_t value_tag
, const char *name
,
516 int num_values
, const int *values
);
517 extern ipp_attribute_t
*ippAddRange(ipp_t
*ipp
, ipp_tag_t group
,
518 const char *name
, int lower
, int upper
);
519 extern ipp_attribute_t
*ippAddRanges(ipp_t
*ipp
, ipp_tag_t group
,
520 const char *name
, int num_values
,
521 const int *lower
, const int *upper
);
522 extern ipp_attribute_t
*ippAddResolution(ipp_t
*ipp
, ipp_tag_t group
,
523 const char *name
, ipp_res_t units
,
525 extern ipp_attribute_t
*ippAddResolutions(ipp_t
*ipp
, ipp_tag_t group
,
526 const char *name
, int num_values
,
527 ipp_res_t units
, const int *xres
,
529 extern ipp_attribute_t
*ippAddSeparator(ipp_t
*ipp
);
530 extern ipp_attribute_t
*ippAddString(ipp_t
*ipp
, ipp_tag_t group
,
531 ipp_tag_t value_tag
, const char *name
,
532 const char *language
, const char *value
);
533 extern ipp_attribute_t
*ippAddStrings(ipp_t
*ipp
, ipp_tag_t group
,
534 ipp_tag_t value_tag
, const char *name
,
535 int num_values
, const char *language
,
536 const char * const *values
);
537 extern time_t ippDateToTime(const ipp_uchar_t
*date
);
538 extern void ippDelete(ipp_t
*ipp
);
539 extern const char *ippErrorString(ipp_status_t error
);
540 extern ipp_attribute_t
*ippFindAttribute(ipp_t
*ipp
, const char *name
,
541 ipp_tag_t value_tag
);
542 extern ipp_attribute_t
*ippFindNextAttribute(ipp_t
*ipp
, const char *name
,
543 ipp_tag_t value_tag
);
544 extern size_t ippLength(ipp_t
*ipp
);
545 extern ipp_t
*ippNew(void);
546 extern ipp_state_t
ippRead(http_t
*http
, ipp_t
*ipp
);
547 extern const ipp_uchar_t
*ippTimeToDate(time_t t
);
548 extern ipp_state_t
ippWrite(http_t
*http
, ipp_t
*ipp
);
549 extern int ippPort(void);
550 extern void ippSetPort(int p
);
552 /**** New in CUPS 1.1.19 ****/
553 extern ipp_attribute_t
*ippAddCollection(ipp_t
*ipp
, ipp_tag_t group
,
554 const char *name
, ipp_t
*value
) _CUPS_API_1_1_19
;
555 extern ipp_attribute_t
*ippAddCollections(ipp_t
*ipp
, ipp_tag_t group
,
556 const char *name
, int num_values
,
557 const ipp_t
**values
) _CUPS_API_1_1_19
;
558 extern void ippDeleteAttribute(ipp_t
*ipp
, ipp_attribute_t
*attr
) _CUPS_API_1_1_19
;
559 extern ipp_state_t
ippReadFile(int fd
, ipp_t
*ipp
) _CUPS_API_1_1_19
;
560 extern ipp_state_t
ippWriteFile(int fd
, ipp_t
*ipp
) _CUPS_API_1_1_19
;
562 /**** New in CUPS 1.2/Mac OS X 10.5 ****/
563 extern ipp_attribute_t
*ippAddOctetString(ipp_t
*ipp
, ipp_tag_t group
,
565 const void *data
, int datalen
) _CUPS_API_1_2
;
566 extern ipp_status_t
ippErrorValue(const char *name
) _CUPS_API_1_2
;
567 extern ipp_t
*ippNewRequest(ipp_op_t op
) _CUPS_API_1_2
;
568 extern const char *ippOpString(ipp_op_t op
) _CUPS_API_1_2
;
569 extern ipp_op_t
ippOpValue(const char *name
) _CUPS_API_1_2
;
570 extern ipp_state_t
ippReadIO(void *src
, ipp_iocb_t cb
, int blocking
,
571 ipp_t
*parent
, ipp_t
*ipp
) _CUPS_API_1_2
;
572 extern ipp_state_t
ippWriteIO(void *dst
, ipp_iocb_t cb
, int blocking
,
573 ipp_t
*parent
, ipp_t
*ipp
) _CUPS_API_1_2
;
575 /**** New in CUPS 1.4/Mac OS X 10.6 ****/
576 extern const char *ippTagString(ipp_tag_t tag
) _CUPS_API_1_4
;
577 extern ipp_tag_t
ippTagValue(const char *name
) _CUPS_API_1_4
;
579 /**** New in CUPS 1.6 ****/
580 extern ipp_attribute_t
*ippAddOutOfBand(ipp_t
*ipp
, ipp_tag_t group
,
581 ipp_tag_t value_tag
, const char *name
)
583 extern size_t ippAttributeString(ipp_attribute_t
*attr
, char *buffer
,
584 size_t bufsize
) _CUPS_API_1_6
;
585 extern ipp_attribute_t
*ippCopyAttribute(ipp_t
*dst
, ipp_attribute_t
*attr
,
586 int quickcopy
) _CUPS_API_1_6
;
587 extern int ippCopyAttributes(ipp_t
*dst
, ipp_t
*src
,
588 int quickcopy
, ipp_copycb_t cb
,
589 void *context
) _CUPS_API_1_6
;
590 extern int ippDeleteValues(ipp_t
*ipp
, ipp_attribute_t
**attr
,
591 int element
, int count
) _CUPS_API_1_6
;
592 extern const char *ippEnumString(const char *attrname
, int enumvalue
)
594 extern int ippEnumValue(const char *attrname
,
595 const char *enumstring
) _CUPS_API_1_6
;
596 extern ipp_attribute_t
*ippFirstAttribute(ipp_t
*ipp
) _CUPS_API_1_6
;
597 extern int ippGetBoolean(ipp_attribute_t
*attr
, int element
)
599 extern ipp_t
*ippGetCollection(ipp_attribute_t
*attr
,
600 int element
) _CUPS_API_1_6
;
601 extern int ippGetCount(ipp_attribute_t
*attr
) _CUPS_API_1_6
;
602 extern const ipp_uchar_t
*ippGetDate(ipp_attribute_t
*attr
, int element
)
604 extern ipp_tag_t
ippGetGroupTag(ipp_attribute_t
*attr
) _CUPS_API_1_6
;
605 extern int ippGetInteger(ipp_attribute_t
*attr
, int element
)
607 extern const char *ippGetName(ipp_attribute_t
*attr
) _CUPS_API_1_6
;
608 extern ipp_op_t
ippGetOperation(ipp_t
*ipp
) _CUPS_API_1_6
;
609 extern int ippGetRange(ipp_attribute_t
*attr
, int element
,
610 int *upper
) _CUPS_API_1_6
;
611 extern int ippGetRequestId(ipp_t
*ipp
) _CUPS_API_1_6
;
612 extern int ippGetResolution(ipp_attribute_t
*attr
, int element
,
613 int *yres
, ipp_res_t
*units
)
615 extern ipp_state_t
ippGetState(ipp_t
*ipp
) _CUPS_API_1_6
;
616 extern ipp_status_t
ippGetStatusCode(ipp_t
*ipp
) _CUPS_API_1_6
;
617 extern const char *ippGetString(ipp_attribute_t
*attr
, int element
,
618 const char **language
) _CUPS_API_1_6
;
619 extern ipp_tag_t
ippGetValueTag(ipp_attribute_t
*attr
) _CUPS_API_1_6
;
620 extern int ippGetVersion(ipp_t
*ipp
, int *minor
) _CUPS_API_1_6
;
621 extern ipp_attribute_t
*ippNextAttribute(ipp_t
*ipp
) _CUPS_API_1_6
;
622 extern int ippSetBoolean(ipp_t
*ipp
, ipp_attribute_t
**attr
,
623 int element
, int boolvalue
) _CUPS_API_1_6
;
624 extern int ippSetCollection(ipp_t
*ipp
, ipp_attribute_t
**attr
,
625 int element
, ipp_t
*colvalue
)
627 extern int ippSetDate(ipp_t
*ipp
, ipp_attribute_t
**attr
,
628 int element
, const ipp_uchar_t
*datevalue
)
630 extern int ippSetGroupTag(ipp_t
*ipp
, ipp_attribute_t
**attr
,
631 ipp_tag_t group_tag
) _CUPS_API_1_6
;
632 extern int ippSetInteger(ipp_t
*ipp
, ipp_attribute_t
**attr
,
633 int element
, int intvalue
) _CUPS_API_1_6
;
634 extern int ippSetName(ipp_t
*ipp
, ipp_attribute_t
**attr
,
635 const char *name
) _CUPS_API_1_6
;
636 extern int ippSetOperation(ipp_t
*ipp
, ipp_op_t op
) _CUPS_API_1_6
;
637 extern int ippSetRange(ipp_t
*ipp
, ipp_attribute_t
**attr
,
638 int element
, int lowervalue
, int uppervalue
)
640 extern int ippSetRequestId(ipp_t
*ipp
, int request_id
)
642 extern int ippSetResolution(ipp_t
*ipp
, ipp_attribute_t
**attr
,
643 int element
, ipp_res_t unitsvalue
,
644 int xresvalue
, int yresvalue
)
646 extern int ippSetState(ipp_t
*ipp
, ipp_state_t state
)
648 extern int ippSetStatusCode(ipp_t
*ipp
, ipp_status_t status
)
650 extern int ippSetString(ipp_t
*ipp
, ipp_attribute_t
**attr
,
651 int element
, const char *strvalue
)
653 extern int ippSetValueTag(ipp_t
*ipp
, ipp_attribute_t
**attr
,
654 ipp_tag_t value_tag
) _CUPS_API_1_6
;
655 extern int ippSetVersion(ipp_t
*ipp
, int major
, int minor
)
665 # endif /* __cplusplus */
666 #endif /* !_CUPS_IPP_H_ */
669 * End of "$Id: ipp.h 7847 2008-08-19 04:22:14Z mike $".