xdr_stdio.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley
* 4.3 BSD under license from the Regents of the University of
* California.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* xdr_stdio.c, XDR implementation on standard i/o file.
*
* This set of routines implements a XDR on a stdio stream.
* XDR_ENCODE serializes onto the stream, XDR_DECODE de-serializes
* from the stream.
*/
#include "mt.h"
#include "rpc_mt.h"
#include <stdio.h>
#include <inttypes.h>
static struct xdr_ops *xdrstdio_ops(void);
/*
* Initialize a stdio xdr stream.
* Sets the xdr stream handle xdrs for use on the stream file.
* Operation flag is set to op.
*/
void
{
trace1(TR_xdrstdio_create, 0);
}
/*
* Destroy a stdio xdr stream.
* Cleans up the xdr stream handle xdrs previously set up by xdrstdio_create.
*/
static void
{
/* xx should we close the file ?? */
}
static bool_t
{
return (FALSE);
}
return (TRUE);
}
static bool_t
{
return (FALSE);
}
return (TRUE);
}
static bool_t
long *lp;
{
int32_t i;
if (!xdrstdio_getint32(xdrs, &i))
return (FALSE);
*lp = (long)i;
return (TRUE);
}
static bool_t
long *lp;
{
int32_t i;
#if defined(_LP64)
return (FALSE);
}
#endif
return (xdrstdio_putint32(xdrs, &i));
}
static bool_t
{
if ((len != 0) &&
return (FALSE);
}
return (TRUE);
}
static bool_t
{
if ((len != 0) &&
return (FALSE);
}
return (TRUE);
}
static uint_t
{
trace1(TR_xdrstdio_getpos, 0);
return (dummy1);
}
static bool_t
{
return (dummy2);
}
static rpc_inline_t *
{
/*
* Must do some work to implement this: must insure
* enough data in the underlying stdio buffer,
* that the buffer is aligned so that we can indirect through a
* long *, and stuff this pointer in xdrs->x_buf. Doing
* a fread or fwrite to a scratch buffer would defeat
* most of the gains to be had here and require storage
* management on this buffer, so we don't do this.
*/
return (NULL);
}
static bool_t
{
switch (request) {
default:
return (FALSE);
}
}
static struct xdr_ops *
{
/* VARIABLES PROTECTED BY ops_lock: ops */
trace1(TR_xdrstdio_ops, 0);
#if defined(_LP64)
#endif
}
return (&ops);
}