]>
git.ipfire.org Git - thirdparty/cups.git/blob - cups/ipp-private.h
2 * Private IPP definitions for CUPS.
4 * Copyright © 2007-2018 by Apple Inc.
5 * Copyright © 1997-2006 by Easy Software Products.
7 * Licensed under Apache License v2.0. See the file "LICENSE" for more
11 #ifndef _CUPS_IPP_PRIVATE_H_
12 # define _CUPS_IPP_PRIVATE_H_
15 * Include necessary headers...
18 # include <cups/cups.h>
27 # endif /* __cplusplus */
34 # define IPP_BUF_SIZE (IPP_MAX_LENGTH + 2)
42 typedef union _ipp_request_u
/**** Request Header ****/
44 struct /* Any Header */
46 ipp_uchar_t version
[2]; /* Protocol version number */
47 int op_status
; /* Operation ID or status code*/
48 int request_id
; /* Request ID */
51 struct /* Operation Header */
53 ipp_uchar_t version
[2]; /* Protocol version number */
54 ipp_op_t operation_id
; /* Operation ID */
55 int request_id
; /* Request ID */
58 struct /* Status Header */
60 ipp_uchar_t version
[2]; /* Protocol version number */
61 ipp_status_t status_code
; /* Status code */
62 int request_id
; /* Request ID */
65 /**** New in CUPS 1.1.19 ****/
66 struct /* Event Header @since CUPS 1.1.19/macOS 10.3@ */
68 ipp_uchar_t version
[2]; /* Protocol version number */
69 ipp_status_t status_code
; /* Status code */
70 int request_id
; /* Request ID */
74 typedef union _ipp_value_u
/**** Attribute Value ****/
76 int integer
; /* Integer/enumerated value */
78 char boolean
; /* Boolean value */
80 ipp_uchar_t date
[11]; /* Date/time value */
84 int xres
, /* Horizontal resolution */
85 yres
; /* Vertical resolution */
86 ipp_res_t units
; /* Resolution units */
87 } resolution
; /* Resolution value */
91 int lower
, /* Lower value */
92 upper
; /* Upper value */
93 } range
; /* Range of integers value */
97 char *language
; /* Language code */
98 char *text
; /* String */
99 } string
; /* String with language value */
103 int length
; /* Length of attribute */
104 void *data
; /* Data in attribute */
105 } unknown
; /* Unknown attribute type */
107 /**** New in CUPS 1.1.19 ****/
108 ipp_t
*collection
; /* Collection value @since CUPS 1.1.19/macOS 10.3@ */
111 struct _ipp_attribute_s
/**** IPP attribute ****/
113 ipp_attribute_t
*next
; /* Next attribute in list */
114 ipp_tag_t group_tag
, /* Job/Printer/Operation group tag */
115 value_tag
; /* What type of value is it? */
116 char *name
; /* Name of attribute */
117 int num_values
; /* Number of values */
118 _ipp_value_t values
[1]; /* Values */
121 struct _ipp_s
/**** IPP Request/Response/Notification ****/
123 ipp_state_t state
; /* State of request */
124 _ipp_request_t request
; /* Request header */
125 ipp_attribute_t
*attrs
; /* Attributes */
126 ipp_attribute_t
*last
; /* Last attribute in list */
127 ipp_attribute_t
*current
; /* Current attribute (for read/write) */
128 ipp_tag_t curtag
; /* Current attribute group tag */
130 /**** New in CUPS 1.2 ****/
131 ipp_attribute_t
*prev
; /* Previous attribute (for read) @since CUPS 1.2/macOS 10.5@ */
133 /**** New in CUPS 1.4.4 ****/
134 int use
; /* Use count @since CUPS 1.4.4/macOS 10.6.?@ */
135 /**** New in CUPS 2.0 ****/
136 int atend
, /* At end of list? */
137 curindex
; /* Current attribute index for hierarchical search */
140 typedef struct _ipp_option_s
/**** Attribute mapping data ****/
142 int multivalue
; /* Option has multiple values? */
143 const char *name
; /* Option/attribute name */
144 ipp_tag_t value_tag
; /* Value tag for this attribute */
145 ipp_tag_t group_tag
; /* Group tag for this attribute */
146 ipp_tag_t alt_group_tag
; /* Alternate group tag for this
148 const ipp_op_t
*operations
; /* Allowed operations for this attr */
151 typedef struct _ipp_file_s _ipp_file_t
;/**** File Parser ****/
152 typedef struct _ipp_vars_s _ipp_vars_t
;/**** Variables ****/
154 typedef int (*_ipp_fattr_cb_t
)(_ipp_file_t
*f
, void *user_data
, const char *attr
);
155 /**** File Attribute (Filter) Callback ****/
156 typedef int (*_ipp_ferror_cb_t
)(_ipp_file_t
*f
, void *user_data
, const char *error
);
157 /**** File Parser Error Callback ****/
158 typedef int (*_ipp_ftoken_cb_t
)(_ipp_file_t
*f
, _ipp_vars_t
*v
, void *user_data
, const char *token
);
159 /**** File Parser Token Callback ****/
161 struct _ipp_vars_s
/**** Variables ****/
163 char *uri
, /* URI for printer */
164 scheme
[64], /* Scheme from URI */
165 username
[256], /* Username from URI */
166 *password
, /* Password from URI (if any) */
167 host
[256], /* Hostname from URI */
168 portstr
[32], /* Port number string */
169 resource
[1024]; /* Resource path from URI */
170 int port
; /* Port number from URI */
171 int num_vars
; /* Number of variables */
172 cups_option_t
*vars
; /* Array of variables */
173 int password_tries
; /* Number of retries for password */
174 _ipp_fattr_cb_t attrcb
; /* Attribute (filter) callback */
175 _ipp_ferror_cb_t errorcb
; /* Error callback */
176 _ipp_ftoken_cb_t tokencb
; /* Token callback */
179 struct _ipp_file_s
/**** File Parser */
181 const char *filename
; /* Filename */
182 cups_file_t
*fp
; /* File pointer */
183 int linenum
; /* Current line number */
184 ipp_t
*attrs
; /* Attributes */
185 ipp_tag_t group_tag
; /* Current group for new attributes */
190 * Prototypes for private functions...
195 extern const char *_ippCheckOptions(void);
197 extern _ipp_option_t
*_ippFindOption(const char *name
);
200 extern ipp_t
*_ippFileParse(_ipp_vars_t
*v
, const char *filename
, void *user_data
);
201 extern int _ippFileReadToken(_ipp_file_t
*f
, char *token
, size_t tokensize
);
204 extern void _ippVarsDeinit(_ipp_vars_t
*v
);
205 extern void _ippVarsExpand(_ipp_vars_t
*v
, char *dst
, const char *src
, size_t dstsize
) __attribute__((nonnull(1,2,3)));
206 extern const char *_ippVarsGet(_ipp_vars_t
*v
, const char *name
);
207 extern void _ippVarsInit(_ipp_vars_t
*v
, _ipp_fattr_cb_t attrcb
, _ipp_ferror_cb_t errorcb
, _ipp_ftoken_cb_t tokencb
);
208 extern const char *_ippVarsPasswordCB(const char *prompt
, http_t
*http
, const char *method
, const char *resource
, void *user_data
);
209 extern int _ippVarsSet(_ipp_vars_t
*v
, const char *name
, const char *value
);
218 # endif /* __cplusplus */
219 #endif /* !_CUPS_IPP_H_ */