]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/ipp-private.h
Update ipp documentation to reflect the behavior of configuring WiFi on IPP USB printers.
[thirdparty/cups.git] / cups / ipp-private.h
CommitLineData
fa73b229 1/*
7e86f2f6 2 * Private IPP definitions for CUPS.
fa73b229 3 *
fd96ad89
MS
4 * Copyright © 2007-2018 by Apple Inc.
5 * Copyright © 1997-2006 by Easy Software Products.
fa73b229 6 *
fd96ad89
MS
7 * Licensed under Apache License v2.0. See the file "LICENSE" for more
8 * information.
fa73b229 9 */
10
11#ifndef _CUPS_IPP_PRIVATE_H_
12# define _CUPS_IPP_PRIVATE_H_
13
14/*
15 * Include necessary headers...
16 */
17
fd96ad89 18# include <cups/cups.h>
fa73b229 19
20
21/*
22 * C++ magic...
23 */
24
25# ifdef __cplusplus
26extern "C" {
27# endif /* __cplusplus */
28
29
1f6f3dbc
MS
30/*
31 * Constants...
32 */
33
34# define IPP_BUF_SIZE (IPP_MAX_LENGTH + 2)
35 /* Size of buffer */
36
37
8ca02f3c 38/*
39 * Structures...
40 */
41
0fb02fb9
MS
42typedef union _ipp_request_u /**** Request Header ****/
43{
44 struct /* Any Header */
45 {
46 ipp_uchar_t version[2]; /* Protocol version number */
47 int op_status; /* Operation ID or status code*/
48 int request_id; /* Request ID */
49 } any;
50
51 struct /* Operation Header */
52 {
53 ipp_uchar_t version[2]; /* Protocol version number */
54 ipp_op_t operation_id; /* Operation ID */
55 int request_id; /* Request ID */
56 } op;
57
58 struct /* Status Header */
59 {
60 ipp_uchar_t version[2]; /* Protocol version number */
61 ipp_status_t status_code; /* Status code */
62 int request_id; /* Request ID */
63 } status;
64
65 /**** New in CUPS 1.1.19 ****/
66 struct /* Event Header @since CUPS 1.1.19/macOS 10.3@ */
67 {
68 ipp_uchar_t version[2]; /* Protocol version number */
69 ipp_status_t status_code; /* Status code */
70 int request_id; /* Request ID */
71 } event;
72} _ipp_request_t;
73
74typedef union _ipp_value_u /**** Attribute Value ****/
75{
76 int integer; /* Integer/enumerated value */
77
78 char boolean; /* Boolean value */
79
80 ipp_uchar_t date[11]; /* Date/time value */
81
82 struct
83 {
84 int xres, /* Horizontal resolution */
85 yres; /* Vertical resolution */
86 ipp_res_t units; /* Resolution units */
87 } resolution; /* Resolution value */
88
89 struct
90 {
91 int lower, /* Lower value */
92 upper; /* Upper value */
93 } range; /* Range of integers value */
94
95 struct
96 {
97 char *language; /* Language code */
98 char *text; /* String */
99 } string; /* String with language value */
100
101 struct
102 {
103 int length; /* Length of attribute */
104 void *data; /* Data in attribute */
105 } unknown; /* Unknown attribute type */
106
107/**** New in CUPS 1.1.19 ****/
108 ipp_t *collection; /* Collection value @since CUPS 1.1.19/macOS 10.3@ */
109} _ipp_value_t;
110
111struct _ipp_attribute_s /**** IPP attribute ****/
112{
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 */
119};
120
121struct _ipp_s /**** IPP Request/Response/Notification ****/
122{
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 */
129
130/**** New in CUPS 1.2 ****/
131 ipp_attribute_t *prev; /* Previous attribute (for read) @since CUPS 1.2/macOS 10.5@ */
132
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 */
138};
139
140typedef struct _ipp_option_s /**** Attribute mapping data ****/
8ca02f3c 141{
5a738aea 142 int multivalue; /* Option has multiple values? */
8ca02f3c 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 */
dcb445bc
MS
146 ipp_tag_t alt_group_tag; /* Alternate group tag for this
147 * attribute */
a469f8a5 148 const ipp_op_t *operations; /* Allowed operations for this attr */
8ca02f3c 149} _ipp_option_t;
150
fd96ad89
MS
151typedef struct _ipp_file_s _ipp_file_t;/**** File Parser ****/
152typedef struct _ipp_vars_s _ipp_vars_t;/**** Variables ****/
153
a166e933
MS
154typedef int (*_ipp_fattr_cb_t)(_ipp_file_t *f, void *user_data, const char *attr);
155 /**** File Attribute (Filter) Callback ****/
fd96ad89
MS
156typedef int (*_ipp_ferror_cb_t)(_ipp_file_t *f, void *user_data, const char *error);
157 /**** File Parser Error Callback ****/
158typedef int (*_ipp_ftoken_cb_t)(_ipp_file_t *f, _ipp_vars_t *v, void *user_data, const char *token);
159 /**** File Parser Token Callback ****/
160
161struct _ipp_vars_s /**** Variables ****/
162{
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 */
fd96ad89
MS
171 int num_vars; /* Number of variables */
172 cups_option_t *vars; /* Array of variables */
173 int password_tries; /* Number of retries for password */
a166e933
MS
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 */
fd96ad89
MS
177};
178
179struct _ipp_file_s /**** File Parser */
180{
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 */
186};
187
8ca02f3c 188
fa73b229 189/*
190 * Prototypes for private functions...
191 */
192
fd96ad89 193/* encode.c */
a469f8a5 194#ifdef DEBUG
e3586875 195extern const char *_ippCheckOptions(void) _CUPS_PRIVATE;
a469f8a5 196#endif /* DEBUG */
e3586875 197extern _ipp_option_t *_ippFindOption(const char *name) _CUPS_PRIVATE;
fa73b229 198
fd96ad89 199/* ipp-file.c */
e3586875
MS
200extern ipp_t *_ippFileParse(_ipp_vars_t *v, const char *filename, void *user_data) _CUPS_PRIVATE;
201extern int _ippFileReadToken(_ipp_file_t *f, char *token, size_t tokensize) _CUPS_PRIVATE;
fd96ad89
MS
202
203/* ipp-vars.c */
e3586875
MS
204extern void _ippVarsDeinit(_ipp_vars_t *v) _CUPS_PRIVATE;
205extern void _ippVarsExpand(_ipp_vars_t *v, char *dst, const char *src, size_t dstsize) _CUPS_NONNULL(1,2,3) _CUPS_PRIVATE;
206extern const char *_ippVarsGet(_ipp_vars_t *v, const char *name) _CUPS_PRIVATE;
207extern void _ippVarsInit(_ipp_vars_t *v, _ipp_fattr_cb_t attrcb, _ipp_ferror_cb_t errorcb, _ipp_ftoken_cb_t tokencb) _CUPS_PRIVATE;
208extern const char *_ippVarsPasswordCB(const char *prompt, http_t *http, const char *method, const char *resource, void *user_data) _CUPS_PRIVATE;
209extern int _ippVarsSet(_ipp_vars_t *v, const char *name, const char *value) _CUPS_PRIVATE;
fd96ad89
MS
210
211
fa73b229 212/*
213 * C++ magic...
214 */
215
216# ifdef __cplusplus
217}
218# endif /* __cplusplus */
219#endif /* !_CUPS_IPP_H_ */