A filter primitive that translates between variable-length arrays
and their corresponding external representations.
The argument
arrpis the address of the pointer to the array, while
sizepis the address of the element count of the array;
this element count cannot exceed
maxsize.
The argument
elsizeis the
sizeofeach of the array's elements, and
elprocis an XDR filter that translates between
the array elements' C form, and their external
representation.
This routine returns one if it succeeds, zero otherwise.

bool_t xdr_bool(XDR *xdrs, bool_t *bp);

A filter primitive that translates between booleans (C
integers)
and their external representations.
When encoding data, this
filter produces values of either one or zero.
This routine returns one if it succeeds, zero otherwise.

A filter primitive that translates between counted byte
strings and their external representations.
The argument
spis the address of the string pointer.
The length of the
string is located at address
sizep;
strings cannot be longer than
maxsize.
This routine returns one if it succeeds, zero otherwise.

bool_t xdr_char(XDR *xdrs, char *cp);

A filter primitive that translates between C characters
and their external representations.
This routine returns one if it succeeds, zero otherwise.
Note: encoded characters are not packed, and occupy 4 bytes each.
For arrays of characters, it is worthwhile to
consider
xdr_bytes(),
xdr_opaque()
or
xdr_string().

void xdr_destroy(XDR *xdrs);

A macro that invokes the destroy routine associated with the XDR stream,
xdrs.
Destruction usually involves freeing private data structures
associated with the stream.
Using
xdrsafter invoking
xdr_destroy()
is undefined.

bool_t xdr_double(XDR *xdrs, double *dp);

A filter primitive that translates between C
doubleprecision numbers and their external representations.
This routine returns one if it succeeds, zero otherwise.

bool_t xdr_enum(XDR *xdrs, enum_t *ep);

A filter primitive that translates between C
enums
(actually integers) and their external representations.
This routine returns one if it succeeds, zero otherwise.

bool_t xdr_float(XDR *xdrs, float *fp);

A filter primitive that translates between C
floats
and their external representations.
This routine returns one if it succeeds, zero otherwise.

void xdr_free(xdrproc_t proc, char *objp);

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
notfreed, but what it points to
isfreed (recursively).

unsigned int xdr_getpos(XDR *xdrs);

A macro that invokes the get-position routine
associated with the XDR stream,
xdrs.
The routine returns an unsigned integer,
which indicates the position of the XDR byte stream.
A desirable feature of XDR
streams is that simple arithmetic works with this number,
although the XDR stream instances need not guarantee this.

long *xdr_inline(XDR *xdrs, int len);

A macro that invokes the inline routine associated with the XDR stream,
xdrs.
The routine returns a pointer
to a contiguous piece of the stream's buffer;
lenis the byte length of the desired buffer.
Note: pointer is cast to
long *.

Warning:
xdr_inline()
may return NULL (0)
if it cannot allocate a contiguous piece of a buffer.
Therefore the behavior may vary among stream instances;
it exists for the sake of efficiency.

bool_t xdr_int(XDR *xdrs, int *ip);

A filter primitive that translates between C integers
and their external representations.
This routine returns one if it succeeds, zero otherwise.

bool_t xdr_long(XDR *xdrs, long *lp);

A filter primitive that translates between C
longintegers and their external representations.
This routine returns one if it succeeds, zero otherwise.

This routine initializes the XDR stream object pointed to by
xdrs.
The stream's data is written to, or read from,
a chunk of memory at location
addrwhose length is no more than
sizebytes long.
The
opdetermines the direction of the XDR stream (either
XDR_ENCODE,
XDR_DECODE,
or
XDR_FREE).

bool_t xdr_opaque(XDR *xdrs, char *cp, unsigned int cnt);

A filter primitive that translates between fixed size opaque data
and its external representation.
The argument
cpis the address of the opaque object, and
cntis its size in bytes.
This routine returns one if it succeeds, zero otherwise.

This routine initializes the XDR stream object pointed to by
xdrs.
The stream's data is written to a buffer of size
sendsize;
a value of zero indicates the system should use a suitable default.
The stream's data is read from a buffer of size
recvsize;
it too can be set to a suitable default by passing a zero value.
When a stream's output buffer is full,
writeitis called.
Similarly, when a stream's input buffer is empty,
readitis called.
The behavior of these two routines is similar to
the system calls
read(2)
and
write(2),
except that
handleis passed to the former routines as the first argument.
Note: the XDR stream's
opfield must be set by the caller.

Warning: to read from an XDR stream created by this API,
you'll need to call
xdrrec_skiprecord()
first before calling any other XDR APIs.
This inserts additional bytes in the stream to provide
record boundary information.
Also, XDR streams created with different
xdr*_createAPIs are not compatible for the same reason.

bool_t xdrrec_endofrecord(XDR *xdrs, int sendnow);

