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
223f6c28404c8d330c123e98936160b8da9a26b2jacobs * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * Use is subject to license terms.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs/* $Id: printer.c 146 2006-03-24 00:26:54Z njacobs $ */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#pragma ident "%Z%%M% %I% %E% SMI"
355b4669e025ff377602b6fc7caaf30dbc218371jacobs/*LINTLIBRARY*/
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * Enumeration of printers is not part of the IPP specification, so many
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * servers will probably not respond back with a list of printers, but
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * CUPS has implemented an extension to IPP to enumerate printers and
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * classes. the Apache/mod_ipp IPP listener module available in Solaris
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * implements this IPP extension, so CUPS and Solaris can provide this
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * to IPP clients.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#ifndef OPID_CUPS_GET_PRINTERS /* for servers that will enumerate */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#endif /* OPID_CUPS_GET_PRINTERS */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#ifndef OPID_CUPS_DELETE_PRINTER /* for servers that can delete */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#endif /* OPID_CUPS_DELETE_PRINTER */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#ifndef OPID_CUPS_GET_CLASSES /* for servers that will enumerate */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#endif /* OPID_CUPS_GET_CLASSES */
355b4669e025ff377602b6fc7caaf30dbc218371jacobspapiPrintersList(papi_service_t handle, char **requested_attrs,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* if we are already connected, use that connection. */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((result = service_connect(svc, DEFAULT_DEST)) != PAPI_OK)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs ipp_initialize_request(svc, &request, OPID_CUPS_GET_PRINTERS);
223f6c28404c8d330c123e98936160b8da9a26b2jacobs ipp_initialize_operational_attributes(svc, &op, NULL, -1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs for (status = papiAttributeListGetCollection(response, &iter,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs status = papiAttributeListGetCollection(response, &iter,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((svc == NULL) || (name == NULL) || (printer == NULL))
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* if we are already connected, use that connection. */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((result = service_connect(svc, name)) != PAPI_OK)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs ipp_initialize_request(svc, &request, OPID_GET_PRINTER_ATTRIBUTES);
223f6c28404c8d330c123e98936160b8da9a26b2jacobs ipp_initialize_operational_attributes(svc, &op, name, -1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs_printer_enable_disable_pause_resume_delete(papi_service_t handle, char *name,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* if we are already connected, use that connection. */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((result = service_connect(svc, name)) != PAPI_OK)
223f6c28404c8d330c123e98936160b8da9a26b2jacobs ipp_initialize_operational_attributes(svc, &op, name, -1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs default: /* a message value is of no use */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (_printer_enable_disable_pause_resume_delete(handle, name,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (_printer_enable_disable_pause_resume_delete(handle, name,
355b4669e025ff377602b6fc7caaf30dbc218371jacobspapiPrinterPause(papi_service_t handle, char *name, char *message)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (_printer_enable_disable_pause_resume_delete(handle, name,
355b4669e025ff377602b6fc7caaf30dbc218371jacobspapiPrinterDisable(papi_service_t handle, char *name, char *message)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (_printer_enable_disable_pause_resume_delete(handle, name,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * there is no IPP create operation, the set-printer-attibutes operation
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * is the closest we have, so we will assume that the server will create
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * a printer and set attributes if there is none.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papi_attribute_t **attributes, papi_printer_t *printer)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (papiPrinterModify(handle, name, attributes, printer));
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papi_attribute_t **attributes, papi_printer_t *printer)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((svc == NULL) || (name == NULL) || (printer == NULL))
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* if we are already connected, use that connection. */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((result = service_connect(svc, name)) != PAPI_OK)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs ipp_initialize_request(svc, &request, OPID_SET_PRINTER_ATTRIBUTES);
223f6c28404c8d330c123e98936160b8da9a26b2jacobs ipp_initialize_operational_attributes(svc, &op, name, -1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (_printer_enable_disable_pause_resume_delete(handle, name,
355b4669e025ff377602b6fc7caaf30dbc218371jacobspapiPrinterPurgeJobs(papi_service_t handle, char *name,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* if we are already connected, use that connection. */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((result = service_connect(svc, name)) != PAPI_OK)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs ipp_initialize_request(svc, &request, OPID_PURGE_JOBS);
223f6c28404c8d330c123e98936160b8da9a26b2jacobs ipp_initialize_operational_attributes(svc, &op, name, -1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs for (status = papiAttributeListGetCollection(response, &iter,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs status = papiAttributeListGetCollection(response, &iter,
355b4669e025ff377602b6fc7caaf30dbc218371jacobspapiPrinterListJobs(papi_service_t handle, char *name,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* if we are already connected, use that connection. */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((result = service_connect(svc, name)) != PAPI_OK)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs ipp_initialize_request(svc, &request, OPID_GET_JOBS);
223f6c28404c8d330c123e98936160b8da9a26b2jacobs ipp_initialize_operational_attributes(svc, &op, name, -1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs for (status = papiAttributeListGetCollection(response, &iter,