common.c revision 355b4669e025ff377602b6fc7caaf30dbc218371
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * CDDL HEADER START
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * The contents of this file are subject to the terms of the
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * Common Development and Distribution License (the "License").
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * You may not use this file except in compliance with the License.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * See the License for the specific language governing permissions
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * and limitations under the License.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * When distributing Covered Code, include this CDDL HEADER in each
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * If applicable, add the following below this CDDL HEADER, with the
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * fields enclosed by brackets "[]" replaced with your own identifying
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * information: Portions Copyright [yyyy] [name of copyright owner]
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * CDDL HEADER END
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * Use is subject to license terms.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs/* $Id: common.c 155 2006-04-26 02:34:54Z ktou $ */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#pragma ident "%Z%%M% %I% %E% SMI"
355b4669e025ff377602b6fc7caaf30dbc218371jacobsipp_svc_status_mesg(papi_service_t svc, papi_status_t status)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs snprintf(buf, sizeof (buf), "lpsched://localhost/printers/%s", result);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#endif /* FORCE_LPSCHED_URI */
355b4669e025ff377602b6fc7caaf30dbc218371jacobsget_printer_id(papi_attribute_t **attributes, char **printer, int *id)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs result = papiAttributeListGetString(attributes, NULL, "job-uri", &job);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs result = papiAttributeListGetString(attributes, NULL,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* move to the last component of the name */
355b4669e025ff377602b6fc7caaf30dbc218371jacobsget_string_list(papi_attribute_t **attributes, char *name, char ***values)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs for (result = papiAttributeListGetString(attributes, &iterator,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs result = papiAttributeListGetString(attributes, &iterator,
355b4669e025ff377602b6fc7caaf30dbc218371jacobsadd_default_attributes(papi_attribute_t ***attributes)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (void) papiAttributeListAddString(attributes, PAPI_ATTR_APPEND,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (void) papiAttributeListAddString(attributes, PAPI_ATTR_APPEND,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (void) papiAttributeListAddBoolean(attributes, PAPI_ATTR_EXCL,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs "multiple-document-jobs-supported", 0);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * Should be able to ask the web server if it supports SSL or TLS, but
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * for now, we pick only "none"
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (void) papiAttributeListAddString(attributes, PAPI_ATTR_EXCL,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * For now, we only "none". As we support more authentication methods,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * we will need to add the associated uri for each. Valid values would
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * "none", "requesting-user-name", "basic", "digest", "certificate"
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * See RFC2911 page 127 for more information.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (void) papiAttributeListAddString(attributes, PAPI_ATTR_EXCL,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs "uri-authentication-supported", "requesting-user-name");
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (void) papiAttributeListAddString(attributes, PAPI_ATTR_EXCL,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* printer-uri-supported is added in the service based attributes */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (void) papiAttributeListAddInteger(attributes, PAPI_ATTR_EXCL,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* I18N related */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (void) papiAttributeListAddString(attributes, PAPI_ATTR_EXCL,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (void) papiAttributeListAddString(attributes, PAPI_ATTR_EXCL,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (void) papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
355b4669e025ff377602b6fc7caaf30dbc218371jacobsmassage_printer_attributes_group(papi_attribute_t **group, char *printer_uri)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if (papiAttributeListFind(group, "printer-uri-supported") != NULL)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListAddString(&group, PAPI_ATTR_REPLACE,
355b4669e025ff377602b6fc7caaf30dbc218371jacobsmassage_job_attributes_group(papi_attribute_t **group, char *printer_uri)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if (papiAttributeListFind(group, "job-printer-uri") != NULL)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListAddString(&group, PAPI_ATTR_REPLACE,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if (papiAttributeListFind(group, "job-printer-uri") != NULL) {
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListGetInteger(group, NULL, "job-id", &id);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs snprintf(buf, sizeof (buf), "%s/%d", printer_uri, id);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListAddString(&group, PAPI_ATTR_REPLACE,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * This function will replace the job/printer URIs with the requested
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * uri because the print service may return a URI that isn't IPP based.
355b4669e025ff377602b6fc7caaf30dbc218371jacobsmassage_response(papi_attribute_t **request, papi_attribute_t **response)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (void) papiAttributeListGetString(request, NULL, "uri-host", &host);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (void) papiAttributeListGetString(request, NULL, "uri-path", &path);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (void) papiAttributeListGetInteger(request, NULL, "uri-port", &port);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs snprintf(buf, sizeof (buf), "ipp://%s%s", host, path);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs snprintf(buf, sizeof (buf), "http://%s:%d%s", host, port, path);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs for (status = papiAttributeListGetCollection(response, &iter,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs for (status = papiAttributeListGetCollection(response, &iter,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * This walks through the locale tab and returns the installed
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * locales. There must be a better way.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((fp = fopen("/usr/lib/locale/lcttab", "r")) != NULL) {
355b4669e025ff377602b6fc7caaf30dbc218371jacobs for (i = 0; ((passed == 1) && (name[i] != NULL)); i++)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs "generated-natural-language-supported",
355b4669e025ff377602b6fc7caaf30dbc218371jacobspapi_to_ipp_printer_group(papi_attribute_t ***response,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papi_attribute_t **request, int flags, papi_printer_t p)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs copy_attributes(&ipp_group, papiPrinterGetAttributeList(p));
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* Windows clients appear to have a problem with very large values */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListDelete(&ipp_group, "lpsched-printer-ppd-contents");
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (void) papiAttributeListAddCollection(response, flags,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs copy_attributes(&ipp_group, papiJobGetAttributeList(j));