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