2 * "$Id: ipp.h,v 1.8 1999/03/21 02:10:03 mike Exp $"
4 * Internet Printing Protocol definitions for the Common UNIX Printing
7 * Copyright 1997-1999 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...
33 # include <cups/http.h>
42 # endif /* __cplusplus */
46 * IPP version string...
49 # define IPP_VERSION "\001\000"
56 # define IPP_MAX_NAME 256
57 # define IPP_MAX_VALUES 100
61 * Types and structures...
64 typedef enum /**** Format tags for attribute formats... ****/
72 IPP_TAG_UNSUPPORTED
= 0x10,
76 IPP_TAG_INTEGER
= 0x21,
79 IPP_TAG_STRING
= 0x30,
95 typedef enum /**** Resolution units... ****/
101 typedef enum /**** Multiple Document Handling ****/
109 typedef enum /**** Finishings... ****/
118 typedef enum /**** Duplex/Sides... ****/
121 IPP_SIDES_TWO_LONG_EDGE
,
122 IPP_SIDES_TWO_SHORT_EDGE
125 typedef enum /**** Orientation... ****/
127 IPP_PORTRAIT
= 3, /* No rotation */
128 IPP_LANDSCAPE
, /* 90 degrees counter-clockwise */
129 IPP_REVERSE_LANDSCAPE
, /* 90 degrees clockwise */
130 IPP_REVERSE_PORTRAIT
/* 180 degrees */
133 typedef enum /**** Qualities... ****/
135 IPP_QUALITY_DRAFT
= 3,
140 typedef enum /**** Job States.... */
151 typedef enum /**** Printer States.... */
153 IPP_PRINTER_IDLE
= 3,
154 IPP_PRINTER_PROCESSING
,
158 typedef enum /**** IPP states... ****/
160 IPP_ERROR
= -1, /* An error occurred */
161 IPP_IDLE
, /* Nothing is happening/request completed */
162 IPP_HEADER
, /* The request header needs to be sent/received */
163 IPP_ATTRIBUTE
, /* One or more attributes need to be sent/received */
164 IPP_DATA
/* IPP request data needs to be sent/received */
167 typedef enum /**** IPP operations... ****/
169 IPP_PRINT_JOB
= 0x0002,
176 IPP_GET_JOB_ATTRIBUTES
,
178 IPP_GET_PRINTER_ATTRIBUTES
,
179 IPP_HOLD_JOB
= 0x000c,
182 IPP_PAUSE_PRINTER
= 0x0010,
185 IPP_PRIVATE
= 0x4000,
195 typedef enum /**** IPP status codes... ****/
200 IPP_BAD_REQUEST
= 0x0400,
202 IPP_NOT_AUTHENTICATED
,
215 IPP_INTERNAL_ERROR
= 0x0500,
216 IPP_OPERATION_NOT_SUPPORTED
,
217 IPP_SERVICE_UNAVAILABLE
,
218 IPP_VERSION_NOT_SUPPORTED
,
219 IPP_DEVICE_UNAVAILABLE
,
225 typedef unsigned char uchar
; /**** Unsigned 8-bit integer/character ****/
226 typedef unsigned short ushort
; /**** Unsigned 16-bit integer ****/
227 typedef unsigned int uint
; /**** Unsigned 32-bit integer ****/
229 typedef union /**** Request Header ****/
231 struct /* Any Header */
233 uchar version
[2]; /* Protocol version number */
234 int op_status
; /* Operation ID or status code*/
235 int request_id
; /* Request ID */
238 struct /* Operation Header */
240 uchar version
[2]; /* Protocol version number */
241 ipp_op_t operation_id
; /* Operation ID */
242 int request_id
; /* Request ID */
245 struct /* Status Header */
247 uchar version
[2]; /* Protocol version number */
248 ipp_status_t status_code
; /* Status code */
249 int request_id
; /* Request ID */
254 typedef union /**** Attribute Value ****/
256 int integer
; /* Integer/enumerated value */
258 char boolean
; /* Boolean value */
260 uchar date
[11]; /* Date/time value */
264 int xres
, /* Horizontal resolution */
265 yres
; /* Vertical resolution */
266 ipp_res_t units
; /* Resolution units */
267 } resolution
; /* Resolution value */
271 int lower
, /* Lower value */
272 upper
; /* Upper value */
273 } range
; /* Range of integers value */
277 char *charset
; /* Character set */
278 char *text
; /* String */
279 } string
; /* String with language value */
282 typedef struct ipp_attribute_s
/**** Attribute ****/
284 struct ipp_attribute_s
*next
;
285 /* Next atrtribute in list */
286 ipp_tag_t group_tag
, /* Job/Printer/Operation group tag */
287 value_tag
; /* What type of value is it? */
288 char *name
; /* Name of attribute */
289 int num_values
; /* Number of values */
290 ipp_value_t values
[1]; /* Values */
293 typedef struct /**** Request State ****/
295 ipp_state_t state
; /* State of request */
296 ipp_request_t request
; /* Request header */
297 ipp_attribute_t
*attrs
, /* Attributes */
298 *last
, /* Last attribute in list */
299 *current
; /* Current attribute (for read/write) */
300 ipp_tag_t curtag
; /* Current attribute group tag */
308 extern time_t ippDateToTime(uchar
*date
);
309 extern ipp_attribute_t
*ippAddBoolean(ipp_t
*ipp
, ipp_tag_t group
, char *name
, char value
);
310 extern ipp_attribute_t
*ippAddBooleans(ipp_t
*ipp
, ipp_tag_t group
, char *name
, int num_values
, char *values
);
311 extern ipp_attribute_t
*ippAddDate(ipp_t
*ipp
, ipp_tag_t group
, char *name
, uchar
*value
);
312 extern ipp_attribute_t
*ippAddInteger(ipp_t
*ipp
, ipp_tag_t group
, ipp_tag_t type
, char *name
, int value
);
313 extern ipp_attribute_t
*ippAddIntegers(ipp_t
*ipp
, ipp_tag_t group
, ipp_tag_t type
, char *name
, int num_values
, int *values
);
314 extern ipp_attribute_t
*ippAddRange(ipp_t
*ipp
, ipp_tag_t group
, char *name
, int lower
, int upper
);
315 extern ipp_attribute_t
*ippAddRanges(ipp_t
*ipp
, ipp_tag_t group
, char *name
, int num_values
, int *lower
, int *upper
);
316 extern ipp_attribute_t
*ippAddResolution(ipp_t
*ipp
, ipp_tag_t group
, char *name
, ipp_res_t units
, int xres
, int yres
);
317 extern ipp_attribute_t
*ippAddResolutions(ipp_t
*ipp
, ipp_tag_t group
, char *name
, int num_values
, ipp_res_t units
, int *xres
, int *yres
);
318 extern ipp_attribute_t
*ippAddSeparator(ipp_t
*ipp
);
319 extern ipp_attribute_t
*ippAddString(ipp_t
*ipp
, ipp_tag_t group
, ipp_tag_t type
, char *name
, char *charset
, char *value
);
320 extern ipp_attribute_t
*ippAddStrings(ipp_t
*ipp
, ipp_tag_t group
, ipp_tag_t type
, char *name
, int num_values
, char *charset
, char **values
);
321 extern void ippDelete(ipp_t
*ipp
);
322 extern ipp_attribute_t
*ippFindAttribute(ipp_t
*ipp
, char *name
, ipp_tag_t type
);
323 extern size_t ippLength(ipp_t
*ipp
);
324 extern ipp_t
*ippNew(void);
325 extern ipp_state_t
ippRead(http_t
*http
, ipp_t
*ipp
);
326 extern uchar
*ippTimeToDate(time_t t
);
327 extern ipp_state_t
ippWrite(http_t
*http
, ipp_t
*ipp
);
328 extern int ippPort(void);
336 # endif /* __cplusplus */
337 #endif /* !_CUPS_IPP_H_ */
340 * End of "$Id: ipp.h,v 1.8 1999/03/21 02:10:03 mike Exp $".