2 * "$Id: ipp.h,v 1.37 2001/04/15 11:52:43 mike Exp $"
4 * Internet Printing Protocol definitions for the Common UNIX Printing
7 * Copyright 1997-2001 by Easy Software Products.
9 * These coded instructions, statements, and computer programs are the
10 * property of Easy Software Products and are protected by Federal
11 * copyright law. Distribution and use rights are outlined in the file
12 * "LICENSE.txt" which should have been included with this file. If this
13 * file is missing or damaged please contact Easy Software Products
16 * Attn: CUPS Licensing Information
17 * Easy Software Products
18 * 44141 Airport View Drive, Suite 204
19 * Hollywood, Maryland 20636-3111 USA
21 * Voice: (301) 373-9603
22 * EMail: cups-info@cups.org
23 * WWW: http://www.cups.org
30 * Include necessary headers...
42 # endif /* __cplusplus */
46 * IPP version string...
49 # define IPP_VERSION "\001\000"
52 * IPP registered port number... This is the default value - applications
53 * should use the ippPort() function so that you can customize things in
54 * /etc/services if needed!
63 # define IPP_MAX_NAME 256
64 # define IPP_MAX_VALUES 100
68 * Types and structures...
71 typedef enum /**** Format tags for attribute formats... ****/
78 IPP_TAG_UNSUPPORTED_GROUP
,
80 IPP_TAG_EVENT_NOTIFICATION
,
81 IPP_TAG_UNSUPPORTED_VALUE
= 0x10,
85 IPP_TAG_NOTSETTABLE
= 0x15,
88 IPP_TAG_INTEGER
= 0x21,
91 IPP_TAG_STRING
= 0x30,
95 IPP_TAG_BEGIN_COLLECTION
,
98 IPP_TAG_END_COLLECTION
,
101 IPP_TAG_KEYWORD
= 0x44,
108 IPP_TAG_MASK
= 0x7fffffff, /* Mask for copied attribute values */
109 IPP_TAG_COPY
= 0x80000000 /* Bitflag for copied attribute values */
112 typedef enum /**** Resolution units... ****/
114 IPP_RES_PER_INCH
= 3,
118 typedef enum /**** Finishings... ****/
120 IPP_FINISHINGS_NONE
= 3,
121 IPP_FINISHINGS_STAPLE
,
122 IPP_FINISHINGS_PUNCH
,
123 IPP_FINISHINGS_COVER
,
125 IPP_FINISHINGS_SADDLE_STITCH
,
126 IPP_FINISHINGS_EDGE_STITCH
,
130 IPP_FINISHINGS_BOOKLET_MAKER
,
131 IPP_FINISHINGS_JOB_OFFSET
,
132 IPP_FINISHINGS_STAPLE_TOP_LEFT
= 20,
133 IPP_FINISHINGS_STAPLE_BOTTOM_LEFT
,
134 IPP_FINISHINGS_STAPLE_TOP_RIGHT
,
135 IPP_FINISHINGS_STAPLE_BOTTOM_RIGHT
,
136 IPP_FINISHINGS_EDGE_STITCH_LEFT
,
137 IPP_FINISHINGS_EDGE_STITCH_TOP
,
138 IPP_FINISHINGS_EDGE_STITCH_RIGHT
,
139 IPP_FINISHINGS_EDGE_STITCH_BOTTOM
,
140 IPP_FINISHINGS_STAPLE_DUAL_LEFT
,
141 IPP_FINISHINGS_STAPLE_DUAL_TOP
,
142 IPP_FINISHINGS_STAPLE_DUAL_RIGHT
,
143 IPP_FINISHINGS_STAPLE_DUAL_BOTTOM
,
144 IPP_FINISHINGS_BIND_LEFT
= 50,
145 IPP_FINISHINGS_BIND_TOP
,
146 IPP_FINISHINGS_BIND_RIGHT
,
147 IPP_FINISHINGS_BIND_BOTTOM
150 typedef enum /**** Orientation... ****/
152 IPP_PORTRAIT
= 3, /* No rotation */
153 IPP_LANDSCAPE
, /* 90 degrees counter-clockwise */
154 IPP_REVERSE_LANDSCAPE
, /* 90 degrees clockwise */
155 IPP_REVERSE_PORTRAIT
/* 180 degrees */
158 typedef enum /**** Qualities... ****/
160 IPP_QUALITY_DRAFT
= 3,
165 typedef enum /**** Job States.... */
176 typedef enum /**** Printer States.... */
178 IPP_PRINTER_IDLE
= 3,
179 IPP_PRINTER_PROCESSING
,
183 typedef enum /**** IPP states... ****/
185 IPP_ERROR
= -1, /* An error occurred */
186 IPP_IDLE
, /* Nothing is happening/request completed */
187 IPP_HEADER
, /* The request header needs to be sent/received */
188 IPP_ATTRIBUTE
, /* One or more attributes need to be sent/received */
189 IPP_DATA
/* IPP request data needs to be sent/received */
192 typedef enum /**** IPP operations... ****/
194 IPP_PRINT_JOB
= 0x0002,
201 IPP_GET_JOB_ATTRIBUTES
,
203 IPP_GET_PRINTER_ATTRIBUTES
,
207 IPP_PAUSE_PRINTER
= 0x0010,
210 IPP_SET_PRINTER_ATTRIBUTES
,
211 IPP_SET_JOB_ATTRIBUTES
,
212 IPP_GET_PRINTER_SUPPORTED_VALUES
,
213 IPP_CREATE_PRINTER_SUBSCRIPTION
,
214 IPP_CREATE_JOB_SUBSCRIPTION
,
215 IPP_GET_SUBSCRIPTION_ATTRIBUTES
,
216 IPP_GET_SUBSCRIPTIONS
,
217 IPP_RENEW_SUBSCRIPTION
,
218 IPP_CANCEL_SUBSCRIPTION
,
219 IPP_GET_NOTIFICATIONS
,
220 IPP_SEND_NOTIFICATIONS
,
221 IPP_GET_PRINT_SUPPORT_FILES
= 0x0021,
224 IPP_PAUSE_PRINTER_AFTER_CURRENT_JOB
,
226 IPP_RELEASE_HELD_NEW_JOBS
,
227 IPP_DEACTIVATE_PRINTER
,
228 IPP_ACTIVATE_PRINTER
,
230 IPP_SHUTDOWN_PRINTER
,
233 IPP_CANCEL_CURRENT_JOB
,
234 IPP_SUSPEND_CURRENT_JOB
,
237 IPP_SCHEDULE_JOB_AFTER
,
238 IPP_PRIVATE
= 0x4000,
256 typedef enum /**** IPP status codes... ****/
261 IPP_OK_IGNORED_SUBSCRIPTIONS
,
262 IPP_OK_IGNORED_NOTIFICATIONS
,
263 IPP_OK_TOO_MANY_EVENTS
,
264 IPP_OK_BUT_CANCEL_SUBSCRIPTION
,
265 IPP_REDIRECTION_OTHER_SITE
= 0x300,
266 IPP_BAD_REQUEST
= 0x0400,
268 IPP_NOT_AUTHENTICATED
,
281 IPP_COMPRESSION_NOT_SUPPORTED
,
282 IPP_COMPRESSION_ERROR
,
283 IPP_DOCUMENT_FORMAT_ERROR
,
284 IPP_DOCUMENT_ACCESS_ERROR
,
285 IPP_ATTRIBUTES_NOT_SETTABLE
,
286 IPP_IGNORED_ALL_SUBSCRIPTIONS
,
287 IPP_TOO_MANY_SUBSCRIPTIONS
,
288 IPP_IGNORED_ALL_NOTIFICATIONS
,
289 IPP_PRINT_SUPPORT_FILE_NOT_FOUND
,
291 IPP_INTERNAL_ERROR
= 0x0500,
292 IPP_OPERATION_NOT_SUPPORTED
,
293 IPP_SERVICE_UNAVAILABLE
,
294 IPP_VERSION_NOT_SUPPORTED
,
299 IPP_ERROR_JOB_CANCELLED
,
300 IPP_MULTIPLE_JOBS_NOT_SUPPORTED
,
301 IPP_PRINTER_IS_DEACTIVATED
304 typedef unsigned char ipp_uchar_t
;/**** Unsigned 8-bit integer/character ****/
306 typedef union /**** Request Header ****/
308 struct /* Any Header */
310 ipp_uchar_t version
[2]; /* Protocol version number */
311 int op_status
; /* Operation ID or status code*/
312 int request_id
; /* Request ID */
315 struct /* Operation Header */
317 ipp_uchar_t version
[2]; /* Protocol version number */
318 ipp_op_t operation_id
; /* Operation ID */
319 int request_id
; /* Request ID */
322 struct /* Status Header */
324 ipp_uchar_t version
[2]; /* Protocol version number */
325 ipp_status_t status_code
; /* Status code */
326 int request_id
; /* Request ID */
331 typedef union /**** Attribute Value ****/
333 int integer
; /* Integer/enumerated value */
335 char boolean
; /* Boolean value */
337 ipp_uchar_t date
[11]; /* Date/time value */
341 int xres
, /* Horizontal resolution */
342 yres
; /* Vertical resolution */
343 ipp_res_t units
; /* Resolution units */
344 } resolution
; /* Resolution value */
348 int lower
, /* Lower value */
349 upper
; /* Upper value */
350 } range
; /* Range of integers value */
354 char *charset
; /* Character set */
355 char *text
; /* String */
356 } string
; /* String with language value */
360 int length
; /* Length of attribute */
361 void *data
; /* Data in attribute */
362 } unknown
; /* Unknown attribute type */
365 typedef struct ipp_attribute_s
/**** Attribute ****/
367 struct ipp_attribute_s
*next
;
368 /* Next atrtribute in list */
369 ipp_tag_t group_tag
, /* Job/Printer/Operation group tag */
370 value_tag
; /* What type of value is it? */
371 char *name
; /* Name of attribute */
372 int num_values
; /* Number of values */
373 ipp_value_t values
[1]; /* Values */
376 typedef struct /**** Request State ****/
378 ipp_state_t state
; /* State of request */
379 ipp_request_t request
; /* Request header */
380 ipp_attribute_t
*attrs
, /* Attributes */
381 *last
, /* Last attribute in list */
382 *current
; /* Current attribute (for read/write) */
383 ipp_tag_t curtag
; /* Current attribute group tag */
391 extern ipp_attribute_t
*ippAddBoolean(ipp_t
*ipp
, ipp_tag_t group
, const char *name
, char value
);
392 extern ipp_attribute_t
*ippAddBooleans(ipp_t
*ipp
, ipp_tag_t group
, const char *name
, int num_values
, const char *values
);
393 extern ipp_attribute_t
*ippAddDate(ipp_t
*ipp
, ipp_tag_t group
, const char *name
, const ipp_uchar_t
*value
);
394 extern ipp_attribute_t
*ippAddInteger(ipp_t
*ipp
, ipp_tag_t group
, ipp_tag_t type
, const char *name
, int value
);
395 extern ipp_attribute_t
*ippAddIntegers(ipp_t
*ipp
, ipp_tag_t group
, ipp_tag_t type
, const char *name
, int num_values
, const int *values
);
396 extern ipp_attribute_t
*ippAddRange(ipp_t
*ipp
, ipp_tag_t group
, const char *name
, int lower
, int upper
);
397 extern ipp_attribute_t
*ippAddRanges(ipp_t
*ipp
, ipp_tag_t group
, const char *name
, int num_values
, const int *lower
, const int *upper
);
398 extern ipp_attribute_t
*ippAddResolution(ipp_t
*ipp
, ipp_tag_t group
, const char *name
, ipp_res_t units
, int xres
, int yres
);
399 extern ipp_attribute_t
*ippAddResolutions(ipp_t
*ipp
, ipp_tag_t group
, const char *name
, int num_values
, ipp_res_t units
, const int *xres
, const int *yres
);
400 extern ipp_attribute_t
*ippAddSeparator(ipp_t
*ipp
);
401 extern ipp_attribute_t
*ippAddString(ipp_t
*ipp
, ipp_tag_t group
, ipp_tag_t type
, const char *name
, const char *charset
, const char *value
);
402 extern ipp_attribute_t
*ippAddStrings(ipp_t
*ipp
, ipp_tag_t group
, ipp_tag_t type
, const char *name
, int num_values
, const char *charset
, const char **values
);
403 extern time_t ippDateToTime(const ipp_uchar_t
*date
);
404 extern void ippDelete(ipp_t
*ipp
);
405 extern const char *ippErrorString(ipp_status_t error
);
406 extern ipp_attribute_t
*ippFindAttribute(ipp_t
*ipp
, const char *name
, ipp_tag_t type
);
407 extern size_t ippLength(ipp_t
*ipp
);
408 extern ipp_t
*ippNew(void);
409 extern ipp_state_t
ippRead(http_t
*http
, ipp_t
*ipp
);
410 extern const ipp_uchar_t
*ippTimeToDate(time_t t
);
411 extern ipp_state_t
ippWrite(http_t
*http
, ipp_t
*ipp
);
412 extern int ippPort(void);
413 extern void ippSetPort(int p
);
415 extern ipp_attribute_t
*_ipp_add_attr(ipp_t
*, int);
416 extern void _ipp_free_attr(ipp_attribute_t
*);
425 # endif /* __cplusplus */
426 #endif /* !_CUPS_IPP_H_ */
429 * End of "$Id: ipp.h,v 1.37 2001/04/15 11:52:43 mike Exp $".