]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/ipp.h
Update documentation and dependencies for 1.5b1.
[thirdparty/cups.git] / cups / ipp.h
CommitLineData
dec2f757 1/*
c9d3f842 2 * "$Id$"
dec2f757 3 *
cc624a65 4 * Internet Printing Protocol definitions for CUPS.
dec2f757 5 *
a1a2e89a 6 * Copyright 2007-2011 by Apple Inc.
ada3287d 7 * Copyright 1997-2006 by Easy Software Products.
dec2f757 8 *
9 * These coded instructions, statements, and computer programs are the
4e8d321f 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/".
dab1a4d8 14 *
15 * This file is subject to the Apple OS-Developed Software exception.
dec2f757 16 */
17
94e77cfe 18#ifndef _CUPS_IPP_H_
19# define _CUPS_IPP_H_
3a193f5e 20
dec2f757 21/*
22 * Include necessary headers...
23 */
24
183914a3 25# include "http.h"
3a193f5e 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
cc624a65 41# define IPP_VERSION "\002\001"
3a193f5e 42
20c7158b 43/*
1d9595ab 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!
20c7158b 49 */
50
51# define IPP_PORT 631
3a193f5e 52
3b960317 53/*
54 * Common limits...
55 */
56
67faeb74 57# define IPP_MAX_LENGTH 32767 /* Maximum size of any single value */
58# define IPP_MAX_NAME 256 /* Maximum length of common name values */
357c62c0 59# define IPP_MAX_VALUES 8 /* Power-of-2 allocation increment */
3b960317 60
61
3a193f5e 62/*
63 * Types and structures...
64 */
65
cc624a65 66typedef enum ipp_tag_e /**** Format tags for attributes ****/
3a193f5e 67{
7fbf7fc4 68 IPP_TAG_ZERO = 0x00, /* Zero tag - used for separators */
69 IPP_TAG_OPERATION, /* Operation group */
70 IPP_TAG_JOB, /* Job group */
71 IPP_TAG_END, /* End-of-attributes */
72 IPP_TAG_PRINTER, /* Printer group */
73 IPP_TAG_UNSUPPORTED_GROUP, /* Unsupported attributes group */
74 IPP_TAG_SUBSCRIPTION, /* Subscription group */
75 IPP_TAG_EVENT_NOTIFICATION, /* Event group */
76 IPP_TAG_UNSUPPORTED_VALUE = 0x10, /* Unsupported value */
77 IPP_TAG_DEFAULT, /* Default value */
78 IPP_TAG_UNKNOWN, /* Unknown value */
79 IPP_TAG_NOVALUE, /* No-value value */
80 IPP_TAG_NOTSETTABLE = 0x15, /* Not-settable value */
81 IPP_TAG_DELETEATTR, /* Delete-attribute value */
82 IPP_TAG_ADMINDEFINE, /* Admin-defined value */
83 IPP_TAG_INTEGER = 0x21, /* Integer value */
84 IPP_TAG_BOOLEAN, /* Boolean value */
85 IPP_TAG_ENUM, /* Enumeration value */
86 IPP_TAG_STRING = 0x30, /* Octet string value */
87 IPP_TAG_DATE, /* Date/time value */
88 IPP_TAG_RESOLUTION, /* Resolution value */
89 IPP_TAG_RANGE, /* Range value */
90 IPP_TAG_BEGIN_COLLECTION, /* Beginning of collection value */
91 IPP_TAG_TEXTLANG, /* Text-with-language value */
92 IPP_TAG_NAMELANG, /* Name-with-language value */
93 IPP_TAG_END_COLLECTION, /* End of collection value */
94 IPP_TAG_TEXT = 0x41, /* Text value */
95 IPP_TAG_NAME, /* Name value */
93cbfc28 96 IPP_TAG_RESERVED_STRING, /* Reserved for future string value @private@ */
97 IPP_TAG_KEYWORD, /* Keyword value */
7fbf7fc4 98 IPP_TAG_URI, /* URI value */
99 IPP_TAG_URISCHEME, /* URI scheme value */
100 IPP_TAG_CHARSET, /* Character set value */
101 IPP_TAG_LANGUAGE, /* Language value */
102 IPP_TAG_MIMETYPE, /* MIME media type value */
103 IPP_TAG_MEMBERNAME, /* Collection member name value */
de556b96 104 IPP_TAG_MASK = 0x7fffffff, /* Mask for copied attribute values */
b0a98a63 105 IPP_TAG_COPY = -0x7fffffff-1 /* Bitflag for copied attribute values */
3a193f5e 106} ipp_tag_t;
107
cc624a65 108typedef enum ipp_res_e /**** Resolution units ****/
3a193f5e 109{
7fbf7fc4 110 IPP_RES_PER_INCH = 3, /* Pixels per inch */
111 IPP_RES_PER_CM /* Pixels per centimeter */
3a193f5e 112} ipp_res_t;
113
cc624a65 114typedef enum ipp_finish_e /**** Finishings ****/
50146867 115{
7fbf7fc4 116 IPP_FINISHINGS_NONE = 3, /* No finishing */
117 IPP_FINISHINGS_STAPLE, /* Staple (any location) */
118 IPP_FINISHINGS_PUNCH, /* Punch (any location/count) */
119 IPP_FINISHINGS_COVER, /* Add cover */
120 IPP_FINISHINGS_BIND, /* Bind */
121 IPP_FINISHINGS_SADDLE_STITCH, /* Staple interior */
122 IPP_FINISHINGS_EDGE_STITCH, /* Stitch along any side */
123 IPP_FINISHINGS_FOLD, /* Fold (any type) */
124 IPP_FINISHINGS_TRIM, /* Trim (any type) */
125 IPP_FINISHINGS_BALE, /* Bale (any type) */
126 IPP_FINISHINGS_BOOKLET_MAKER, /* Fold to make booklet */
127 IPP_FINISHINGS_JOB_OFFSET, /* Offset for binding (any type) */
128 IPP_FINISHINGS_STAPLE_TOP_LEFT = 20, /* Staple top left corner */
129 IPP_FINISHINGS_STAPLE_BOTTOM_LEFT, /* Staple bottom left corner */
130 IPP_FINISHINGS_STAPLE_TOP_RIGHT, /* Staple top right corner */
131 IPP_FINISHINGS_STAPLE_BOTTOM_RIGHT, /* Staple bottom right corner */
132 IPP_FINISHINGS_EDGE_STITCH_LEFT, /* Stitch along left side */
133 IPP_FINISHINGS_EDGE_STITCH_TOP, /* Stitch along top edge */
134 IPP_FINISHINGS_EDGE_STITCH_RIGHT, /* Stitch along right side */
135 IPP_FINISHINGS_EDGE_STITCH_BOTTOM, /* Stitch along bottom edge */
136 IPP_FINISHINGS_STAPLE_DUAL_LEFT, /* Two staples on left */
137 IPP_FINISHINGS_STAPLE_DUAL_TOP, /* Two staples on top */
138 IPP_FINISHINGS_STAPLE_DUAL_RIGHT, /* Two staples on right */
139 IPP_FINISHINGS_STAPLE_DUAL_BOTTOM, /* Two staples on bottom */
140 IPP_FINISHINGS_BIND_LEFT = 50, /* Bind on left */
141 IPP_FINISHINGS_BIND_TOP, /* Bind on top */
142 IPP_FINISHINGS_BIND_RIGHT, /* Bind on right */
143 IPP_FINISHINGS_BIND_BOTTOM /* Bind on bottom */
50146867 144} ipp_finish_t;
145
cc624a65 146typedef enum ipp_orient_e /**** Orientation values ****/
50146867 147{
b0a98a63 148 IPP_PORTRAIT = 3, /* No rotation */
149 IPP_LANDSCAPE, /* 90 degrees counter-clockwise */
150 IPP_REVERSE_LANDSCAPE, /* 90 degrees clockwise */
151 IPP_REVERSE_PORTRAIT /* 180 degrees */
50146867 152} ipp_orient_t;
153
cc624a65 154typedef enum ipp_quality_e /**** Qualities ****/
50146867 155{
7fbf7fc4 156 IPP_QUALITY_DRAFT = 3, /* Draft quality */
157 IPP_QUALITY_NORMAL, /* Normal quality */
158 IPP_QUALITY_HIGH /* High quality */
50146867 159} ipp_quality_t;
160
cc624a65 161typedef enum ipp_jstate_e /**** Job states ****/
50146867 162{
7fbf7fc4 163 IPP_JOB_PENDING = 3, /* Job is waiting to be printed */
164 IPP_JOB_HELD, /* Job is held for printing */
165 IPP_JOB_PROCESSING, /* Job is currently printing */
166 IPP_JOB_STOPPED, /* Job has been stopped */
279bbadf 167 IPP_JOB_CANCELED, /* Job has been canceled */
7fbf7fc4 168 IPP_JOB_ABORTED, /* Job has aborted due to error */
169 IPP_JOB_COMPLETED /* Job has completed successfully */
3b960317 170} ipp_jstate_t;
279bbadf 171#define IPP_JOB_CANCELLED IPP_JOB_CANCELED
3b960317 172
cc624a65 173typedef enum ipp_pstate_e /**** Printer states ****/
3b960317 174{
7fbf7fc4 175 IPP_PRINTER_IDLE = 3, /* Printer is idle */
176 IPP_PRINTER_PROCESSING, /* Printer is working */
177 IPP_PRINTER_STOPPED /* Printer is stopped */
3b960317 178} ipp_pstate_t;
50146867 179
cc624a65 180typedef enum ipp_state_e /**** IPP states ****/
3a193f5e 181{
b0a98a63 182 IPP_ERROR = -1, /* An error occurred */
183 IPP_IDLE, /* Nothing is happening/request completed */
184 IPP_HEADER, /* The request header needs to be sent/received */
185 IPP_ATTRIBUTE, /* One or more attributes need to be sent/received */
186 IPP_DATA /* IPP request data needs to be sent/received */
3a193f5e 187} ipp_state_t;
188
cc624a65 189typedef enum ipp_op_e /**** IPP operations ****/
3a193f5e 190{
7fbf7fc4 191 IPP_PRINT_JOB = 0x0002, /* Print a single file */
192 IPP_PRINT_URI, /* Print a single URL @private@ */
193 IPP_VALIDATE_JOB, /* Validate job options */
194 IPP_CREATE_JOB, /* Create an empty print job */
195 IPP_SEND_DOCUMENT, /* Add a file to a job */
196 IPP_SEND_URI, /* Add a URL to a job @private@ */
197 IPP_CANCEL_JOB, /* Cancel a job */
198 IPP_GET_JOB_ATTRIBUTES, /* Get job attributes */
199 IPP_GET_JOBS, /* Get a list of jobs */
200 IPP_GET_PRINTER_ATTRIBUTES, /* Get printer attributes */
201 IPP_HOLD_JOB, /* Hold a job for printing */
202 IPP_RELEASE_JOB, /* Release a job for printing */
203 IPP_RESTART_JOB, /* Reprint a job */
204 IPP_PAUSE_PRINTER = 0x0010, /* Stop a printer */
205 IPP_RESUME_PRINTER, /* Start a printer */
206 IPP_PURGE_JOBS, /* Cancel all jobs */
207 IPP_SET_PRINTER_ATTRIBUTES, /* Set printer attributes @private@ */
208 IPP_SET_JOB_ATTRIBUTES, /* Set job attributes */
209 IPP_GET_PRINTER_SUPPORTED_VALUES, /* Get supported attribute values */
373b3e5f 210 IPP_CREATE_PRINTER_SUBSCRIPTION, /* Create a printer subscription @since CUPS 1.2/Mac OS X 10.5@ */
211 IPP_CREATE_JOB_SUBSCRIPTION, /* Create a job subscription @since CUPS 1.2/Mac OS X 10.5@ */
212 IPP_GET_SUBSCRIPTION_ATTRIBUTES, /* Get subscription attributes @since CUPS 1.2/Mac OS X 10.5@ */
213 IPP_GET_SUBSCRIPTIONS, /* Get list of subscriptions @since CUPS 1.2/Mac OS X 10.5@ */
214 IPP_RENEW_SUBSCRIPTION, /* Renew a printer subscription @since CUPS 1.2/Mac OS X 10.5@ */
215 IPP_CANCEL_SUBSCRIPTION, /* Cancel a subscription @since CUPS 1.2/Mac OS X 10.5@ */
216 IPP_GET_NOTIFICATIONS, /* Get notification events @since CUPS 1.2/Mac OS X 10.5@ */
7fbf7fc4 217 IPP_SEND_NOTIFICATIONS, /* Send notification events @private@ */
218 IPP_GET_PRINT_SUPPORT_FILES = 0x0021, /* Get printer support files @private@ */
219 IPP_ENABLE_PRINTER, /* Start a printer */
220 IPP_DISABLE_PRINTER, /* Stop a printer */
221 IPP_PAUSE_PRINTER_AFTER_CURRENT_JOB, /* Stop printer after the current job @private@ */
222 IPP_HOLD_NEW_JOBS, /* Hold new jobs @private@ */
223 IPP_RELEASE_HELD_NEW_JOBS, /* Release new jobs @private@ */
224 IPP_DEACTIVATE_PRINTER, /* Stop a printer @private@ */
225 IPP_ACTIVATE_PRINTER, /* Start a printer @private@ */
226 IPP_RESTART_PRINTER, /* Restart a printer @private@ */
227 IPP_SHUTDOWN_PRINTER, /* Turn a printer off @private@ */
228 IPP_STARTUP_PRINTER, /* Turn a printer on @private@ */
229 IPP_REPROCESS_JOB, /* Reprint a job @private@ */
230 IPP_CANCEL_CURRENT_JOB, /* Cancel the current job @private@ */
231 IPP_SUSPEND_CURRENT_JOB, /* Suspend the current job @private@ */
232 IPP_RESUME_JOB, /* Resume the current job @private@ */
233 IPP_PROMOTE_JOB, /* Promote a job to print sooner @private@ */
234 IPP_SCHEDULE_JOB_AFTER, /* Schedule a job to print after another @private@ */
a6dfd340 235 IPP_CANCEL_DOCUMENT = 0x0033, /* Cancel-Document @private@ */
236 IPP_GET_DOCUMENT_ATTRIBUTES, /* Get-Document-Attributes @private@ */
237 IPP_GET_DOCUMENTS, /* Get-Documents @private@ */
238 IPP_DELETE_DOCUMENT, /* Delete-Document @private@ */
239 IPP_SET_DOCUMENT_ATTRIBUTES, /* Set-Document-Attributes @private@ */
240 IPP_CANCEL_JOBS, /* Cancel-Jobs */
241 IPP_CANCEL_MY_JOBS, /* Cancel-My-Jobs */
242 IPP_RESUBMIT_JOB, /* Resubmit-Job */
243 IPP_CLOSE_JOB, /* Close-Job */
7fbf7fc4 244 IPP_PRIVATE = 0x4000, /* Reserved @private@ */
245 CUPS_GET_DEFAULT, /* Get the default printer */
246 CUPS_GET_PRINTERS, /* Get a list of printers and/or classes */
247 CUPS_ADD_MODIFY_PRINTER, /* Add or modify a printer */
248 CUPS_DELETE_PRINTER, /* Delete a printer */
249 CUPS_GET_CLASSES, /* Get a list of classes @deprecated@ */
250 CUPS_ADD_MODIFY_CLASS, /* Add or modify a class */
251 CUPS_DELETE_CLASS, /* Delete a class */
252 CUPS_ACCEPT_JOBS, /* Accept new jobs on a printer */
253 CUPS_REJECT_JOBS, /* Reject new jobs on a printer */
254 CUPS_SET_DEFAULT, /* Set the default printer */
255 CUPS_GET_DEVICES, /* Get a list of supported devices */
256 CUPS_GET_PPDS, /* Get a list of supported drivers */
257 CUPS_MOVE_JOB, /* Move a job to a different printer */
373b3e5f 258 CUPS_AUTHENTICATE_JOB, /* Authenticate a job @since CUPS 1.2/Mac OS X 10.5@ */
259 CUPS_GET_PPD, /* Get a PPD file @since CUPS 1.3/Mac OS X 10.5@ */
abc7086c 260 CUPS_GET_DOCUMENT = 0x4027 /* Get a document file @since CUPS 1.4/Mac OS X 10.6@ */
3a193f5e 261} ipp_op_t;
262
e51bcec3 263/* Old names for the operations */
264#define CUPS_ADD_PRINTER CUPS_ADD_MODIFY_PRINTER
265#define CUPS_ADD_CLASS CUPS_ADD_MODIFY_CLASS
266
cc624a65 267typedef enum ipp_status_e /**** IPP status codes ****/
3a193f5e 268{
7fbf7fc4 269 IPP_OK = 0x0000, /* successful-ok */
270 IPP_OK_SUBST, /* successful-ok-ignored-or-substituted-attributes */
271 IPP_OK_CONFLICT, /* successful-ok-conflicting-attributes */
272 IPP_OK_IGNORED_SUBSCRIPTIONS, /* successful-ok-ignored-subscriptions */
273 IPP_OK_IGNORED_NOTIFICATIONS, /* successful-ok-ignored-notifications */
274 IPP_OK_TOO_MANY_EVENTS, /* successful-ok-too-many-events */
275 IPP_OK_BUT_CANCEL_SUBSCRIPTION, /* successful-ok-but-cancel-subscription */
276 IPP_OK_EVENTS_COMPLETE, /* successful-ok-events-complete */
618bbb70 277 IPP_REDIRECTION_OTHER_SITE = 0x200, /* redirection-other-site @private@ */
f8a6e83b 278 CUPS_SEE_OTHER = 0x280, /* cups-see-other */
7fbf7fc4 279 IPP_BAD_REQUEST = 0x0400, /* client-error-bad-request */
280 IPP_FORBIDDEN, /* client-error-forbidden */
281 IPP_NOT_AUTHENTICATED, /* client-error-not-authenticated */
282 IPP_NOT_AUTHORIZED, /* client-error-not-authorized */
283 IPP_NOT_POSSIBLE, /* client-error-not-possible */
284 IPP_TIMEOUT, /* client-error-timeout */
285 IPP_NOT_FOUND, /* client-error-not-found */
286 IPP_GONE, /* client-error-gone */
287 IPP_REQUEST_ENTITY, /* client-error-request-entity-too-large */
288 IPP_REQUEST_VALUE, /* client-error-request-value-too-long */
289 IPP_DOCUMENT_FORMAT, /* client-error-document-format-not-supported */
290 IPP_ATTRIBUTES, /* client-error-attributes-or-values-not-supported */
291 IPP_URI_SCHEME, /* client-error-uri-scheme-not-supported */
292 IPP_CHARSET, /* client-error-charset-not-supported */
293 IPP_CONFLICT, /* client-error-conflicting-attributes */
294 IPP_COMPRESSION_NOT_SUPPORTED, /* client-error-compression-not-supported */
295 IPP_COMPRESSION_ERROR, /* client-error-compression-error */
296 IPP_DOCUMENT_FORMAT_ERROR, /* client-error-document-format-error */
297 IPP_DOCUMENT_ACCESS_ERROR, /* client-error-document-access-error */
298 IPP_ATTRIBUTES_NOT_SETTABLE, /* client-error-attributes-not-settable */
299 IPP_IGNORED_ALL_SUBSCRIPTIONS, /* client-error-ignored-all-subscriptions */
300 IPP_TOO_MANY_SUBSCRIPTIONS, /* client-error-too-many-subscriptions */
301 IPP_IGNORED_ALL_NOTIFICATIONS, /* client-error-ignored-all-notifications */
302 IPP_PRINT_SUPPORT_FILE_NOT_FOUND, /* client-error-print-support-file-not-found */
303
304 IPP_INTERNAL_ERROR = 0x0500, /* server-error-internal-error */
305 IPP_OPERATION_NOT_SUPPORTED, /* server-error-operation-not-supported */
306 IPP_SERVICE_UNAVAILABLE, /* server-error-service-unavailable */
307 IPP_VERSION_NOT_SUPPORTED, /* server-error-version-not-supported */
308 IPP_DEVICE_ERROR, /* server-error-device-error */
309 IPP_TEMPORARY_ERROR, /* server-error-temporary-error */
310 IPP_NOT_ACCEPTING, /* server-error-not-accepting-jobs */
311 IPP_PRINTER_BUSY, /* server-error-busy */
279bbadf 312 IPP_ERROR_JOB_CANCELED, /* server-error-job-canceled */
7fbf7fc4 313 IPP_MULTIPLE_JOBS_NOT_SUPPORTED, /* server-error-multiple-document-jobs-not-supported */
b9738d7c 314 IPP_PRINTER_IS_DEACTIVATED, /* server-error-printer-is-deactivated */
315
a1a2e89a 316 IPP_AUTHENTICATION_CANCELED = 0x1000, /* Authentication canceled by user @since CUPS 1.5/Mac OS X 10.7@ */
317 IPP_PKI_ERROR, /* Error negotiating a secure connection @since CUPS 1.5/Mac OS X 10.7@ */
b9738d7c 318 IPP_UPGRADE_REQUIRED /* TLS upgrade required */
3a193f5e 319} ipp_status_t;
279bbadf 320#define IPP_ERROR_JOB_CANCELLED IPP_ERROR_JOB_CANCELED
3a193f5e 321
b0a98a63 322typedef unsigned char ipp_uchar_t; /**** Unsigned 8-bit integer/character ****/
3a193f5e 323
00a1fad8 324/**** New in CUPS 1.2 ****/
325typedef ssize_t (*ipp_iocb_t)(void *, ipp_uchar_t *, size_t);
373b3e5f 326 /**** IPP IO Callback Function @since CUPS 1.2/Mac OS X 10.5@ ****/
b070f93d 327
7fbf7fc4 328typedef union ipp_request_u /**** Request Header ****/
3a193f5e 329{
b0a98a63 330 struct /* Any Header */
3b960317 331 {
b0a98a63 332 ipp_uchar_t version[2]; /* Protocol version number */
333 int op_status; /* Operation ID or status code*/
334 int request_id; /* Request ID */
3b960317 335 } any;
336
b0a98a63 337 struct /* Operation Header */
50146867 338 {
b0a98a63 339 ipp_uchar_t version[2]; /* Protocol version number */
340 ipp_op_t operation_id; /* Operation ID */
341 int request_id; /* Request ID */
50146867 342 } op;
343
b0a98a63 344 struct /* Status Header */
50146867 345 {
b0a98a63 346 ipp_uchar_t version[2]; /* Protocol version number */
347 ipp_status_t status_code; /* Status code */
348 int request_id; /* Request ID */
50146867 349 } status;
3a193f5e 350
94e77cfe 351 /**** New in CUPS 1.1.19 ****/
373b3e5f 352 struct /* Event Header @since CUPS 1.1.19/Mac OS X 10.3@ */
94e77cfe 353 {
b0a98a63 354 ipp_uchar_t version[2]; /* Protocol version number */
355 ipp_status_t status_code; /* Status code */
356 int request_id; /* Request ID */
94e77cfe 357 } event;
358} ipp_request_t;
359
360/**** New in CUPS 1.1.19 ****/
7fbf7fc4 361typedef struct ipp_s ipp_t;
3a193f5e 362
7fbf7fc4 363typedef union ipp_value_u /**** Attribute Value ****/
3a193f5e 364{
b0a98a63 365 int integer; /* Integer/enumerated value */
3a193f5e 366
b0a98a63 367 char boolean; /* Boolean value */
3a193f5e 368
b0a98a63 369 ipp_uchar_t date[11]; /* Date/time value */
3a193f5e 370
371 struct
372 {
b0a98a63 373 int xres, /* Horizontal resolution */
374 yres; /* Vertical resolution */
375 ipp_res_t units; /* Resolution units */
376 } resolution; /* Resolution value */
3a193f5e 377
378 struct
379 {
b0a98a63 380 int lower, /* Lower value */
381 upper; /* Upper value */
382 } range; /* Range of integers value */
3a193f5e 383
384 struct
385 {
b0a98a63 386 char *charset; /* Character set */
387 char *text; /* String */
388 } string; /* String with language value */
cb1f28d6 389
390 struct
391 {
b0a98a63 392 int length; /* Length of attribute */
393 void *data; /* Data in attribute */
394 } unknown; /* Unknown attribute type */
94e77cfe 395
396/**** New in CUPS 1.1.19 ****/
373b3e5f 397 ipp_t *collection; /* Collection value @since CUPS 1.1.19/Mac OS X 10.3@ */
3a193f5e 398} ipp_value_t;
399
b0a98a63 400typedef struct ipp_attribute_s /**** Attribute ****/
3a193f5e 401{
b0a98a63 402 struct ipp_attribute_s *next; /* Next attribute in list */
403 ipp_tag_t group_tag, /* Job/Printer/Operation group tag */
404 value_tag; /* What type of value is it? */
405 char *name; /* Name of attribute */
406 int num_values; /* Number of values */
407 ipp_value_t values[1]; /* Values */
3a193f5e 408} ipp_attribute_t;
409
7fbf7fc4 410struct ipp_s /**** IPP Request/Response/Notification ****/
3a193f5e 411{
b0a98a63 412 ipp_state_t state; /* State of request */
413 ipp_request_t request; /* Request header */
7fbf7fc4 414 ipp_attribute_t *attrs; /* Attributes */
415 ipp_attribute_t *last; /* Last attribute in list */
416 ipp_attribute_t *current; /* Current attribute (for read/write) */
b0a98a63 417 ipp_tag_t curtag; /* Current attribute group tag */
357c62c0 418
419/**** New in CUPS 1.2 ****/
373b3e5f 420 ipp_attribute_t *prev; /* Previous attribute (for read) @since CUPS 1.2/Mac OS X 10.5@ */
82358d49 421
312482c7 422/**** New in CUPS 1.4.4 ****/
423 int use; /* Use count @since CUPS 1.4.4/Mac OS X 10.6.?@ */
b0757135 424};
3a193f5e 425
426
427/*
428 * Prototypes...
429 */
430
b0a98a63 431extern ipp_attribute_t *ippAddBoolean(ipp_t *ipp, ipp_tag_t group,
432 const char *name, char value);
433extern ipp_attribute_t *ippAddBooleans(ipp_t *ipp, ipp_tag_t group,
434 const char *name, int num_values,
435 const char *values);
436extern ipp_attribute_t *ippAddDate(ipp_t *ipp, ipp_tag_t group,
437 const char *name, const ipp_uchar_t *value);
438extern ipp_attribute_t *ippAddInteger(ipp_t *ipp, ipp_tag_t group,
439 ipp_tag_t type, const char *name,
440 int value);
441extern ipp_attribute_t *ippAddIntegers(ipp_t *ipp, ipp_tag_t group,
442 ipp_tag_t type, const char *name,
443 int num_values, const int *values);
444extern ipp_attribute_t *ippAddRange(ipp_t *ipp, ipp_tag_t group,
445 const char *name, int lower, int upper);
446extern ipp_attribute_t *ippAddRanges(ipp_t *ipp, ipp_tag_t group,
447 const char *name, int num_values,
448 const int *lower, const int *upper);
449extern ipp_attribute_t *ippAddResolution(ipp_t *ipp, ipp_tag_t group,
450 const char *name, ipp_res_t units,
451 int xres, int yres);
452extern ipp_attribute_t *ippAddResolutions(ipp_t *ipp, ipp_tag_t group,
453 const char *name, int num_values,
454 ipp_res_t units, const int *xres,
455 const int *yres);
5356dc5a 456extern ipp_attribute_t *ippAddSeparator(ipp_t *ipp);
b0a98a63 457extern ipp_attribute_t *ippAddString(ipp_t *ipp, ipp_tag_t group,
458 ipp_tag_t type, const char *name,
459 const char *charset, const char *value);
460extern ipp_attribute_t *ippAddStrings(ipp_t *ipp, ipp_tag_t group,
461 ipp_tag_t type, const char *name,
462 int num_values, const char *charset,
463 const char * const *values);
9aebebc3 464extern time_t ippDateToTime(const ipp_uchar_t *date);
50146867 465extern void ippDelete(ipp_t *ipp);
9aebebc3 466extern const char *ippErrorString(ipp_status_t error);
7db52463 467extern ipp_attribute_t *ippFindAttribute(ipp_t *ipp, const char *name,
468 ipp_tag_t type);
469extern ipp_attribute_t *ippFindNextAttribute(ipp_t *ipp, const char *name,
470 ipp_tag_t type);
50146867 471extern size_t ippLength(ipp_t *ipp);
472extern ipp_t *ippNew(void);
3b960317 473extern ipp_state_t ippRead(http_t *http, ipp_t *ipp);
063e1ac7 474extern const ipp_uchar_t *ippTimeToDate(time_t t);
3b960317 475extern ipp_state_t ippWrite(http_t *http, ipp_t *ipp);
7db52463 476extern int ippPort(void);
477extern void ippSetPort(int p);
3a193f5e 478
94e77cfe 479/**** New in CUPS 1.1.19 ****/
b0a98a63 480extern ipp_attribute_t *ippAddCollection(ipp_t *ipp, ipp_tag_t group,
ff137eb1 481 const char *name, ipp_t *value) _CUPS_API_1_1_19;
b0a98a63 482extern ipp_attribute_t *ippAddCollections(ipp_t *ipp, ipp_tag_t group,
483 const char *name, int num_values,
ff137eb1 484 const ipp_t **values) _CUPS_API_1_1_19;
485extern void ippDeleteAttribute(ipp_t *ipp, ipp_attribute_t *attr) _CUPS_API_1_1_19;
486extern ipp_state_t ippReadFile(int fd, ipp_t *ipp) _CUPS_API_1_1_19;
487extern ipp_state_t ippWriteFile(int fd, ipp_t *ipp) _CUPS_API_1_1_19;
94e77cfe 488
a0db0702 489/**** New in CUPS 1.2 ****/
150ba5b1 490extern ipp_attribute_t *ippAddOctetString(ipp_t *ipp, ipp_tag_t group,
491 const char *name,
ff137eb1 492 const void *data, int datalen) _CUPS_API_1_2;
493extern ipp_status_t ippErrorValue(const char *name) _CUPS_API_1_2;
494extern ipp_t *ippNewRequest(ipp_op_t op) _CUPS_API_1_2;
495extern const char *ippOpString(ipp_op_t op) _CUPS_API_1_2;
496extern ipp_op_t ippOpValue(const char *name) _CUPS_API_1_2;
00a1fad8 497extern ipp_state_t ippReadIO(void *src, ipp_iocb_t cb, int blocking,
ff137eb1 498 ipp_t *parent, ipp_t *ipp) _CUPS_API_1_2;
00a1fad8 499extern ipp_state_t ippWriteIO(void *dst, ipp_iocb_t cb, int blocking,
ff137eb1 500 ipp_t *parent, ipp_t *ipp) _CUPS_API_1_2;
a87857fe 501
488cffad 502/**** New in CUPS 1.4 ****/
503extern const char *ippTagString(ipp_tag_t tag) _CUPS_API_1_4;
504extern ipp_tag_t ippTagValue(const char *name) _CUPS_API_1_4;
505
e09246c8 506
3a193f5e 507/*
508 * C++ magic...
509 */
dec2f757 510
3a193f5e 511# ifdef __cplusplus
512}
513# endif /* __cplusplus */
94e77cfe 514#endif /* !_CUPS_IPP_H_ */
dec2f757 515
516/*
c9d3f842 517 * End of "$Id$".
dec2f757 518 */