/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
*/
/* $Id: write.c 146 2006-03-24 00:26:54Z njacobs $ */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <papi.h>
#include <ipp.h>
static int8_t
{
switch (type) {
case PAPI_INTEGER:
return (VTAG_INTEGER);
case PAPI_BOOLEAN:
return (VTAG_BOOLEAN);
case PAPI_RANGE:
return (VTAG_RANGE_OF_INTEGER);
case PAPI_RESOLUTION:
return (VTAG_RESOLUTION);
case PAPI_DATETIME:
return (VTAG_DATE_TIME);
case PAPI_STRING:
return (VTAG_TEXT_WITHOUT_LANGUAGE);
}
return (0);
}
static papi_status_t
{
switch (papi) {
case PAPI_STRING:
switch (ipp) {
case VTAG_URI:
case VTAG_OCTET_STRING:
case VTAG_URI_SCHEME:
case VTAG_CHARSET:
case VTAG_NATURAL_LANGUAGE:
case VTAG_MIME_MEDIA_TYPE:
case VTAG_KEYWORD:
break;
default:
return (PAPI_CONFLICT);
}
break;
case PAPI_INTEGER:
switch (ipp) {
case VTAG_ENUM:
case VTAG_INTEGER:
break;
default:
return (PAPI_CONFLICT);
}
break;
case PAPI_BOOLEAN:
if (ipp != VTAG_BOOLEAN)
return (PAPI_CONFLICT);
break;
case PAPI_RANGE:
if (ipp != VTAG_RANGE_OF_INTEGER)
return (PAPI_CONFLICT);
break;
case PAPI_RESOLUTION:
if (ipp != VTAG_RESOLUTION)
return (PAPI_CONFLICT);
break;
case PAPI_DATETIME:
if (ipp != VTAG_DATE_TIME)
return (PAPI_CONFLICT);
break;
case PAPI_COLLECTION:
/* don't need to match */
break;
}
return (PAPI_OK);
}
static papi_status_t
{
int i;
char *name;
/* The types don't match, so don't send the attribute */
return (status);
return (PAPI_DEVICE_ERROR);
return (PAPI_DEVICE_ERROR);
return (PAPI_DEVICE_ERROR);
}
return (PAPI_DEVICE_ERROR);
return (PAPI_OK);
}
return (PAPI_DEVICE_ERROR);
return (PAPI_DEVICE_ERROR);
return (PAPI_DEVICE_ERROR);
} else {
return (PAPI_DEVICE_ERROR);
}
case PAPI_STRING: {
if (v != NULL) {
/*
* if the length is more than 16 bits can
* express, send what can be represented
* in 16 bits. IPP "strings" can only be
* that large.
*/
if (str_length > 0xFFFF)
str_length = 0xFFFF;
return (PAPI_DEVICE_ERROR);
return (PAPI_DEVICE_ERROR);
} else
return (PAPI_DEVICE_ERROR);
}
break;
case PAPI_BOOLEAN: {
return (PAPI_DEVICE_ERROR);
return (PAPI_DEVICE_ERROR);
}
break;
case PAPI_INTEGER: {
return (PAPI_DEVICE_ERROR);
return (PAPI_DEVICE_ERROR);
}
break;
case PAPI_RANGE: {
return (PAPI_DEVICE_ERROR);
return (PAPI_DEVICE_ERROR);
return (PAPI_DEVICE_ERROR);
}
break;
case PAPI_RESOLUTION: {
return (PAPI_DEVICE_ERROR);
return (PAPI_DEVICE_ERROR);
return (PAPI_DEVICE_ERROR);
return (PAPI_DEVICE_ERROR);
}
break;
case PAPI_DATETIME: {
int8_t c;
uint16_t s;
return (PAPI_DEVICE_ERROR);
return (PAPI_DEVICE_ERROR);
c = v->tm_mon + 1;
return (PAPI_DEVICE_ERROR);
c = v->tm_mday;
return (PAPI_DEVICE_ERROR);
c = v->tm_hour;
return (PAPI_DEVICE_ERROR);
c = v->tm_min;
return (PAPI_DEVICE_ERROR);
c = v->tm_sec;
return (PAPI_DEVICE_ERROR);
c = /* v->deciseconds */ 0;
return (PAPI_DEVICE_ERROR);
c = /* v->utc_dir */ 0;
return (PAPI_DEVICE_ERROR);
c = /* v->utc_hours */ 0;
return (PAPI_DEVICE_ERROR);
c = /* v->utc_minutes */ 0;
return (PAPI_DEVICE_ERROR);
}
break;
default: {
/*
* If there is a value, it is not one of our
* types, so we couldn't use it anyway. We assume
* that it was an OOB type with no value
*/
return (PAPI_DEVICE_ERROR);
}
break;
}
}
return (PAPI_OK);
}
static papi_status_t
{
int i;
/* write group tag */
return (PAPI_DEVICE_ERROR);
/* write values */
return (result);
}
static papi_status_t
{
int8_t c;
c, group);
}
return (result);
}
static papi_status_t
{
int tmp;
int8_t c;
uint16_t s;
int32_t i;
/* write the version */
c = tmp;
return (PAPI_DEVICE_ERROR);
c = tmp;
return (PAPI_DEVICE_ERROR);
return (PAPI_DEVICE_ERROR);
/* write the request id */
return (PAPI_DEVICE_ERROR);
return (PAPI_OK);
}
{
return (PAPI_BAD_ARGUMENT);
return (result);
}