mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-03 10:29:15 +00:00
Now update the XDR library.
Reviewed by: Mark Murray
This commit is contained in:
parent
47593e96db
commit
7d0a5a3919
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/cvs2svn/branches/WPAUL/dist/; revision=26216
@ -1,11 +1,43 @@
|
|||||||
# @(#)Makefile 5.11 (Berkeley) 9/6/90
|
# @(#)Makefile 5.11 (Berkeley) 9/6/90
|
||||||
|
|
||||||
.PATH: ${.CURDIR}/rpc ${.CURDIR}/.
|
.PATH: ${.CURDIR}/../libc/xdr ${.CURDIR}/.
|
||||||
CFLAGS+=-I${.CURDIR} -I${.CURDIR}/rpc
|
SRCS+= xdr.c xdr_array.c xdr_float.c xdr_mem.c \
|
||||||
SRCS= xdr.c xdr_array.c xdr_mem.c \
|
xdr_rec.c xdr_reference.c xdr_stdio.c xdr_sizeof.c
|
||||||
xdr_rec.c xdr_reference.c xdr_stdio.c
|
|
||||||
|
|
||||||
MAN3= xdr/xdr.3
|
# Only build man pages with libc.
|
||||||
|
.if ${LIB} == "c"
|
||||||
UNSUPPORTED+= xdr_float.c
|
MAN3+= xdr/xdr.3
|
||||||
|
|
||||||
|
MLINKS+= xdr.3 xdr_array.3 \
|
||||||
|
xdr.3 xdr_bool.3 \
|
||||||
|
xdr.3 xdr_bytes.3 \
|
||||||
|
xdr.3 xdr_char.3 \
|
||||||
|
xdr.3 xdr_destroy.3 \
|
||||||
|
xdr.3 xdr_double.3 \
|
||||||
|
xdr.3 xdr_enum.3 \
|
||||||
|
xdr.3 xdr_float.3 \
|
||||||
|
xdr.3 xdr_free.3 \
|
||||||
|
xdr.3 xdr_getpos.3 \
|
||||||
|
xdr.3 xdr_inline.3 \
|
||||||
|
xdr.3 xdr_int.3 \
|
||||||
|
xdr.3 xdr_long.3 \
|
||||||
|
xdr.3 xdrmem_create.3 \
|
||||||
|
xdr.3 xdr_opaque.3 \
|
||||||
|
xdr.3 xdr_pointer.3 \
|
||||||
|
xdr.3 xdrrec_create.3 \
|
||||||
|
xdr.3 xdrrec_endofrecord.3 \
|
||||||
|
xdr.3 xdrrec_eof.3 \
|
||||||
|
xdr.3 xdrrec_skiprecord.3 \
|
||||||
|
xdr.3 xdr_reference.3 \
|
||||||
|
xdr.3 xdr_setpos.3 \
|
||||||
|
xdr.3 xdr_short.3 \
|
||||||
|
xdr.3 xdrstdio_create.3 \
|
||||||
|
xdr.3 xdr_string.3 \
|
||||||
|
xdr.3 xdr_u_char.3 \
|
||||||
|
xdr.3 xdr_u_long.3 \
|
||||||
|
xdr.3 xdr_u_short.3 \
|
||||||
|
xdr.3 xdr_union.3 \
|
||||||
|
xdr.3 xdr_vector.3 \
|
||||||
|
xdr.3 xdr_void.3 \
|
||||||
|
xdr.3 xdr_wrapstring.3
|
||||||
|
.endif
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
.\" @(#)xdr.3n 2.2 88/08/03 4.0 RPCSRC; from 1.16 88/03/14 SMI
|
.\" @(#)xdr.3n 2.2 88/08/03 4.0 RPCSRC; from 1.16 88/03/14 SMI
|
||||||
.TH XDR 3N "16 February 1988"
|
.\" $Id: xdr.3,v 1.3 1996/10/05 22:26:44 wosch Exp $
|
||||||
|
.\"
|
||||||
|
.TH XDR 3 "16 February 1988"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
xdr \- library routines for external data representation
|
xdr \- library routines for external data representation
|
||||||
.SH SYNOPSIS AND DESCRIPTION
|
.SH SYNOPSIS AND DESCRIPTION
|
||||||
@ -753,7 +755,7 @@ parameter
|
|||||||
.I arrp
|
.I arrp
|
||||||
is the address of the pointer to the array, while
|
is the address of the pointer to the array, while
|
||||||
.I size
|
.I size
|
||||||
is is the element count of the array. The parameter
|
is the element count of the array. The parameter
|
||||||
.I elsize
|
.I elsize
|
||||||
is the
|
is the
|
||||||
.I sizeof
|
.I sizeof
|
||||||
@ -808,7 +810,7 @@ routines as parameters, and
|
|||||||
one of the most frequently used primitives, requires three.
|
one of the most frequently used primitives, requires three.
|
||||||
Returns one if it succeeds, zero otherwise.
|
Returns one if it succeeds, zero otherwise.
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR rpc (3N)
|
.BR rpc (3)
|
||||||
.LP
|
.LP
|
||||||
The following manuals:
|
The following manuals:
|
||||||
.RS
|
.RS
|
||||||
|
@ -5,23 +5,23 @@
|
|||||||
* may copy or modify Sun RPC without charge, but are not authorized
|
* may copy or modify Sun RPC without charge, but are not authorized
|
||||||
* to license or distribute it to anyone else except as part of a product or
|
* to license or distribute it to anyone else except as part of a product or
|
||||||
* program developed by the user.
|
* program developed by the user.
|
||||||
*
|
*
|
||||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||||
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||||
*
|
*
|
||||||
* Sun RPC is provided with no support and without any obligation on the
|
* Sun RPC is provided with no support and without any obligation on the
|
||||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||||
* modification or enhancement.
|
* modification or enhancement.
|
||||||
*
|
*
|
||||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||||
* OR ANY PART THEREOF.
|
* OR ANY PART THEREOF.
|
||||||
*
|
*
|
||||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||||
* or profits or other special, indirect and consequential damages, even if
|
* or profits or other special, indirect and consequential damages, even if
|
||||||
* Sun has been advised of the possibility of such damages.
|
* Sun has been advised of the possibility of such damages.
|
||||||
*
|
*
|
||||||
* Sun Microsystems, Inc.
|
* Sun Microsystems, Inc.
|
||||||
* 2550 Garcia Avenue
|
* 2550 Garcia Avenue
|
||||||
* Mountain View, California 94043
|
* Mountain View, California 94043
|
||||||
@ -30,7 +30,7 @@
|
|||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
/*static char *sccsid = "from: @(#)xdr.c 1.35 87/08/12";*/
|
/*static char *sccsid = "from: @(#)xdr.c 1.35 87/08/12";*/
|
||||||
/*static char *sccsid = "from: @(#)xdr.c 2.1 88/07/29 4.0 RPCSRC";*/
|
/*static char *sccsid = "from: @(#)xdr.c 2.1 88/07/29 4.0 RPCSRC";*/
|
||||||
static char *rcsid = "$Id: xdr.c,v 1.1 1993/10/27 05:41:06 paul Exp $";
|
static char *rcsid = "$Id: xdr.c,v 1.4 1996/12/30 14:07:07 peter Exp $";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -44,6 +44,8 @@ static char *rcsid = "$Id: xdr.c,v 1.1 1993/10/27 05:41:06 paul Exp $";
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <rpc/types.h>
|
#include <rpc/types.h>
|
||||||
#include <rpc/xdr.h>
|
#include <rpc/xdr.h>
|
||||||
@ -70,7 +72,7 @@ xdr_free(proc, objp)
|
|||||||
char *objp;
|
char *objp;
|
||||||
{
|
{
|
||||||
XDR x;
|
XDR x;
|
||||||
|
|
||||||
x.x_op = XDR_FREE;
|
x.x_op = XDR_FREE;
|
||||||
(*proc)(&x, objp);
|
(*proc)(&x, objp);
|
||||||
}
|
}
|
||||||
@ -87,6 +89,7 @@ xdr_void(/* xdrs, addr */)
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XDR integers
|
* XDR integers
|
||||||
*/
|
*/
|
||||||
@ -95,17 +98,25 @@ xdr_int(xdrs, ip)
|
|||||||
XDR *xdrs;
|
XDR *xdrs;
|
||||||
int *ip;
|
int *ip;
|
||||||
{
|
{
|
||||||
|
long l;
|
||||||
|
|
||||||
#ifdef lint
|
switch (xdrs->x_op) {
|
||||||
(void) (xdr_short(xdrs, (short *)ip));
|
|
||||||
return (xdr_long(xdrs, (long *)ip));
|
case XDR_ENCODE:
|
||||||
#else
|
l = (long) *ip;
|
||||||
if (sizeof (int) == sizeof (long)) {
|
return (XDR_PUTLONG(xdrs, &l));
|
||||||
return (xdr_long(xdrs, (long *)ip));
|
|
||||||
} else {
|
case XDR_DECODE:
|
||||||
return (xdr_short(xdrs, (short *)ip));
|
if (!XDR_GETLONG(xdrs, &l)) {
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
*ip = (int) l;
|
||||||
|
return (TRUE);
|
||||||
|
|
||||||
|
case XDR_FREE:
|
||||||
|
return (TRUE);
|
||||||
}
|
}
|
||||||
#endif
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -116,19 +127,28 @@ xdr_u_int(xdrs, up)
|
|||||||
XDR *xdrs;
|
XDR *xdrs;
|
||||||
u_int *up;
|
u_int *up;
|
||||||
{
|
{
|
||||||
|
u_long l;
|
||||||
|
|
||||||
#ifdef lint
|
switch (xdrs->x_op) {
|
||||||
(void) (xdr_short(xdrs, (short *)up));
|
|
||||||
return (xdr_u_long(xdrs, (u_long *)up));
|
case XDR_ENCODE:
|
||||||
#else
|
l = (u_long) *up;
|
||||||
if (sizeof (u_int) == sizeof (u_long)) {
|
return (XDR_PUTLONG(xdrs, (long *)&l));
|
||||||
return (xdr_u_long(xdrs, (u_long *)up));
|
|
||||||
} else {
|
case XDR_DECODE:
|
||||||
return (xdr_short(xdrs, (short *)up));
|
if (!XDR_GETLONG(xdrs, (long *)&l)) {
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
*up = (u_int) l;
|
||||||
|
return (TRUE);
|
||||||
|
|
||||||
|
case XDR_FREE:
|
||||||
|
return (TRUE);
|
||||||
}
|
}
|
||||||
#endif
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XDR long integers
|
* XDR long integers
|
||||||
* same as xdr_u_long - open coded to save a proc call!
|
* same as xdr_u_long - open coded to save a proc call!
|
||||||
@ -138,15 +158,14 @@ xdr_long(xdrs, lp)
|
|||||||
register XDR *xdrs;
|
register XDR *xdrs;
|
||||||
long *lp;
|
long *lp;
|
||||||
{
|
{
|
||||||
|
switch (xdrs->x_op) {
|
||||||
if (xdrs->x_op == XDR_ENCODE)
|
case XDR_ENCODE:
|
||||||
return (XDR_PUTLONG(xdrs, lp));
|
return (XDR_PUTLONG(xdrs, lp));
|
||||||
|
case XDR_DECODE:
|
||||||
if (xdrs->x_op == XDR_DECODE)
|
|
||||||
return (XDR_GETLONG(xdrs, lp));
|
return (XDR_GETLONG(xdrs, lp));
|
||||||
|
case XDR_FREE:
|
||||||
if (xdrs->x_op == XDR_FREE)
|
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
@ -160,16 +179,79 @@ xdr_u_long(xdrs, ulp)
|
|||||||
register XDR *xdrs;
|
register XDR *xdrs;
|
||||||
u_long *ulp;
|
u_long *ulp;
|
||||||
{
|
{
|
||||||
|
switch (xdrs->x_op) {
|
||||||
if (xdrs->x_op == XDR_DECODE)
|
case XDR_ENCODE:
|
||||||
return (XDR_GETLONG(xdrs, (long *)ulp));
|
|
||||||
if (xdrs->x_op == XDR_ENCODE)
|
|
||||||
return (XDR_PUTLONG(xdrs, (long *)ulp));
|
return (XDR_PUTLONG(xdrs, (long *)ulp));
|
||||||
if (xdrs->x_op == XDR_FREE)
|
case XDR_DECODE:
|
||||||
|
return (XDR_GETLONG(xdrs, (long *)ulp));
|
||||||
|
case XDR_FREE:
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
|
}
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XDR 32-bit integers
|
||||||
|
* same as xdr_u_int32_t - open coded to save a proc call!
|
||||||
|
*/
|
||||||
|
bool_t
|
||||||
|
xdr_int32_t(xdrs, int32_p)
|
||||||
|
register XDR *xdrs;
|
||||||
|
int32_t *int32_p;
|
||||||
|
{
|
||||||
|
long l;
|
||||||
|
|
||||||
|
switch (xdrs->x_op) {
|
||||||
|
|
||||||
|
case XDR_ENCODE:
|
||||||
|
l = (long) *int32_p;
|
||||||
|
return (XDR_PUTLONG(xdrs, &l));
|
||||||
|
|
||||||
|
case XDR_DECODE:
|
||||||
|
if (!XDR_GETLONG(xdrs, &l)) {
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
*int32_p = (int32_t) l;
|
||||||
|
return (TRUE);
|
||||||
|
|
||||||
|
case XDR_FREE:
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XDR unsigned 32-bit integers
|
||||||
|
* same as xdr_int32_t - open coded to save a proc call!
|
||||||
|
*/
|
||||||
|
bool_t
|
||||||
|
xdr_u_int32_t(xdrs, u_int32_p)
|
||||||
|
register XDR *xdrs;
|
||||||
|
u_int32_t *u_int32_p;
|
||||||
|
{
|
||||||
|
u_long l;
|
||||||
|
|
||||||
|
switch (xdrs->x_op) {
|
||||||
|
|
||||||
|
case XDR_ENCODE:
|
||||||
|
l = (u_long) *u_int32_p;
|
||||||
|
return (XDR_PUTLONG(xdrs, (long *)&l));
|
||||||
|
|
||||||
|
case XDR_DECODE:
|
||||||
|
if (!XDR_GETLONG(xdrs, (long *)&l)) {
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
*u_int32_p = (u_int32_t) l;
|
||||||
|
return (TRUE);
|
||||||
|
|
||||||
|
case XDR_FREE:
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XDR short integers
|
* XDR short integers
|
||||||
*/
|
*/
|
||||||
@ -213,13 +295,72 @@ xdr_u_short(xdrs, usp)
|
|||||||
|
|
||||||
case XDR_ENCODE:
|
case XDR_ENCODE:
|
||||||
l = (u_long) *usp;
|
l = (u_long) *usp;
|
||||||
|
return (XDR_PUTLONG(xdrs, (long *)&l));
|
||||||
|
|
||||||
|
case XDR_DECODE:
|
||||||
|
if (!XDR_GETLONG(xdrs, (long *)&l)) {
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
*usp = (u_short) l;
|
||||||
|
return (TRUE);
|
||||||
|
|
||||||
|
case XDR_FREE:
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XDR 16-bit integers
|
||||||
|
*/
|
||||||
|
bool_t
|
||||||
|
xdr_int16_t(xdrs, int16_p)
|
||||||
|
register XDR *xdrs;
|
||||||
|
int16_t *int16_p;
|
||||||
|
{
|
||||||
|
long l;
|
||||||
|
|
||||||
|
switch (xdrs->x_op) {
|
||||||
|
|
||||||
|
case XDR_ENCODE:
|
||||||
|
l = (long) *int16_p;
|
||||||
return (XDR_PUTLONG(xdrs, &l));
|
return (XDR_PUTLONG(xdrs, &l));
|
||||||
|
|
||||||
case XDR_DECODE:
|
case XDR_DECODE:
|
||||||
if (!XDR_GETLONG(xdrs, &l)) {
|
if (!XDR_GETLONG(xdrs, &l)) {
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
*usp = (u_short) l;
|
*int16_p = (int16_t) l;
|
||||||
|
return (TRUE);
|
||||||
|
|
||||||
|
case XDR_FREE:
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XDR unsigned 16-bit integers
|
||||||
|
*/
|
||||||
|
bool_t
|
||||||
|
xdr_u_int16_t(xdrs, u_int16_p)
|
||||||
|
register XDR *xdrs;
|
||||||
|
u_int16_t *u_int16_p;
|
||||||
|
{
|
||||||
|
u_long l;
|
||||||
|
|
||||||
|
switch (xdrs->x_op) {
|
||||||
|
|
||||||
|
case XDR_ENCODE:
|
||||||
|
l = (u_long) *u_int16_p;
|
||||||
|
return (XDR_PUTLONG(xdrs, (long *)&l));
|
||||||
|
|
||||||
|
case XDR_DECODE:
|
||||||
|
if (!XDR_GETLONG(xdrs, (long *)&l)) {
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
*u_int16_p = (u_int16_t) l;
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
|
|
||||||
case XDR_FREE:
|
case XDR_FREE:
|
||||||
@ -253,7 +394,7 @@ xdr_char(xdrs, cp)
|
|||||||
bool_t
|
bool_t
|
||||||
xdr_u_char(xdrs, cp)
|
xdr_u_char(xdrs, cp)
|
||||||
XDR *xdrs;
|
XDR *xdrs;
|
||||||
char *cp;
|
u_char *cp;
|
||||||
{
|
{
|
||||||
u_int u;
|
u_int u;
|
||||||
|
|
||||||
@ -310,6 +451,8 @@ xdr_enum(xdrs, ep)
|
|||||||
*/
|
*/
|
||||||
if (sizeof (enum sizecheck) == sizeof (long)) {
|
if (sizeof (enum sizecheck) == sizeof (long)) {
|
||||||
return (xdr_long(xdrs, (long *)ep));
|
return (xdr_long(xdrs, (long *)ep));
|
||||||
|
} else if (sizeof (enum sizecheck) == sizeof (int)) {
|
||||||
|
return (xdr_int(xdrs, (int *)ep));
|
||||||
} else if (sizeof (enum sizecheck) == sizeof (short)) {
|
} else if (sizeof (enum sizecheck) == sizeof (short)) {
|
||||||
return (xdr_short(xdrs, (short *)ep));
|
return (xdr_short(xdrs, (short *)ep));
|
||||||
} else {
|
} else {
|
||||||
@ -317,6 +460,7 @@ xdr_enum(xdrs, ep)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
(void) (xdr_short(xdrs, (short *)ep));
|
(void) (xdr_short(xdrs, (short *)ep));
|
||||||
|
(void) (xdr_int(xdrs, (int *)ep));
|
||||||
return (xdr_long(xdrs, (long *)ep));
|
return (xdr_long(xdrs, (long *)ep));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -354,7 +498,7 @@ xdr_opaque(xdrs, cp, cnt)
|
|||||||
}
|
}
|
||||||
if (rndup == 0)
|
if (rndup == 0)
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
return (XDR_GETBYTES(xdrs, crud, rndup));
|
return (XDR_GETBYTES(xdrs, (caddr_t)crud, rndup));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xdrs->x_op == XDR_ENCODE) {
|
if (xdrs->x_op == XDR_ENCODE) {
|
||||||
@ -562,8 +706,8 @@ xdr_string(xdrs, cpp, maxsize)
|
|||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wrapper for xdr_string that can be called directly from
|
* Wrapper for xdr_string that can be called directly from
|
||||||
* routines like clnt_call
|
* routines like clnt_call
|
||||||
*/
|
*/
|
||||||
bool_t
|
bool_t
|
||||||
@ -571,8 +715,5 @@ xdr_wrapstring(xdrs, cpp)
|
|||||||
XDR *xdrs;
|
XDR *xdrs;
|
||||||
char **cpp;
|
char **cpp;
|
||||||
{
|
{
|
||||||
if (xdr_string(xdrs, cpp, LASTUNSIGNED)) {
|
return xdr_string(xdrs, cpp, LASTUNSIGNED);
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
return (FALSE);
|
|
||||||
}
|
}
|
||||||
|
@ -5,23 +5,23 @@
|
|||||||
* may copy or modify Sun RPC without charge, but are not authorized
|
* may copy or modify Sun RPC without charge, but are not authorized
|
||||||
* to license or distribute it to anyone else except as part of a product or
|
* to license or distribute it to anyone else except as part of a product or
|
||||||
* program developed by the user.
|
* program developed by the user.
|
||||||
*
|
*
|
||||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||||
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||||
*
|
*
|
||||||
* Sun RPC is provided with no support and without any obligation on the
|
* Sun RPC is provided with no support and without any obligation on the
|
||||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||||
* modification or enhancement.
|
* modification or enhancement.
|
||||||
*
|
*
|
||||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||||
* OR ANY PART THEREOF.
|
* OR ANY PART THEREOF.
|
||||||
*
|
*
|
||||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||||
* or profits or other special, indirect and consequential damages, even if
|
* or profits or other special, indirect and consequential damages, even if
|
||||||
* Sun has been advised of the possibility of such damages.
|
* Sun has been advised of the possibility of such damages.
|
||||||
*
|
*
|
||||||
* Sun Microsystems, Inc.
|
* Sun Microsystems, Inc.
|
||||||
* 2550 Garcia Avenue
|
* 2550 Garcia Avenue
|
||||||
* Mountain View, California 94043
|
* Mountain View, California 94043
|
||||||
@ -30,7 +30,7 @@
|
|||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
/*static char *sccsid = "from: @(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro";*/
|
/*static char *sccsid = "from: @(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro";*/
|
||||||
/*static char *sccsid = "from: @(#)xdr_array.c 2.1 88/07/29 4.0 RPCSRC";*/
|
/*static char *sccsid = "from: @(#)xdr_array.c 2.1 88/07/29 4.0 RPCSRC";*/
|
||||||
static char *rcsid = "$Id: xdr_array.c,v 1.1 1993/10/27 05:41:09 paul Exp $";
|
static char *rcsid = "$Id: xdr_array.c,v 1.4 1996/12/30 14:07:08 peter Exp $";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -44,11 +44,11 @@ static char *rcsid = "$Id: xdr_array.c,v 1.1 1993/10/27 05:41:09 paul Exp $";
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <rpc/types.h>
|
#include <rpc/types.h>
|
||||||
#include <rpc/xdr.h>
|
#include <rpc/xdr.h>
|
||||||
|
|
||||||
#define LASTUNSIGNED ((u_int)0-1)
|
#define LASTUNSIGNED ((u_int) 0-1)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XDR an array of arbitrary elements
|
* XDR an array of arbitrary elements
|
||||||
@ -93,17 +93,17 @@ xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc)
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
*addrp = target = mem_alloc(nodesize);
|
*addrp = target = mem_alloc(nodesize);
|
||||||
if (target == NULL) {
|
if (target == NULL) {
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
"xdr_array: out of memory\n");
|
"xdr_array: out of memory\n");
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
bzero(target, nodesize);
|
memset(target, 0, nodesize);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XDR_FREE:
|
case XDR_FREE:
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* now we xdr each element of array
|
* now we xdr each element of array
|
||||||
*/
|
*/
|
||||||
@ -138,7 +138,7 @@ xdr_vector(xdrs, basep, nelem, elemsize, xdr_elem)
|
|||||||
register char *basep;
|
register char *basep;
|
||||||
register u_int nelem;
|
register u_int nelem;
|
||||||
register u_int elemsize;
|
register u_int elemsize;
|
||||||
register xdrproc_t xdr_elem;
|
register xdrproc_t xdr_elem;
|
||||||
{
|
{
|
||||||
register u_int i;
|
register u_int i;
|
||||||
register char *elptr;
|
register char *elptr;
|
||||||
@ -150,6 +150,6 @@ xdr_vector(xdrs, basep, nelem, elemsize, xdr_elem)
|
|||||||
}
|
}
|
||||||
elptr += elemsize;
|
elptr += elemsize;
|
||||||
}
|
}
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,23 +5,23 @@
|
|||||||
* may copy or modify Sun RPC without charge, but are not authorized
|
* may copy or modify Sun RPC without charge, but are not authorized
|
||||||
* to license or distribute it to anyone else except as part of a product or
|
* to license or distribute it to anyone else except as part of a product or
|
||||||
* program developed by the user.
|
* program developed by the user.
|
||||||
*
|
*
|
||||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||||
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||||
*
|
*
|
||||||
* Sun RPC is provided with no support and without any obligation on the
|
* Sun RPC is provided with no support and without any obligation on the
|
||||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||||
* modification or enhancement.
|
* modification or enhancement.
|
||||||
*
|
*
|
||||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||||
* OR ANY PART THEREOF.
|
* OR ANY PART THEREOF.
|
||||||
*
|
*
|
||||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||||
* or profits or other special, indirect and consequential damages, even if
|
* or profits or other special, indirect and consequential damages, even if
|
||||||
* Sun has been advised of the possibility of such damages.
|
* Sun has been advised of the possibility of such damages.
|
||||||
*
|
*
|
||||||
* Sun Microsystems, Inc.
|
* Sun Microsystems, Inc.
|
||||||
* 2550 Garcia Avenue
|
* 2550 Garcia Avenue
|
||||||
* Mountain View, California 94043
|
* Mountain View, California 94043
|
||||||
@ -30,7 +30,7 @@
|
|||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
/*static char *sccsid = "from: @(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro";*/
|
/*static char *sccsid = "from: @(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro";*/
|
||||||
/*static char *sccsid = "from: @(#)xdr_float.c 2.1 88/07/29 4.0 RPCSRC";*/
|
/*static char *sccsid = "from: @(#)xdr_float.c 2.1 88/07/29 4.0 RPCSRC";*/
|
||||||
static char *rcsid = "$Id: xdr_float.c,v 1.1 1993/10/27 05:41:10 paul Exp $";
|
static char *rcsid = "$Id: xdr_float.c,v 1.3 1996/12/30 14:07:08 peter Exp $";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -51,10 +51,13 @@ static char *rcsid = "$Id: xdr_float.c,v 1.1 1993/10/27 05:41:10 paul Exp $";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* NB: Not portable.
|
* NB: Not portable.
|
||||||
* This routine works on Suns (Sky / 68000's), i386's, MIPS, NS32k and Vaxen.
|
* This routine works on machines with IEEE754 FP and Vaxen.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(mc68000)||defined(sparc)||defined(i386)||defined(mips)||defined(ns32000)
|
#if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \
|
||||||
|
defined(__mips__) || defined(__ns32k__) || defined(__alpha__) || \
|
||||||
|
defined(__arm32__) || defined(__ppc__)
|
||||||
|
#include <machine/endian.h>
|
||||||
#define IEEEFP
|
#define IEEEFP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -94,7 +97,10 @@ xdr_float(xdrs, fp)
|
|||||||
register XDR *xdrs;
|
register XDR *xdrs;
|
||||||
register float *fp;
|
register float *fp;
|
||||||
{
|
{
|
||||||
#ifndef IEEEFP
|
#ifdef IEEEFP
|
||||||
|
bool_t rv;
|
||||||
|
long tmpl;
|
||||||
|
#else
|
||||||
struct ieee_single is;
|
struct ieee_single is;
|
||||||
struct vax_single vs, *vsp;
|
struct vax_single vs, *vsp;
|
||||||
struct sgl_limits *lim;
|
struct sgl_limits *lim;
|
||||||
@ -103,8 +109,9 @@ xdr_float(xdrs, fp)
|
|||||||
switch (xdrs->x_op) {
|
switch (xdrs->x_op) {
|
||||||
|
|
||||||
case XDR_ENCODE:
|
case XDR_ENCODE:
|
||||||
#ifdef IEEEFP
|
#ifdef IEEEFP
|
||||||
return (XDR_PUTLONG(xdrs, (long *)fp));
|
tmpl = *(int32_t *)fp;
|
||||||
|
return (XDR_PUTLONG(xdrs, &tmpl));
|
||||||
#else
|
#else
|
||||||
vs = *((struct vax_single *)fp);
|
vs = *((struct vax_single *)fp);
|
||||||
for (i = 0, lim = sgl_limits;
|
for (i = 0, lim = sgl_limits;
|
||||||
@ -126,7 +133,9 @@ xdr_float(xdrs, fp)
|
|||||||
|
|
||||||
case XDR_DECODE:
|
case XDR_DECODE:
|
||||||
#ifdef IEEEFP
|
#ifdef IEEEFP
|
||||||
return (XDR_GETLONG(xdrs, (long *)fp));
|
rv = XDR_GETLONG(xdrs, &tmpl);
|
||||||
|
*(int32_t *)fp = tmpl;
|
||||||
|
return (rv);
|
||||||
#else
|
#else
|
||||||
vsp = (struct vax_single *)fp;
|
vsp = (struct vax_single *)fp;
|
||||||
if (!XDR_GETLONG(xdrs, (long *)&is))
|
if (!XDR_GETLONG(xdrs, (long *)&is))
|
||||||
@ -154,10 +163,6 @@ xdr_float(xdrs, fp)
|
|||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* This routine works on Suns (Sky / 68000's), i386's, MIPS and Vaxen.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef vax
|
#ifdef vax
|
||||||
/* What IEEE double precision floating point looks like on a Vax */
|
/* What IEEE double precision floating point looks like on a Vax */
|
||||||
struct ieee_double {
|
struct ieee_double {
|
||||||
@ -199,8 +204,12 @@ xdr_double(xdrs, dp)
|
|||||||
register XDR *xdrs;
|
register XDR *xdrs;
|
||||||
double *dp;
|
double *dp;
|
||||||
{
|
{
|
||||||
|
#ifdef IEEEFP
|
||||||
|
register int32_t *i32p;
|
||||||
|
bool_t rv;
|
||||||
|
long tmpl;
|
||||||
|
#else
|
||||||
register long *lp;
|
register long *lp;
|
||||||
#ifndef IEEEFP
|
|
||||||
struct ieee_double id;
|
struct ieee_double id;
|
||||||
struct vax_double vd;
|
struct vax_double vd;
|
||||||
register struct dbl_limits *lim;
|
register struct dbl_limits *lim;
|
||||||
@ -211,12 +220,23 @@ xdr_double(xdrs, dp)
|
|||||||
|
|
||||||
case XDR_ENCODE:
|
case XDR_ENCODE:
|
||||||
#ifdef IEEEFP
|
#ifdef IEEEFP
|
||||||
lp = (long *)dp;
|
i32p = (int32_t *)dp;
|
||||||
#if BYTE_ORDER == BIG_ENDIAN
|
#if BYTE_ORDER == BIG_ENDIAN
|
||||||
return (XDR_PUTLONG(xdrs, lp++) && XDR_PUTLONG(xdrs, lp));
|
tmpl = *i32p++;
|
||||||
|
rv = XDR_PUTLONG(xdrs, &tmpl);
|
||||||
|
if (!rv)
|
||||||
|
return (rv);
|
||||||
|
tmpl = *i32p;
|
||||||
|
rv = XDR_PUTLONG(xdrs, &tmpl);
|
||||||
#else
|
#else
|
||||||
return (XDR_PUTLONG(xdrs, lp+1) && XDR_PUTLONG(xdrs, lp));
|
tmpl = *(i32p+1);
|
||||||
|
rv = XDR_PUTLONG(xdrs, &tmpl);
|
||||||
|
if (!rv)
|
||||||
|
return (rv);
|
||||||
|
tmpl = *i32p;
|
||||||
|
rv = XDR_PUTLONG(xdrs, &tmpl);
|
||||||
#endif
|
#endif
|
||||||
|
return (rv);
|
||||||
#else
|
#else
|
||||||
vd = *((struct vax_double *)dp);
|
vd = *((struct vax_double *)dp);
|
||||||
for (i = 0, lim = dbl_limits;
|
for (i = 0, lim = dbl_limits;
|
||||||
@ -244,12 +264,23 @@ xdr_double(xdrs, dp)
|
|||||||
|
|
||||||
case XDR_DECODE:
|
case XDR_DECODE:
|
||||||
#ifdef IEEEFP
|
#ifdef IEEEFP
|
||||||
lp = (long *)dp;
|
i32p = (int32_t *)dp;
|
||||||
#if BYTE_ORDER == BIG_ENDIAN
|
#if BYTE_ORDER == BIG_ENDIAN
|
||||||
return (XDR_GETLONG(xdrs, lp++) && XDR_GETLONG(xdrs, lp));
|
rv = XDR_GETLONG(xdrs, &tmpl);
|
||||||
|
*i32p++ = tmpl;
|
||||||
|
if (!rv)
|
||||||
|
return (rv);
|
||||||
|
rv = XDR_GETLONG(xdrs, &tmpl);
|
||||||
|
*i32p = tmpl;
|
||||||
#else
|
#else
|
||||||
return (XDR_GETLONG(xdrs, lp+1) && XDR_GETLONG(xdrs, lp));
|
rv = XDR_GETLONG(xdrs, &tmpl);
|
||||||
|
*(i32p+1) = tmpl;
|
||||||
|
if (!rv)
|
||||||
|
return (rv);
|
||||||
|
rv = XDR_GETLONG(xdrs, &tmpl);
|
||||||
|
*i32p = tmpl;
|
||||||
#endif
|
#endif
|
||||||
|
return (rv);
|
||||||
#else
|
#else
|
||||||
lp = (long *)&id;
|
lp = (long *)&id;
|
||||||
if (!XDR_GETLONG(xdrs, lp++) || !XDR_GETLONG(xdrs, lp))
|
if (!XDR_GETLONG(xdrs, lp++) || !XDR_GETLONG(xdrs, lp))
|
||||||
|
@ -5,23 +5,23 @@
|
|||||||
* may copy or modify Sun RPC without charge, but are not authorized
|
* may copy or modify Sun RPC without charge, but are not authorized
|
||||||
* to license or distribute it to anyone else except as part of a product or
|
* to license or distribute it to anyone else except as part of a product or
|
||||||
* program developed by the user.
|
* program developed by the user.
|
||||||
*
|
*
|
||||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||||
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||||
*
|
*
|
||||||
* Sun RPC is provided with no support and without any obligation on the
|
* Sun RPC is provided with no support and without any obligation on the
|
||||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||||
* modification or enhancement.
|
* modification or enhancement.
|
||||||
*
|
*
|
||||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||||
* OR ANY PART THEREOF.
|
* OR ANY PART THEREOF.
|
||||||
*
|
*
|
||||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||||
* or profits or other special, indirect and consequential damages, even if
|
* or profits or other special, indirect and consequential damages, even if
|
||||||
* Sun has been advised of the possibility of such damages.
|
* Sun has been advised of the possibility of such damages.
|
||||||
*
|
*
|
||||||
* Sun Microsystems, Inc.
|
* Sun Microsystems, Inc.
|
||||||
* 2550 Garcia Avenue
|
* 2550 Garcia Avenue
|
||||||
* Mountain View, California 94043
|
* Mountain View, California 94043
|
||||||
@ -30,7 +30,7 @@
|
|||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
/*static char *sccsid = "from: @(#)xdr_mem.c 1.19 87/08/11 Copyr 1984 Sun Micro";*/
|
/*static char *sccsid = "from: @(#)xdr_mem.c 1.19 87/08/11 Copyr 1984 Sun Micro";*/
|
||||||
/*static char *sccsid = "from: @(#)xdr_mem.c 2.1 88/07/29 4.0 RPCSRC";*/
|
/*static char *sccsid = "from: @(#)xdr_mem.c 2.1 88/07/29 4.0 RPCSRC";*/
|
||||||
static char *rcsid = "$Id: xdr_mem.c,v 1.1 1993/10/27 05:41:11 paul Exp $";
|
static char *rcsid = "$Id: xdr_mem.c,v 1.4 1996/12/30 14:07:09 peter Exp $";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -44,34 +44,48 @@ static char *rcsid = "$Id: xdr_mem.c,v 1.1 1993/10/27 05:41:11 paul Exp $";
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
#include <rpc/types.h>
|
#include <rpc/types.h>
|
||||||
#include <rpc/xdr.h>
|
#include <rpc/xdr.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
|
||||||
static bool_t xdrmem_getlong();
|
static bool_t xdrmem_getlong_aligned();
|
||||||
static bool_t xdrmem_putlong();
|
static bool_t xdrmem_putlong_aligned();
|
||||||
|
static bool_t xdrmem_getlong_unaligned();
|
||||||
|
static bool_t xdrmem_putlong_unaligned();
|
||||||
static bool_t xdrmem_getbytes();
|
static bool_t xdrmem_getbytes();
|
||||||
static bool_t xdrmem_putbytes();
|
static bool_t xdrmem_putbytes();
|
||||||
static u_int xdrmem_getpos();
|
static u_int xdrmem_getpos(); /* XXX w/64-bit pointers, u_int not enough! */
|
||||||
static bool_t xdrmem_setpos();
|
static bool_t xdrmem_setpos();
|
||||||
static long * xdrmem_inline();
|
static int32_t *xdrmem_inline_aligned();
|
||||||
|
static int32_t *xdrmem_inline_unaligned();
|
||||||
static void xdrmem_destroy();
|
static void xdrmem_destroy();
|
||||||
|
|
||||||
static struct xdr_ops xdrmem_ops = {
|
static struct xdr_ops xdrmem_ops_aligned = {
|
||||||
xdrmem_getlong,
|
xdrmem_getlong_aligned,
|
||||||
xdrmem_putlong,
|
xdrmem_putlong_aligned,
|
||||||
xdrmem_getbytes,
|
xdrmem_getbytes,
|
||||||
xdrmem_putbytes,
|
xdrmem_putbytes,
|
||||||
xdrmem_getpos,
|
xdrmem_getpos,
|
||||||
xdrmem_setpos,
|
xdrmem_setpos,
|
||||||
xdrmem_inline,
|
xdrmem_inline_aligned,
|
||||||
|
xdrmem_destroy
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct xdr_ops xdrmem_ops_unaligned = {
|
||||||
|
xdrmem_getlong_unaligned,
|
||||||
|
xdrmem_putlong_unaligned,
|
||||||
|
xdrmem_getbytes,
|
||||||
|
xdrmem_putbytes,
|
||||||
|
xdrmem_getpos,
|
||||||
|
xdrmem_setpos,
|
||||||
|
xdrmem_inline_unaligned,
|
||||||
xdrmem_destroy
|
xdrmem_destroy
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The procedure xdrmem_create initializes a stream descriptor for a
|
* The procedure xdrmem_create initializes a stream descriptor for a
|
||||||
* memory buffer.
|
* memory buffer.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xdrmem_create(xdrs, addr, size, op)
|
xdrmem_create(xdrs, addr, size, op)
|
||||||
@ -82,7 +96,8 @@ xdrmem_create(xdrs, addr, size, op)
|
|||||||
{
|
{
|
||||||
|
|
||||||
xdrs->x_op = op;
|
xdrs->x_op = op;
|
||||||
xdrs->x_ops = &xdrmem_ops;
|
xdrs->x_ops = ((size_t)addr & (sizeof(int32_t) - 1))
|
||||||
|
? &xdrmem_ops_unaligned : &xdrmem_ops_aligned;
|
||||||
xdrs->x_private = xdrs->x_base = addr;
|
xdrs->x_private = xdrs->x_base = addr;
|
||||||
xdrs->x_handy = size;
|
xdrs->x_handy = size;
|
||||||
}
|
}
|
||||||
@ -91,31 +106,62 @@ static void
|
|||||||
xdrmem_destroy(/*xdrs*/)
|
xdrmem_destroy(/*xdrs*/)
|
||||||
/*XDR *xdrs;*/
|
/*XDR *xdrs;*/
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool_t
|
static bool_t
|
||||||
xdrmem_getlong(xdrs, lp)
|
xdrmem_getlong_aligned(xdrs, lp)
|
||||||
register XDR *xdrs;
|
register XDR *xdrs;
|
||||||
long *lp;
|
long *lp;
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((xdrs->x_handy -= sizeof(long)) < 0)
|
if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
*lp = (long)ntohl((u_long)(*((long *)(xdrs->x_private))));
|
*lp = ntohl(*(int32_t *)(xdrs->x_private));
|
||||||
xdrs->x_private += sizeof(long);
|
xdrs->x_private += sizeof(int32_t);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool_t
|
static bool_t
|
||||||
xdrmem_putlong(xdrs, lp)
|
xdrmem_putlong_aligned(xdrs, lp)
|
||||||
register XDR *xdrs;
|
register XDR *xdrs;
|
||||||
long *lp;
|
long *lp;
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((xdrs->x_handy -= sizeof(long)) < 0)
|
if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
*(long *)xdrs->x_private = (long)htonl((u_long)(*lp));
|
*(int32_t *)xdrs->x_private = htonl(*lp);
|
||||||
xdrs->x_private += sizeof(long);
|
xdrs->x_private += sizeof(int32_t);
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool_t
|
||||||
|
xdrmem_getlong_unaligned(xdrs, lp)
|
||||||
|
register XDR *xdrs;
|
||||||
|
long *lp;
|
||||||
|
{
|
||||||
|
int32_t l;
|
||||||
|
|
||||||
|
if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
|
||||||
|
return (FALSE);
|
||||||
|
memcpy(&l, xdrs->x_private, sizeof(int32_t));
|
||||||
|
*lp = ntohl(l);
|
||||||
|
xdrs->x_private += sizeof(int32_t);
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool_t
|
||||||
|
xdrmem_putlong_unaligned(xdrs, lp)
|
||||||
|
register XDR *xdrs;
|
||||||
|
long *lp;
|
||||||
|
{
|
||||||
|
int32_t l;
|
||||||
|
|
||||||
|
if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
|
||||||
|
return (FALSE);
|
||||||
|
l = htonl(*lp);
|
||||||
|
memcpy(xdrs->x_private, &l, sizeof(int32_t));
|
||||||
|
xdrs->x_private += sizeof(int32_t);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +174,7 @@ xdrmem_getbytes(xdrs, addr, len)
|
|||||||
|
|
||||||
if ((xdrs->x_handy -= len) < 0)
|
if ((xdrs->x_handy -= len) < 0)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
bcopy(xdrs->x_private, addr, len);
|
memcpy(addr, xdrs->x_private, len);
|
||||||
xdrs->x_private += len;
|
xdrs->x_private += len;
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
@ -142,7 +188,7 @@ xdrmem_putbytes(xdrs, addr, len)
|
|||||||
|
|
||||||
if ((xdrs->x_handy -= len) < 0)
|
if ((xdrs->x_handy -= len) < 0)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
bcopy(addr, xdrs->x_private, len);
|
memcpy(xdrs->x_private, addr, len);
|
||||||
xdrs->x_private += len;
|
xdrs->x_private += len;
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
@ -152,7 +198,8 @@ xdrmem_getpos(xdrs)
|
|||||||
register XDR *xdrs;
|
register XDR *xdrs;
|
||||||
{
|
{
|
||||||
|
|
||||||
return ((u_int)xdrs->x_private - (u_int)xdrs->x_base);
|
/* XXX w/64-bit pointers, u_int not enough! */
|
||||||
|
return ((u_long)xdrs->x_private - (u_long)xdrs->x_base);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool_t
|
static bool_t
|
||||||
@ -166,21 +213,30 @@ xdrmem_setpos(xdrs, pos)
|
|||||||
if ((long)newaddr > (long)lastaddr)
|
if ((long)newaddr > (long)lastaddr)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
xdrs->x_private = newaddr;
|
xdrs->x_private = newaddr;
|
||||||
xdrs->x_handy = (int)lastaddr - (int)newaddr;
|
xdrs->x_handy = (long)lastaddr - (long)newaddr;
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static long *
|
static int32_t *
|
||||||
xdrmem_inline(xdrs, len)
|
xdrmem_inline_aligned(xdrs, len)
|
||||||
register XDR *xdrs;
|
register XDR *xdrs;
|
||||||
int len;
|
int len;
|
||||||
{
|
{
|
||||||
long *buf = 0;
|
int32_t *buf = 0;
|
||||||
|
|
||||||
if (xdrs->x_handy >= len) {
|
if (xdrs->x_handy >= len) {
|
||||||
xdrs->x_handy -= len;
|
xdrs->x_handy -= len;
|
||||||
buf = (long *) xdrs->x_private;
|
buf = (int32_t *) xdrs->x_private;
|
||||||
xdrs->x_private += len;
|
xdrs->x_private += len;
|
||||||
}
|
}
|
||||||
return (buf);
|
return (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t *
|
||||||
|
xdrmem_inline_unaligned(xdrs, len)
|
||||||
|
register XDR *xdrs;
|
||||||
|
int len;
|
||||||
|
{
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
@ -5,31 +5,31 @@
|
|||||||
* may copy or modify Sun RPC without charge, but are not authorized
|
* may copy or modify Sun RPC without charge, but are not authorized
|
||||||
* to license or distribute it to anyone else except as part of a product or
|
* to license or distribute it to anyone else except as part of a product or
|
||||||
* program developed by the user.
|
* program developed by the user.
|
||||||
*
|
*
|
||||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||||
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||||
*
|
*
|
||||||
* Sun RPC is provided with no support and without any obligation on the
|
* Sun RPC is provided with no support and without any obligation on the
|
||||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||||
* modification or enhancement.
|
* modification or enhancement.
|
||||||
*
|
*
|
||||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||||
* OR ANY PART THEREOF.
|
* OR ANY PART THEREOF.
|
||||||
*
|
*
|
||||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||||
* or profits or other special, indirect and consequential damages, even if
|
* or profits or other special, indirect and consequential damages, even if
|
||||||
* Sun has been advised of the possibility of such damages.
|
* Sun has been advised of the possibility of such damages.
|
||||||
*
|
*
|
||||||
* Sun Microsystems, Inc.
|
* Sun Microsystems, Inc.
|
||||||
* 2550 Garcia Avenue
|
* 2550 Garcia Avenue
|
||||||
* Mountain View, California 94043
|
* Mountain View, California 94043
|
||||||
*/
|
*/
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
/*static char *sccsid = "from: @(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";*/
|
/*static char *sccsid = "from: @(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";*/
|
||||||
/*static char *sccsid = "from: @(#)xdr_rec.c 2.2 88/08/01 4.0 RPCSRC";*/
|
/*static char *sccsid = "from: @(#)xdr_rec.c 2.2 88/08/01 4.0 RPCSRC";*/
|
||||||
static char *rcsid = "$Id: xdr_rec.c,v 1.1 1993/10/27 05:41:12 paul Exp $";
|
static char *rcsid = "$Id: xdr_rec.c,v 1.5 1996/12/30 14:07:10 peter Exp $";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -45,18 +45,17 @@ static char *rcsid = "$Id: xdr_rec.c,v 1.1 1993/10/27 05:41:12 paul Exp $";
|
|||||||
* by n bytes of data, where n is contained in the header. The header
|
* by n bytes of data, where n is contained in the header. The header
|
||||||
* is represented as a htonl(u_long). Thegh order bit encodes
|
* is represented as a htonl(u_long). Thegh order bit encodes
|
||||||
* whether or not the fragment is the last fragment of the record
|
* whether or not the fragment is the last fragment of the record
|
||||||
* (1 => fragment is last, 0 => more fragments to follow.
|
* (1 => fragment is last, 0 => more fragments to follow.
|
||||||
* The other 31 bits encode the byte length of the fragment.
|
* The other 31 bits encode the byte length of the fragment.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <rpc/types.h>
|
#include <rpc/types.h>
|
||||||
#include <rpc/xdr.h>
|
#include <rpc/xdr.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
|
||||||
extern long lseek();
|
|
||||||
|
|
||||||
static u_int fix_buf_size();
|
static u_int fix_buf_size();
|
||||||
static bool_t flush_out();
|
static bool_t flush_out();
|
||||||
static bool_t get_input_bytes();
|
static bool_t get_input_bytes();
|
||||||
@ -69,7 +68,7 @@ static bool_t xdrrec_getbytes();
|
|||||||
static bool_t xdrrec_putbytes();
|
static bool_t xdrrec_putbytes();
|
||||||
static u_int xdrrec_getpos();
|
static u_int xdrrec_getpos();
|
||||||
static bool_t xdrrec_setpos();
|
static bool_t xdrrec_setpos();
|
||||||
static long * xdrrec_inline();
|
static int32_t *xdrrec_inline();
|
||||||
static void xdrrec_destroy();
|
static void xdrrec_destroy();
|
||||||
|
|
||||||
static struct xdr_ops xdrrec_ops = {
|
static struct xdr_ops xdrrec_ops = {
|
||||||
@ -96,7 +95,7 @@ static struct xdr_ops xdrrec_ops = {
|
|||||||
* meet the needs of xdr and rpc based on tcp.
|
* meet the needs of xdr and rpc based on tcp.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LAST_FRAG ((u_long)(1 << 31))
|
#define LAST_FRAG ((u_int32_t)(1 << 31))
|
||||||
|
|
||||||
typedef struct rec_strm {
|
typedef struct rec_strm {
|
||||||
caddr_t tcp_handle;
|
caddr_t tcp_handle;
|
||||||
@ -104,16 +103,16 @@ typedef struct rec_strm {
|
|||||||
/*
|
/*
|
||||||
* out-goung bits
|
* out-goung bits
|
||||||
*/
|
*/
|
||||||
int (*writeit)();
|
int (*writeit) __P((caddr_t, caddr_t, int));
|
||||||
caddr_t out_base; /* output buffer (points to frag header) */
|
caddr_t out_base; /* output buffer (points to frag header) */
|
||||||
caddr_t out_finger; /* next output position */
|
caddr_t out_finger; /* next output position */
|
||||||
caddr_t out_boundry; /* data cannot up to this address */
|
caddr_t out_boundry; /* data cannot up to this address */
|
||||||
u_long *frag_header; /* beginning of curren fragment */
|
u_int32_t *frag_header; /* beginning of current fragment */
|
||||||
bool_t frag_sent; /* true if buffer sent in middle of record */
|
bool_t frag_sent; /* true if buffer sent in middle of record */
|
||||||
/*
|
/*
|
||||||
* in-coming bits
|
* in-coming bits
|
||||||
*/
|
*/
|
||||||
int (*readit)();
|
int (*readit) __P((caddr_t, caddr_t, int));
|
||||||
u_long in_size; /* fixed size of the input buffer */
|
u_long in_size; /* fixed size of the input buffer */
|
||||||
caddr_t in_base;
|
caddr_t in_base;
|
||||||
caddr_t in_finger; /* location of next byte to be had */
|
caddr_t in_finger; /* location of next byte to be had */
|
||||||
@ -148,8 +147,8 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit)
|
|||||||
|
|
||||||
if (rstrm == NULL) {
|
if (rstrm == NULL) {
|
||||||
(void)fprintf(stderr, "xdrrec_create: out of memory\n");
|
(void)fprintf(stderr, "xdrrec_create: out of memory\n");
|
||||||
/*
|
/*
|
||||||
* This is bad. Should rework xdrrec_create to
|
* This is bad. Should rework xdrrec_create to
|
||||||
* return a handle, and in this case return NULL
|
* return a handle, and in this case return NULL
|
||||||
*/
|
*/
|
||||||
return;
|
return;
|
||||||
@ -165,7 +164,7 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (rstrm->out_base = rstrm->the_buffer;
|
for (rstrm->out_base = rstrm->the_buffer;
|
||||||
(u_int)rstrm->out_base % BYTES_PER_XDR_UNIT != 0;
|
(u_long)rstrm->out_base % BYTES_PER_XDR_UNIT != 0;
|
||||||
rstrm->out_base++);
|
rstrm->out_base++);
|
||||||
rstrm->in_base = rstrm->out_base + sendsize;
|
rstrm->in_base = rstrm->out_base + sendsize;
|
||||||
/*
|
/*
|
||||||
@ -177,8 +176,8 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit)
|
|||||||
rstrm->readit = readit;
|
rstrm->readit = readit;
|
||||||
rstrm->writeit = writeit;
|
rstrm->writeit = writeit;
|
||||||
rstrm->out_finger = rstrm->out_boundry = rstrm->out_base;
|
rstrm->out_finger = rstrm->out_boundry = rstrm->out_base;
|
||||||
rstrm->frag_header = (u_long *)rstrm->out_base;
|
rstrm->frag_header = (u_int32_t *)rstrm->out_base;
|
||||||
rstrm->out_finger += sizeof(u_long);
|
rstrm->out_finger += sizeof(u_int32_t);
|
||||||
rstrm->out_boundry += sendsize;
|
rstrm->out_boundry += sendsize;
|
||||||
rstrm->frag_sent = FALSE;
|
rstrm->frag_sent = FALSE;
|
||||||
rstrm->in_size = recvsize;
|
rstrm->in_size = recvsize;
|
||||||
@ -200,19 +199,19 @@ xdrrec_getlong(xdrs, lp)
|
|||||||
long *lp;
|
long *lp;
|
||||||
{
|
{
|
||||||
register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
|
register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
|
||||||
register long *buflp = (long *)(rstrm->in_finger);
|
register int32_t *buflp = (int32_t *)(rstrm->in_finger);
|
||||||
long mylong;
|
int32_t mylong;
|
||||||
|
|
||||||
/* first try the inline, fast case */
|
/* first try the inline, fast case */
|
||||||
if ((rstrm->fbtbc >= sizeof(long)) &&
|
if ((rstrm->fbtbc >= sizeof(int32_t)) &&
|
||||||
(((int)rstrm->in_boundry - (int)buflp) >= sizeof(long))) {
|
(((long)rstrm->in_boundry - (long)buflp) >= sizeof(int32_t))) {
|
||||||
*lp = (long)ntohl((u_long)(*buflp));
|
*lp = (long)ntohl((u_int32_t)(*buflp));
|
||||||
rstrm->fbtbc -= sizeof(long);
|
rstrm->fbtbc -= sizeof(int32_t);
|
||||||
rstrm->in_finger += sizeof(long);
|
rstrm->in_finger += sizeof(int32_t);
|
||||||
} else {
|
} else {
|
||||||
if (! xdrrec_getbytes(xdrs, (caddr_t)&mylong, sizeof(long)))
|
if (! xdrrec_getbytes(xdrs, (caddr_t)&mylong, sizeof(int32_t)))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
*lp = (long)ntohl((u_long)mylong);
|
*lp = (long)ntohl((u_int32_t)mylong);
|
||||||
}
|
}
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
@ -223,21 +222,21 @@ xdrrec_putlong(xdrs, lp)
|
|||||||
long *lp;
|
long *lp;
|
||||||
{
|
{
|
||||||
register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
|
register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
|
||||||
register long *dest_lp = ((long *)(rstrm->out_finger));
|
register int32_t *dest_lp = ((int32_t *)(rstrm->out_finger));
|
||||||
|
|
||||||
if ((rstrm->out_finger += sizeof(long)) > rstrm->out_boundry) {
|
if ((rstrm->out_finger += sizeof(int32_t)) > rstrm->out_boundry) {
|
||||||
/*
|
/*
|
||||||
* this case should almost never happen so the code is
|
* this case should almost never happen so the code is
|
||||||
* inefficient
|
* inefficient
|
||||||
*/
|
*/
|
||||||
rstrm->out_finger -= sizeof(long);
|
rstrm->out_finger -= sizeof(int32_t);
|
||||||
rstrm->frag_sent = TRUE;
|
rstrm->frag_sent = TRUE;
|
||||||
if (! flush_out(rstrm, FALSE))
|
if (! flush_out(rstrm, FALSE))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
dest_lp = ((long *)(rstrm->out_finger));
|
dest_lp = ((int32_t *)(rstrm->out_finger));
|
||||||
rstrm->out_finger += sizeof(long);
|
rstrm->out_finger += sizeof(int32_t);
|
||||||
}
|
}
|
||||||
*dest_lp = (long)htonl((u_long)(*lp));
|
*dest_lp = (int32_t)htonl((u_int32_t)(*lp));
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +261,7 @@ xdrrec_getbytes(xdrs, addr, len)
|
|||||||
current = (len < current) ? len : current;
|
current = (len < current) ? len : current;
|
||||||
if (! get_input_bytes(rstrm, addr, current))
|
if (! get_input_bytes(rstrm, addr, current))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
addr += current;
|
addr += current;
|
||||||
rstrm->fbtbc -= current;
|
rstrm->fbtbc -= current;
|
||||||
len -= current;
|
len -= current;
|
||||||
}
|
}
|
||||||
@ -276,12 +275,13 @@ xdrrec_putbytes(xdrs, addr, len)
|
|||||||
register u_int len;
|
register u_int len;
|
||||||
{
|
{
|
||||||
register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
|
register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
|
||||||
register int current;
|
register long current;
|
||||||
|
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
current = (u_int)rstrm->out_boundry - (u_int)rstrm->out_finger;
|
current = (u_long)rstrm->out_boundry -
|
||||||
|
(u_long)rstrm->out_finger;
|
||||||
current = (len < current) ? len : current;
|
current = (len < current) ? len : current;
|
||||||
bcopy(addr, rstrm->out_finger, current);
|
memcpy(rstrm->out_finger, addr, current);
|
||||||
rstrm->out_finger += current;
|
rstrm->out_finger += current;
|
||||||
addr += current;
|
addr += current;
|
||||||
len -= current;
|
len -= current;
|
||||||
@ -301,7 +301,7 @@ xdrrec_getpos(xdrs)
|
|||||||
register RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
|
register RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
|
||||||
register long pos;
|
register long pos;
|
||||||
|
|
||||||
pos = lseek((int)rstrm->tcp_handle, (long) 0, 1);
|
pos = lseek((int)(long)rstrm->tcp_handle, (off_t) 0, 1);
|
||||||
if (pos != -1)
|
if (pos != -1)
|
||||||
switch (xdrs->x_op) {
|
switch (xdrs->x_op) {
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ xdrrec_getpos(xdrs)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
pos = (u_int) -1;
|
pos = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ((u_int) pos);
|
return ((u_int) pos);
|
||||||
@ -356,19 +356,19 @@ xdrrec_setpos(xdrs, pos)
|
|||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static long *
|
static int32_t *
|
||||||
xdrrec_inline(xdrs, len)
|
xdrrec_inline(xdrs, len)
|
||||||
register XDR *xdrs;
|
register XDR *xdrs;
|
||||||
int len;
|
int len;
|
||||||
{
|
{
|
||||||
register RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
|
register RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
|
||||||
long * buf = NULL;
|
int32_t * buf = NULL;
|
||||||
|
|
||||||
switch (xdrs->x_op) {
|
switch (xdrs->x_op) {
|
||||||
|
|
||||||
case XDR_ENCODE:
|
case XDR_ENCODE:
|
||||||
if ((rstrm->out_finger + len) <= rstrm->out_boundry) {
|
if ((rstrm->out_finger + len) <= rstrm->out_boundry) {
|
||||||
buf = (long *) rstrm->out_finger;
|
buf = (int32_t *) rstrm->out_finger;
|
||||||
rstrm->out_finger += len;
|
rstrm->out_finger += len;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -376,7 +376,7 @@ xdrrec_inline(xdrs, len)
|
|||||||
case XDR_DECODE:
|
case XDR_DECODE:
|
||||||
if ((len <= rstrm->fbtbc) &&
|
if ((len <= rstrm->fbtbc) &&
|
||||||
((rstrm->in_finger + len) <= rstrm->in_boundry)) {
|
((rstrm->in_finger + len) <= rstrm->in_boundry)) {
|
||||||
buf = (long *) rstrm->in_finger;
|
buf = (int32_t *) rstrm->in_finger;
|
||||||
rstrm->fbtbc -= len;
|
rstrm->fbtbc -= len;
|
||||||
rstrm->in_finger += len;
|
rstrm->in_finger += len;
|
||||||
}
|
}
|
||||||
@ -424,7 +424,7 @@ xdrrec_skiprecord(xdrs)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Look ahead fuction.
|
* Look ahead fuction.
|
||||||
* Returns TRUE iff there is no more input in the buffer
|
* Returns TRUE iff there is no more input in the buffer
|
||||||
* after consuming the rest of the current record.
|
* after consuming the rest of the current record.
|
||||||
*/
|
*/
|
||||||
bool_t
|
bool_t
|
||||||
@ -460,16 +460,16 @@ xdrrec_endofrecord(xdrs, sendnow)
|
|||||||
register u_long len; /* fragment length */
|
register u_long len; /* fragment length */
|
||||||
|
|
||||||
if (sendnow || rstrm->frag_sent ||
|
if (sendnow || rstrm->frag_sent ||
|
||||||
((u_long)rstrm->out_finger + sizeof(u_long) >=
|
((u_long)rstrm->out_finger + sizeof(u_int32_t) >=
|
||||||
(u_long)rstrm->out_boundry)) {
|
(u_long)rstrm->out_boundry)) {
|
||||||
rstrm->frag_sent = FALSE;
|
rstrm->frag_sent = FALSE;
|
||||||
return (flush_out(rstrm, TRUE));
|
return (flush_out(rstrm, TRUE));
|
||||||
}
|
}
|
||||||
len = (u_long)(rstrm->out_finger) - (u_long)(rstrm->frag_header) -
|
len = (u_long)(rstrm->out_finger) - (u_long)(rstrm->frag_header) -
|
||||||
sizeof(u_long);
|
sizeof(u_int32_t);
|
||||||
*(rstrm->frag_header) = htonl((u_long)len | LAST_FRAG);
|
*(rstrm->frag_header) = htonl((u_long)len | LAST_FRAG);
|
||||||
rstrm->frag_header = (u_long *)rstrm->out_finger;
|
rstrm->frag_header = (u_int32_t *)rstrm->out_finger;
|
||||||
rstrm->out_finger += sizeof(u_long);
|
rstrm->out_finger += sizeof(u_int32_t);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,16 +483,16 @@ flush_out(rstrm, eor)
|
|||||||
bool_t eor;
|
bool_t eor;
|
||||||
{
|
{
|
||||||
register u_long eormask = (eor == TRUE) ? LAST_FRAG : 0;
|
register u_long eormask = (eor == TRUE) ? LAST_FRAG : 0;
|
||||||
register u_long len = (u_long)(rstrm->out_finger) -
|
register u_int32_t len = (u_long)(rstrm->out_finger) -
|
||||||
(u_long)(rstrm->frag_header) - sizeof(u_long);
|
(u_long)(rstrm->frag_header) - sizeof(u_int32_t);
|
||||||
|
|
||||||
*(rstrm->frag_header) = htonl(len | eormask);
|
*(rstrm->frag_header) = htonl(len | eormask);
|
||||||
len = (u_long)(rstrm->out_finger) - (u_long)(rstrm->out_base);
|
len = (u_long)(rstrm->out_finger) - (u_long)(rstrm->out_base);
|
||||||
if ((*(rstrm->writeit))(rstrm->tcp_handle, rstrm->out_base, (int)len)
|
if ((*(rstrm->writeit))(rstrm->tcp_handle, rstrm->out_base, (int)len)
|
||||||
!= (int)len)
|
!= (int)len)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
rstrm->frag_header = (u_long *)rstrm->out_base;
|
rstrm->frag_header = (u_int32_t *)rstrm->out_base;
|
||||||
rstrm->out_finger = (caddr_t)rstrm->out_base + sizeof(u_long);
|
rstrm->out_finger = (caddr_t)rstrm->out_base + sizeof(u_int32_t);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,11 +501,11 @@ fill_input_buf(rstrm)
|
|||||||
register RECSTREAM *rstrm;
|
register RECSTREAM *rstrm;
|
||||||
{
|
{
|
||||||
register caddr_t where;
|
register caddr_t where;
|
||||||
u_int i;
|
u_long i;
|
||||||
register int len;
|
register long len;
|
||||||
|
|
||||||
where = rstrm->in_base;
|
where = rstrm->in_base;
|
||||||
i = (u_int)rstrm->in_boundry % BYTES_PER_XDR_UNIT;
|
i = (u_long)rstrm->in_boundry % BYTES_PER_XDR_UNIT;
|
||||||
where += i;
|
where += i;
|
||||||
len = rstrm->in_size - i;
|
len = rstrm->in_size - i;
|
||||||
if ((len = (*(rstrm->readit))(rstrm->tcp_handle, where, len)) == -1)
|
if ((len = (*(rstrm->readit))(rstrm->tcp_handle, where, len)) == -1)
|
||||||
@ -522,17 +522,17 @@ get_input_bytes(rstrm, addr, len)
|
|||||||
register caddr_t addr;
|
register caddr_t addr;
|
||||||
register int len;
|
register int len;
|
||||||
{
|
{
|
||||||
register int current;
|
register long current;
|
||||||
|
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
current = (int)rstrm->in_boundry - (int)rstrm->in_finger;
|
current = (long)rstrm->in_boundry - (long)rstrm->in_finger;
|
||||||
if (current == 0) {
|
if (current == 0) {
|
||||||
if (! fill_input_buf(rstrm))
|
if (! fill_input_buf(rstrm))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
current = (len < current) ? len : current;
|
current = (len < current) ? len : current;
|
||||||
bcopy(rstrm->in_finger, addr, current);
|
memcpy(addr, rstrm->in_finger, current);
|
||||||
rstrm->in_finger += current;
|
rstrm->in_finger += current;
|
||||||
addr += current;
|
addr += current;
|
||||||
len -= current;
|
len -= current;
|
||||||
@ -544,7 +544,7 @@ static bool_t /* next two bytes of the input stream are treated as a header */
|
|||||||
set_input_fragment(rstrm)
|
set_input_fragment(rstrm)
|
||||||
register RECSTREAM *rstrm;
|
register RECSTREAM *rstrm;
|
||||||
{
|
{
|
||||||
u_long header;
|
u_int32_t header;
|
||||||
|
|
||||||
if (! get_input_bytes(rstrm, (caddr_t)&header, sizeof(header)))
|
if (! get_input_bytes(rstrm, (caddr_t)&header, sizeof(header)))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
@ -559,10 +559,10 @@ skip_input_bytes(rstrm, cnt)
|
|||||||
register RECSTREAM *rstrm;
|
register RECSTREAM *rstrm;
|
||||||
long cnt;
|
long cnt;
|
||||||
{
|
{
|
||||||
register int current;
|
register long current;
|
||||||
|
|
||||||
while (cnt > 0) {
|
while (cnt > 0) {
|
||||||
current = (int)rstrm->in_boundry - (int)rstrm->in_finger;
|
current = (long)rstrm->in_boundry - (long)rstrm->in_finger;
|
||||||
if (current == 0) {
|
if (current == 0) {
|
||||||
if (! fill_input_buf(rstrm))
|
if (! fill_input_buf(rstrm))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
@ -5,32 +5,32 @@
|
|||||||
* may copy or modify Sun RPC without charge, but are not authorized
|
* may copy or modify Sun RPC without charge, but are not authorized
|
||||||
* to license or distribute it to anyone else except as part of a product or
|
* to license or distribute it to anyone else except as part of a product or
|
||||||
* program developed by the user.
|
* program developed by the user.
|
||||||
*
|
*
|
||||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||||
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||||
*
|
*
|
||||||
* Sun RPC is provided with no support and without any obligation on the
|
* Sun RPC is provided with no support and without any obligation on the
|
||||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||||
* modification or enhancement.
|
* modification or enhancement.
|
||||||
*
|
*
|
||||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||||
* OR ANY PART THEREOF.
|
* OR ANY PART THEREOF.
|
||||||
*
|
*
|
||||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||||
* or profits or other special, indirect and consequential damages, even if
|
* or profits or other special, indirect and consequential damages, even if
|
||||||
* Sun has been advised of the possibility of such damages.
|
* Sun has been advised of the possibility of such damages.
|
||||||
*
|
*
|
||||||
* Sun Microsystems, Inc.
|
* Sun Microsystems, Inc.
|
||||||
* 2550 Garcia Avenue
|
* 2550 Garcia Avenue
|
||||||
* Mountain View, California 94043
|
* Mountain View, California 94043
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
/*static char *sccsid = "from: @(#)xdr_reference.c 1.11 87/08/11 SMI";*/
|
/*static char *sccsid = "from: @(#)xdr_reference.c 1.11 87/08/11 SMI";*/
|
||||||
/*static char *sccsid = "from: @(#)xdr_reference.c 2.1 88/07/29 4.0 RPCSRC";*/
|
/*static char *sccsid = "from: @(#)xdr_reference.c 2.1 88/07/29 4.0 RPCSRC";*/
|
||||||
static char *rcsid = "$Id: xdr_reference.c,v 1.1 1993/10/27 05:41:13 paul Exp $";
|
static char *rcsid = "$Id: xdr_reference.c,v 1.4 1996/12/30 14:07:11 peter Exp $";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -43,10 +43,12 @@ static char *rcsid = "$Id: xdr_reference.c,v 1.1 1993/10/27 05:41:13 paul Exp $"
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <rpc/types.h>
|
#include <rpc/types.h>
|
||||||
#include <rpc/xdr.h>
|
#include <rpc/xdr.h>
|
||||||
|
|
||||||
#define LASTUNSIGNED ((u_int)0-1)
|
#define LASTUNSIGNED ((u_int) 0-1)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XDR an indirect pointer
|
* XDR an indirect pointer
|
||||||
@ -79,7 +81,7 @@ xdr_reference(xdrs, pp, size, proc)
|
|||||||
"xdr_reference: out of memory\n");
|
"xdr_reference: out of memory\n");
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
bzero(loc, (int)size);
|
memset(loc, 0, (int)size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
163
lib/libc/xdr/xdr_sizeof.c
Normal file
163
lib/libc/xdr/xdr_sizeof.c
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
/*
|
||||||
|
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||||
|
* unrestricted use provided that this legend is included on all tape
|
||||||
|
* media and as a part of the software program in whole or part. Users
|
||||||
|
* may copy or modify Sun RPC without charge, but are not authorized
|
||||||
|
* to license or distribute it to anyone else except as part of a product or
|
||||||
|
* program developed by the user.
|
||||||
|
*
|
||||||
|
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||||
|
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||||
|
*
|
||||||
|
* Sun RPC is provided with no support and without any obligation on the
|
||||||
|
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||||
|
* modification or enhancement.
|
||||||
|
*
|
||||||
|
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||||
|
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||||
|
* OR ANY PART THEREOF.
|
||||||
|
*
|
||||||
|
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||||
|
* or profits or other special, indirect and consequential damages, even if
|
||||||
|
* Sun has been advised of the possibility of such damages.
|
||||||
|
*
|
||||||
|
* Sun Microsystems, Inc.
|
||||||
|
* 2550 Garcia Avenue
|
||||||
|
* Mountain View, California 94043
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* xdr_sizeof.c
|
||||||
|
*
|
||||||
|
* Copyright 1990 Sun Microsystems, Inc.
|
||||||
|
*
|
||||||
|
* General purpose routine to see how much space something will use
|
||||||
|
* when serialized using XDR.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <rpc/types.h>
|
||||||
|
#include <rpc/xdr.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/* ARGSUSED */
|
||||||
|
static bool_t
|
||||||
|
x_putlong(xdrs, longp)
|
||||||
|
XDR *xdrs;
|
||||||
|
long *longp;
|
||||||
|
{
|
||||||
|
xdrs->x_handy += BYTES_PER_XDR_UNIT;
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ARGSUSED */
|
||||||
|
static bool_t
|
||||||
|
x_putbytes(xdrs, bp, len)
|
||||||
|
XDR *xdrs;
|
||||||
|
char *bp;
|
||||||
|
int len;
|
||||||
|
{
|
||||||
|
xdrs->x_handy += len;
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static u_int
|
||||||
|
x_getpostn(xdrs)
|
||||||
|
XDR *xdrs;
|
||||||
|
{
|
||||||
|
return (xdrs->x_handy);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ARGSUSED */
|
||||||
|
static bool_t
|
||||||
|
x_setpostn(xdrs, pos)
|
||||||
|
XDR *xdrs;
|
||||||
|
u_int pos;
|
||||||
|
{
|
||||||
|
/* This is not allowed */
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t *
|
||||||
|
x_inline(xdrs, len)
|
||||||
|
XDR *xdrs;
|
||||||
|
int len;
|
||||||
|
{
|
||||||
|
if (len == 0) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
if (xdrs->x_op != XDR_ENCODE) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
if (len < (int) xdrs->x_base) {
|
||||||
|
/* x_private was already allocated */
|
||||||
|
xdrs->x_handy += len;
|
||||||
|
return ((int32_t *) xdrs->x_private);
|
||||||
|
} else {
|
||||||
|
/* Free the earlier space and allocate new area */
|
||||||
|
if (xdrs->x_private)
|
||||||
|
free(xdrs->x_private);
|
||||||
|
if ((xdrs->x_private = (caddr_t) malloc(len)) == NULL) {
|
||||||
|
xdrs->x_base = 0;
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
xdrs->x_base = (caddr_t) len;
|
||||||
|
xdrs->x_handy += len;
|
||||||
|
return ((int32_t *) xdrs->x_private);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
harmless()
|
||||||
|
{
|
||||||
|
/* Always return FALSE/NULL, as the case may be */
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
x_destroy(xdrs)
|
||||||
|
XDR *xdrs;
|
||||||
|
{
|
||||||
|
xdrs->x_handy = 0;
|
||||||
|
xdrs->x_base = 0;
|
||||||
|
if (xdrs->x_private) {
|
||||||
|
free(xdrs->x_private);
|
||||||
|
xdrs->x_private = NULL;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long
|
||||||
|
xdr_sizeof(func, data)
|
||||||
|
xdrproc_t func;
|
||||||
|
void *data;
|
||||||
|
{
|
||||||
|
XDR x;
|
||||||
|
struct xdr_ops ops;
|
||||||
|
bool_t stat;
|
||||||
|
/* to stop ANSI-C compiler from complaining */
|
||||||
|
typedef bool_t (* dummyfunc1)(XDR *, long *);
|
||||||
|
typedef bool_t (* dummyfunc2)(XDR *, caddr_t, u_int);
|
||||||
|
|
||||||
|
ops.x_putlong = x_putlong;
|
||||||
|
ops.x_putbytes = x_putbytes;
|
||||||
|
ops.x_inline = x_inline;
|
||||||
|
ops.x_getpostn = x_getpostn;
|
||||||
|
ops.x_setpostn = x_setpostn;
|
||||||
|
ops.x_destroy = x_destroy;
|
||||||
|
|
||||||
|
/* the other harmless ones */
|
||||||
|
ops.x_getlong = (dummyfunc1) harmless;
|
||||||
|
ops.x_getbytes = (dummyfunc2) harmless;
|
||||||
|
|
||||||
|
x.x_op = XDR_ENCODE;
|
||||||
|
x.x_ops = &ops;
|
||||||
|
x.x_handy = 0;
|
||||||
|
x.x_private = (caddr_t) NULL;
|
||||||
|
x.x_base = (caddr_t) 0;
|
||||||
|
|
||||||
|
stat = func(&x, data);
|
||||||
|
if (x.x_private)
|
||||||
|
free(x.x_private);
|
||||||
|
return (stat == TRUE ? (unsigned) x.x_handy: 0);
|
||||||
|
}
|
@ -5,23 +5,23 @@
|
|||||||
* may copy or modify Sun RPC without charge, but are not authorized
|
* may copy or modify Sun RPC without charge, but are not authorized
|
||||||
* to license or distribute it to anyone else except as part of a product or
|
* to license or distribute it to anyone else except as part of a product or
|
||||||
* program developed by the user.
|
* program developed by the user.
|
||||||
*
|
*
|
||||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||||
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||||
*
|
*
|
||||||
* Sun RPC is provided with no support and without any obligation on the
|
* Sun RPC is provided with no support and without any obligation on the
|
||||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||||
* modification or enhancement.
|
* modification or enhancement.
|
||||||
*
|
*
|
||||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||||
* OR ANY PART THEREOF.
|
* OR ANY PART THEREOF.
|
||||||
*
|
*
|
||||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||||
* or profits or other special, indirect and consequential damages, even if
|
* or profits or other special, indirect and consequential damages, even if
|
||||||
* Sun has been advised of the possibility of such damages.
|
* Sun has been advised of the possibility of such damages.
|
||||||
*
|
*
|
||||||
* Sun Microsystems, Inc.
|
* Sun Microsystems, Inc.
|
||||||
* 2550 Garcia Avenue
|
* 2550 Garcia Avenue
|
||||||
* Mountain View, California 94043
|
* Mountain View, California 94043
|
||||||
@ -30,7 +30,7 @@
|
|||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
/*static char *sccsid = "from: @(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro";*/
|
/*static char *sccsid = "from: @(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro";*/
|
||||||
/*static char *sccsid = "from: @(#)xdr_stdio.c 2.1 88/07/29 4.0 RPCSRC";*/
|
/*static char *sccsid = "from: @(#)xdr_stdio.c 2.1 88/07/29 4.0 RPCSRC";*/
|
||||||
static char *rcsid = "$Id: xdr_stdio.c,v 1.1 1993/10/27 05:41:14 paul Exp $";
|
static char *rcsid = "$Id: xdr_stdio.c,v 1.3 1996/12/30 14:07:11 peter Exp $";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -53,7 +53,7 @@ static bool_t xdrstdio_getbytes();
|
|||||||
static bool_t xdrstdio_putbytes();
|
static bool_t xdrstdio_putbytes();
|
||||||
static u_int xdrstdio_getpos();
|
static u_int xdrstdio_getpos();
|
||||||
static bool_t xdrstdio_setpos();
|
static bool_t xdrstdio_setpos();
|
||||||
static long * xdrstdio_inline();
|
static int32_t *xdrstdio_inline();
|
||||||
static void xdrstdio_destroy();
|
static void xdrstdio_destroy();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -99,7 +99,7 @@ xdrstdio_destroy(xdrs)
|
|||||||
{
|
{
|
||||||
(void)fflush((FILE *)xdrs->x_private);
|
(void)fflush((FILE *)xdrs->x_private);
|
||||||
/* xx should we close the file ?? */
|
/* xx should we close the file ?? */
|
||||||
};
|
}
|
||||||
|
|
||||||
static bool_t
|
static bool_t
|
||||||
xdrstdio_getlong(xdrs, lp)
|
xdrstdio_getlong(xdrs, lp)
|
||||||
@ -107,11 +107,10 @@ xdrstdio_getlong(xdrs, lp)
|
|||||||
register long *lp;
|
register long *lp;
|
||||||
{
|
{
|
||||||
|
|
||||||
if (fread((caddr_t)lp, sizeof(long), 1, (FILE *)xdrs->x_private) != 1)
|
if (fread((caddr_t)lp, sizeof(int32_t), 1,
|
||||||
|
(FILE *)xdrs->x_private) != 1)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
#ifndef mc68000
|
*lp = (long)ntohl((int32_t)*lp);
|
||||||
*lp = ntohl(*lp);
|
|
||||||
#endif
|
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,11 +120,10 @@ xdrstdio_putlong(xdrs, lp)
|
|||||||
long *lp;
|
long *lp;
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifndef mc68000
|
long mycopy = (long)htonl((int32_t)*lp);
|
||||||
long mycopy = htonl(*lp);
|
|
||||||
lp = &mycopy;
|
if (fwrite((caddr_t)&mycopy, sizeof(int32_t), 1,
|
||||||
#endif
|
(FILE *)xdrs->x_private) != 1)
|
||||||
if (fwrite((caddr_t)lp, sizeof(long), 1, (FILE *)xdrs->x_private) != 1)
|
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
@ -163,16 +161,16 @@ xdrstdio_getpos(xdrs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool_t
|
static bool_t
|
||||||
xdrstdio_setpos(xdrs, pos)
|
xdrstdio_setpos(xdrs, pos)
|
||||||
XDR *xdrs;
|
XDR *xdrs;
|
||||||
u_int pos;
|
u_int pos;
|
||||||
{
|
{
|
||||||
|
|
||||||
return ((fseek((FILE *)xdrs->x_private, (long)pos, 0) < 0) ?
|
return ((fseek((FILE *)xdrs->x_private, (long)pos, 0) < 0) ?
|
||||||
FALSE : TRUE);
|
FALSE : TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static long *
|
static int32_t *
|
||||||
xdrstdio_inline(xdrs, len)
|
xdrstdio_inline(xdrs, len)
|
||||||
XDR *xdrs;
|
XDR *xdrs;
|
||||||
u_int len;
|
u_int len;
|
||||||
|
Loading…
Reference in New Issue
Block a user