xdr_complex(3N)xdr_complex(3N)NAME
xdr_complex, xdr_array, xdr_bytes, xdr_opaque, xdr_pointer, xdr_refer‐
ence, xdr_string, xdr_union, xdr_vector, xdr_wrapstring - library rou‐
tines for external data representation
SYNOPSIS
#include <rpc/xdr.h>
DESCRIPTION
XDR library routines allow C programmers to describe complex data
structures in a machine-independent fashion. Protocols such as remote
procedure calls (RPC) use these routines to describe the format of the
data. These routines are the XDR library routines for complex data
structures. They require the creation of XDR stream (see xdr_cre‐
ate(3N)).
Routines
See rpc(3N) for the definition of the data structure. Note that any
buffers passed to the XDR routines must be properly aligned. It is sug‐
gested that be used to allocate these buffers or that the programmer
insure that the buffer address is divisible evenly by four.
translates between variable-length arrays
and their corresponding external representations. The parameter
arrp is the address of the pointer to the array, while sizep is
the address of the element count of the array; this element
count cannot exceed maxsize. The parameter elsize is the size
of each of the array's elements, and elproc is an XDR routine
that translates between the array elements' C form and their
external representation. If is null when decoding, allocates
memory and points to it. This routine returns if it succeeds,
otherwise.
translates between counted byte
strings and their external representations. The parameter sp is
the address of the string pointer. The length of the string is
located at address sizep; strings cannot be longer than maxsize.
If is null when decoding, allocates memory and points to it.
This routine returns if it succeeds, otherwise.
translates between fixed size opaque data
and its external representation. The parameter cp is the
address of the opaque object, and cnt is its size in bytes.
This routine returns if it succeeds, otherwise.
Like except that it serializes pointers, whereas does not. Thus, can
represent recursive data structures, such as binary trees or
linked lists. If is null when decoding, allocates memory and
points to it.
provides pointer chasing within structures.
The parameter pp is the address of the pointer; size is the the
structure that *pp points to; and proc is an XDR procedure that
translates the structure between its C form and its external
representation. If is null when decoding, allocates memory and
points to it. This routine returns if it succeeds, otherwise.
Warning: this routine does not understand pointers. Use
instead.
translates between C strings and their
corresponding external representations. Strings cannot be
longer than maxsize. Note: sp is the address of the string's
pointer. If is null when decoding, allocates memory and points
to it. This routine returns if it succeeds, otherwise. Note:
can be used to send an empty string (""), but not a NULL string.
translates between a discriminated C
and its corresponding external representation. It first trans‐
lates the discriminant of the union located at dscmp. This dis‐
criminant is always an Next the union located at unp is trans‐
lated. The parameter choices is a pointer to an array of struc‐
tures. Each structure contains an ordered pair of [value,proc].
If the union's discriminant is equal to the associated value,
then the proc is called to translate the union. The end of the
structure array is denoted by a routine of value If the discrim‐
inant is not found in the choices array, then the defaultarm
procedure is called (if it is not Returns if it succeeds, other‐
wise.
translates between fixed-length
arrays and their corresponding external representations. The
parameter arrp is the address of the pointer to the array, while
size is the element count of the array. The parameter elsize is
the each of the array's elements, and elproc is an XDR routine
that translates between the array elements' C form and their
external representation. This routine returns if it succeeds,
otherwise.
A routine that calls
where maxuint is the maximum value of an unsigned integer.
Many routines, such as and take a function pointer of type which
takes two arguments. one of the most frequently used routines,
requires three arguments, while only requires two. For these
routines, is desirable. This routine returns if it succeeds,
otherwise.
MULTITHREAD USAGE
Thread Safe: Yes
Cancel Safe: Yes
Fork Safe: No
Async-cancel Safe: No
Async-signal Safe: No
These functions can be called safely in a multithreaded environment.
They may be cancellation points in that they call functions that are
cancel points.
In a multithreaded environment, these functions are not safe to be
called by a child process after and before These functions should not
be called by a multithreaded application that support asynchronous can‐
cellation or asynchronous signals.
SEE ALSOrpc(3N), xdr_admin(3N), xdr_create(3N), xdr_simple(3N).
xdr_complex(3N)