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