.\" @(#)xdr.3n 2.2 88/08/03 4.0 RPCSRC; from 1.16 88/03/14 SMI
.TH XDR 3N "16 February 1988"
xdr \- library routines for external data representation
.SH SYNOPSIS AND DESCRIPTION
These routines allow C programmers to describe
arbitrary data structures in a machine-independent fashion.
Data for remote procedure calls are transmitted using these
xdr_array(xdrs, arrp, sizep, maxsize, elsize, elproc)
u_int *sizep, maxsize, elsize;
A filter primitive that translates between variable-length
and their corresponding external representations. The
is the address of the pointer to the array, while
is the address of the element count of the array;
this element count cannot exceed
each of the array's elements, and
filter that translates between
the array elements' C form, and their external
This routine returns one if it succeeds, zero otherwise.
A filter primitive that translates between booleans (C
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.
xdr_bytes(xdrs, sp, sizep, maxsize)
A filter primitive that translates between counted byte
strings and their external representations.
is the address of the string pointer. The length of the
string is located at address
strings cannot be longer than
This routine returns one if it succeeds, zero otherwise.
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
A macro that invokes the destroy routine associated with the
Destruction usually involves freeing private data structures
associated with the stream. Using
A filter primitive that translates between C
precision numbers and their external representations.
This routine returns one if it succeeds, zero otherwise.
A filter primitive that translates between C
(actually integers) and their external representations.
This routine returns one if it succeeds, zero otherwise.
A filter primitive that translates between C
and their external representations.
This routine returns one if it succeeds, zero otherwise.
Generic freeing routine. The first argument is the
routine for the object being freed. The second argument
is a pointer to the object itself. Note: the pointer passed
freed, but what it points to
A macro that invokes the get-position routine
The routine returns an unsigned integer,
which indicates the position of the
streams is that simple arithmetic works with this number,
stream instances need not guarantee this.
A macro that invokes the in-line routine associated with the
The routine returns a pointer
to a contiguous piece of the stream's buffer;
is the byte length of the desired buffer.
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.
A filter primitive that translates between C integers
and their external representations.
This routine returns one if it succeeds, zero otherwise.
A filter primitive that translates between C
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
xdrmem_create(xdrs, addr, size, op)
This routine initializes the
stream object pointed to by
The stream's data is written to, or read from,
a chunk of memory at location
whose length is no more than
determines the direction of the
xdr_opaque(xdrs, cp, cnt)
A filter primitive that translates between fixed size opaque
and its external representation.
is the address of the opaque object, and
This routine returns one if it succeeds, zero otherwise.
xdr_pointer(xdrs, objpp, objsize, xdrobj)
execpt that it serializes
recursive data structures, such as binary trees or
xdrrec_create(xdrs, sendsize, recvsize, handle, readit, writeit)
u_int sendsize, recvsize;
int (*readit) (\|), (*writeit) (\|);
This routine initializes the
stream object pointed to by
The stream's data is written to a buffer of size
a value of zero indicates the system should use a suitable
default. The stream's data is read from a buffer of size
it too can be set to a suitable default by passing a zero
When a stream's output buffer is full,
is called. Similarly, when a stream's input buffer is empty,
is called. The behavior of these two routines is similar to
is passed to the former routines as the first parameter.
field must be set by the caller.
stream implements an intermediate record stream.
Therefore there are additional bytes in the stream
to provide record boundary information.
xdrrec_endofrecord(xdrs, sendnow)
This routine can be invoked only on
The data in the output buffer is marked as a completed
and the output buffer is optionally written out if
is non-zero. This routine returns one if it succeeds, zero
This routine can be invoked only on
After consuming the rest of the current record in the stream,
this routine returns one if the stream has no more input,
This routine can be invoked only on
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.
xdr_reference(xdrs, pp, size, proc)
A primitive that provides pointer chasing within structures.
is the address of the pointer;
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
A macro that invokes the set position routine associated with
is a position value obtained from
This routine returns one if the
stream could be repositioned,
Warning: it is difficult to reposition some types of
streams, so this routine may fail with one
type of stream and succeed with another.
A filter primitive that translates between C
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
xdrstdio_create(xdrs, file, op)
This routine initializes the
stream object pointed to by
stream data is written to, or read from, the Standard
determines the direction of the
Warning: the destroy routine associated with such
xdr_string(xdrs, sp, maxsize)
A filter primitive that translates between C strings and
corresponding external representations.
Strings cannot be longer than
is the address of the string's pointer.
This routine returns one if it succeeds, zero otherwise.
A filter primitive that translates between
C characters and their external representations.
This routine returns one if it succeeds, zero otherwise.
A filter primitive that translates between C
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
A filter primitive that translates between C
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
A filter primitive that translates between C
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
xdr_union(xdrs, dscmp, unp, choices, dfault)
struct xdr_discrim *choices;
bool_t (*defaultarm) (\|); /* may equal \s-1NULL\s0 */
A filter primitive that translates between a discriminated C
and its corresponding external representation. It first
translates the discriminant of the union located at
This discriminant is always an
Next the union located at
is translated. The parameter
is a pointer to an array of
structures. Each structure contains an ordered pair of
If the union's discriminant is equal to the associated
is called to translate the union. The end of the
structure array is denoted by a routine of value
If the discriminant is not found in the
procedure is called (if it is not
Returns one if it succeeds, zero otherwise.
xdr_vector(xdrs, arrp, size, elsize, elproc)
A filter primitive that translates between fixed-length
and their corresponding external representations. The
is the address of the pointer to the array, while
is is the element count of the array. The parameter
each of the array's elements, and
filter that translates between
the array elements' C form, and their external
This routine returns one if it succeeds, zero otherwise.
This routine always returns one.
routines that require a function parameter,
where nothing is to be done.
.B "xdr_string(xdrs, sp,\s-1MAXUN.UNSIGNED\s0 );"
is the maximum value of an unsigned integer.
package passes a maximum of two
routines as parameters, and
one of the most frequently used primitives, requires three.
Returns one if it succeeds, zero otherwise.
eXternal Data Representation Standard: Protocol Specification
eXternal Data Representation: Sun Technical Notes
.IR "\s-1XDR\s0: External Data Representation Standard" ,
.SM RFC1014, Sun Microsystems, Inc.,