]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
d21dc0ed | 2 | * Internet Printing Protocol support functions for CUPS. |
ef416fc2 | 3 | * |
f28728ee MS |
4 | * Copyright © 2007-2018 by Apple Inc. |
5 | * Copyright © 1997-2007 by Easy Software Products, all rights reserved. | |
ef416fc2 | 6 | * |
f28728ee MS |
7 | * Licensed under Apache License v2.0. See the file "LICENSE" for more |
8 | * information. | |
ef416fc2 | 9 | */ |
10 | ||
11 | /* | |
12 | * Include necessary headers... | |
13 | */ | |
14 | ||
71e16022 | 15 | #include "cups-private.h" |
ef416fc2 | 16 | |
17 | ||
18 | /* | |
19 | * Local globals... | |
20 | */ | |
21 | ||
d21dc0ed MS |
22 | static const char * const ipp_states[] = |
23 | { | |
24 | "IPP_STATE_ERROR", | |
25 | "IPP_STATE_IDLE", | |
26 | "IPP_STATE_HEADER", | |
27 | "IPP_STATE_ATTRIBUTE", | |
28 | "IPP_STATE_DATA" | |
29 | }; | |
ef416fc2 | 30 | static const char * const ipp_status_oks[] = /* "OK" status codes */ |
a2326b5b | 31 | { /* (name) = abandoned standard value */ |
ef416fc2 | 32 | "successful-ok", |
33 | "successful-ok-ignored-or-substituted-attributes", | |
34 | "successful-ok-conflicting-attributes", | |
35 | "successful-ok-ignored-subscriptions", | |
a2326b5b | 36 | "(successful-ok-ignored-notifications)", |
ef416fc2 | 37 | "successful-ok-too-many-events", |
a2326b5b | 38 | "(successful-ok-but-cancel-subscription)", |
bd7854cb | 39 | "successful-ok-events-complete" |
ef416fc2 | 40 | }, |
41 | * const ipp_status_400s[] = /* Client errors */ | |
a2326b5b | 42 | { /* (name) = abandoned standard value */ |
ef416fc2 | 43 | "client-error-bad-request", |
44 | "client-error-forbidden", | |
45 | "client-error-not-authenticated", | |
46 | "client-error-not-authorized", | |
47 | "client-error-not-possible", | |
48 | "client-error-timeout", | |
49 | "client-error-not-found", | |
50 | "client-error-gone", | |
51 | "client-error-request-entity-too-large", | |
52 | "client-error-request-value-too-long", | |
53 | "client-error-document-format-not-supported", | |
54 | "client-error-attributes-or-values-not-supported", | |
55 | "client-error-uri-scheme-not-supported", | |
56 | "client-error-charset-not-supported", | |
57 | "client-error-conflicting-attributes", | |
58 | "client-error-compression-not-supported", | |
59 | "client-error-compression-error", | |
60 | "client-error-document-format-error", | |
61 | "client-error-document-access-error", | |
62 | "client-error-attributes-not-settable", | |
63 | "client-error-ignored-all-subscriptions", | |
64 | "client-error-too-many-subscriptions", | |
a2326b5b | 65 | "(client-error-ignored-all-notifications)", |
82cc1f9a MS |
66 | "(client-error-client-print-support-file-not-found)", |
67 | "client-error-document-password-error", | |
68 | "client-error-document-permission-error", | |
69 | "client-error-document-security-error", | |
6b13fa61 MS |
70 | "client-error-document-unprintable-error", |
71 | "client-error-account-info-needed", | |
72 | "client-error-account-closed", | |
73 | "client-error-account-limit-reached", | |
c47d4869 MS |
74 | "client-error-account-authorization-failed", |
75 | "client-error-not-fetchable" | |
ef416fc2 | 76 | }, |
a469f8a5 MS |
77 | * const ipp_status_480s[] = /* Vendor client errors */ |
78 | { | |
79 | /* 0x0480 - 0x048F */ | |
80 | "0x0480", | |
81 | "0x0481", | |
82 | "0x0482", | |
83 | "0x0483", | |
84 | "0x0484", | |
85 | "0x0485", | |
86 | "0x0486", | |
87 | "0x0487", | |
88 | "0x0488", | |
89 | "0x0489", | |
90 | "0x048A", | |
91 | "0x048B", | |
92 | "0x048C", | |
93 | "0x048D", | |
94 | "0x048E", | |
95 | "0x048F", | |
96 | /* 0x0490 - 0x049F */ | |
97 | "0x0490", | |
98 | "0x0491", | |
99 | "0x0492", | |
100 | "0x0493", | |
101 | "0x0494", | |
102 | "0x0495", | |
103 | "0x0496", | |
104 | "0x0497", | |
105 | "0x0498", | |
106 | "0x0499", | |
107 | "0x049A", | |
108 | "0x049B", | |
109 | "cups-error-account-info-needed", | |
110 | "cups-error-account-closed", | |
111 | "cups-error-account-limit-reached", | |
112 | "cups-error-account-authorization-failed" | |
113 | }, | |
ef416fc2 | 114 | * const ipp_status_500s[] = /* Server errors */ |
115 | { | |
116 | "server-error-internal-error", | |
117 | "server-error-operation-not-supported", | |
118 | "server-error-service-unavailable", | |
119 | "server-error-version-not-supported", | |
120 | "server-error-device-error", | |
121 | "server-error-temporary-error", | |
122 | "server-error-not-accepting-jobs", | |
123 | "server-error-busy", | |
124 | "server-error-job-canceled", | |
125 | "server-error-multiple-document-jobs-not-supported", | |
a2326b5b MS |
126 | "server-error-printer-is-deactivated", |
127 | "server-error-too-many-jobs", | |
128 | "server-error-too-many-documents" | |
7cf5915e MS |
129 | }, |
130 | * const ipp_status_1000s[] = /* CUPS internal */ | |
131 | { | |
a469f8a5 | 132 | "cups-authentication-canceled", |
7cf5915e MS |
133 | "cups-pki-error", |
134 | "cups-upgrade-required" | |
ef416fc2 | 135 | }; |
a2326b5b | 136 | static const char * const ipp_std_ops[] = |
ef416fc2 | 137 | { |
138 | /* 0x0000 - 0x000f */ | |
db8b865d MS |
139 | "0x0000", |
140 | "0x0001", | |
aaf19ab0 MS |
141 | "Print-Job", |
142 | "Print-URI", | |
143 | "Validate-Job", | |
144 | "Create-Job", | |
145 | "Send-Document", | |
146 | "Send-URI", | |
147 | "Cancel-Job", | |
148 | "Get-Job-Attributes", | |
149 | "Get-Jobs", | |
150 | "Get-Printer-Attributes", | |
151 | "Hold-Job", | |
152 | "Release-Job", | |
153 | "Restart-Job", | |
db8b865d | 154 | "0x000f", |
ef416fc2 | 155 | |
156 | /* 0x0010 - 0x001f */ | |
aaf19ab0 MS |
157 | "Pause-Printer", |
158 | "Resume-Printer", | |
159 | "Purge-Jobs", | |
160 | "Set-Printer-Attributes", | |
ef416fc2 | 161 | "Set-Job-Attributes", |
162 | "Get-Printer-Supported-Values", | |
42404685 MS |
163 | "Create-Printer-Subscriptions", |
164 | "Create-Job-Subscriptions", | |
ef416fc2 | 165 | "Get-Subscription-Attributes", |
aaf19ab0 MS |
166 | "Get-Subscriptions", |
167 | "Renew-Subscription", | |
168 | "Cancel-Subscription", | |
169 | "Get-Notifications", | |
a2326b5b MS |
170 | "(Send-Notifications)", |
171 | "(Get-Resource-Attributes)", | |
172 | "(Get-Resource-Data)", | |
ef416fc2 | 173 | |
174 | /* 0x0020 - 0x002f */ | |
a2326b5b MS |
175 | "(Get-Resources)", |
176 | "(Get-Printer-Support-Files)", | |
ef416fc2 | 177 | "Enable-Printer", |
178 | "Disable-Printer", | |
179 | "Pause-Printer-After-Current-Job", | |
180 | "Hold-New-Jobs", | |
181 | "Release-Held-New-Jobs", | |
182 | "Deactivate-Printer", | |
183 | "Activate-Printer", | |
184 | "Restart-Printer", | |
185 | "Shutdown-Printer", | |
186 | "Startup-Printer", | |
187 | "Reprocess-Job", | |
188 | "Cancel-Current-Job", | |
189 | "Suspend-Current-Job", | |
190 | "Resume-Job", | |
191 | ||
9b4bd602 | 192 | /* 0x0030 - 0x003f */ |
ef416fc2 | 193 | "Promote-Job", |
aaf19ab0 | 194 | "Schedule-Job-After", |
db8b865d | 195 | "0x0032", |
aaf19ab0 MS |
196 | "Cancel-Document", |
197 | "Get-Document-Attributes", | |
198 | "Get-Documents", | |
199 | "Delete-Document", | |
200 | "Set-Document-Attributes", | |
201 | "Cancel-Jobs", | |
202 | "Cancel-My-Jobs", | |
203 | "Resubmit-Job", | |
771bd8cb | 204 | "Close-Job", |
82cc1f9a | 205 | "Identify-Printer", |
9475ec92 | 206 | "Validate-Document", |
e06e4eb5 | 207 | "Add-Document-Images", |
9b4bd602 MS |
208 | "Acknowledge-Document", |
209 | ||
054eee9c | 210 | /* 0x0040 - 0x004f */ |
9b4bd602 MS |
211 | "Acknowledge-Identify-Printer", |
212 | "Acknowledge-Job", | |
213 | "Fetch-Document", | |
214 | "Fetch-Job", | |
215 | "Get-Output-Device-Attributes", | |
216 | "Update-Active-Jobs", | |
217 | "Deregister-Output-Device", | |
218 | "Update-Document-Status", | |
219 | "Update-Job-Status", | |
220 | "Update-Output-Device-Attributes", | |
054eee9c MS |
221 | "Get-Next-Document-Data", |
222 | "Allocate-Printer-Resources", | |
223 | "Create-Printer", | |
224 | "Deallocate-Printer-Resources", | |
225 | "Delete-Printer", | |
226 | "Get-Printers", | |
227 | ||
228 | /* 0x0050 - 0x005f */ | |
229 | "Shutdown-One-Printer", | |
230 | "Startup-One-Printer", | |
231 | "Cancel-Resource", | |
232 | "Create-Resource", | |
233 | "Install-Resource", | |
234 | "Send-Resource-Data", | |
235 | "Set-Resource-Attributes", | |
236 | "Create-Resource-Subscriptions", | |
237 | "Create-System-Subscriptions", | |
238 | "Disable-All-Printers", | |
239 | "Enable-All-Printers", | |
240 | "Get-System-Attributes", | |
241 | "Get-System-Supported-Values", | |
242 | "Pause-All-Printers", | |
243 | "Pause-All-Printers-After-Current-Job", | |
244 | "Register-Output-Device", | |
245 | ||
246 | /* 0x0060 - 0x0064 */ | |
247 | "Restart-System", | |
248 | "Resume-All-Printers", | |
249 | "Set-System-Attributes", | |
250 | "Shutdown-All-Printers", | |
251 | "Startup-All-Printers" | |
ef416fc2 | 252 | }, |
253 | * const ipp_cups_ops[] = | |
254 | { | |
255 | "CUPS-Get-Default", | |
256 | "CUPS-Get-Printers", | |
480ef0fe | 257 | "CUPS-Add-Modify-Printer", |
ef416fc2 | 258 | "CUPS-Delete-Printer", |
259 | "CUPS-Get-Classes", | |
480ef0fe | 260 | "CUPS-Add-Modify-Class", |
ef416fc2 | 261 | "CUPS-Delete-Class", |
262 | "CUPS-Accept-Jobs", | |
263 | "CUPS-Reject-Jobs", | |
264 | "CUPS-Set-Default", | |
265 | "CUPS-Get-Devices", | |
266 | "CUPS-Get-PPDs", | |
267 | "CUPS-Move-Job", | |
b94498cf | 268 | "CUPS-Authenticate-Job", |
269 | "CUPS-Get-PPD" | |
2e4ff8af MS |
270 | }, |
271 | * const ipp_cups_ops2[] = | |
272 | { | |
95ece0cb MS |
273 | "CUPS-Get-Document", |
274 | "CUPS-Create-Local-Printer" | |
1ff0402e MS |
275 | }, |
276 | * const ipp_tag_names[] = | |
277 | { /* Value/group tag names */ | |
278 | "zero", /* 0x00 */ | |
279 | "operation-attributes-tag", | |
280 | /* 0x01 */ | |
281 | "job-attributes-tag", /* 0x02 */ | |
282 | "end-of-attributes-tag", | |
283 | /* 0x03 */ | |
284 | "printer-attributes-tag", | |
285 | /* 0x04 */ | |
286 | "unsupported-attributes-tag", | |
287 | /* 0x05 */ | |
288 | "subscription-attributes-tag", | |
289 | /* 0x06 */ | |
290 | "event-notification-attributes-tag", | |
291 | /* 0x07 */ | |
a2326b5b MS |
292 | "(resource-attributes-tag)", |
293 | /* 0x08 */ | |
d7225fc2 MS |
294 | "document-attributes-tag", |
295 | /* 0x09 */ | |
296 | "0x0a", /* 0x0a */ | |
297 | "0x0b", /* 0x0b */ | |
298 | "0x0c", /* 0x0c */ | |
299 | "0x0d", /* 0x0d */ | |
300 | "0x0e", /* 0x0e */ | |
301 | "0x0f", /* 0x0f */ | |
1ff0402e MS |
302 | "unsupported", /* 0x10 */ |
303 | "default", /* 0x11 */ | |
304 | "unknown", /* 0x12 */ | |
305 | "no-value", /* 0x13 */ | |
d7225fc2 | 306 | "0x14", /* 0x14 */ |
1ff0402e MS |
307 | "not-settable", /* 0x15 */ |
308 | "delete-attribute", /* 0x16 */ | |
309 | "admin-define", /* 0x17 */ | |
d7225fc2 MS |
310 | "0x18", /* 0x18 */ |
311 | "0x19", /* 0x19 */ | |
312 | "0x1a", /* 0x1a */ | |
313 | "0x1b", /* 0x1b */ | |
314 | "0x1c", /* 0x1c */ | |
315 | "0x1d", /* 0x1d */ | |
316 | "0x1e", /* 0x1e */ | |
317 | "0x1f", /* 0x1f */ | |
318 | "0x20", /* 0x20 */ | |
1ff0402e MS |
319 | "integer", /* 0x21 */ |
320 | "boolean", /* 0x22 */ | |
321 | "enum", /* 0x23 */ | |
d7225fc2 MS |
322 | "0x24", /* 0x24 */ |
323 | "0x25", /* 0x25 */ | |
324 | "0x26", /* 0x26 */ | |
325 | "0x27", /* 0x27 */ | |
326 | "0x28", /* 0x28 */ | |
327 | "0x29", /* 0x29 */ | |
328 | "0x2a", /* 0x2a */ | |
329 | "0x2b", /* 0x2b */ | |
330 | "0x2c", /* 0x2c */ | |
331 | "0x2d", /* 0x2d */ | |
332 | "0x2e", /* 0x2e */ | |
333 | "0x2f", /* 0x2f */ | |
1ff0402e MS |
334 | "octetString", /* 0x30 */ |
335 | "dateTime", /* 0x31 */ | |
336 | "resolution", /* 0x32 */ | |
337 | "rangeOfInteger", /* 0x33 */ | |
f8b3a85b | 338 | "collection", /* 0x34 */ |
1ff0402e MS |
339 | "textWithLanguage", /* 0x35 */ |
340 | "nameWithLanguage", /* 0x36 */ | |
341 | "endCollection", /* 0x37 */ | |
d7225fc2 MS |
342 | "0x38", /* 0x38 */ |
343 | "0x39", /* 0x39 */ | |
344 | "0x3a", /* 0x3a */ | |
345 | "0x3b", /* 0x3b */ | |
346 | "0x3c", /* 0x3c */ | |
347 | "0x3d", /* 0x3d */ | |
348 | "0x3e", /* 0x3e */ | |
349 | "0x3f", /* 0x3f */ | |
350 | "0x40", /* 0x40 */ | |
1ff0402e MS |
351 | "textWithoutLanguage",/* 0x41 */ |
352 | "nameWithoutLanguage",/* 0x42 */ | |
d7225fc2 | 353 | "0x43", /* 0x43 */ |
1ff0402e MS |
354 | "keyword", /* 0x44 */ |
355 | "uri", /* 0x45 */ | |
356 | "uriScheme", /* 0x46 */ | |
357 | "charset", /* 0x47 */ | |
358 | "naturalLanguage", /* 0x48 */ | |
359 | "mimeMediaType", /* 0x49 */ | |
360 | "memberAttrName" /* 0x4a */ | |
ef416fc2 | 361 | }; |
a2326b5b MS |
362 | static const char * const ipp_document_states[] = |
363 | { /* document-state-enums */ | |
364 | "pending", | |
365 | "4", | |
366 | "processing", | |
cd3614ae | 367 | "processing-stopped", /* IPPSIX */ |
a2326b5b MS |
368 | "canceled", |
369 | "aborted", | |
370 | "completed" | |
371 | }, | |
372 | * const ipp_finishings[] = | |
373 | { /* finishings enums */ | |
374 | "none", | |
375 | "staple", | |
376 | "punch", | |
377 | "cover", | |
378 | "bind", | |
379 | "saddle-stitch", | |
380 | "edge-stitch", | |
381 | "fold", | |
382 | "trim", | |
383 | "bale", | |
384 | "booklet-maker", | |
385 | "jog-offset", | |
cd3614ae MS |
386 | "coat", /* Finishings 2.0 */ |
387 | "laminate", /* Finishings 2.0 */ | |
a2326b5b MS |
388 | "17", |
389 | "18", | |
390 | "19", | |
391 | "staple-top-left", | |
392 | "staple-bottom-left", | |
393 | "staple-top-right", | |
394 | "staple-bottom-right", | |
395 | "edge-stitch-left", | |
396 | "edge-stitch-top", | |
397 | "edge-stitch-right", | |
398 | "edge-stitch-bottom", | |
399 | "staple-dual-left", | |
400 | "staple-dual-top", | |
401 | "staple-dual-right", | |
402 | "staple-dual-bottom", | |
cd3614ae MS |
403 | "staple-triple-left", /* Finishings 2.0 */ |
404 | "staple-triple-top", /* Finishings 2.0 */ | |
405 | "staple-triple-right",/* Finishings 2.0 */ | |
406 | "staple-triple-bottom",/* Finishings 2.0 */ | |
a2326b5b MS |
407 | "36", |
408 | "37", | |
409 | "38", | |
410 | "39", | |
411 | "40", | |
412 | "41", | |
413 | "42", | |
414 | "43", | |
415 | "44", | |
416 | "45", | |
417 | "46", | |
418 | "47", | |
419 | "48", | |
420 | "49", | |
421 | "bind-left", | |
422 | "bind-top", | |
423 | "bind-right", | |
424 | "bind-bottom", | |
425 | "54", | |
426 | "55", | |
427 | "56", | |
428 | "57", | |
429 | "58", | |
430 | "59", | |
431 | "trim-after-pages", | |
432 | "trim-after-documents", | |
433 | "trim-after-copies", | |
9475ec92 MS |
434 | "trim-after-job", |
435 | "64", | |
436 | "65", | |
437 | "66", | |
438 | "67", | |
439 | "68", | |
440 | "69", | |
cd3614ae MS |
441 | "punch-top-left", /* Finishings 2.0 */ |
442 | "punch-bottom-left", /* Finishings 2.0 */ | |
443 | "punch-top-right", /* Finishings 2.0 */ | |
444 | "punch-bottom-right", /* Finishings 2.0 */ | |
445 | "punch-dual-left", /* Finishings 2.0 */ | |
446 | "punch-dual-top", /* Finishings 2.0 */ | |
447 | "punch-dual-right", /* Finishings 2.0 */ | |
448 | "punch-dual-bottom", /* Finishings 2.0 */ | |
449 | "punch-triple-left", /* Finishings 2.0 */ | |
450 | "punch-triple-top", /* Finishings 2.0 */ | |
451 | "punch-triple-right", /* Finishings 2.0 */ | |
452 | "punch-triple-bottom",/* Finishings 2.0 */ | |
453 | "punch-quad-left", /* Finishings 2.0 */ | |
454 | "punch-quad-top", /* Finishings 2.0 */ | |
455 | "punch-quad-right", /* Finishings 2.0 */ | |
456 | "punch-quad-bottom", /* Finishings 2.0 */ | |
2a8afc20 MS |
457 | "punch-multiple-left",/* Finishings 2.1/Canon */ |
458 | "punch-multiple-top", /* Finishings 2.1/Canon */ | |
459 | "punch-multiple-right",/* Finishings 2.1/Canon */ | |
460 | "punch-multiple-bottom",/* Finishings 2.1/Canon */ | |
cd3614ae MS |
461 | "fold-accordian", /* Finishings 2.0 */ |
462 | "fold-double-gate", /* Finishings 2.0 */ | |
463 | "fold-gate", /* Finishings 2.0 */ | |
464 | "fold-half", /* Finishings 2.0 */ | |
465 | "fold-half-z", /* Finishings 2.0 */ | |
466 | "fold-left-gate", /* Finishings 2.0 */ | |
467 | "fold-letter", /* Finishings 2.0 */ | |
468 | "fold-parallel", /* Finishings 2.0 */ | |
469 | "fold-poster", /* Finishings 2.0 */ | |
470 | "fold-right-gate", /* Finishings 2.0 */ | |
2a8afc20 MS |
471 | "fold-z", /* Finishings 2.0 */ |
472 | "fold-engineering-z" /* Finishings 2.1 */ | |
a2326b5b | 473 | }, |
a469f8a5 MS |
474 | * const ipp_finishings_vendor[] = |
475 | { | |
476 | /* 0x40000000 to 0x4000000F */ | |
477 | "0x40000000", | |
478 | "0x40000001", | |
479 | "0x40000002", | |
480 | "0x40000003", | |
481 | "0x40000004", | |
482 | "0x40000005", | |
483 | "0x40000006", | |
484 | "0x40000007", | |
485 | "0x40000008", | |
486 | "0x40000009", | |
487 | "0x4000000A", | |
488 | "0x4000000B", | |
489 | "0x4000000C", | |
490 | "0x4000000D", | |
491 | "0x4000000E", | |
492 | "0x4000000F", | |
493 | /* 0x40000010 to 0x4000001F */ | |
494 | "0x40000010", | |
495 | "0x40000011", | |
496 | "0x40000012", | |
497 | "0x40000013", | |
498 | "0x40000014", | |
499 | "0x40000015", | |
500 | "0x40000016", | |
501 | "0x40000017", | |
502 | "0x40000018", | |
503 | "0x40000019", | |
504 | "0x4000001A", | |
505 | "0x4000001B", | |
506 | "0x4000001C", | |
507 | "0x4000001D", | |
508 | "0x4000001E", | |
509 | "0x4000001F", | |
510 | /* 0x40000020 to 0x4000002F */ | |
511 | "0x40000020", | |
512 | "0x40000021", | |
513 | "0x40000022", | |
514 | "0x40000023", | |
515 | "0x40000024", | |
516 | "0x40000025", | |
517 | "0x40000026", | |
518 | "0x40000027", | |
519 | "0x40000028", | |
520 | "0x40000029", | |
521 | "0x4000002A", | |
522 | "0x4000002B", | |
523 | "0x4000002C", | |
524 | "0x4000002D", | |
525 | "0x4000002E", | |
526 | "0x4000002F", | |
527 | /* 0x40000030 to 0x4000003F */ | |
528 | "0x40000030", | |
529 | "0x40000031", | |
530 | "0x40000032", | |
531 | "0x40000033", | |
532 | "0x40000034", | |
533 | "0x40000035", | |
534 | "0x40000036", | |
535 | "0x40000037", | |
536 | "0x40000038", | |
537 | "0x40000039", | |
538 | "0x4000003A", | |
539 | "0x4000003B", | |
540 | "0x4000003C", | |
541 | "0x4000003D", | |
542 | "0x4000003E", | |
543 | "0x4000003F", | |
544 | /* 0x40000040 - 0x4000004F */ | |
545 | "0x40000040", | |
546 | "0x40000041", | |
547 | "0x40000042", | |
548 | "0x40000043", | |
549 | "0x40000044", | |
550 | "0x40000045", | |
9475ec92 MS |
551 | "cups-punch-top-left", |
552 | "cups-punch-bottom-left", | |
553 | "cups-punch-top-right", | |
554 | "cups-punch-bottom-right", | |
555 | "cups-punch-dual-left", | |
556 | "cups-punch-dual-top", | |
557 | "cups-punch-dual-right", | |
558 | "cups-punch-dual-bottom", | |
559 | "cups-punch-triple-left", | |
560 | "cups-punch-triple-top", | |
6961465f | 561 | /* 0x40000050 - 0x4000005F */ |
9475ec92 MS |
562 | "cups-punch-triple-right", |
563 | "cups-punch-triple-bottom", | |
564 | "cups-punch-quad-left", | |
565 | "cups-punch-quad-top", | |
566 | "cups-punch-quad-right", | |
567 | "cups-punch-quad-bottom", | |
6961465f MS |
568 | "0x40000056", |
569 | "0x40000057", | |
570 | "0x40000058", | |
571 | "0x40000059", | |
9475ec92 MS |
572 | "cups-fold-accordian", |
573 | "cups-fold-double-gate", | |
574 | "cups-fold-gate", | |
575 | "cups-fold-half", | |
576 | "cups-fold-half-z", | |
577 | "cups-fold-left-gate", | |
6961465f | 578 | /* 0x40000060 - 0x40000064 */ |
9475ec92 MS |
579 | "cups-fold-letter", |
580 | "cups-fold-parallel", | |
581 | "cups-fold-poster", | |
582 | "cups-fold-right-gate", | |
583 | "cups-fold-z" | |
a469f8a5 | 584 | }, |
a2326b5b MS |
585 | * const ipp_job_collation_types[] = |
586 | { /* job-collation-type enums */ | |
587 | "uncollated-sheets", | |
588 | "collated-documents", | |
589 | "uncollated-documents" | |
590 | }, | |
591 | * const ipp_job_states[] = | |
592 | { /* job-state enums */ | |
593 | "pending", | |
594 | "pending-held", | |
595 | "processing", | |
596 | "processing-stopped", | |
597 | "canceled", | |
598 | "aborted", | |
599 | "completed" | |
600 | }, | |
601 | * const ipp_orientation_requesteds[] = | |
602 | { /* orientation-requested enums */ | |
603 | "portrait", | |
604 | "landscape", | |
605 | "reverse-landscape", | |
8f787fca MS |
606 | "reverse-portrait", |
607 | "none" | |
a2326b5b MS |
608 | }, |
609 | * const ipp_print_qualities[] = | |
610 | { /* print-quality enums */ | |
611 | "draft", | |
612 | "normal", | |
613 | "high" | |
614 | }, | |
615 | * const ipp_printer_states[] = | |
616 | { /* printer-state enums */ | |
617 | "idle", | |
618 | "processing", | |
619 | "stopped", | |
620 | }; | |
aaf19ab0 MS |
621 | |
622 | ||
623 | /* | |
624 | * Local functions... | |
625 | */ | |
626 | ||
627 | static size_t ipp_col_string(ipp_t *col, char *buffer, size_t bufsize); | |
628 | ||
629 | ||
630 | /* | |
a2326b5b | 631 | * 'ippAttributeString()' - Convert the attribute's value to a string. |
aaf19ab0 MS |
632 | * |
633 | * Returns the number of bytes that would be written, not including the | |
634 | * trailing nul. The buffer pointer can be NULL to get the required length, | |
635 | * just like (v)snprintf. | |
a2326b5b | 636 | * |
8072030b | 637 | * @since CUPS 1.6/macOS 10.8@ |
aaf19ab0 MS |
638 | */ |
639 | ||
640 | size_t /* O - Number of bytes less nul */ | |
a2326b5b MS |
641 | ippAttributeString( |
642 | ipp_attribute_t *attr, /* I - Attribute */ | |
643 | char *buffer, /* I - String buffer or NULL */ | |
644 | size_t bufsize) /* I - Size of string buffer */ | |
aaf19ab0 MS |
645 | { |
646 | int i; /* Looping var */ | |
647 | char *bufptr, /* Pointer into buffer */ | |
648 | *bufend, /* End of buffer */ | |
649 | temp[256]; /* Temporary string */ | |
db8b865d MS |
650 | const char *ptr, /* Pointer into string */ |
651 | *end; /* Pointer to end of string */ | |
a2326b5b | 652 | _ipp_value_t *val; /* Current value */ |
aaf19ab0 MS |
653 | |
654 | ||
655 | if (!attr || !attr->name) | |
656 | { | |
657 | if (buffer) | |
658 | *buffer = '\0'; | |
659 | ||
660 | return (0); | |
661 | } | |
662 | ||
663 | bufptr = buffer; | |
664 | if (buffer) | |
665 | bufend = buffer + bufsize - 1; | |
666 | else | |
667 | bufend = NULL; | |
668 | ||
669 | for (i = attr->num_values, val = attr->values; i > 0; i --, val ++) | |
670 | { | |
671 | if (val > attr->values) | |
672 | { | |
7cf5915e | 673 | if (buffer && bufptr < bufend) |
aaf19ab0 MS |
674 | *bufptr++ = ','; |
675 | else | |
676 | bufptr ++; | |
677 | } | |
678 | ||
cb7f98ee | 679 | switch (attr->value_tag & ~IPP_TAG_CUPS_CONST) |
aaf19ab0 MS |
680 | { |
681 | case IPP_TAG_ENUM : | |
a2326b5b | 682 | ptr = ippEnumString(attr->name, val->integer); |
aaf19ab0 | 683 | |
a2326b5b | 684 | if (buffer && bufptr < bufend) |
07623986 | 685 | strlcpy(bufptr, ptr, (size_t)(bufend - bufptr + 1)); |
9b66acc5 | 686 | |
a2326b5b MS |
687 | bufptr += strlen(ptr); |
688 | break; | |
aaf19ab0 MS |
689 | |
690 | case IPP_TAG_INTEGER : | |
7cf5915e | 691 | if (buffer && bufptr < bufend) |
07623986 | 692 | bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%d", val->integer); |
aaf19ab0 MS |
693 | else |
694 | bufptr += snprintf(temp, sizeof(temp), "%d", val->integer); | |
695 | break; | |
696 | ||
697 | case IPP_TAG_BOOLEAN : | |
7cf5915e | 698 | if (buffer && bufptr < bufend) |
07623986 | 699 | strlcpy(bufptr, val->boolean ? "true" : "false", (size_t)(bufend - bufptr + 1)); |
aaf19ab0 MS |
700 | |
701 | bufptr += val->boolean ? 4 : 5; | |
702 | break; | |
703 | ||
704 | case IPP_TAG_RANGE : | |
7cf5915e | 705 | if (buffer && bufptr < bufend) |
07623986 | 706 | bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%d-%d", val->range.lower, val->range.upper); |
aaf19ab0 | 707 | else |
07623986 | 708 | bufptr += snprintf(temp, sizeof(temp), "%d-%d", val->range.lower, val->range.upper); |
aaf19ab0 MS |
709 | break; |
710 | ||
711 | case IPP_TAG_RESOLUTION : | |
4a838088 MS |
712 | if (val->resolution.xres == val->resolution.yres) |
713 | { | |
714 | if (buffer && bufptr < bufend) | |
715 | bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%d%s", val->resolution.xres, val->resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpcm"); | |
716 | else | |
717 | bufptr += snprintf(temp, sizeof(temp), "%d%s", val->resolution.xres, val->resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpcm"); | |
718 | } | |
719 | else if (buffer && bufptr < bufend) | |
07623986 | 720 | bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%dx%d%s", val->resolution.xres, val->resolution.yres, val->resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpcm"); |
aaf19ab0 | 721 | else |
07623986 | 722 | bufptr += snprintf(temp, sizeof(temp), "%dx%d%s", val->resolution.xres, val->resolution.yres, val->resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpcm"); |
aaf19ab0 MS |
723 | break; |
724 | ||
725 | case IPP_TAG_DATE : | |
726 | { | |
727 | unsigned year; /* Year */ | |
728 | ||
7e86f2f6 | 729 | year = ((unsigned)val->date[0] << 8) + (unsigned)val->date[1]; |
aaf19ab0 MS |
730 | |
731 | if (val->date[9] == 0 && val->date[10] == 0) | |
732 | snprintf(temp, sizeof(temp), "%04u-%02u-%02uT%02u:%02u:%02uZ", | |
733 | year, val->date[2], val->date[3], val->date[4], | |
734 | val->date[5], val->date[6]); | |
735 | else | |
736 | snprintf(temp, sizeof(temp), | |
737 | "%04u-%02u-%02uT%02u:%02u:%02u%c%02u%02u", | |
738 | year, val->date[2], val->date[3], val->date[4], | |
739 | val->date[5], val->date[6], val->date[8], val->date[9], | |
740 | val->date[10]); | |
741 | ||
7cf5915e | 742 | if (buffer && bufptr < bufend) |
07623986 | 743 | strlcpy(bufptr, temp, (size_t)(bufend - bufptr + 1)); |
aaf19ab0 MS |
744 | |
745 | bufptr += strlen(temp); | |
746 | } | |
747 | break; | |
748 | ||
749 | case IPP_TAG_TEXT : | |
750 | case IPP_TAG_NAME : | |
751 | case IPP_TAG_KEYWORD : | |
752 | case IPP_TAG_CHARSET : | |
753 | case IPP_TAG_URI : | |
d7225fc2 | 754 | case IPP_TAG_URISCHEME : |
aaf19ab0 MS |
755 | case IPP_TAG_MIMETYPE : |
756 | case IPP_TAG_LANGUAGE : | |
757 | case IPP_TAG_TEXTLANG : | |
758 | case IPP_TAG_NAMELANG : | |
7cf5915e MS |
759 | if (!val->string.text) |
760 | break; | |
761 | ||
aaf19ab0 MS |
762 | for (ptr = val->string.text; *ptr; ptr ++) |
763 | { | |
a2326b5b | 764 | if (*ptr == '\\' || *ptr == '\"' || *ptr == '[') |
aaf19ab0 | 765 | { |
7cf5915e | 766 | if (buffer && bufptr < bufend) |
aaf19ab0 MS |
767 | *bufptr = '\\'; |
768 | bufptr ++; | |
769 | } | |
770 | ||
7cf5915e | 771 | if (buffer && bufptr < bufend) |
aaf19ab0 MS |
772 | *bufptr = *ptr; |
773 | bufptr ++; | |
774 | } | |
a2326b5b MS |
775 | |
776 | if (val->string.language) | |
777 | { | |
778 | /* | |
779 | * Add "[language]" to end of string... | |
780 | */ | |
781 | ||
782 | if (buffer && bufptr < bufend) | |
783 | *bufptr = '['; | |
784 | bufptr ++; | |
785 | ||
786 | if (buffer && bufptr < bufend) | |
07623986 | 787 | strlcpy(bufptr, val->string.language, (size_t)(bufend - bufptr)); |
a2326b5b MS |
788 | bufptr += strlen(val->string.language); |
789 | ||
790 | if (buffer && bufptr < bufend) | |
791 | *bufptr = ']'; | |
792 | bufptr ++; | |
793 | } | |
aaf19ab0 MS |
794 | break; |
795 | ||
796 | case IPP_TAG_BEGIN_COLLECTION : | |
7cf5915e | 797 | if (buffer && bufptr < bufend) |
7e86f2f6 | 798 | bufptr += ipp_col_string(val->collection, bufptr, (size_t)(bufend - bufptr + 1)); |
aaf19ab0 MS |
799 | else |
800 | bufptr += ipp_col_string(val->collection, NULL, 0); | |
801 | break; | |
802 | ||
803 | case IPP_TAG_STRING : | |
db8b865d MS |
804 | for (ptr = val->unknown.data, end = ptr + val->unknown.length; |
805 | ptr < end; ptr ++) | |
aaf19ab0 | 806 | { |
7cf5915e | 807 | if (*ptr == '\\' || _cups_isspace(*ptr)) |
aaf19ab0 | 808 | { |
7cf5915e | 809 | if (buffer && bufptr < bufend) |
aaf19ab0 MS |
810 | *bufptr = '\\'; |
811 | bufptr ++; | |
812 | ||
7cf5915e | 813 | if (buffer && bufptr < bufend) |
aaf19ab0 MS |
814 | *bufptr = *ptr; |
815 | bufptr ++; | |
816 | } | |
817 | else if (!isprint(*ptr & 255)) | |
818 | { | |
7cf5915e | 819 | if (buffer && bufptr < bufend) |
07623986 | 820 | bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "\\%03o", *ptr & 255); |
aaf19ab0 | 821 | else |
07623986 | 822 | bufptr += snprintf(temp, sizeof(temp), "\\%03o", *ptr & 255); |
aaf19ab0 MS |
823 | } |
824 | else | |
825 | { | |
7cf5915e | 826 | if (buffer && bufptr < bufend) |
aaf19ab0 MS |
827 | *bufptr = *ptr; |
828 | bufptr ++; | |
829 | } | |
830 | } | |
831 | break; | |
832 | ||
833 | default : | |
834 | ptr = ippTagString(attr->value_tag); | |
7cf5915e | 835 | if (buffer && bufptr < bufend) |
07623986 | 836 | strlcpy(bufptr, ptr, (size_t)(bufend - bufptr + 1)); |
aaf19ab0 MS |
837 | bufptr += strlen(ptr); |
838 | break; | |
839 | } | |
840 | } | |
841 | ||
7cf5915e | 842 | if (buffer && bufptr < bufend) |
aaf19ab0 MS |
843 | *bufptr = '\0'; |
844 | else if (bufend) | |
845 | *bufend = '\0'; | |
846 | ||
7e86f2f6 | 847 | return ((size_t)(bufptr - buffer)); |
aaf19ab0 | 848 | } |
ef416fc2 | 849 | |
850 | ||
db8b865d MS |
851 | /* |
852 | * 'ippCreateRequestedArray()' - Create a CUPS array of attribute names from the | |
853 | * given requested-attributes attribute. | |
854 | * | |
855 | * This function creates a (sorted) CUPS array of attribute names matching the | |
856 | * list of "requested-attribute" values supplied in an IPP request. All IANA- | |
857 | * registered values are supported in addition to the CUPS IPP extension | |
858 | * attributes. | |
859 | * | |
860 | * The @code request@ parameter specifies the request message that was read from | |
861 | * the client. | |
862 | * | |
863 | * @code NULL@ is returned if all attributes should be returned. Otherwise, the | |
864 | * result is a sorted array of attribute names, where @code cupsArrayFind(array, | |
865 | * "attribute-name")@ will return a non-NULL pointer. The array must be freed | |
866 | * using the @code cupsArrayDelete@ function. | |
867 | * | |
8072030b | 868 | * @since CUPS 1.7/macOS 10.9@ |
db8b865d MS |
869 | */ |
870 | ||
871 | cups_array_t * /* O - CUPS array or @code NULL@ if all */ | |
872 | ippCreateRequestedArray(ipp_t *request) /* I - IPP request */ | |
873 | { | |
874 | int i, j, /* Looping vars */ | |
875 | count, /* Number of values */ | |
876 | added; /* Was name added? */ | |
877 | ipp_attribute_t *requested; /* requested-attributes attribute */ | |
878 | cups_array_t *ra; /* Requested attributes array */ | |
879 | const char *value; /* Current value */ | |
880 | /* The following lists come from the current IANA IPP registry of attributes */ | |
881 | static const char * const document_description[] = | |
882 | { /* document-description group */ | |
883 | "compression", | |
884 | "copies-actual", | |
885 | "cover-back-actual", | |
886 | "cover-front-actual", | |
887 | "current-page-order", | |
888 | "date-time-at-completed", | |
889 | "date-time-at-creation", | |
890 | "date-time-at-processing", | |
891 | "detailed-status-messages", | |
892 | "document-access-errors", | |
893 | "document-charset", | |
894 | "document-digital-signature", | |
895 | "document-format", | |
896 | "document-format-details", | |
897 | "document-format-detected", | |
898 | "document-format-version", | |
899 | "document-format-version-detected", | |
900 | "document-job-id", | |
901 | "document-job-uri", | |
902 | "document-message", | |
903 | "document-metadata", | |
904 | "document-name", | |
905 | "document-natural-language", | |
906 | "document-number", | |
907 | "document-printer-uri", | |
908 | "document-state", | |
909 | "document-state-message", | |
910 | "document-state-reasons", | |
911 | "document-uri", | |
912 | "document-uuid", | |
913 | "errors-count", | |
914 | "finishings-actual", | |
915 | "finishings-col-actual", | |
916 | "force-front-side-actual", | |
917 | "imposition-template-actual", | |
918 | "impressions", | |
516dacf7 | 919 | "impressions-col", |
db8b865d | 920 | "impressions-completed", |
516dacf7 | 921 | "impressions-completed-col", |
db8b865d MS |
922 | "impressions-completed-current-copy", |
923 | "insert-sheet-actual", | |
924 | "k-octets", | |
925 | "k-octets-processed", | |
926 | "last-document", | |
87e9bb55 | 927 | "materials-col-actual", /* IPP 3D */ |
db8b865d MS |
928 | "media-actual", |
929 | "media-col-actual", | |
930 | "media-input-tray-check-actual", | |
931 | "media-sheets", | |
516dacf7 | 932 | "media-sheets-col", |
db8b865d | 933 | "media-sheets-completed", |
516dacf7 | 934 | "media-sheets-completed-col", |
db8b865d | 935 | "more-info", |
87e9bb55 | 936 | "multiple-object-handling-actual", /* IPP 3D */ |
db8b865d MS |
937 | "number-up-actual", |
938 | "orientation-requested-actual", | |
939 | "output-bin-actual", | |
940 | "output-device-assigned", | |
941 | "overrides-actual", | |
942 | "page-delivery-actual", | |
943 | "page-order-received-actual", | |
944 | "page-ranges-actual", | |
945 | "pages", | |
516dacf7 | 946 | "pages-col", |
db8b865d | 947 | "pages-completed", |
516dacf7 | 948 | "pages-completed-col", |
db8b865d | 949 | "pages-completed-current-copy", |
87e9bb55 | 950 | "platform-temperature-actual", /* IPP 3D */ |
db8b865d | 951 | "presentation-direction-number-up-actual", |
87e9bb55 MS |
952 | "print-accuracy-actual", /* IPP 3D */ |
953 | "print-base-actual", /* IPP 3D */ | |
db8b865d MS |
954 | "print-color-mode-actual", |
955 | "print-content-optimize-actual", | |
87e9bb55 | 956 | "print-objects-actual", /* IPP 3D */ |
db8b865d MS |
957 | "print-quality-actual", |
958 | "print-rendering-intent-actual", | |
6961465f | 959 | "print-scaling-actual", /* IPP Paid Printing */ |
87e9bb55 | 960 | "print-supports-actual", /* IPP 3D */ |
db8b865d MS |
961 | "printer-resolution-actual", |
962 | "printer-up-time", | |
963 | "separator-sheets-actual", | |
964 | "sheet-completed-copy-number", | |
965 | "sides-actual", | |
966 | "time-at-completed", | |
967 | "time-at-creation", | |
968 | "time-at-processing", | |
969 | "x-image-position-actual", | |
970 | "x-image-shift-actual", | |
971 | "x-side1-image-shift-actual", | |
972 | "x-side2-image-shift-actual", | |
973 | "y-image-position-actual", | |
974 | "y-image-shift-actual", | |
975 | "y-side1-image-shift-actual", | |
976 | "y-side2-image-shift-actual" | |
977 | }; | |
978 | static const char * const document_template[] = | |
979 | { /* document-template group */ | |
980 | "copies", | |
981 | "copies-default", | |
982 | "copies-supported", | |
983 | "cover-back", | |
984 | "cover-back-default", | |
985 | "cover-back-supported", | |
986 | "cover-front", | |
987 | "cover-front-default", | |
988 | "cover-front-supported", | |
989 | "feed-orientation", | |
990 | "feed-orientation-default", | |
991 | "feed-orientation-supported", | |
992 | "finishings", | |
993 | "finishings-col", | |
253dc4fc | 994 | "finishings-col-database", |
db8b865d | 995 | "finishings-col-default", |
253dc4fc | 996 | "finishings-col-ready", |
db8b865d MS |
997 | "finishings-col-supported", |
998 | "finishings-default", | |
253dc4fc | 999 | "finishings-ready", |
db8b865d MS |
1000 | "finishings-supported", |
1001 | "font-name-requested", | |
1002 | "font-name-requested-default", | |
1003 | "font-name-requested-supported", | |
1004 | "font-size-requested", | |
1005 | "font-size-requested-default", | |
1006 | "font-size-requested-supported", | |
1007 | "force-front-side", | |
1008 | "force-front-side-default", | |
1009 | "force-front-side-supported", | |
1010 | "imposition-template", | |
1011 | "imposition-template-default", | |
1012 | "imposition-template-supported", | |
1013 | "insert-after-page-number-supported", | |
1014 | "insert-count-supported", | |
1015 | "insert-sheet", | |
1016 | "insert-sheet-default", | |
1017 | "insert-sheet-supported", | |
87e9bb55 MS |
1018 | "material-amount-units-supported", /* IPP 3D */ |
1019 | "material-diameter-supported", /* IPP 3D */ | |
1020 | "material-purpose-supported", /* IPP 3D */ | |
1021 | "material-rate-supported", /* IPP 3D */ | |
1022 | "material-rate-units-supported", /* IPP 3D */ | |
1023 | "material-shell-thickness-supported",/* IPP 3D */ | |
1024 | "material-temperature-supported", /* IPP 3D */ | |
1025 | "material-type-supported", /* IPP 3D */ | |
1026 | "materials-col", /* IPP 3D */ | |
1027 | "materials-col-database", /* IPP 3D */ | |
1028 | "materials-col-default", /* IPP 3D */ | |
1029 | "materials-col-ready", /* IPP 3D */ | |
1030 | "materials-col-supported", /* IPP 3D */ | |
1031 | "max-materials-col-supported", /* IPP 3D */ | |
db8b865d MS |
1032 | "max-stitching-locations-supported", |
1033 | "media", | |
1034 | "media-back-coating-supported", | |
1035 | "media-bottom-margin-supported", | |
1036 | "media-col", | |
1037 | "media-col-default", | |
253dc4fc | 1038 | "media-col-ready", |
db8b865d MS |
1039 | "media-col-supported", |
1040 | "media-color-supported", | |
1041 | "media-default", | |
1042 | "media-front-coating-supported", | |
1043 | "media-grain-supported", | |
1044 | "media-hole-count-supported", | |
1045 | "media-info-supported", | |
1046 | "media-input-tray-check", | |
1047 | "media-input-tray-check-default", | |
1048 | "media-input-tray-check-supported", | |
1049 | "media-key-supported", | |
1050 | "media-left-margin-supported", | |
1051 | "media-order-count-supported", | |
1052 | "media-pre-printed-supported", | |
253dc4fc | 1053 | "media-ready", |
db8b865d MS |
1054 | "media-recycled-supported", |
1055 | "media-right-margin-supported", | |
1056 | "media-size-supported", | |
1057 | "media-source-supported", | |
1058 | "media-supported", | |
1059 | "media-thickness-supported", | |
1060 | "media-top-margin-supported", | |
1061 | "media-type-supported", | |
1062 | "media-weight-metric-supported", | |
1063 | "multiple-document-handling", | |
1064 | "multiple-document-handling-default", | |
1065 | "multiple-document-handling-supported", | |
87e9bb55 MS |
1066 | "multiple-object-handling", /* IPP 3D */ |
1067 | "multiple-object-handling-default", /* IPP 3D */ | |
1068 | "multiple-object-handling-supported",/* IPP 3D */ | |
db8b865d MS |
1069 | "number-up", |
1070 | "number-up-default", | |
1071 | "number-up-supported", | |
1072 | "orientation-requested", | |
1073 | "orientation-requested-default", | |
1074 | "orientation-requested-supported", | |
6961465f MS |
1075 | "output-mode", /* CUPS extension */ |
1076 | "output-mode-default", /* CUPS extension */ | |
1077 | "output-mode-supported", /* CUPS extension */ | |
db8b865d MS |
1078 | "overrides", |
1079 | "overrides-supported", | |
1080 | "page-delivery", | |
1081 | "page-delivery-default", | |
1082 | "page-delivery-supported", | |
1083 | "page-order-received", | |
1084 | "page-order-received-default", | |
1085 | "page-order-received-supported", | |
1086 | "page-ranges", | |
1087 | "page-ranges-supported", | |
1088 | "pages-per-subset", | |
1089 | "pages-per-subset-supported", | |
1090 | "pdl-init-file", | |
1091 | "pdl-init-file-default", | |
1092 | "pdl-init-file-entry-supported", | |
1093 | "pdl-init-file-location-supported", | |
1094 | "pdl-init-file-name-subdirectory-supported", | |
1095 | "pdl-init-file-name-supported", | |
1096 | "pdl-init-file-supported", | |
87e9bb55 MS |
1097 | "platform-temperature", /* IPP 3D */ |
1098 | "platform-temperature-default", /* IPP 3D */ | |
1099 | "platform-temperature-supported", /* IPP 3D */ | |
db8b865d MS |
1100 | "presentation-direction-number-up", |
1101 | "presentation-direction-number-up-default", | |
1102 | "presentation-direction-number-up-supported", | |
87e9bb55 MS |
1103 | "print-accuracy", /* IPP 3D */ |
1104 | "print-accuracy-default", /* IPP 3D */ | |
1105 | "print-accuracy-supported", /* IPP 3D */ | |
1106 | "print-base", /* IPP 3D */ | |
1107 | "print-base-default", /* IPP 3D */ | |
1108 | "print-base-supported", /* IPP 3D */ | |
db8b865d MS |
1109 | "print-color-mode", |
1110 | "print-color-mode-default", | |
1111 | "print-color-mode-supported", | |
1112 | "print-content-optimize", | |
1113 | "print-content-optimize-default", | |
1114 | "print-content-optimize-supported", | |
87e9bb55 MS |
1115 | "print-objects", /* IPP 3D */ |
1116 | "print-objects-default", /* IPP 3D */ | |
1117 | "print-objects-supported", /* IPP 3D */ | |
db8b865d MS |
1118 | "print-quality", |
1119 | "print-quality-default", | |
1120 | "print-quality-supported", | |
1121 | "print-rendering-intent", | |
1122 | "print-rendering-intent-default", | |
1123 | "print-rendering-intent-supported", | |
6961465f MS |
1124 | "print-scaling", /* IPP Paid Printing */ |
1125 | "print-scaling-default", /* IPP Paid Printing */ | |
1126 | "print-scaling-supported", /* IPP Paid Printing */ | |
87e9bb55 MS |
1127 | "print-supports", /* IPP 3D */ |
1128 | "print-supports-default", /* IPP 3D */ | |
1129 | "print-supports-supported", /* IPP 3D */ | |
db8b865d MS |
1130 | "printer-resolution", |
1131 | "printer-resolution-default", | |
1132 | "printer-resolution-supported", | |
1133 | "separator-sheets", | |
1134 | "separator-sheets-default", | |
1135 | "separator-sheets-supported", | |
1136 | "sheet-collate", | |
1137 | "sheet-collate-default", | |
1138 | "sheet-collate-supported", | |
1139 | "sides", | |
1140 | "sides-default", | |
1141 | "sides-supported", | |
1142 | "stitching-locations-supported", | |
1143 | "stitching-offset-supported", | |
1144 | "x-image-position", | |
1145 | "x-image-position-default", | |
1146 | "x-image-position-supported", | |
1147 | "x-image-shift", | |
1148 | "x-image-shift-default", | |
1149 | "x-image-shift-supported", | |
1150 | "x-side1-image-shift", | |
1151 | "x-side1-image-shift-default", | |
1152 | "x-side1-image-shift-supported", | |
1153 | "x-side2-image-shift", | |
1154 | "x-side2-image-shift-default", | |
1155 | "x-side2-image-shift-supported", | |
1156 | "y-image-position", | |
1157 | "y-image-position-default", | |
1158 | "y-image-position-supported", | |
1159 | "y-image-shift", | |
1160 | "y-image-shift-default", | |
1161 | "y-image-shift-supported", | |
1162 | "y-side1-image-shift", | |
1163 | "y-side1-image-shift-default", | |
1164 | "y-side1-image-shift-supported", | |
1165 | "y-side2-image-shift", | |
1166 | "y-side2-image-shift-default", | |
1167 | "y-side2-image-shift-supported" | |
1168 | }; | |
1169 | static const char * const job_description[] = | |
1170 | { /* job-description group */ | |
1171 | "compression-supplied", | |
1172 | "copies-actual", | |
1173 | "cover-back-actual", | |
1174 | "cover-front-actual", | |
1175 | "current-page-order", | |
1176 | "date-time-at-completed", | |
1177 | "date-time-at-creation", | |
1178 | "date-time-at-processing", | |
1179 | "destination-statuses", | |
1180 | "document-charset-supplied", | |
1181 | "document-digital-signature-supplied", | |
1182 | "document-format-details-supplied", | |
1183 | "document-format-supplied", | |
1184 | "document-message-supplied", | |
1185 | "document-metadata", | |
1186 | "document-name-supplied", | |
1187 | "document-natural-language-supplied", | |
1188 | "document-overrides-actual", | |
1189 | "errors-count", | |
1190 | "finishings-actual", | |
1191 | "finishings-col-actual", | |
1192 | "force-front-side-actual", | |
1193 | "imposition-template-actual", | |
1194 | "impressions-completed-current-copy", | |
1195 | "insert-sheet-actual", | |
1196 | "job-account-id-actual", | |
1197 | "job-accounting-sheets-actual", | |
1198 | "job-accounting-user-id-actual", | |
1199 | "job-attribute-fidelity", | |
1200 | "job-charge-info", /* CUPS extension */ | |
1201 | "job-collation-type", | |
1202 | "job-collation-type-actual", | |
1203 | "job-copies-actual", | |
1204 | "job-cover-back-actual", | |
1205 | "job-cover-front-actual", | |
1206 | "job-detailed-status-message", | |
1207 | "job-document-access-errors", | |
1208 | "job-error-sheet-actual", | |
1209 | "job-finishings-actual", | |
1210 | "job-finishings-col-actual", | |
1211 | "job-hold-until-actual", | |
1212 | "job-id", | |
1213 | "job-impressions", | |
516dacf7 | 1214 | "job-impressions-col", |
db8b865d | 1215 | "job-impressions-completed", |
516dacf7 | 1216 | "job-impressions-completed-col", |
db8b865d MS |
1217 | "job-k-octets", |
1218 | "job-k-octets-processed", | |
1219 | "job-mandatory-attributes", | |
1220 | "job-media-progress", /* CUPS extension */ | |
1221 | "job-media-sheets", | |
516dacf7 | 1222 | "job-media-sheets-col", |
db8b865d | 1223 | "job-media-sheets-completed", |
516dacf7 | 1224 | "job-media-sheets-completed-col", |
db8b865d MS |
1225 | "job-message-from-operator", |
1226 | "job-more-info", | |
1227 | "job-name", | |
1228 | "job-originating-host-name", /* CUPS extension */ | |
1229 | "job-originating-user-name", | |
1230 | "job-originating-user-uri", | |
1231 | "job-pages", | |
516dacf7 | 1232 | "job-pages-col", |
db8b865d | 1233 | "job-pages-completed", |
516dacf7 | 1234 | "job-pages-completed-col", |
db8b865d MS |
1235 | "job-pages-completed-current-copy", |
1236 | "job-printer-state-message", /* CUPS extension */ | |
1237 | "job-printer-state-reasons", /* CUPS extension */ | |
1238 | "job-printer-up-time", | |
1239 | "job-printer-uri", | |
1240 | "job-priority-actual", | |
1241 | "job-save-printer-make-and-model", | |
1242 | "job-sheet-message-actual", | |
1243 | "job-sheets-actual", | |
1244 | "job-sheets-col-actual", | |
1245 | "job-state", | |
1246 | "job-state-message", | |
1247 | "job-state-reasons", | |
1248 | "job-uri", | |
1249 | "job-uuid", | |
87e9bb55 | 1250 | "materials-col-actual", /* IPP 3D */ |
db8b865d MS |
1251 | "media-actual", |
1252 | "media-col-actual", | |
1253 | "media-check-input-tray-actual", | |
1254 | "multiple-document-handling-actual", | |
87e9bb55 | 1255 | "multiple-object-handling-actual", /* IPP 3D */ |
db8b865d MS |
1256 | "number-of-documents", |
1257 | "number-of-intervening-jobs", | |
1258 | "number-up-actual", | |
1259 | "orientation-requested-actual", | |
1260 | "original-requesting-user-name", | |
1261 | "output-bin-actual", | |
1262 | "output-device-assigned", | |
1263 | "overrides-actual", | |
1264 | "page-delivery-actual", | |
1265 | "page-order-received-actual", | |
1266 | "page-ranges-actual", | |
87e9bb55 | 1267 | "platform-temperature-actual", /* IPP 3D */ |
db8b865d | 1268 | "presentation-direction-number-up-actual", |
87e9bb55 MS |
1269 | "print-accuracy-actual", /* IPP 3D */ |
1270 | "print-base-actual", /* IPP 3D */ | |
db8b865d MS |
1271 | "print-color-mode-actual", |
1272 | "print-content-optimize-actual", | |
87e9bb55 | 1273 | "print-objects-actual", /* IPP 3D */ |
db8b865d MS |
1274 | "print-quality-actual", |
1275 | "print-rendering-intent-actual", | |
6961465f | 1276 | "print-scaling-actual", /* IPP Paid Printing */ |
87e9bb55 | 1277 | "print-supports-actual", /* IPP 3D */ |
db8b865d MS |
1278 | "printer-resolution-actual", |
1279 | "separator-sheets-actual", | |
1280 | "sheet-collate-actual", | |
1281 | "sheet-completed-copy-number", | |
1282 | "sheet-completed-document-number", | |
1283 | "sides-actual", | |
1284 | "time-at-completed", | |
1285 | "time-at-creation", | |
1286 | "time-at-processing", | |
1287 | "warnings-count", | |
1288 | "x-image-position-actual", | |
1289 | "x-image-shift-actual", | |
1290 | "x-side1-image-shift-actual", | |
1291 | "x-side2-image-shift-actual", | |
1292 | "y-image-position-actual", | |
1293 | "y-image-shift-actual", | |
1294 | "y-side1-image-shift-actual", | |
1295 | "y-side2-image-shift-actual" | |
1296 | }; | |
1297 | static const char * const job_template[] = | |
1298 | { /* job-template group */ | |
87e9bb55 | 1299 | "accuracy-units-supported", /* IPP 3D */ |
db8b865d MS |
1300 | "confirmation-sheet-print", /* IPP FaxOut */ |
1301 | "confirmation-sheet-print-default", | |
1302 | "copies", | |
1303 | "copies-default", | |
1304 | "copies-supported", | |
1305 | "cover-back", | |
1306 | "cover-back-default", | |
1307 | "cover-back-supported", | |
1308 | "cover-front", | |
1309 | "cover-front-default", | |
1310 | "cover-front-supported", | |
1311 | "cover-sheet-info", /* IPP FaxOut */ | |
1312 | "cover-sheet-info-default", | |
1313 | "cover-sheet-info-supported", | |
1314 | "destination-uri-schemes-supported",/* IPP FaxOut */ | |
1315 | "destination-uris", /* IPP FaxOut */ | |
1316 | "destination-uris-supported", | |
1317 | "feed-orientation", | |
1318 | "feed-orientation-default", | |
1319 | "feed-orientation-supported", | |
1320 | "finishings", | |
1321 | "finishings-col", | |
253dc4fc | 1322 | "finishings-col-database", |
db8b865d | 1323 | "finishings-col-default", |
253dc4fc | 1324 | "finishings-col-ready", |
db8b865d MS |
1325 | "finishings-col-supported", |
1326 | "finishings-default", | |
253dc4fc | 1327 | "finishings-ready", |
db8b865d MS |
1328 | "finishings-supported", |
1329 | "font-name-requested", | |
1330 | "font-name-requested-default", | |
1331 | "font-name-requested-supported", | |
1332 | "font-size-requested", | |
1333 | "font-size-requested-default", | |
1334 | "font-size-requested-supported", | |
1335 | "force-front-side", | |
1336 | "force-front-side-default", | |
1337 | "force-front-side-supported", | |
1338 | "imposition-template", | |
1339 | "imposition-template-default", | |
1340 | "imposition-template-supported", | |
1341 | "insert-after-page-number-supported", | |
1342 | "insert-count-supported", | |
1343 | "insert-sheet", | |
1344 | "insert-sheet-default", | |
1345 | "insert-sheet-supported", | |
1346 | "job-account-id", | |
1347 | "job-account-id-default", | |
1348 | "job-account-id-supported", | |
1349 | "job-accounting-sheets" | |
1350 | "job-accounting-sheets-default" | |
1351 | "job-accounting-sheets-supported" | |
1352 | "job-accounting-user-id", | |
1353 | "job-accounting-user-id-default", | |
1354 | "job-accounting-user-id-supported", | |
1355 | "job-copies", | |
1356 | "job-copies-default", | |
1357 | "job-copies-supported", | |
1358 | "job-cover-back", | |
1359 | "job-cover-back-default", | |
1360 | "job-cover-back-supported", | |
1361 | "job-cover-front", | |
1362 | "job-cover-front-default", | |
1363 | "job-cover-front-supported", | |
1364 | "job-delay-output-until", | |
1365 | "job-delay-output-until-default", | |
1366 | "job-delay-output-until-supported", | |
1367 | "job-delay-output-until-time", | |
1368 | "job-delay-output-until-time-default", | |
1369 | "job-delay-output-until-time-supported", | |
1370 | "job-error-action", | |
1371 | "job-error-action-default", | |
1372 | "job-error-action-supported", | |
1373 | "job-error-sheet", | |
1374 | "job-error-sheet-default", | |
1375 | "job-error-sheet-supported", | |
1376 | "job-finishings", | |
1377 | "job-finishings-col", | |
1378 | "job-finishings-col-default", | |
1379 | "job-finishings-col-supported", | |
1380 | "job-finishings-default", | |
1381 | "job-finishings-supported", | |
1382 | "job-hold-until", | |
1383 | "job-hold-until-default", | |
1384 | "job-hold-until-supported", | |
1385 | "job-hold-until-time", | |
1386 | "job-hold-until-time-default", | |
1387 | "job-hold-until-time-supported", | |
1388 | "job-message-to-operator", | |
1389 | "job-message-to-operator-default", | |
1390 | "job-message-to-operator-supported", | |
1391 | "job-phone-number", | |
1392 | "job-phone-number-default", | |
1393 | "job-phone-number-supported", | |
1394 | "job-priority", | |
1395 | "job-priority-default", | |
1396 | "job-priority-supported", | |
1397 | "job-recipient-name", | |
1398 | "job-recipient-name-default", | |
1399 | "job-recipient-name-supported", | |
1400 | "job-save-disposition", | |
1401 | "job-save-disposition-default", | |
1402 | "job-save-disposition-supported", | |
1403 | "job-sheets", | |
1404 | "job-sheets-col", | |
1405 | "job-sheets-col-default", | |
1406 | "job-sheets-col-supported", | |
1407 | "job-sheets-default", | |
1408 | "job-sheets-supported", | |
1409 | "logo-uri-schemes-supported", | |
87e9bb55 MS |
1410 | "material-amount-units-supported", /* IPP 3D */ |
1411 | "material-diameter-supported", /* IPP 3D */ | |
1412 | "material-purpose-supported", /* IPP 3D */ | |
1413 | "material-rate-supported", /* IPP 3D */ | |
1414 | "material-rate-units-supported", /* IPP 3D */ | |
1415 | "material-shell-thickness-supported",/* IPP 3D */ | |
1416 | "material-temperature-supported", /* IPP 3D */ | |
1417 | "material-type-supported", /* IPP 3D */ | |
1418 | "materials-col", /* IPP 3D */ | |
1419 | "materials-col-database", /* IPP 3D */ | |
1420 | "materials-col-default", /* IPP 3D */ | |
1421 | "materials-col-ready", /* IPP 3D */ | |
1422 | "materials-col-supported", /* IPP 3D */ | |
1423 | "max-materials-col-supported", /* IPP 3D */ | |
db8b865d MS |
1424 | "max-save-info-supported", |
1425 | "max-stitching-locations-supported", | |
1426 | "media", | |
1427 | "media-back-coating-supported", | |
1428 | "media-bottom-margin-supported", | |
1429 | "media-col", | |
1430 | "media-col-default", | |
253dc4fc | 1431 | "media-col-ready", |
db8b865d MS |
1432 | "media-col-supported", |
1433 | "media-color-supported", | |
1434 | "media-default", | |
1435 | "media-front-coating-supported", | |
1436 | "media-grain-supported", | |
1437 | "media-hole-count-supported", | |
1438 | "media-info-supported", | |
1439 | "media-input-tray-check", | |
1440 | "media-input-tray-check-default", | |
1441 | "media-input-tray-check-supported", | |
1442 | "media-key-supported", | |
1443 | "media-left-margin-supported", | |
1444 | "media-order-count-supported", | |
1445 | "media-pre-printed-supported", | |
253dc4fc | 1446 | "media-ready", |
db8b865d MS |
1447 | "media-recycled-supported", |
1448 | "media-right-margin-supported", | |
1449 | "media-size-supported", | |
1450 | "media-source-supported", | |
1451 | "media-supported", | |
1452 | "media-thickness-supported", | |
1453 | "media-top-margin-supported", | |
1454 | "media-type-supported", | |
1455 | "media-weight-metric-supported", | |
1456 | "multiple-document-handling", | |
1457 | "multiple-document-handling-default", | |
1458 | "multiple-document-handling-supported", | |
87e9bb55 MS |
1459 | "multiple-object-handling", /* IPP 3D */ |
1460 | "multiple-object-handling-default", /* IPP 3D */ | |
1461 | "multiple-object-handling-supported",/* IPP 3D */ | |
db8b865d MS |
1462 | "number-of-retries", /* IPP FaxOut */ |
1463 | "number-of-retries-default", | |
1464 | "number-of-retries-supported", | |
1465 | "number-up", | |
1466 | "number-up-default", | |
1467 | "number-up-supported", | |
1468 | "orientation-requested", | |
1469 | "orientation-requested-default", | |
1470 | "orientation-requested-supported", | |
1471 | "output-bin", | |
1472 | "output-bin-default", | |
1473 | "output-bin-supported", | |
1474 | "output-device", | |
1475 | "output-device-default", | |
1476 | "output-device-supported", | |
6961465f MS |
1477 | "output-mode", /* CUPS extension */ |
1478 | "output-mode-default", /* CUPS extension */ | |
1479 | "output-mode-supported", /* CUPS extension */ | |
db8b865d MS |
1480 | "overrides", |
1481 | "overrides-supported", | |
1482 | "page-delivery", | |
1483 | "page-delivery-default", | |
1484 | "page-delivery-supported", | |
1485 | "page-order-received", | |
1486 | "page-order-received-default", | |
1487 | "page-order-received-supported", | |
1488 | "page-ranges", | |
1489 | "page-ranges-supported", | |
1490 | "pages-per-subset", | |
1491 | "pages-per-subset-supported", | |
1492 | "pdl-init-file", | |
1493 | "pdl-init-file-default", | |
1494 | "pdl-init-file-entry-supported", | |
1495 | "pdl-init-file-location-supported", | |
1496 | "pdl-init-file-name-subdirectory-supported", | |
1497 | "pdl-init-file-name-supported", | |
1498 | "pdl-init-file-supported", | |
87e9bb55 MS |
1499 | "platform-temperature", /* IPP 3D */ |
1500 | "platform-temperature-default", /* IPP 3D */ | |
1501 | "platform-temperature-supported", /* IPP 3D */ | |
db8b865d MS |
1502 | "presentation-direction-number-up", |
1503 | "presentation-direction-number-up-default", | |
1504 | "presentation-direction-number-up-supported", | |
87e9bb55 MS |
1505 | "print-accuracy", /* IPP 3D */ |
1506 | "print-accuracy-default", /* IPP 3D */ | |
1507 | "print-accuracy-supported", /* IPP 3D */ | |
1508 | "print-base", /* IPP 3D */ | |
1509 | "print-base-default", /* IPP 3D */ | |
1510 | "print-base-supported", /* IPP 3D */ | |
db8b865d MS |
1511 | "print-color-mode", |
1512 | "print-color-mode-default", | |
1513 | "print-color-mode-supported", | |
1514 | "print-content-optimize", | |
1515 | "print-content-optimize-default", | |
1516 | "print-content-optimize-supported", | |
87e9bb55 MS |
1517 | "print-objects", /* IPP 3D */ |
1518 | "print-objects-default", /* IPP 3D */ | |
1519 | "print-objects-supported", /* IPP 3D */ | |
db8b865d MS |
1520 | "print-quality", |
1521 | "print-quality-default", | |
1522 | "print-quality-supported", | |
1523 | "print-rendering-intent", | |
1524 | "print-rendering-intent-default", | |
1525 | "print-rendering-intent-supported", | |
6961465f MS |
1526 | "print-scaling", /* IPP Paid Printing */ |
1527 | "print-scaling-default", /* IPP Paid Printing */ | |
1528 | "print-scaling-supported", /* IPP Paid Printing */ | |
87e9bb55 MS |
1529 | "print-supports", /* IPP 3D */ |
1530 | "print-supports-default", /* IPP 3D */ | |
1531 | "print-supports-supported", /* IPP 3D */ | |
db8b865d MS |
1532 | "printer-resolution", |
1533 | "printer-resolution-default", | |
1534 | "printer-resolution-supported", | |
1535 | "proof-print", | |
1536 | "proof-print-default", | |
1537 | "proof-print-supported", | |
1538 | "retry-interval", /* IPP FaxOut */ | |
1539 | "retry-interval-default", | |
1540 | "retry-interval-supported", | |
1541 | "retry-timeout", /* IPP FaxOut */ | |
1542 | "retry-timeout-default", | |
1543 | "retry-timeout-supported", | |
1544 | "save-disposition-supported", | |
1545 | "save-document-format-default", | |
1546 | "save-document-format-supported", | |
1547 | "save-location-default", | |
1548 | "save-location-supported", | |
1549 | "save-name-subdirectory-supported", | |
1550 | "save-name-supported", | |
1551 | "separator-sheets", | |
1552 | "separator-sheets-default", | |
1553 | "separator-sheets-supported", | |
1554 | "sheet-collate", | |
1555 | "sheet-collate-default", | |
1556 | "sheet-collate-supported", | |
1557 | "sides", | |
1558 | "sides-default", | |
1559 | "sides-supported", | |
1560 | "stitching-locations-supported", | |
1561 | "stitching-offset-supported", | |
1562 | "x-image-position", | |
1563 | "x-image-position-default", | |
1564 | "x-image-position-supported", | |
1565 | "x-image-shift", | |
1566 | "x-image-shift-default", | |
1567 | "x-image-shift-supported", | |
1568 | "x-side1-image-shift", | |
1569 | "x-side1-image-shift-default", | |
1570 | "x-side1-image-shift-supported", | |
1571 | "x-side2-image-shift", | |
1572 | "x-side2-image-shift-default", | |
1573 | "x-side2-image-shift-supported", | |
1574 | "y-image-position", | |
1575 | "y-image-position-default", | |
1576 | "y-image-position-supported", | |
1577 | "y-image-shift", | |
1578 | "y-image-shift-default", | |
1579 | "y-image-shift-supported", | |
1580 | "y-side1-image-shift", | |
1581 | "y-side1-image-shift-default", | |
1582 | "y-side1-image-shift-supported", | |
1583 | "y-side2-image-shift", | |
1584 | "y-side2-image-shift-default", | |
1585 | "y-side2-image-shift-supported" | |
1586 | }; | |
1587 | static const char * const printer_description[] = | |
1588 | { /* printer-description group */ | |
1589 | "auth-info-required", /* CUPS extension */ | |
1590 | "charset-configured", | |
1591 | "charset-supported", | |
1592 | "color-supported", | |
1593 | "compression-supported", | |
1594 | "device-service-count", | |
1595 | "device-uri", /* CUPS extension */ | |
1596 | "device-uuid", | |
1597 | "document-charset-default", | |
1598 | "document-charset-supported", | |
1599 | "document-creation-attributes-supported", | |
1600 | "document-digital-signature-default", | |
1601 | "document-digital-signature-supported", | |
1602 | "document-format-default", | |
1603 | "document-format-details-default", | |
1604 | "document-format-details-supported", | |
1605 | "document-format-supported", | |
1606 | "document-format-varying-attributes", | |
1607 | "document-format-version-default", | |
1608 | "document-format-version-supported", | |
1609 | "document-natural-language-default", | |
1610 | "document-natural-language-supported", | |
1611 | "document-password-supported", | |
367068f3 MS |
1612 | "document-privacy-attributes", /* IPP Privacy Attributes */ |
1613 | "document-privacy-scope", /* IPP Privacy Attributes */ | |
db8b865d MS |
1614 | "generated-natural-language-supported", |
1615 | "identify-actions-default", | |
1616 | "identify-actions-supported", | |
1617 | "input-source-supported", | |
1618 | "ipp-features-supported", | |
1619 | "ipp-versions-supported", | |
1620 | "ippget-event-life", | |
1621 | "job-authorization-uri-supported", /* CUPS extension */ | |
1622 | "job-constraints-supported", | |
1623 | "job-creation-attributes-supported", | |
1624 | "job-finishings-col-ready", | |
1625 | "job-finishings-ready", | |
1626 | "job-ids-supported", | |
1627 | "job-impressions-supported", | |
1628 | "job-k-limit", /* CUPS extension */ | |
1629 | "job-k-octets-supported", | |
1630 | "job-media-sheets-supported", | |
1631 | "job-page-limit", /* CUPS extension */ | |
1632 | "job-password-encryption-supported", | |
1633 | "job-password-supported", | |
060016a0 | 1634 | "job-presets-supported", /* IPP Presets */ |
367068f3 MS |
1635 | "job-privacy-attributes", /* IPP Privacy Attributes */ |
1636 | "job-privacy-scope", /* IPP Privacy Attributes */ | |
db8b865d MS |
1637 | "job-quota-period", /* CUPS extension */ |
1638 | "job-resolvers-supported", | |
1639 | "job-settable-attributes-supported", | |
1640 | "job-spooling-supported", | |
060016a0 | 1641 | "job-triggers-supported", /* IPP Presets */ |
c5b24bfa MS |
1642 | "jpeg-k-octets-supported", /* CUPS extension */ |
1643 | "jpeg-x-dimension-supported", /* CUPS extension */ | |
1644 | "jpeg-y-dimension-supported", /* CUPS extension */ | |
1645 | "landscape-orientation-requested-preferred", | |
1646 | /* CUPS extension */ | |
db8b865d MS |
1647 | "marker-change-time", /* CUPS extension */ |
1648 | "marker-colors", /* CUPS extension */ | |
1649 | "marker-high-levels", /* CUPS extension */ | |
1650 | "marker-levels", /* CUPS extension */ | |
1651 | "marker-low-levels", /* CUPS extension */ | |
1652 | "marker-message", /* CUPS extension */ | |
1653 | "marker-names", /* CUPS extension */ | |
1654 | "marker-types", /* CUPS extension */ | |
db8b865d MS |
1655 | "member-names", /* CUPS extension */ |
1656 | "member-uris", /* CUPS extension */ | |
1657 | "multiple-destination-uris-supported",/* IPP FaxOut */ | |
1658 | "multiple-document-jobs-supported", | |
1659 | "multiple-operation-time-out", | |
1660 | "multiple-operation-time-out-action", | |
1661 | "natural-language-configured", | |
1662 | "operations-supported", | |
1663 | "pages-per-minute", | |
1664 | "pages-per-minute-color", | |
c5b24bfa | 1665 | "pdf-k-octets-supported", /* CUPS extension */ |
87e9bb55 | 1666 | "pdf-features-supported", /* IPP 3D */ |
c5b24bfa | 1667 | "pdf-versions-supported", /* CUPS extension */ |
db8b865d MS |
1668 | "pdl-override-supported", |
1669 | "port-monitor", /* CUPS extension */ | |
1670 | "port-monitor-supported", /* CUPS extension */ | |
1671 | "preferred-attributes-supported", | |
1672 | "printer-alert", | |
1673 | "printer-alert-description", | |
1674 | "printer-charge-info", | |
1675 | "printer-charge-info-uri", | |
1676 | "printer-commands", /* CUPS extension */ | |
f28728ee MS |
1677 | "printer-config-change-date-time", |
1678 | "printer-config-change-time", | |
db8b865d MS |
1679 | "printer-current-time", |
1680 | "printer-detailed-status-messages", | |
1681 | "printer-device-id", | |
1682 | "printer-dns-sd-name", /* CUPS extension */ | |
1683 | "printer-driver-installer", | |
1684 | "printer-fax-log-uri", /* IPP FaxOut */ | |
1685 | "printer-fax-modem-info", /* IPP FaxOut */ | |
1686 | "printer-fax-modem-name", /* IPP FaxOut */ | |
1687 | "printer-fax-modem-number", /* IPP FaxOut */ | |
8f787fca MS |
1688 | "printer-firmware-name", /* PWG 5110.1 */ |
1689 | "printer-firmware-patches", /* PWG 5110.1 */ | |
1690 | "printer-firmware-string-version", /* PWG 5110.1 */ | |
1691 | "printer-firmware-version", /* PWG 5110.1 */ | |
db8b865d MS |
1692 | "printer-geo-location", |
1693 | "printer-get-attributes-supported", | |
1694 | "printer-icc-profiles", | |
1695 | "printer-icons", | |
cd3a0368 | 1696 | "printer-id", /* CUPS extension */ |
db8b865d | 1697 | "printer-info", |
8f787fca | 1698 | "printer-input-tray", /* IPP JPS3 */ |
db8b865d | 1699 | "printer-is-accepting-jobs", |
6961465f | 1700 | "printer-is-shared", /* CUPS extension */ |
7ae00c35 | 1701 | "printer-is-temporary", /* CUPS extension */ |
6961465f | 1702 | "printer-kind", /* IPP Paid Printing */ |
db8b865d MS |
1703 | "printer-location", |
1704 | "printer-make-and-model", | |
1705 | "printer-mandatory-job-attributes", | |
1706 | "printer-message-date-time", | |
1707 | "printer-message-from-operator", | |
1708 | "printer-message-time", | |
1709 | "printer-more-info", | |
1710 | "printer-more-info-manufacturer", | |
1711 | "printer-name", | |
6961465f | 1712 | "printer-native-formats", |
db8b865d MS |
1713 | "printer-organization", |
1714 | "printer-organizational-unit", | |
8f787fca | 1715 | "printer-output-tray", /* IPP JPS3 */ |
34a63bd9 | 1716 | "printer-queue-id", /* CUPS extension */ |
db8b865d MS |
1717 | "printer-settable-attributes-supported", |
1718 | "printer-state", | |
1719 | "printer-state-change-date-time", | |
1720 | "printer-state-change-time", | |
1721 | "printer-state-message", | |
1722 | "printer-state-reasons", | |
1723 | "printer-supply", | |
1724 | "printer-supply-description", | |
1725 | "printer-supply-info-uri", | |
1726 | "printer-type", /* CUPS extension */ | |
1727 | "printer-up-time", | |
1728 | "printer-uri-supported", | |
1729 | "printer-uuid", | |
1730 | "printer-xri-supported", | |
1731 | "pwg-raster-document-resolution-supported", | |
1732 | "pwg-raster-document-sheet-back", | |
1733 | "pwg-raster-document-type-supported", | |
1734 | "queued-job-count", | |
1735 | "reference-uri-schemes-supported", | |
1736 | "repertoire-supported", | |
1737 | "requesting-user-name-allowed", /* CUPS extension */ | |
1738 | "requesting-user-name-denied", /* CUPS extension */ | |
1739 | "requesting-user-uri-supported", | |
1740 | "subordinate-printers-supported", | |
367068f3 MS |
1741 | "subscription-privacy-attributes", /* IPP Privacy Attributes */ |
1742 | "subscription-privacy-scope", /* IPP Privacy Attributes */ | |
6961465f | 1743 | "urf-supported", /* CUPS extension */ |
db8b865d MS |
1744 | "uri-authentication-supported", |
1745 | "uri-security-supported", | |
1746 | "user-defined-value-supported", | |
1747 | "which-jobs-supported", | |
1748 | "xri-authentication-supported", | |
1749 | "xri-security-supported", | |
1750 | "xri-uri-scheme-supported" | |
1751 | }; | |
1752 | static const char * const subscription_description[] = | |
1753 | { /* subscription-description group */ | |
1754 | "notify-job-id", | |
1755 | "notify-lease-expiration-time", | |
1756 | "notify-printer-up-time", | |
1757 | "notify-printer-uri", | |
1758 | "notify-sequence-number", | |
1759 | "notify-subscriber-user-name", | |
1760 | "notify-subscriber-user-uri", | |
1761 | "notify-subscription-id", | |
516dacf7 | 1762 | "notify-subscription-uuid" |
db8b865d MS |
1763 | }; |
1764 | static const char * const subscription_template[] = | |
1765 | { /* subscription-template group */ | |
1766 | "notify-attributes", | |
1767 | "notify-attributes-supported", | |
1768 | "notify-charset", | |
1769 | "notify-events", | |
1770 | "notify-events-default", | |
1771 | "notify-events-supported", | |
1772 | "notify-lease-duration", | |
1773 | "notify-lease-duration-default", | |
1774 | "notify-lease-duration-supported", | |
1775 | "notify-max-events-supported", | |
1776 | "notify-natural-language", | |
1777 | "notify-pull-method", | |
1778 | "notify-pull-method-supported", | |
1779 | "notify-recipient-uri", | |
1780 | "notify-schemes-supported", | |
1781 | "notify-time-interval", | |
1782 | "notify-user-data" | |
1783 | }; | |
1784 | ||
1785 | ||
1786 | /* | |
1787 | * Get the requested-attributes attribute... | |
1788 | */ | |
1789 | ||
1790 | if ((requested = ippFindAttribute(request, "requested-attributes", | |
1791 | IPP_TAG_KEYWORD)) == NULL) | |
1792 | { | |
1793 | /* | |
1794 | * The Get-Jobs operation defaults to "job-id" and "job-uri", all others | |
1795 | * default to "all"... | |
1796 | */ | |
1797 | ||
cb7f98ee | 1798 | if (ippGetOperation(request) == IPP_OP_GET_JOBS) |
db8b865d MS |
1799 | { |
1800 | ra = cupsArrayNew((cups_array_func_t)strcmp, NULL); | |
1801 | cupsArrayAdd(ra, "job-id"); | |
1802 | cupsArrayAdd(ra, "job-uri"); | |
1803 | ||
1804 | return (ra); | |
1805 | } | |
1806 | else | |
1807 | return (NULL); | |
1808 | } | |
1809 | ||
1810 | /* | |
1811 | * If the attribute contains a single "all" keyword, return NULL... | |
1812 | */ | |
1813 | ||
1814 | count = ippGetCount(requested); | |
1815 | if (count == 1 && !strcmp(ippGetString(requested, 0, NULL), "all")) | |
1816 | return (NULL); | |
1817 | ||
1818 | /* | |
1819 | * Create an array using "strcmp" as the comparison function... | |
1820 | */ | |
1821 | ||
1822 | ra = cupsArrayNew((cups_array_func_t)strcmp, NULL); | |
1823 | ||
1824 | for (i = 0; i < count; i ++) | |
1825 | { | |
1826 | added = 0; | |
1827 | value = ippGetString(requested, i, NULL); | |
1828 | ||
1829 | if (!strcmp(value, "document-description") || !strcmp(value, "all")) | |
1830 | { | |
1831 | for (j = 0; | |
1832 | j < (int)(sizeof(document_description) / | |
1833 | sizeof(document_description[0])); | |
1834 | j ++) | |
1835 | cupsArrayAdd(ra, (void *)document_description[j]); | |
1836 | ||
1837 | added = 1; | |
1838 | } | |
1839 | ||
1840 | if (!strcmp(value, "document-template") || !strcmp(value, "all")) | |
1841 | { | |
1842 | for (j = 0; | |
1843 | j < (int)(sizeof(document_template) / sizeof(document_template[0])); | |
1844 | j ++) | |
1845 | cupsArrayAdd(ra, (void *)document_template[j]); | |
1846 | ||
1847 | added = 1; | |
1848 | } | |
1849 | ||
1850 | if (!strcmp(value, "job-description") || !strcmp(value, "all")) | |
1851 | { | |
1852 | for (j = 0; | |
1853 | j < (int)(sizeof(job_description) / sizeof(job_description[0])); | |
1854 | j ++) | |
1855 | cupsArrayAdd(ra, (void *)job_description[j]); | |
1856 | ||
1857 | added = 1; | |
1858 | } | |
1859 | ||
1860 | if (!strcmp(value, "job-template") || !strcmp(value, "all")) | |
1861 | { | |
1862 | for (j = 0; | |
1863 | j < (int)(sizeof(job_template) / sizeof(job_template[0])); | |
1864 | j ++) | |
1865 | cupsArrayAdd(ra, (void *)job_template[j]); | |
1866 | ||
1867 | added = 1; | |
1868 | } | |
1869 | ||
1870 | if (!strcmp(value, "printer-description") || !strcmp(value, "all")) | |
1871 | { | |
1872 | for (j = 0; | |
1873 | j < (int)(sizeof(printer_description) / | |
1874 | sizeof(printer_description[0])); | |
1875 | j ++) | |
1876 | cupsArrayAdd(ra, (void *)printer_description[j]); | |
1877 | ||
1878 | added = 1; | |
1879 | } | |
1880 | ||
1881 | if (!strcmp(value, "subscription-description") || !strcmp(value, "all")) | |
1882 | { | |
1883 | for (j = 0; | |
1884 | j < (int)(sizeof(subscription_description) / | |
1885 | sizeof(subscription_description[0])); | |
1886 | j ++) | |
1887 | cupsArrayAdd(ra, (void *)subscription_description[j]); | |
1888 | ||
1889 | added = 1; | |
1890 | } | |
1891 | ||
1892 | if (!strcmp(value, "subscription-template") || !strcmp(value, "all")) | |
1893 | { | |
1894 | for (j = 0; | |
1895 | j < (int)(sizeof(subscription_template) / | |
1896 | sizeof(subscription_template[0])); | |
1897 | j ++) | |
1898 | cupsArrayAdd(ra, (void *)subscription_template[j]); | |
1899 | ||
1900 | added = 1; | |
1901 | } | |
1902 | ||
1903 | if (!added) | |
1904 | cupsArrayAdd(ra, (void *)value); | |
1905 | } | |
1906 | ||
1907 | return (ra); | |
1908 | } | |
1909 | ||
1910 | ||
a2326b5b MS |
1911 | /* |
1912 | * 'ippEnumString()' - Return a string corresponding to the enum value. | |
1913 | */ | |
1914 | ||
1915 | const char * /* O - Enum string */ | |
1916 | ippEnumString(const char *attrname, /* I - Attribute name */ | |
1917 | int enumvalue) /* I - Enum value */ | |
1918 | { | |
1919 | _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */ | |
1920 | ||
1921 | ||
1922 | /* | |
1923 | * Check for standard enum values... | |
1924 | */ | |
1925 | ||
1926 | if (!strcmp(attrname, "document-state") && | |
1927 | enumvalue >= 3 && | |
0fa6c7fa MS |
1928 | enumvalue < (3 + (int)(sizeof(ipp_document_states) / |
1929 | sizeof(ipp_document_states[0])))) | |
a2326b5b | 1930 | return (ipp_document_states[enumvalue - 3]); |
a469f8a5 MS |
1931 | else if (!strcmp(attrname, "finishings") || |
1932 | !strcmp(attrname, "finishings-actual") || | |
1933 | !strcmp(attrname, "finishings-default") || | |
1934 | !strcmp(attrname, "finishings-ready") || | |
6961465f MS |
1935 | !strcmp(attrname, "finishings-supported") || |
1936 | !strcmp(attrname, "job-finishings") || | |
1937 | !strcmp(attrname, "job-finishings-default") || | |
1938 | !strcmp(attrname, "job-finishings-supported")) | |
a469f8a5 MS |
1939 | { |
1940 | if (enumvalue >= 3 && | |
0fa6c7fa MS |
1941 | enumvalue < (3 + (int)(sizeof(ipp_finishings) / |
1942 | sizeof(ipp_finishings[0])))) | |
a469f8a5 MS |
1943 | return (ipp_finishings[enumvalue - 3]); |
1944 | else if (enumvalue >= 0x40000000 && | |
1945 | enumvalue <= (0x40000000 + (int)(sizeof(ipp_finishings_vendor) / | |
1946 | sizeof(ipp_finishings_vendor[0])))) | |
1947 | return (ipp_finishings_vendor[enumvalue - 0x40000000]); | |
1948 | } | |
a2326b5b MS |
1949 | else if ((!strcmp(attrname, "job-collation-type") || |
1950 | !strcmp(attrname, "job-collation-type-actual")) && | |
1951 | enumvalue >= 3 && | |
0fa6c7fa MS |
1952 | enumvalue < (3 + (int)(sizeof(ipp_job_collation_types) / |
1953 | sizeof(ipp_job_collation_types[0])))) | |
a2326b5b MS |
1954 | return (ipp_job_collation_types[enumvalue - 3]); |
1955 | else if (!strcmp(attrname, "job-state") && | |
cb7f98ee MS |
1956 | enumvalue >= IPP_JSTATE_PENDING && enumvalue <= IPP_JSTATE_COMPLETED) |
1957 | return (ipp_job_states[enumvalue - IPP_JSTATE_PENDING]); | |
a2326b5b MS |
1958 | else if (!strcmp(attrname, "operations-supported")) |
1959 | return (ippOpString((ipp_op_t)enumvalue)); | |
1960 | else if ((!strcmp(attrname, "orientation-requested") || | |
1961 | !strcmp(attrname, "orientation-requested-actual") || | |
1962 | !strcmp(attrname, "orientation-requested-default") || | |
1963 | !strcmp(attrname, "orientation-requested-supported")) && | |
1964 | enumvalue >= 3 && | |
0fa6c7fa MS |
1965 | enumvalue < (3 + (int)(sizeof(ipp_orientation_requesteds) / |
1966 | sizeof(ipp_orientation_requesteds[0])))) | |
a2326b5b MS |
1967 | return (ipp_orientation_requesteds[enumvalue - 3]); |
1968 | else if ((!strcmp(attrname, "print-quality") || | |
1969 | !strcmp(attrname, "print-quality-actual") || | |
1970 | !strcmp(attrname, "print-quality-default") || | |
1971 | !strcmp(attrname, "print-quality-supported")) && | |
1972 | enumvalue >= 3 && | |
0fa6c7fa MS |
1973 | enumvalue < (3 + (int)(sizeof(ipp_print_qualities) / |
1974 | sizeof(ipp_print_qualities[0])))) | |
a2326b5b MS |
1975 | return (ipp_print_qualities[enumvalue - 3]); |
1976 | else if (!strcmp(attrname, "printer-state") && | |
cb7f98ee MS |
1977 | enumvalue >= IPP_PSTATE_IDLE && enumvalue <= IPP_PSTATE_STOPPED) |
1978 | return (ipp_printer_states[enumvalue - IPP_PSTATE_IDLE]); | |
a2326b5b MS |
1979 | |
1980 | /* | |
1981 | * Not a standard enum value, just return the decimal equivalent... | |
1982 | */ | |
1983 | ||
1984 | snprintf(cg->ipp_unknown, sizeof(cg->ipp_unknown), "%d", enumvalue); | |
1985 | return (cg->ipp_unknown); | |
1986 | } | |
1987 | ||
1988 | ||
1989 | /* | |
1990 | * 'ippEnumValue()' - Return the value associated with a given enum string. | |
1991 | */ | |
1992 | ||
1993 | int /* O - Enum value or -1 if unknown */ | |
1994 | ippEnumValue(const char *attrname, /* I - Attribute name */ | |
1995 | const char *enumstring) /* I - Enum string */ | |
1996 | { | |
1997 | int i, /* Looping var */ | |
1998 | num_strings; /* Number of strings to compare */ | |
1999 | const char * const *strings; /* Strings to compare */ | |
2000 | ||
2001 | ||
2002 | /* | |
2003 | * If the string is just a number, return it... | |
2004 | */ | |
2005 | ||
2006 | if (isdigit(*enumstring & 255)) | |
7e86f2f6 | 2007 | return ((int)strtol(enumstring, NULL, 0)); |
a2326b5b MS |
2008 | |
2009 | /* | |
2010 | * Otherwise look up the string... | |
2011 | */ | |
2012 | ||
2013 | if (!strcmp(attrname, "document-state")) | |
2014 | { | |
2015 | num_strings = (int)(sizeof(ipp_document_states) / sizeof(ipp_document_states[0])); | |
2016 | strings = ipp_document_states; | |
2017 | } | |
2018 | else if (!strcmp(attrname, "finishings") || | |
2019 | !strcmp(attrname, "finishings-actual") || | |
2020 | !strcmp(attrname, "finishings-default") || | |
2021 | !strcmp(attrname, "finishings-ready") || | |
2022 | !strcmp(attrname, "finishings-supported")) | |
2023 | { | |
a469f8a5 MS |
2024 | for (i = 0; |
2025 | i < (int)(sizeof(ipp_finishings_vendor) / | |
2026 | sizeof(ipp_finishings_vendor[0])); | |
2027 | i ++) | |
2028 | if (!strcmp(enumstring, ipp_finishings_vendor[i])) | |
2029 | return (i + 0x40000000); | |
2030 | ||
a2326b5b MS |
2031 | num_strings = (int)(sizeof(ipp_finishings) / sizeof(ipp_finishings[0])); |
2032 | strings = ipp_finishings; | |
2033 | } | |
2034 | else if (!strcmp(attrname, "job-collation-type") || | |
2035 | !strcmp(attrname, "job-collation-type-actual")) | |
2036 | { | |
2037 | num_strings = (int)(sizeof(ipp_job_collation_types) / | |
2038 | sizeof(ipp_job_collation_types[0])); | |
2039 | strings = ipp_job_collation_types; | |
2040 | } | |
2041 | else if (!strcmp(attrname, "job-state")) | |
2042 | { | |
2043 | num_strings = (int)(sizeof(ipp_job_states) / sizeof(ipp_job_states[0])); | |
2044 | strings = ipp_job_states; | |
2045 | } | |
2046 | else if (!strcmp(attrname, "operations-supported")) | |
2047 | return (ippOpValue(enumstring)); | |
2048 | else if (!strcmp(attrname, "orientation-requested") || | |
2049 | !strcmp(attrname, "orientation-requested-actual") || | |
2050 | !strcmp(attrname, "orientation-requested-default") || | |
2051 | !strcmp(attrname, "orientation-requested-supported")) | |
2052 | { | |
2053 | num_strings = (int)(sizeof(ipp_orientation_requesteds) / | |
2054 | sizeof(ipp_orientation_requesteds[0])); | |
2055 | strings = ipp_orientation_requesteds; | |
2056 | } | |
2057 | else if (!strcmp(attrname, "print-quality") || | |
2058 | !strcmp(attrname, "print-quality-actual") || | |
2059 | !strcmp(attrname, "print-quality-default") || | |
2060 | !strcmp(attrname, "print-quality-supported")) | |
2061 | { | |
2062 | num_strings = (int)(sizeof(ipp_print_qualities) / sizeof(ipp_print_qualities[0])); | |
2063 | strings = ipp_print_qualities; | |
2064 | } | |
2065 | else if (!strcmp(attrname, "printer-state")) | |
2066 | { | |
2067 | num_strings = (int)(sizeof(ipp_printer_states) / sizeof(ipp_printer_states[0])); | |
2068 | strings = ipp_printer_states; | |
2069 | } | |
2070 | else | |
2071 | return (-1); | |
2072 | ||
2073 | for (i = 0; i < num_strings; i ++) | |
2074 | if (!strcmp(enumstring, strings[i])) | |
2075 | return (i + 3); | |
2076 | ||
2077 | return (-1); | |
2078 | } | |
2079 | ||
2080 | ||
ef416fc2 | 2081 | /* |
2082 | * 'ippErrorString()' - Return a name for the given status code. | |
2083 | */ | |
2084 | ||
2085 | const char * /* O - Text string */ | |
2086 | ippErrorString(ipp_status_t error) /* I - Error status */ | |
2087 | { | |
2088 | _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */ | |
2089 | ||
2090 | ||
2091 | /* | |
2092 | * See if the error code is a known value... | |
2093 | */ | |
2094 | ||
a469f8a5 | 2095 | if (error >= IPP_STATUS_OK && error <= IPP_STATUS_OK_EVENTS_COMPLETE) |
ef416fc2 | 2096 | return (ipp_status_oks[error]); |
a469f8a5 | 2097 | else if (error == IPP_STATUS_REDIRECTION_OTHER_SITE) |
ef416fc2 | 2098 | return ("redirection-other-site"); |
a469f8a5 | 2099 | else if (error == IPP_STATUS_CUPS_SEE_OTHER) |
b94498cf | 2100 | return ("cups-see-other"); |
a469f8a5 | 2101 | else if (error >= IPP_STATUS_ERROR_BAD_REQUEST && |
6b13fa61 | 2102 | error <= IPP_STATUS_ERROR_ACCOUNT_AUTHORIZATION_FAILED) |
a469f8a5 MS |
2103 | return (ipp_status_400s[error - IPP_STATUS_ERROR_BAD_REQUEST]); |
2104 | else if (error >= 0x480 && | |
2105 | error <= IPP_STATUS_ERROR_CUPS_ACCOUNT_AUTHORIZATION_FAILED) | |
2106 | return (ipp_status_480s[error - 0x0480]); | |
2107 | else if (error >= IPP_STATUS_ERROR_INTERNAL && | |
2108 | error <= IPP_STATUS_ERROR_TOO_MANY_DOCUMENTS) | |
2109 | return (ipp_status_500s[error - IPP_STATUS_ERROR_INTERNAL]); | |
2110 | else if (error >= IPP_STATUS_ERROR_CUPS_AUTHENTICATION_CANCELED && | |
2111 | error <= IPP_STATUS_ERROR_CUPS_UPGRADE_REQUIRED) | |
2112 | return (ipp_status_1000s[error - | |
2113 | IPP_STATUS_ERROR_CUPS_AUTHENTICATION_CANCELED]); | |
ef416fc2 | 2114 | |
2115 | /* | |
d7225fc2 | 2116 | * No, build an "0xxxxx" error string... |
ef416fc2 | 2117 | */ |
2118 | ||
d7225fc2 | 2119 | sprintf(cg->ipp_unknown, "0x%04x", error); |
ef416fc2 | 2120 | |
2121 | return (cg->ipp_unknown); | |
2122 | } | |
2123 | ||
2124 | ||
2125 | /* | |
2126 | * 'ippErrorValue()' - Return a status code for the given name. | |
2127 | * | |
8072030b | 2128 | * @since CUPS 1.2/macOS 10.5@ |
ef416fc2 | 2129 | */ |
2130 | ||
2131 | ipp_status_t /* O - IPP status code */ | |
2132 | ippErrorValue(const char *name) /* I - Name */ | |
2133 | { | |
7e86f2f6 | 2134 | size_t i; /* Looping var */ |
ef416fc2 | 2135 | |
2136 | ||
2137 | for (i = 0; i < (sizeof(ipp_status_oks) / sizeof(ipp_status_oks[0])); i ++) | |
88f9aafc | 2138 | if (!_cups_strcasecmp(name, ipp_status_oks[i])) |
ef416fc2 | 2139 | return ((ipp_status_t)i); |
2140 | ||
88f9aafc | 2141 | if (!_cups_strcasecmp(name, "redirection-other-site")) |
a469f8a5 | 2142 | return (IPP_STATUS_REDIRECTION_OTHER_SITE); |
ef416fc2 | 2143 | |
88f9aafc | 2144 | if (!_cups_strcasecmp(name, "cups-see-other")) |
a469f8a5 | 2145 | return (IPP_STATUS_CUPS_SEE_OTHER); |
b94498cf | 2146 | |
ef416fc2 | 2147 | for (i = 0; i < (sizeof(ipp_status_400s) / sizeof(ipp_status_400s[0])); i ++) |
88f9aafc | 2148 | if (!_cups_strcasecmp(name, ipp_status_400s[i])) |
ef416fc2 | 2149 | return ((ipp_status_t)(i + 0x400)); |
2150 | ||
a469f8a5 MS |
2151 | for (i = 0; i < (sizeof(ipp_status_480s) / sizeof(ipp_status_480s[0])); i ++) |
2152 | if (!_cups_strcasecmp(name, ipp_status_480s[i])) | |
2153 | return ((ipp_status_t)(i + 0x480)); | |
2154 | ||
ef416fc2 | 2155 | for (i = 0; i < (sizeof(ipp_status_500s) / sizeof(ipp_status_500s[0])); i ++) |
88f9aafc | 2156 | if (!_cups_strcasecmp(name, ipp_status_500s[i])) |
ef416fc2 | 2157 | return ((ipp_status_t)(i + 0x500)); |
2158 | ||
7cf5915e | 2159 | for (i = 0; i < (sizeof(ipp_status_1000s) / sizeof(ipp_status_1000s[0])); i ++) |
88f9aafc | 2160 | if (!_cups_strcasecmp(name, ipp_status_1000s[i])) |
7cf5915e MS |
2161 | return ((ipp_status_t)(i + 0x1000)); |
2162 | ||
ef416fc2 | 2163 | return ((ipp_status_t)-1); |
2164 | } | |
2165 | ||
2166 | ||
2167 | /* | |
2168 | * 'ippOpString()' - Return a name for the given operation id. | |
2169 | * | |
8072030b | 2170 | * @since CUPS 1.2/macOS 10.5@ |
ef416fc2 | 2171 | */ |
2172 | ||
2173 | const char * /* O - Name */ | |
2174 | ippOpString(ipp_op_t op) /* I - Operation ID */ | |
2175 | { | |
2176 | _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */ | |
2177 | ||
2178 | ||
2179 | /* | |
2180 | * See if the operation ID is a known value... | |
2181 | */ | |
2182 | ||
4888dff9 | 2183 | if (op >= IPP_OP_PRINT_JOB && op < (ipp_op_t)(sizeof(ipp_std_ops) / sizeof(ipp_std_ops[0]))) |
ef416fc2 | 2184 | return (ipp_std_ops[op]); |
a469f8a5 | 2185 | else if (op == IPP_OP_PRIVATE) |
ef416fc2 | 2186 | return ("windows-ext"); |
a469f8a5 | 2187 | else if (op >= IPP_OP_CUPS_GET_DEFAULT && op <= IPP_OP_CUPS_GET_PPD) |
cb7f98ee | 2188 | return (ipp_cups_ops[op - IPP_OP_CUPS_GET_DEFAULT]); |
c585706d MS |
2189 | else if (op >= IPP_OP_CUPS_GET_DOCUMENT && op <= IPP_OP_CUPS_CREATE_LOCAL_PRINTER) |
2190 | return (ipp_cups_ops2[op - IPP_OP_CUPS_GET_DOCUMENT]); | |
ef416fc2 | 2191 | |
2192 | /* | |
d7225fc2 | 2193 | * No, build an "0xxxxx" operation string... |
ef416fc2 | 2194 | */ |
2195 | ||
9b66acc5 | 2196 | sprintf(cg->ipp_unknown, "0x%04x", op); |
ef416fc2 | 2197 | |
2198 | return (cg->ipp_unknown); | |
2199 | } | |
2200 | ||
2201 | ||
2202 | /* | |
2203 | * 'ippOpValue()' - Return an operation id for the given name. | |
2204 | * | |
8072030b | 2205 | * @since CUPS 1.2/macOS 10.5@ |
ef416fc2 | 2206 | */ |
2207 | ||
2208 | ipp_op_t /* O - Operation ID */ | |
2209 | ippOpValue(const char *name) /* I - Textual name */ | |
2210 | { | |
7e86f2f6 | 2211 | size_t i; /* Looping var */ |
ef416fc2 | 2212 | |
2213 | ||
9b66acc5 MS |
2214 | if (!strncmp(name, "0x", 2)) |
2215 | return ((ipp_op_t)strtol(name + 2, NULL, 16)); | |
2216 | ||
ef416fc2 | 2217 | for (i = 0; i < (sizeof(ipp_std_ops) / sizeof(ipp_std_ops[0])); i ++) |
88f9aafc | 2218 | if (!_cups_strcasecmp(name, ipp_std_ops[i])) |
ef416fc2 | 2219 | return ((ipp_op_t)i); |
2220 | ||
88f9aafc | 2221 | if (!_cups_strcasecmp(name, "windows-ext")) |
a469f8a5 | 2222 | return (IPP_OP_PRIVATE); |
ef416fc2 | 2223 | |
2224 | for (i = 0; i < (sizeof(ipp_cups_ops) / sizeof(ipp_cups_ops[0])); i ++) | |
88f9aafc | 2225 | if (!_cups_strcasecmp(name, ipp_cups_ops[i])) |
ef416fc2 | 2226 | return ((ipp_op_t)(i + 0x4001)); |
2227 | ||
2e4ff8af | 2228 | for (i = 0; i < (sizeof(ipp_cups_ops2) / sizeof(ipp_cups_ops2[0])); i ++) |
88f9aafc | 2229 | if (!_cups_strcasecmp(name, ipp_cups_ops2[i])) |
2e4ff8af MS |
2230 | return ((ipp_op_t)(i + 0x4027)); |
2231 | ||
42404685 MS |
2232 | if (!_cups_strcasecmp(name, "Create-Job-Subscription")) |
2233 | return (IPP_OP_CREATE_JOB_SUBSCRIPTIONS); | |
2234 | ||
2235 | if (!_cups_strcasecmp(name, "Create-Printer-Subscription")) | |
2236 | return (IPP_OP_CREATE_PRINTER_SUBSCRIPTIONS); | |
2237 | ||
88f9aafc | 2238 | if (!_cups_strcasecmp(name, "CUPS-Add-Class")) |
a469f8a5 | 2239 | return (IPP_OP_CUPS_ADD_MODIFY_CLASS); |
480ef0fe | 2240 | |
88f9aafc | 2241 | if (!_cups_strcasecmp(name, "CUPS-Add-Printer")) |
a469f8a5 | 2242 | return (IPP_OP_CUPS_ADD_MODIFY_PRINTER); |
480ef0fe | 2243 | |
a469f8a5 | 2244 | return (IPP_OP_CUPS_INVALID); |
ef416fc2 | 2245 | } |
2246 | ||
2247 | ||
2248 | /* | |
2249 | * 'ippPort()' - Return the default IPP port number. | |
2250 | */ | |
2251 | ||
2252 | int /* O - Port number */ | |
2253 | ippPort(void) | |
2254 | { | |
ef416fc2 | 2255 | _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */ |
2256 | ||
2257 | ||
d09495fa | 2258 | DEBUG_puts("ippPort()"); |
2259 | ||
2260 | if (!cg->ipp_port) | |
e07d4801 | 2261 | _cupsSetDefaults(); |
d09495fa | 2262 | |
e07d4801 | 2263 | DEBUG_printf(("1ippPort: Returning %d...", cg->ipp_port)); |
d09495fa | 2264 | |
ef416fc2 | 2265 | return (cg->ipp_port); |
2266 | } | |
2267 | ||
2268 | ||
2269 | /* | |
2270 | * 'ippSetPort()' - Set the default port number. | |
2271 | */ | |
2272 | ||
2273 | void | |
2274 | ippSetPort(int p) /* I - Port number to use */ | |
2275 | { | |
e07d4801 | 2276 | DEBUG_printf(("ippSetPort(p=%d)", p)); |
d09495fa | 2277 | |
ef416fc2 | 2278 | _cupsGlobals()->ipp_port = p; |
2279 | } | |
2280 | ||
2281 | ||
d21dc0ed MS |
2282 | /* |
2283 | * 'ippStateString()' - Return the name corresponding to a state value. | |
2284 | * | |
e1f19878 | 2285 | * @since CUPS 2.0/OS 10.10@ |
d21dc0ed MS |
2286 | */ |
2287 | ||
2288 | const char * /* O - State name */ | |
2289 | ippStateString(ipp_state_t state) /* I - State value */ | |
2290 | { | |
2291 | if (state >= IPP_STATE_ERROR && state <= IPP_STATE_DATA) | |
2292 | return (ipp_states[state - IPP_STATE_ERROR]); | |
2293 | else | |
2294 | return ("UNKNOWN"); | |
2295 | } | |
2296 | ||
2297 | ||
ef416fc2 | 2298 | /* |
1ff0402e MS |
2299 | * 'ippTagString()' - Return the tag name corresponding to a tag value. |
2300 | * | |
65bebeac | 2301 | * The returned names are defined in RFC 8011 and the IANA IPP Registry. |
1ff0402e | 2302 | * |
8072030b | 2303 | * @since CUPS 1.4/macOS 10.6@ |
1ff0402e MS |
2304 | */ |
2305 | ||
2306 | const char * /* O - Tag name */ | |
2307 | ippTagString(ipp_tag_t tag) /* I - Tag value */ | |
2308 | { | |
cb7f98ee | 2309 | tag &= IPP_TAG_CUPS_MASK; |
ed6e7faf | 2310 | |
1ff0402e MS |
2311 | if (tag < (ipp_tag_t)(sizeof(ipp_tag_names) / sizeof(ipp_tag_names[0]))) |
2312 | return (ipp_tag_names[tag]); | |
2313 | else | |
2314 | return ("UNKNOWN"); | |
2315 | } | |
2316 | ||
2317 | ||
2318 | /* | |
2319 | * 'ippTagValue()' - Return the tag value corresponding to a tag name. | |
2320 | * | |
65bebeac | 2321 | * The tag names are defined in RFC 8011 and the IANA IPP Registry. |
1ff0402e | 2322 | * |
8072030b | 2323 | * @since CUPS 1.4/macOS 10.6@ |
1ff0402e MS |
2324 | */ |
2325 | ||
2326 | ipp_tag_t /* O - Tag value */ | |
2327 | ippTagValue(const char *name) /* I - Tag name */ | |
2328 | { | |
7e86f2f6 | 2329 | size_t i; /* Looping var */ |
1ff0402e MS |
2330 | |
2331 | ||
2332 | for (i = 0; i < (sizeof(ipp_tag_names) / sizeof(ipp_tag_names[0])); i ++) | |
88f9aafc | 2333 | if (!_cups_strcasecmp(name, ipp_tag_names[i])) |
1ff0402e MS |
2334 | return ((ipp_tag_t)i); |
2335 | ||
88f9aafc | 2336 | if (!_cups_strcasecmp(name, "operation")) |
1ff0402e | 2337 | return (IPP_TAG_OPERATION); |
88f9aafc | 2338 | else if (!_cups_strcasecmp(name, "job")) |
1ff0402e | 2339 | return (IPP_TAG_JOB); |
88f9aafc | 2340 | else if (!_cups_strcasecmp(name, "printer")) |
1ff0402e | 2341 | return (IPP_TAG_PRINTER); |
88f9aafc | 2342 | else if (!_cups_strcasecmp(name, "unsupported")) |
5a6b583a | 2343 | return (IPP_TAG_UNSUPPORTED_GROUP); |
88f9aafc | 2344 | else if (!_cups_strcasecmp(name, "subscription")) |
1ff0402e | 2345 | return (IPP_TAG_SUBSCRIPTION); |
88f9aafc | 2346 | else if (!_cups_strcasecmp(name, "event")) |
5a6b583a | 2347 | return (IPP_TAG_EVENT_NOTIFICATION); |
88f9aafc | 2348 | else if (!_cups_strcasecmp(name, "language")) |
1ff0402e | 2349 | return (IPP_TAG_LANGUAGE); |
88f9aafc | 2350 | else if (!_cups_strcasecmp(name, "mimetype")) |
1ff0402e | 2351 | return (IPP_TAG_MIMETYPE); |
88f9aafc | 2352 | else if (!_cups_strcasecmp(name, "name")) |
1ff0402e | 2353 | return (IPP_TAG_NAME); |
88f9aafc | 2354 | else if (!_cups_strcasecmp(name, "text")) |
1ff0402e | 2355 | return (IPP_TAG_TEXT); |
88f9aafc | 2356 | else if (!_cups_strcasecmp(name, "begCollection")) |
5a6b583a | 2357 | return (IPP_TAG_BEGIN_COLLECTION); |
1ff0402e MS |
2358 | else |
2359 | return (IPP_TAG_ZERO); | |
2360 | } | |
2361 | ||
2362 | ||
2363 | /* | |
1106b00e MS |
2364 | * 'ipp_col_string()' - Convert a collection to a string. |
2365 | */ | |
2366 | ||
2367 | static size_t /* O - Number of bytes */ | |
2368 | ipp_col_string(ipp_t *col, /* I - Collection attribute */ | |
2369 | char *buffer, /* I - Buffer or NULL */ | |
2370 | size_t bufsize) /* I - Size of buffer */ | |
2371 | { | |
2372 | char *bufptr, /* Position in buffer */ | |
2373 | *bufend, /* End of buffer */ | |
9c80ffa2 | 2374 | prefix = '{', /* Prefix character */ |
1106b00e MS |
2375 | temp[256]; /* Temporary string */ |
2376 | ipp_attribute_t *attr; /* Current member attribute */ | |
2377 | ||
2378 | ||
2c69d462 MS |
2379 | if (!col) |
2380 | { | |
2381 | if (buffer) | |
2382 | *buffer = '\0'; | |
2383 | ||
2384 | return (0); | |
2385 | } | |
2386 | ||
1106b00e MS |
2387 | bufptr = buffer; |
2388 | bufend = buffer + bufsize - 1; | |
2389 | ||
1106b00e MS |
2390 | for (attr = col->attrs; attr; attr = attr->next) |
2391 | { | |
2392 | if (!attr->name) | |
2393 | continue; | |
2394 | ||
9c80ffa2 MS |
2395 | if (buffer && bufptr < bufend) |
2396 | *bufptr = prefix; | |
2397 | bufptr ++; | |
2398 | prefix = ' '; | |
2399 | ||
1106b00e | 2400 | if (buffer && bufptr < bufend) |
07623986 | 2401 | bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%s=", attr->name); |
1106b00e MS |
2402 | else |
2403 | bufptr += strlen(attr->name) + 1; | |
2404 | ||
2405 | if (buffer && bufptr < bufend) | |
7e86f2f6 | 2406 | bufptr += ippAttributeString(attr, bufptr, (size_t)(bufend - bufptr + 1)); |
1106b00e | 2407 | else |
a2326b5b | 2408 | bufptr += ippAttributeString(attr, temp, sizeof(temp)); |
1106b00e MS |
2409 | } |
2410 | ||
9c80ffa2 MS |
2411 | if (prefix == '{') |
2412 | { | |
2413 | if (buffer && bufptr < bufend) | |
2414 | *bufptr = prefix; | |
2415 | bufptr ++; | |
2416 | } | |
2417 | ||
1106b00e MS |
2418 | if (buffer && bufptr < bufend) |
2419 | *bufptr = '}'; | |
2420 | bufptr ++; | |
2421 | ||
7e86f2f6 | 2422 | return ((size_t)(bufptr - buffer)); |
1106b00e | 2423 | } |