'\"macro stdmacro
.if n .pH g3n.xdr_simple @(#)xdr_simple	40.5 of 10/10/89
.\" Copyright 1989 AT&T
'\"macro stdmacro
.nr X
.if \nX=0 .ds x} xdr_simple 3N "" "\&"
.if \nX=1 .ds x} xdr_simple 3N ""
.if \nX=2 .ds x} xdr_simple 3N "" "\&"
.if \nX=3 .ds x} xdr_simple "" "" "\&"
.TH \*(x}
.SH NAME
.na
\f4xdr_simple\fP:  \f4 xdr_bool\f1, \f4xdr_char\f1, \f4xdr_double\f1, \f4xdr_enum\f1, \f4xdr_float\f1, \f4xdr_free\f1, \f4xdr_int\f1, \f4xdr_long\f1, \f4xdr_short\f1, \f4xdr_u_char\f1, \f4xdr_u_long\f1, \f4xdr_u_short\f1, \f4xdr_void\f1 \- library routines for external data representation
.ad
.SH DESCRIPTION
XDR library routines allow C programmers to describe
simple data structures in a machine-independent fashion.
Protocols such as remote procedure calls (RPC)
use these routines to describe the format of the data.
.P
These routines require the creation of XDR streams
[see \f4xdr_create\fP(3N)].
.SS Routines
See \f4rpc\fP(3N) for the definition of the 
\f4XDR\f1
data structure.
.br
.P
.ft 4
.nf
#include <rpc/xdr.h>
.fi
.ft 1
.br
.if t .ne 8
.P
.ft 4
.nf
.sp .5
bool_t
xdr_bool(XDR *xdrs, bool_t *bp);
.fi
.ft 1
.IP
\f4xdr_bool\f1
translates between booleans
(C integers)
and their external representations.
When encoding data,
this filter produces values of either \f41\f1 or \f40\f1.
This routine returns \f41\f1 if it succeeds,
\f40\f1 otherwise.
.br
.if t .ne 7
.P
.ft 4
.nf
.sp .5
bool_t
xdr_char(XDR *xdrs, char *cp);
.fi
.ft 1
.IP
\f4xdr_char\f1
translates between C characters
and their external representations.
This routine returns \f41\f1 if it succeeds,
\f40\f1 otherwise.
Note:
encoded characters are not packed,
and occupy 4 bytes each.
For arrays of characters,
it is worthwhile to consider
\f4xdr_bytes\f1,
\f4xdr_opaque\f1
or
\f4xdr_string\f1
[see
\f4xdr_bytes\f1,
\f4xdr_opaque\f1
and
\f4xdr_string\f1
in \f4xdr_complex\fP(3N)].
.br
.if t .ne 7
.P
.ft 4
.nf
.sp .5
bool_t
xdr_double(XDR *xdrs, double *dp);
.fi
.ft 1
.IP
\f4xdr_double\f1
translates between C
\f4double\f1
precision numbers and their external representations.
This routine returns \f41\f1 if it succeeds,
\f40\f1 otherwise.
.br
.if t .ne 7
.P
.ft 4
.nf
.sp .5
bool_t
xdr_enum(XDR *xdrs, enum_t *ep);
.fi
.ft 1
.IP
\f4xdr_enum\f1
translates between C
\f4enum\f1s
(actually integers) and their external representations.
This routine returns \f41\f1 if it succeeds,
\f40\f1 otherwise.
.br
.if t .ne 8
.P
.ft 4
.nf
.sp .5
bool_t
xdr_float(XDR *xdrs, float *fp);
.fi
.ft 1
.IP
\f4xdr_float\f1
translates between C
\f4float\f1s
and their external representations.
This routine returns \f41\f1 if it succeeds,
\f40\f1 otherwise.
.br
.if t .ne 5
.P
.ft 4
.nf
.sp .5
void
xdr_free(xdrproc_t proc, char *objp);
.fi
.ft 1
.IP
Generic freeing routine.
The first argument is the XDR
routine for the object being freed.
The second argument
is a pointer to the object itself.
Note:
the pointer passed
to this routine is
not
freed,
but what it points to
is
freed (recursively).
.br
.if t .ne 7
.P
.ft 4
.nf
.sp .5
bool_t
xdr_int(XDR *xdrs, int *ip);
.fi
.ft 1
.IP
\f4xdr_int\f1
translates between C integers
and their external representations.
This routine returns \f41\f1 if it succeeds,
\f40\f1 otherwise.
.br
.if t .ne 7
.P
.ft 4
.nf
.sp .5
bool_t
xdr_long(XDR *xdrs, long *lp);
.fi
.ft 1
.IP
\f4xdr_long\f1
translates between C
\f4long\f1
integers and their external representations.
This routine returns \f41\f1 if it succeeds,
\f40\f1 otherwise.
.br
.if t .ne 8
.P
.ft 4
.nf
.sp .5
bool_t
xdr_short(XDR *xdrs, short *sp);
.fi
.ft 1
.IP
\f4xdr_short\f1
translates between C
\f4short\f1
integers and their external representations.
This routine returns \f41\f1 if it succeeds,
\f40\f1 otherwise.
.br
.if t .ne 8
.P
.ft 4
.nf
.sp .5
bool_t
xdr_u_char(XDR *xdrs, char *ucp);
.fi
.ft 1
.IP
\f4xdr_u_char\f1
translates between
\f4unsigned\f1
C characters and their external representations.
This routine returns \f41\f1 if it succeeds,
\f40\f1 otherwise.
.br
.if t .ne 7
.P
.ft 4
.nf
.sp .5
bool_t
xdr_u_long(XDR *xdrs, unsigned long *ulp);
.fi
.ft 1
.IP
\f4xdr_u_long\f1
translates between C
\f4unsigned long\f1
integers and their external representations.
This routine returns \f41\f1 if it succeeds,
\f40\f1 otherwise.
.br
.if t .ne 7
.P
.ft 4
.nf
.sp .5
bool_t
xdr_u_short(XDR *xdrs, unsigned short *usp);
.fi
.ft 1
.IP
\f4xdr_u_short\f1
translates between C
\f4unsigned short\f1
integers and their external representations.
This routine returns \f41\f1 if it succeeds,
\f40\f1 otherwise.
.if t .ne 5
.P
.ft 4
.nf
.sp .5
bool_t
xdr_void(void);
.fi
.ft 1
.IP
This routine always returns \f41\f1.
It may be passed to RPC
routines that require a function parameter,
where nothing is to be done.
.SH SEE ALSO
.na
\f4rpc\fP(3N),
\f4xdr_admin\fP(3N),
\f4xdr_complex\fP(3N),
\f4xdr_create\fP(3N).
.ad