This routine can be invoked only on streams created by
xdrrec_create().
The data in the output buffer is marked as a completed record,
and the output buffer is optionally written out if
sendnowis nonzero.
This routine returns one if it succeeds, zero otherwise.

bool_t xdrrec_eof(XDR *xdrs);

This routine can be invoked only on streams created by
xdrrec_create().
After consuming the rest of the current record in the stream,
this routine returns one if the stream has no more input,
zero otherwise.

bool_t xdrrec_skiprecord(XDR *xdrs);

This routine can be invoked only on
streams created by
xdrrec_create().
It tells the XDR implementation that the rest of the current record
in the stream's input buffer should be discarded.
This routine returns one if it succeeds, zero otherwise.

A primitive that provides pointer chasing within structures.
The argument
ppis the address of the pointer;
sizeis the
sizeofthe structure that
*pppoints to; and
procis an XDR procedure that filters the structure
between its C form and its external representation.
This routine returns one if it succeeds, zero otherwise.

Warning: this routine does not understand null pointers.
Use
xdr_pointer()
instead.

xdr_setpos(XDR *xdrs, unsigned int pos);

A macro that invokes the set position routine associated with
the XDR stream
xdrs.
The argument
posis a position value obtained from
xdr_getpos().
This routine returns one if the XDR stream could be repositioned,
and zero otherwise.

Warning: it is difficult to reposition some types of XDR
streams, so this routine may fail with one
type of stream and succeed with another.

bool_t xdr_short(XDR *xdrs, short *sp);

A filter primitive that translates between C
shortintegers and their external representations.
This routine returns one if it succeeds, zero otherwise.

void xdrstdio_create(XDR *xdrs, FILE *file, enum xdr_op op);

This routine initializes the XDR stream object pointed to by
xdrs.
The XDR stream data is written to, or read from, the
stdiostream
file.
The argument
opdetermines the direction of the XDR stream (either
XDR_ENCODE,
XDR_DECODE,
or
XDR_FREE).

Warning: the destroy routine associated with such XDR streams calls
fflush(3)
on the
filestream, but never
fclose(3).

bool_t xdr_string(XDR *xdrs, char **sp, unsigned int maxsize);

A filter primitive that translates between C strings and
their corresponding external representations.
Strings cannot be longer than
maxsize.
Note:
spis the address of the string's pointer.
This routine returns one if it succeeds, zero otherwise.

bool_t xdr_u_char(XDR *xdrs, unsigned char *ucp);

A filter primitive that translates between
unsignedC characters and their external representations.
This routine returns one if it succeeds, zero otherwise.

bool_t xdr_u_int(XDR *xdrs, unsigned *up);

A filter primitive that translates between C
unsignedintegers and their external representations.
This routine returns one if it succeeds, zero otherwise.

bool_t xdr_u_long(XDR *xdrs, unsigned long *ulp);

A filter primitive that translates between C
unsigned longintegers and their external representations.
This routine returns one if it succeeds, zero otherwise.

bool_t xdr_u_short(XDR *xdrs, unsigned short *usp);

A filter primitive that translates between C
unsigned shortintegers and their external representations.
This routine returns one if it succeeds, zero otherwise.

A filter primitive that translates between a discriminated C
unionand its corresponding external representation.
It first
translates the discriminant of the union located at
dscmp.
This discriminant is always an
enum_t.
Next the union located at
unpis translated.
The argument
choicesis a pointer to an array of
xdr_discrim()
structures.
Each structure contains an ordered pair of
[value,proc].
If the union's discriminant is equal to the associated
value,
then the
procis called to translate the union.
The end of the
xdr_discrim()
structure array is denoted by a routine of value NULL.
If the discriminant is not found in the
choicesarray, then the
defaultarmprocedure is called (if it is not NULL).
Returns one if it succeeds, zero otherwise.

A filter primitive that translates between fixed-length arrays
and their corresponding external representations.
The argument
arrpis the address of the pointer to the array, while
sizeis the element count of the array.
The argument
elsizeis the
sizeofeach of the array's elements, and
elprocis an XDR filter that translates between
the array elements' C form, and their external
representation.
This routine returns one if it succeeds, zero otherwise.

bool_t xdr_void(void);

This routine always returns one.
It may be passed to RPC routines that require a function argument,
where nothing is to be done.

bool_t xdr_wrapstring(XDR *xdrs, char **sp);

A primitive that calls
xdr_string(xdrs, sp,MAXUN.UNSIGNED );where
MAXUN.UNSIGNEDis the maximum value of an unsigned integer.
xdr_wrapstring()
is handy because the RPC package passes a maximum of two XDR
routines as arguments, and
xdr_string(),
one of the most frequently used primitives, requires three.
Returns one if it succeeds, zero otherwise.

ATTRIBUTES

For an explanation of the terms used in this section, see
attributes(7).