service.c revision a18dc42fc967d11feba9b8be61c6727dc6c56b48
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
*/
/* $Id: service.c 172 2006-05-24 20:54:00Z njacobs $ */
#pragma ident "%Z%%M% %I% %E% SMI"
/*LINTLIBRARY*/
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <alloca.h>
#include <libintl.h>
#include <papi_impl.h>
#include <config-site.h>
static int
{
int result = -1;
return (result);
}
static char *
default_service_uri(char *fallback)
{
char *cups;
}
}
return (result);
}
static char *
{
}
return (result);
}
static papi_status_t
{
char *scheme = default_print_service();
return (PAPI_OK);
return (PAPI_OK);
/* Lookup the printer in the configuration DB */
/* Printer found (or was a URI), use the attribute data */
"printer-uri-supported", &tmp);
/* parse the URI and set the scheme(print service) */
/* override the scheme if it was in the attributes */
"print-service-module", &scheme);
} else /* not found, assume it is the actual print service name */
switch (result) {
case PAPI_OK:
break; /* no error */
case PAPI_URI_SCHEME:
#ifdef DEBUG
#endif
break;
default: /* set the detailed message */
}
return (result);
}
static papi_status_t
{
papi_status_t (*f)();
if (f != NULL)
}
return (result);
}
{
/* if there is no print service module loaded, try and load one. */
/*
* the print service module is loaded, but we don't have a service
* handle.
*/
papi_status_t (*f)();
return (PAPI_OK);
if (f != NULL) {
/* if no API user, try the URI user */
/* if no API password, try the URI password */
: NULL),
(void) service_send_peer(svc);
}
}
return (result);
}
char *password,
{
return (PAPI_BAD_ARGUMENT);
return (PAPI_TEMPORARY_ERROR);
/* If not specified, get a "default" service from the environment */
if (service_name == NULL)
if (service_name != NULL) {
/* if the psm loaded and the svc contains a URI, connect */
} else
return (result);
}
void
{
void (*f)();
"papiServiceDestroy");
f(svc->svc_handle);
}
}
}
}
{
} else
return (result);
}
{
papi_status_t (*f)();
if (f != NULL)
} else
return (result);
}
{
papi_status_t (*f)();
if (f != NULL)
} else
return (result);
}
{
papi_status_t (*f)();
"papiServiceSetEncryption");
if (f != NULL)
} else
return (result);
}
{
papi_status_t (*f)();
if (f != NULL)
} else
return (result);
}
{
papi_status_t (*f)();
} else
return (result);
}
char *
{
char *(*f)();
if (f != NULL)
}
return (result);
}
char *
{
char *(*f)();
if (f != NULL)
}
return (result);
}
char *
{
char *(*f)();
if (f != NULL)
}
return (result);
}
{
papi_encryption_t (*f)();
"papiServiceGetEncryption");
if (f != NULL)
if (result == PAPI_ENCRYPT_NEVER)
}
return (result);
}
void *
{
return (result);
}
{
papi_attribute_t **(*f)();
return (NULL);
}
"papiServiceGetAttributeList");
if (f != NULL)
} else
return (result);
}
char *
{
char *(*f)();
if (f != NULL)
}
"detailed-status-message", &result);
}
return (result);
}
void
{
/*
* fill in the message. If the buffer is too small, allocate
* one that is large enough and fill it in.
*/
"detailed-status-message", message);
#ifdef DEBUG
#endif
}
}