4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 /* $Id: strings.c 151 2006-04-25 16:55:34Z njacobs $ */
30 #pragma ident "%Z%%M% %I% %E% SMI"
38 static char *tag_strings
[] = {
40 "reserved-delimiter-00",
41 "operational-attributes-group",
42 "job-attributes-group",
43 "end-of-attributes-group",
44 "printer-attributes-group",
45 "unsupported-attributes-group",
46 "subscription-attributes-group",
47 "event-notification-attributes-group",
48 "reserved-delimiter-08",
49 "reserved-delimiter-09",
50 "reserved-delimiter-0a",
51 "reserved-delimiter-0b",
52 "reserved-delimiter-0c",
53 "reserved-delimiter-0d",
54 "reserved-delimiter-0e",
55 "reserved-delimiter-0f",
61 "reserved-out-of-band-14",
65 "reserved-out-of-band-18",
66 "reserved-out-of-band-19",
67 "reserved-out-of-band-1a",
68 "reserved-out-of-band-1b",
69 "reserved-out-of-band-1c",
70 "reserved-out-of-band-1d",
71 "reserved-out-of-band-1e",
72 "reserved-out-of-band-1f",
77 "reserved-integer-type-24",
78 "reserved-integer-type-25",
79 "reserved-integer-type-26",
80 "reserved-integer-type-27",
81 "reserved-integer-type-28",
82 "reserved-integer-type-29",
83 "reserved-integer-type-2a",
84 "reserved-integer-type-2b",
85 "reserved-integer-type-2c",
86 "reserved-integer-type-2d",
87 "reserved-integer-type-2e",
88 "reserved-integer-type-2f",
97 "reserved-octetString-38",
98 "reserved-octetString-39",
99 "reserved-octetString-3a",
100 "reserved-octetString-3b",
101 "reserved-octetString-3c",
102 "reserved-octetString-3d",
103 "reserved-octetString-3e",
104 "reserved-octetString-3f",
106 "textWithoutLanguage",
107 "nameWithoutLanguage",
116 "reserved-charString-4b",
117 "reserved-charString-4c",
118 "reserved-charString-4d",
119 "reserved-charString-4e",
120 "reserved-charString-4f",
121 "reserved-charString-50",
122 "reserved-charString-51",
123 "reserved-charString-52",
124 "reserved-charString-53",
125 "reserved-charString-54",
126 "reserved-charString-55",
127 "reserved-charString-56",
128 "reserved-charString-57",
129 "reserved-charString-58",
130 "reserved-charString-59",
131 "reserved-charString-5a",
132 "reserved-charString-5b",
133 "reserved-charString-5c",
134 "reserved-charString-5d",
135 "reserved-charString-5e",
136 "reserved-charString-5f",
139 static char *opid_strings
[] = {
149 "Get-Job-Attributes",
151 "Get-Printer-Attributes",
159 "Set-Printer-Attributes",
160 "Set-Job-Attributes",
161 "Get-Printer-Supported-Values",
162 "Create-Printer-Subscription",
163 "Create-Job-Subscription",
164 "Get-Subscription-Attributes",
166 "Renew-Subscription",
167 "Cancel-Subscription",
169 "Send-Notifications",
170 "Get-Resource-Attributes-deleted",
171 "Get-Resource-Data-deleted",
172 "Get-Resources-deleted",
173 "Get-Print-Support-Files",
175 "Pause-Printer-After-Current-Job",
177 "Release-Held-New-Jobs",
178 "Deactivate-Printer",
184 "Cancel-Current-Job",
185 "Suspend-Current-Job",
188 "Schedule-Job-After",
192 static char *res_opid_strings
[] = {
197 "CUPS-Delete-Printer",
212 #define KNOWN_RESERVED_MIN 0x4000
213 #define KNOWN_RESERVED_MAX 0x4010
215 static char *ok_status_strings
[] = {
217 "successful-ok-ignored-or-substituted-attributes",
218 "successful-ok-conflicting-attributes",
219 "successful-ok-ignored-subscriptions",
220 "successful-ok-ignored-notifications",
221 "successful-ok-too-many-events",
222 "successful-ok-but-cancel-subscription"
225 static char *redir_status_strings
[] = {
226 "redirection-other-site"
229 static char *client_error_status_strings
[] = {
230 "client-error-bad-request",
231 "client-error-forbidden",
232 "client-error-not-authenticated",
233 "client-error-not-authorized",
234 "client-error-not-possible",
235 "client-error-timeout",
236 "client-error-not-found",
238 "client-error-request-entity-too-large",
239 "client-error-request-value-too-long",
240 "client-error-document-format-not-supported",
241 "client-error-attributes-or-values-not-supported",
242 "client-error-uri-scheme-not-supported",
243 "client-error-charset-not-supported",
244 "client-error-conflicting-attributes",
245 "client-error-compression-not-supported",
246 "client-error-compression-error",
247 "client-error-document-format-error",
248 "client-error-document-access-error",
249 "client-error-attributes-not-settable",
250 "client-error-ignored-all-subscriptions",
251 "client-error-too-many-subscriptions",
252 "client-error-ignored-all-notifications",
253 "client-error-print-support-file-not-found"
256 static char *server_error_status_strings
[] = {
257 "server-error-internal-error",
258 "server-error-operation-not-supported",
259 "server-error-service-unavailable",
260 "server-error-version-not-supported",
261 "server-error-device-error",
262 "server-error-temporary-error",
263 "server-error-not-accepting-jobs",
265 "server-error-job-canceled",
266 "server-error-multiple-document-jobs-not-supported",
267 "server-error-printer-is-deactivated"
271 ipp_tag_string(int8_t id
, char *ret
, size_t len
)
274 (void) strlcpy(ret
, tag_strings
[id
], len
);
275 else if (id
== VTAG_EXTEND
)
276 (void) strlcpy(ret
, "extension", len
);
278 (void) snprintf(ret
, len
, "bogus-0x%.2x", id
);
284 ipp_opid_string(int16_t id
, char *ret
, size_t len
)
286 if (id
< OPID_RESERVED_MIN
)
287 (void) strlcpy(ret
, opid_strings
[id
], len
);
288 else if (id
< OPID_RESERVED_VENDOR_MIN
)
289 (void) snprintf(ret
, len
, "reserved-0x%.4x", id
);
290 else if (id
<= KNOWN_RESERVED_MAX
)
292 res_opid_strings
[id
- KNOWN_RESERVED_MIN
], len
);
293 else /* if (id <= OPID_RESERVED_VENDOR_MAX) */
294 (void) snprintf(ret
, len
, "reserved-vendor-0x%.4x", id
);
300 ipp_string_opid(char *string
)
304 for (i
= 0; opid_strings
[i
] != NULL
; i
++)
305 if (strcasecmp(opid_strings
[i
], string
) == 0)
308 for (i
= 0; res_opid_strings
[i
] != NULL
; i
++)
309 if (strcasecmp(res_opid_strings
[i
], string
) == 0)
316 ipp_status_string(int16_t id
, char *ret
, size_t len
)
318 if (id
<= IPP_OK_MAX
)
319 (void) strlcpy(ret
, ok_status_strings
[id
], len
);
320 else if (id
>= IPP_REDIR_MIN
&& id
<= IPP_REDIR_MAX
)
322 redir_status_strings
[id
- IPP_REDIR_MIN
], len
);
323 else if (id
>= IPP_CERR_MIN
&& id
<= IPP_CERR_MAX
)
325 client_error_status_strings
[id
- IPP_CERR_MIN
], len
);
326 else if (id
>= IPP_SERR_MIN
&& id
<= IPP_SERR_MAX
)
328 server_error_status_strings
[id
- IPP_SERR_MIN
], len
);
330 (void) snprintf(ret
, len
, "bogus-0x%.4hx", id
);
338 * attribute template handling routines
340 char *job_template
[] = {
347 "multiple-document-handling",
349 "page-ranges-supported",
351 "printer-resoultion",
356 char *job_description
[] = {
357 "copies-default", "copies-supported",
358 "finishing-default", "finishing-supported",
359 "job-hold-until-default", "job-hold-until-supported",
360 "job-priority-default", "job-priority-supported",
361 "job-sheets-default", "job-sheets-supported",
362 "media-default", "media-supported",
363 "multiple-document-handling-default",
364 "multiple-document-handling-supported",
365 "number-up-default", "number-up-supported",
366 "page-ranges-supported",
367 "print-quality-default", "print-quality-supported",
368 "printer-resoultion-default", "printer-resoultion-supported",
369 "sides-default", "sides-supported",
373 char *printer_description
[] = {
374 "printer-uri-supported",
375 "uri-security-supported",
376 "uri-authentication-supported",
381 "printer-driver-installer",
382 "printer-make-and-model",
383 "printer-more-info-manufacturer",
385 "printer-state-reasons",
386 "printer-state-message",
387 "ipp-versions-supported",
388 "multiple-document-jobs-supported",
389 "charset-configured",
391 "natural-language-configured",
392 "generated-natural-language-supported",
393 "document-format-default",
394 "document-format-supported",
395 "printer-is-accepting-jobs",
397 "printer-message-from-operator",
399 "reference-uri-schemes-supported",
400 "pdl-override-supported",
402 "printer-current-time",
403 "multiple-operation-time-out",
404 "compression-supported",
405 "job-k-octets-supported",
406 "job-impressions-supported",
407 "job-media-sheets-supported",
409 "pages-per-minute-color",