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