2 * "$Id: ipp.h 5090 2006-02-08 17:08:01Z mike $"
4 * Internet Printing Protocol definitions for the Common UNIX Printing
7 * Copyright 1997-2006 by Easy Software Products.
9 * These coded instructions, statements, and computer programs are the
10 * property of Easy Software Products and are protected by Federal
11 * copyright law. Distribution and use rights are outlined in the file
12 * "LICENSE.txt" which should have been included with this file. If this
13 * file is missing or damaged please contact Easy Software Products
16 * Attn: CUPS Licensing Information
17 * Easy Software Products
18 * 44141 Airport View Drive, Suite 204
19 * Hollywood, Maryland 20636 USA
21 * Voice: (301) 373-9600
22 * EMail: cups-info@cups.org
23 * WWW: http://www.cups.org
25 * This file is subject to the Apple OS-Developed Software exception.
32 * Include necessary headers...
44 # endif /* __cplusplus */
48 * IPP version string...
51 # define IPP_VERSION "\001\001"
54 * IPP registered port number...
56 * Note: Applications should never use IPP_PORT, but instead use the
57 * ippPort() function to allow overrides via the IPP_PORT environment
58 * variable and services file if needed!
67 # define IPP_MAX_NAME 256
68 # define IPP_MAX_VALUES 8 /* Power-of-2 allocation increment */
72 * Types and structures...
75 typedef enum /**** Format tags for attribute formats... ****/
82 IPP_TAG_UNSUPPORTED_GROUP
,
84 IPP_TAG_EVENT_NOTIFICATION
,
85 IPP_TAG_UNSUPPORTED_VALUE
= 0x10,
89 IPP_TAG_NOTSETTABLE
= 0x15,
92 IPP_TAG_INTEGER
= 0x21,
95 IPP_TAG_STRING
= 0x30,
99 IPP_TAG_BEGIN_COLLECTION
,
102 IPP_TAG_END_COLLECTION
,
105 IPP_TAG_KEYWORD
= 0x44,
112 IPP_TAG_MASK
= 0x7fffffff, /* Mask for copied attribute values */
113 IPP_TAG_COPY
= -0x7fffffff-1 /* Bitflag for copied attribute values */
116 typedef enum /**** Resolution units... ****/
118 IPP_RES_PER_INCH
= 3,
122 typedef enum /**** Finishings... ****/
124 IPP_FINISHINGS_NONE
= 3,
125 IPP_FINISHINGS_STAPLE
,
126 IPP_FINISHINGS_PUNCH
,
127 IPP_FINISHINGS_COVER
,
129 IPP_FINISHINGS_SADDLE_STITCH
,
130 IPP_FINISHINGS_EDGE_STITCH
,
134 IPP_FINISHINGS_BOOKLET_MAKER
,
135 IPP_FINISHINGS_JOB_OFFSET
,
136 IPP_FINISHINGS_STAPLE_TOP_LEFT
= 20,
137 IPP_FINISHINGS_STAPLE_BOTTOM_LEFT
,
138 IPP_FINISHINGS_STAPLE_TOP_RIGHT
,
139 IPP_FINISHINGS_STAPLE_BOTTOM_RIGHT
,
140 IPP_FINISHINGS_EDGE_STITCH_LEFT
,
141 IPP_FINISHINGS_EDGE_STITCH_TOP
,
142 IPP_FINISHINGS_EDGE_STITCH_RIGHT
,
143 IPP_FINISHINGS_EDGE_STITCH_BOTTOM
,
144 IPP_FINISHINGS_STAPLE_DUAL_LEFT
,
145 IPP_FINISHINGS_STAPLE_DUAL_TOP
,
146 IPP_FINISHINGS_STAPLE_DUAL_RIGHT
,
147 IPP_FINISHINGS_STAPLE_DUAL_BOTTOM
,
148 IPP_FINISHINGS_BIND_LEFT
= 50,
149 IPP_FINISHINGS_BIND_TOP
,
150 IPP_FINISHINGS_BIND_RIGHT
,
151 IPP_FINISHINGS_BIND_BOTTOM
154 typedef enum /**** Orientation... ****/
156 IPP_PORTRAIT
= 3, /* No rotation */
157 IPP_LANDSCAPE
, /* 90 degrees counter-clockwise */
158 IPP_REVERSE_LANDSCAPE
, /* 90 degrees clockwise */
159 IPP_REVERSE_PORTRAIT
/* 180 degrees */
162 typedef enum /**** Qualities... ****/
164 IPP_QUALITY_DRAFT
= 3,
169 typedef enum /**** Job States.... */
180 typedef enum /**** Printer States.... */
182 IPP_PRINTER_IDLE
= 3,
183 IPP_PRINTER_PROCESSING
,
187 typedef enum /**** IPP states... ****/
189 IPP_ERROR
= -1, /* An error occurred */
190 IPP_IDLE
, /* Nothing is happening/request completed */
191 IPP_HEADER
, /* The request header needs to be sent/received */
192 IPP_ATTRIBUTE
, /* One or more attributes need to be sent/received */
193 IPP_DATA
/* IPP request data needs to be sent/received */
196 typedef enum /**** IPP operations... ****/
198 IPP_PRINT_JOB
= 0x0002,
205 IPP_GET_JOB_ATTRIBUTES
,
207 IPP_GET_PRINTER_ATTRIBUTES
,
211 IPP_PAUSE_PRINTER
= 0x0010,
214 IPP_SET_PRINTER_ATTRIBUTES
,
215 IPP_SET_JOB_ATTRIBUTES
,
216 IPP_GET_PRINTER_SUPPORTED_VALUES
,
217 IPP_CREATE_PRINTER_SUBSCRIPTION
,
218 IPP_CREATE_JOB_SUBSCRIPTION
,
219 IPP_GET_SUBSCRIPTION_ATTRIBUTES
,
220 IPP_GET_SUBSCRIPTIONS
,
221 IPP_RENEW_SUBSCRIPTION
,
222 IPP_CANCEL_SUBSCRIPTION
,
223 IPP_GET_NOTIFICATIONS
,
224 IPP_SEND_NOTIFICATIONS
,
225 IPP_GET_PRINT_SUPPORT_FILES
= 0x0021,
228 IPP_PAUSE_PRINTER_AFTER_CURRENT_JOB
,
230 IPP_RELEASE_HELD_NEW_JOBS
,
231 IPP_DEACTIVATE_PRINTER
,
232 IPP_ACTIVATE_PRINTER
,
234 IPP_SHUTDOWN_PRINTER
,
237 IPP_CANCEL_CURRENT_JOB
,
238 IPP_SUSPEND_CURRENT_JOB
,
241 IPP_SCHEDULE_JOB_AFTER
,
242 IPP_PRIVATE
= 0x4000,
245 CUPS_ADD_MODIFY_PRINTER
,
248 CUPS_ADD_MODIFY_CLASS
,
256 CUPS_AUTHENTICATE_JOB
259 /* Old names for the operations */
260 #define CUPS_ADD_PRINTER CUPS_ADD_MODIFY_PRINTER
261 #define CUPS_ADD_CLASS CUPS_ADD_MODIFY_CLASS
263 typedef enum /**** IPP status codes... ****/
268 IPP_OK_IGNORED_SUBSCRIPTIONS
,
269 IPP_OK_IGNORED_NOTIFICATIONS
,
270 IPP_OK_TOO_MANY_EVENTS
,
271 IPP_OK_BUT_CANCEL_SUBSCRIPTION
,
272 IPP_OK_EVENTS_COMPLETE
,
273 IPP_REDIRECTION_OTHER_SITE
= 0x300,
274 IPP_BAD_REQUEST
= 0x0400,
276 IPP_NOT_AUTHENTICATED
,
289 IPP_COMPRESSION_NOT_SUPPORTED
,
290 IPP_COMPRESSION_ERROR
,
291 IPP_DOCUMENT_FORMAT_ERROR
,
292 IPP_DOCUMENT_ACCESS_ERROR
,
293 IPP_ATTRIBUTES_NOT_SETTABLE
,
294 IPP_IGNORED_ALL_SUBSCRIPTIONS
,
295 IPP_TOO_MANY_SUBSCRIPTIONS
,
296 IPP_IGNORED_ALL_NOTIFICATIONS
,
297 IPP_PRINT_SUPPORT_FILE_NOT_FOUND
,
299 IPP_INTERNAL_ERROR
= 0x0500,
300 IPP_OPERATION_NOT_SUPPORTED
,
301 IPP_SERVICE_UNAVAILABLE
,
302 IPP_VERSION_NOT_SUPPORTED
,
307 IPP_ERROR_JOB_CANCELLED
,
308 IPP_MULTIPLE_JOBS_NOT_SUPPORTED
,
309 IPP_PRINTER_IS_DEACTIVATED
312 typedef unsigned char ipp_uchar_t
; /**** Unsigned 8-bit integer/character ****/
314 /**** New in CUPS 1.2 ****/
315 typedef ssize_t (*ipp_iocb_t
)(void *, ipp_uchar_t
*, size_t);
316 /**** IPP IO Callback Function @since CUPS 1.2@ ****/
318 typedef union /**** Request Header ****/
320 struct /* Any Header */
322 ipp_uchar_t version
[2]; /* Protocol version number */
323 int op_status
; /* Operation ID or status code*/
324 int request_id
; /* Request ID */
327 struct /* Operation Header */
329 ipp_uchar_t version
[2]; /* Protocol version number */
330 ipp_op_t operation_id
; /* Operation ID */
331 int request_id
; /* Request ID */
334 struct /* Status Header */
336 ipp_uchar_t version
[2]; /* Protocol version number */
337 ipp_status_t status_code
; /* Status code */
338 int request_id
; /* Request ID */
341 /**** New in CUPS 1.1.19 ****/
342 struct /* Event Header */
344 ipp_uchar_t version
[2]; /* Protocol version number */
345 ipp_status_t status_code
; /* Status code */
346 int request_id
; /* Request ID */
350 /**** New in CUPS 1.1.19 ****/
351 typedef struct ipp_str ipp_t
;
353 typedef union /**** Attribute Value ****/
355 int integer
; /* Integer/enumerated value */
357 char boolean
; /* Boolean value */
359 ipp_uchar_t date
[11]; /* Date/time value */
363 int xres
, /* Horizontal resolution */
364 yres
; /* Vertical resolution */
365 ipp_res_t units
; /* Resolution units */
366 } resolution
; /* Resolution value */
370 int lower
, /* Lower value */
371 upper
; /* Upper value */
372 } range
; /* Range of integers value */
376 char *charset
; /* Character set */
377 char *text
; /* String */
378 } string
; /* String with language value */
382 int length
; /* Length of attribute */
383 void *data
; /* Data in attribute */
384 } unknown
; /* Unknown attribute type */
386 /**** New in CUPS 1.1.19 ****/
387 ipp_t
*collection
; /* Collection value */
390 typedef struct ipp_attribute_s
/**** Attribute ****/
392 struct ipp_attribute_s
*next
; /* Next attribute in list */
393 ipp_tag_t group_tag
, /* Job/Printer/Operation group tag */
394 value_tag
; /* What type of value is it? */
395 char *name
; /* Name of attribute */
396 int num_values
; /* Number of values */
397 ipp_value_t values
[1]; /* Values */
400 struct ipp_str
/**** IPP Request/Response/Notification ****/
402 ipp_state_t state
; /* State of request */
403 ipp_request_t request
; /* Request header */
404 ipp_attribute_t
*attrs
, /* Attributes */
405 *last
, /* Last attribute in list */
406 *current
; /* Current attribute (for read/write) */
407 ipp_tag_t curtag
; /* Current attribute group tag */
409 /**** New in CUPS 1.2 ****/
410 ipp_attribute_t
*prev
; /* Previous attribute (for read) */
418 extern ipp_attribute_t
*ippAddBoolean(ipp_t
*ipp
, ipp_tag_t group
,
419 const char *name
, char value
);
420 extern ipp_attribute_t
*ippAddBooleans(ipp_t
*ipp
, ipp_tag_t group
,
421 const char *name
, int num_values
,
423 extern ipp_attribute_t
*ippAddDate(ipp_t
*ipp
, ipp_tag_t group
,
424 const char *name
, const ipp_uchar_t
*value
);
425 extern ipp_attribute_t
*ippAddInteger(ipp_t
*ipp
, ipp_tag_t group
,
426 ipp_tag_t type
, const char *name
,
428 extern ipp_attribute_t
*ippAddIntegers(ipp_t
*ipp
, ipp_tag_t group
,
429 ipp_tag_t type
, const char *name
,
430 int num_values
, const int *values
);
431 extern ipp_attribute_t
*ippAddRange(ipp_t
*ipp
, ipp_tag_t group
,
432 const char *name
, int lower
, int upper
);
433 extern ipp_attribute_t
*ippAddRanges(ipp_t
*ipp
, ipp_tag_t group
,
434 const char *name
, int num_values
,
435 const int *lower
, const int *upper
);
436 extern ipp_attribute_t
*ippAddResolution(ipp_t
*ipp
, ipp_tag_t group
,
437 const char *name
, ipp_res_t units
,
439 extern ipp_attribute_t
*ippAddResolutions(ipp_t
*ipp
, ipp_tag_t group
,
440 const char *name
, int num_values
,
441 ipp_res_t units
, const int *xres
,
443 extern ipp_attribute_t
*ippAddSeparator(ipp_t
*ipp
);
444 extern ipp_attribute_t
*ippAddString(ipp_t
*ipp
, ipp_tag_t group
,
445 ipp_tag_t type
, const char *name
,
446 const char *charset
, const char *value
);
447 extern ipp_attribute_t
*ippAddStrings(ipp_t
*ipp
, ipp_tag_t group
,
448 ipp_tag_t type
, const char *name
,
449 int num_values
, const char *charset
,
450 const char * const *values
);
451 extern time_t ippDateToTime(const ipp_uchar_t
*date
);
452 extern void ippDelete(ipp_t
*ipp
);
453 extern const char *ippErrorString(ipp_status_t error
);
454 extern ipp_attribute_t
*ippFindAttribute(ipp_t
*ipp
, const char *name
,
456 extern ipp_attribute_t
*ippFindNextAttribute(ipp_t
*ipp
, const char *name
,
458 extern size_t ippLength(ipp_t
*ipp
);
459 extern ipp_t
*ippNew(void);
460 extern ipp_state_t
ippRead(http_t
*http
, ipp_t
*ipp
);
461 extern const ipp_uchar_t
*ippTimeToDate(time_t t
);
462 extern ipp_state_t
ippWrite(http_t
*http
, ipp_t
*ipp
);
463 extern int ippPort(void);
464 extern void ippSetPort(int p
);
466 /**** New in CUPS 1.1.19 ****/
467 extern ipp_attribute_t
*ippAddCollection(ipp_t
*ipp
, ipp_tag_t group
,
468 const char *name
, ipp_t
*value
);
469 extern ipp_attribute_t
*ippAddCollections(ipp_t
*ipp
, ipp_tag_t group
,
470 const char *name
, int num_values
,
471 const ipp_t
**values
);
472 extern void ippDeleteAttribute(ipp_t
*ipp
, ipp_attribute_t
*attr
);
473 extern ipp_state_t
ippReadFile(int fd
, ipp_t
*ipp
);
474 extern ipp_state_t
ippWriteFile(int fd
, ipp_t
*ipp
);
476 /**** New in CUPS 1.2 ****/
477 extern ipp_attribute_t
*ippAddOctetString(ipp_t
*ipp
, ipp_tag_t group
,
479 const void *data
, int datalen
);
480 extern ipp_status_t
ippErrorValue(const char *name
);
481 extern ipp_t
*ippNewRequest(ipp_op_t op
);
482 extern const char *ippOpString(ipp_op_t op
);
483 extern ipp_op_t
ippOpValue(const char *name
);
484 extern ipp_state_t
ippReadIO(void *src
, ipp_iocb_t cb
, int blocking
,
485 ipp_t
*parent
, ipp_t
*ipp
);
486 extern ipp_state_t
ippWriteIO(void *dst
, ipp_iocb_t cb
, int blocking
,
487 ipp_t
*parent
, ipp_t
*ipp
);
496 # endif /* __cplusplus */
497 #endif /* !_CUPS_IPP_H_ */
500 * End of "$Id: ipp.h 5090 2006-02-08 17:08:01Z mike $".