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: write.c 146 2006-03-24 00:26:54Z njacobs $ */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#pragma ident "%Z%%M% %I% %E% SMI"
355b4669e025ff377602b6fc7caaf30dbc218371jacobspapi_attribute_to_ipp_type(papi_attribute_value_type_t type)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (0);
355b4669e025ff377602b6fc7caaf30dbc218371jacobspapi_ipp_type_match(papi_attribute_value_type_t papi, int8_t ipp)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* don't need to match */
355b4669e025ff377602b6fc7caaf30dbc218371jacobsipp_write_attribute(ipp_writer_t iwrite, void *fd, papi_attribute_t *attribute)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* The types don't match, so don't send the attribute */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((status = papi_ipp_type_match(attribute->type, type)) != PAPI_OK)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if (v != NULL) {
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * if the length is more than 16 bits can
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * express, send what can be represented
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * in 16 bits. IPP "strings" can only be
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * that large.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs int32_t min = (int32_t)htonl((int)(value->range).lower),
355b4669e025ff377602b6fc7caaf30dbc218371jacobs c = /* v->deciseconds */ 0;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs c = /* v->utc_dir */ 0;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs c = /* v->utc_hours */ 0;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs c = /* v->utc_minutes */ 0;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * If there is a value, it is not one of our
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * types, so we couldn't use it anyway. We assume
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * that it was an OOB type with no value
355b4669e025ff377602b6fc7caaf30dbc218371jacobsipp_write_attribute_group(ipp_writer_t iwrite, void *fd, int8_t type,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* write group tag */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* write values */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs for (i = 0; ((attributes[i] != NULL) && (result == PAPI_OK)); i++)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs result = ipp_write_attribute(iwrite, fd, attributes[i]);
355b4669e025ff377602b6fc7caaf30dbc218371jacobsipp_write_attribute_groups(ipp_writer_t iwrite, void *fd,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs for (status = papiAttributeListGetCollection(groups, &iter,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs status = papiAttributeListGetCollection(groups, &iter,
355b4669e025ff377602b6fc7caaf30dbc218371jacobsipp_write_message_header(ipp_writer_t iwrite, void *fd,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* write the version */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListGetInteger(message, NULL, "version-major", &tmp);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListGetInteger(message, NULL, "version-minor", &tmp);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* write the request/status code */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListGetInteger(message, NULL, "status-code", &tmp);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListGetInteger(message, NULL, "operation-id", &tmp);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* write the request id */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiAttributeListGetInteger(message, NULL, "request-id", &tmp);
355b4669e025ff377602b6fc7caaf30dbc218371jacobsipp_write_message(ipp_writer_t iwrite, void *fd, papi_attribute_t **message)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((iwrite == NULL) || (fd == NULL) || (message == NULL))
355b4669e025ff377602b6fc7caaf30dbc218371jacobs result = ipp_write_message_header(iwrite, fd, message);