955 lines
19 KiB
HTML
955 lines
19 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of XDR</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>XDR</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
xdr - library routines for external data representation
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS AND DESCRIPTION</H2>
|
|
|
|
<P>
|
|
|
|
These routines allow C programmers to describe
|
|
arbitrary data structures in a machine-independent fashion.
|
|
Data for remote procedure calls are transmitted using these
|
|
routines.
|
|
<P>
|
|
|
|
The prototypes below are declared in
|
|
<I><<A HREF="file:///usr/include/rpc/xdr.h">rpc/xdr.h</A>></I>
|
|
|
|
and make use of the following types:
|
|
<P>
|
|
|
|
|
|
|
|
<B>typedef int </B><I>bool_t</I><B>;</B>
|
|
|
|
<P>
|
|
|
|
<B>typedef bool_t (*</B><I>xdrproc_t</I><B>) (XDR *, void *,...);</B>
|
|
|
|
|
|
|
|
<P>
|
|
|
|
For the declaration of the
|
|
<I>XDR</I>
|
|
|
|
type, see
|
|
<I><<A HREF="file:///usr/include/rpc/xdr.h">rpc/xdr.h</A>></I>.
|
|
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_array(XDR *</B><I>xdrs</I><B>, char **</B><I>arrp</I><B>, unsigned int *</B><I>sizep</I><B>,</B>
|
|
<B> unsigned int </B><I>maxsize</I><B>, unsigned int </B><I>elsize</I><B>,</B>
|
|
<B> xdrproc_t </B><I>elproc</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><DD>
|
|
A filter primitive that translates between variable-length arrays
|
|
and their corresponding external representations.
|
|
The argument
|
|
<I>arrp</I>
|
|
|
|
is the address of the pointer to the array, while
|
|
<I>sizep</I>
|
|
|
|
is the address of the element count of the array;
|
|
this element count cannot exceed
|
|
<I>maxsize</I>.
|
|
|
|
The argument
|
|
<I>elsize</I>
|
|
|
|
is the
|
|
<I>sizeof</I>
|
|
|
|
each of the array's elements, and
|
|
<I>elproc</I>
|
|
|
|
is an XDR filter that translates between
|
|
the array elements' C form, and their external
|
|
representation.
|
|
This routine returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_bool(XDR *</B><I>xdrs</I><B>, bool_t *</B><I>bp</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="2"><DD>
|
|
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.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_bytes(XDR *</B><I>xdrs</I><B>, char **</B><I>sp</I><B>, unsigned int *</B><I>sizep</I><B>,</B>
|
|
<B> unsigned int </B><I>maxsize</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="3"><DD>
|
|
A filter primitive that translates between counted byte
|
|
strings and their external representations.
|
|
The argument
|
|
<I>sp</I>
|
|
|
|
is the address of the string pointer.
|
|
The length of the
|
|
string is located at address
|
|
<I>sizep</I>;
|
|
|
|
strings cannot be longer than
|
|
<I>maxsize</I>.
|
|
|
|
This routine returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_char(XDR *</B><I>xdrs</I><B>, char *</B><I>cp</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="4"><DD>
|
|
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
|
|
<B>xdr_bytes</B>(),
|
|
|
|
<B>xdr_opaque</B>()
|
|
|
|
or
|
|
<B>xdr_string</B>().
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>void xdr_destroy(XDR *</B><I>xdrs</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="5"><DD>
|
|
A macro that invokes the destroy routine associated with the XDR stream,
|
|
<I>xdrs</I>.
|
|
|
|
Destruction usually involves freeing private data structures
|
|
associated with the stream.
|
|
Using
|
|
<I>xdrs</I>
|
|
|
|
after invoking
|
|
<B>xdr_destroy</B>()
|
|
|
|
is undefined.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_double(XDR *</B><I>xdrs</I><B>, double *</B><I>dp</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="6"><DD>
|
|
A filter primitive that translates between C
|
|
<I>double</I>
|
|
|
|
precision numbers and their external representations.
|
|
This routine returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_enum(XDR *</B><I>xdrs</I><B>, enum_t *</B><I>ep</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="7"><DD>
|
|
A filter primitive that translates between C
|
|
<I>enum</I>s
|
|
|
|
(actually integers) and their external representations.
|
|
This routine returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_float(XDR *</B><I>xdrs</I><B>, float *</B><I>fp</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="8"><DD>
|
|
A filter primitive that translates between C
|
|
<I>float</I>s
|
|
|
|
and their external representations.
|
|
This routine returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>void xdr_free(xdrproc_t </B><I>proc</I><B>, char *</B><I>objp</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="9"><DD>
|
|
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
|
|
<I>not</I>
|
|
|
|
freed, but what it points to
|
|
<I>is</I>
|
|
|
|
freed (recursively).
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>unsigned int xdr_getpos(XDR *</B><I>xdrs</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="10"><DD>
|
|
A macro that invokes the get-position routine
|
|
associated with the XDR stream,
|
|
<I>xdrs</I>.
|
|
|
|
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.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>long *xdr_inline(XDR *</B><I>xdrs</I><B>, int </B><I>len</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="11"><DD>
|
|
A macro that invokes the inline routine associated with the XDR stream,
|
|
<I>xdrs</I>.
|
|
|
|
The routine returns a pointer
|
|
to a contiguous piece of the stream's buffer;
|
|
<I>len</I>
|
|
|
|
is the byte length of the desired buffer.
|
|
Note: pointer is cast to
|
|
<I>long *</I>.
|
|
|
|
<DT id="12"><DD>
|
|
Warning:
|
|
<B>xdr_inline</B>()
|
|
|
|
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.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_int(XDR *</B><I>xdrs</I><B>, int *</B><I>ip</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="13"><DD>
|
|
A filter primitive that translates between C integers
|
|
and their external representations.
|
|
This routine returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_long(XDR *</B><I>xdrs</I><B>, long *</B><I>lp</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="14"><DD>
|
|
A filter primitive that translates between C
|
|
<I>long</I>
|
|
|
|
integers and their external representations.
|
|
This routine returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>void xdrmem_create(XDR *</B><I>xdrs</I><B>, char *</B><I>addr</I><B>, unsigned int </B><I>size</I><B>,</B>
|
|
<B> enum xdr_op </B><I>op</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="15"><DD>
|
|
This routine initializes the XDR stream object pointed to by
|
|
<I>xdrs</I>.
|
|
|
|
The stream's data is written to, or read from,
|
|
a chunk of memory at location
|
|
<I>addr</I>
|
|
|
|
whose length is no more than
|
|
<I>size</I>
|
|
|
|
bytes long.
|
|
The
|
|
<I>op</I>
|
|
|
|
determines the direction of the XDR stream (either
|
|
<B>XDR_ENCODE</B>,
|
|
|
|
<B>XDR_DECODE</B>,
|
|
|
|
or
|
|
<B>XDR_FREE</B>).
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_opaque(XDR *</B><I>xdrs</I><B>, char *</B><I>cp</I><B>, unsigned int </B><I>cnt</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="16"><DD>
|
|
A filter primitive that translates between fixed size opaque data
|
|
and its external representation.
|
|
The argument
|
|
<I>cp</I>
|
|
|
|
is the address of the opaque object, and
|
|
<I>cnt</I>
|
|
|
|
is its size in bytes.
|
|
This routine returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_pointer(XDR *</B><I>xdrs</I><B>, char **</B><I>objpp</I><B>,</B>
|
|
<B> unsigned int </B><I>objsize</I><B>, xdrproc_t </B><I>xdrobj</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="17"><DD>
|
|
Like
|
|
<B>xdr_reference</B>()
|
|
|
|
except that it serializes null pointers, whereas
|
|
<B>xdr_reference</B>()
|
|
|
|
does not.
|
|
Thus,
|
|
<B>xdr_pointer</B>()
|
|
|
|
can represent
|
|
recursive data structures, such as binary trees or
|
|
linked lists.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>void xdrrec_create(XDR *</B><I>xdrs</I><B>, unsigned int </B><I>sendsize</I><B>,</B>
|
|
<B> unsigned int </B><I>recvsize</I><B>, char *</B><I>handle</I><B>,</B>
|
|
<B> int (*</B><I>readit</I><B>) (char *, char *, int),</B>
|
|
<B> int (*</B><I>writeit</I><B>) (char *, char *, int));</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="18"><DD>
|
|
This routine initializes the XDR stream object pointed to by
|
|
<I>xdrs</I>.
|
|
|
|
The stream's data is written to a buffer of size
|
|
<I>sendsize</I>;
|
|
|
|
a value of zero indicates the system should use a suitable default.
|
|
The stream's data is read from a buffer of size
|
|
<I>recvsize</I>;
|
|
|
|
it too can be set to a suitable default by passing a zero value.
|
|
When a stream's output buffer is full,
|
|
<I>writeit</I>
|
|
|
|
is called.
|
|
Similarly, when a stream's input buffer is empty,
|
|
<I>readit</I>
|
|
|
|
is called.
|
|
The behavior of these two routines is similar to
|
|
the system calls
|
|
<B><A HREF="/cgi-bin/man/man2html?2+read">read</A></B>(2)
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+write">write</A></B>(2),
|
|
|
|
except that
|
|
<I>handle</I>
|
|
|
|
is passed to the former routines as the first argument.
|
|
Note: the XDR stream's
|
|
<I>op</I>
|
|
|
|
field must be set by the caller.
|
|
<DT id="19"><DD>
|
|
Warning: to read from an XDR stream created by this API,
|
|
you'll need to call
|
|
<B>xdrrec_skiprecord</B>()
|
|
|
|
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
|
|
<B>xdr*_create</B>
|
|
|
|
APIs are not compatible for the same reason.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdrrec_endofrecord(XDR *</B><I>xdrs</I><B>, int </B><I>sendnow</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="20"><DD>
|
|
This routine can be invoked only on streams created by
|
|
<B>xdrrec_create</B>().
|
|
|
|
The data in the output buffer is marked as a completed record,
|
|
and the output buffer is optionally written out if
|
|
<I>sendnow</I>
|
|
|
|
is nonzero.
|
|
This routine returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdrrec_eof(XDR *</B><I>xdrs</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="21"><DD>
|
|
This routine can be invoked only on streams created by
|
|
<B>xdrrec_create</B>().
|
|
|
|
After consuming the rest of the current record in the stream,
|
|
this routine returns one if the stream has no more input,
|
|
zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdrrec_skiprecord(XDR *</B><I>xdrs</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="22"><DD>
|
|
This routine can be invoked only on
|
|
streams created by
|
|
<B>xdrrec_create</B>().
|
|
|
|
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.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_reference(XDR *</B><I>xdrs</I><B>, char **</B><I>pp</I><B>, unsigned int </B><I>size</I><B>,</B>
|
|
<B> xdrproc_t </B><I>proc</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="23"><DD>
|
|
A primitive that provides pointer chasing within structures.
|
|
The argument
|
|
<I>pp</I>
|
|
|
|
is the address of the pointer;
|
|
<I>size</I>
|
|
|
|
is the
|
|
<I>sizeof</I>
|
|
|
|
the structure that
|
|
<I>*pp</I>
|
|
|
|
points to; and
|
|
<I>proc</I>
|
|
|
|
is an XDR procedure that filters the structure
|
|
between its C form and its external representation.
|
|
This routine returns one if it succeeds, zero otherwise.
|
|
<DT id="24"><DD>
|
|
Warning: this routine does not understand null pointers.
|
|
Use
|
|
<B>xdr_pointer</B>()
|
|
|
|
instead.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>xdr_setpos(XDR *</B><I>xdrs</I><B>, unsigned int </B><I>pos</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="25"><DD>
|
|
A macro that invokes the set position routine associated with
|
|
the XDR stream
|
|
<I>xdrs</I>.
|
|
|
|
The argument
|
|
<I>pos</I>
|
|
|
|
is a position value obtained from
|
|
<B>xdr_getpos</B>().
|
|
|
|
This routine returns one if the XDR stream could be repositioned,
|
|
and zero otherwise.
|
|
<DT id="26"><DD>
|
|
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.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_short(XDR *</B><I>xdrs</I><B>, short *</B><I>sp</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="27"><DD>
|
|
A filter primitive that translates between C
|
|
<I>short</I>
|
|
|
|
integers and their external representations.
|
|
This routine returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>void xdrstdio_create(XDR *</B><I>xdrs</I><B>, FILE *</B><I>file</I><B>, enum xdr_op </B><I>op</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="28"><DD>
|
|
This routine initializes the XDR stream object pointed to by
|
|
<I>xdrs</I>.
|
|
|
|
The XDR stream data is written to, or read from, the
|
|
<I>stdio</I>
|
|
|
|
stream
|
|
<I>file</I>.
|
|
|
|
The argument
|
|
<I>op</I>
|
|
|
|
determines the direction of the XDR stream (either
|
|
<B>XDR_ENCODE</B>,
|
|
|
|
<B>XDR_DECODE</B>,
|
|
|
|
or
|
|
<B>XDR_FREE</B>).
|
|
|
|
<DT id="29"><DD>
|
|
Warning: the destroy routine associated with such XDR streams calls
|
|
<B><A HREF="/cgi-bin/man/man2html?3+fflush">fflush</A></B>(3)
|
|
|
|
on the
|
|
<I>file</I>
|
|
|
|
stream, but never
|
|
<B><A HREF="/cgi-bin/man/man2html?3+fclose">fclose</A></B>(3).
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_string(XDR *</B><I>xdrs</I><B>, char **</B><I>sp</I><B>, unsigned int </B><I>maxsize</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="30"><DD>
|
|
A filter primitive that translates between C strings and
|
|
their corresponding external representations.
|
|
Strings cannot be longer than
|
|
<I>maxsize</I>.
|
|
|
|
Note:
|
|
<I>sp</I>
|
|
|
|
is the address of the string's pointer.
|
|
This routine returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_u_char(XDR *</B><I>xdrs</I><B>, unsigned char *</B><I>ucp</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="31"><DD>
|
|
A filter primitive that translates between
|
|
<I>unsigned</I>
|
|
|
|
C characters and their external representations.
|
|
This routine returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_u_int(XDR *</B><I>xdrs</I><B>, unsigned *</B><I>up</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="32"><DD>
|
|
A filter primitive that translates between C
|
|
<I>unsigned</I>
|
|
|
|
integers and their external representations.
|
|
This routine returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_u_long(XDR *</B><I>xdrs</I><B>, unsigned long *</B><I>ulp</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="33"><DD>
|
|
A filter primitive that translates between C
|
|
<I>unsigned long</I>
|
|
|
|
integers and their external representations.
|
|
This routine returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_u_short(XDR *</B><I>xdrs</I><B>, unsigned short *</B><I>usp</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="34"><DD>
|
|
A filter primitive that translates between C
|
|
<I>unsigned short</I>
|
|
|
|
integers and their external representations.
|
|
This routine returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_union(XDR *</B><I>xdrs</I><B>, int *</B><I>dscmp</I><B>, char *</B><I>unp</I><B>,</B>
|
|
<B> struct xdr_discrim *</B><I>choices</I><B>,</B>
|
|
<B> xdrproc_t </B><I>defaultarm</I><B>); /* may equal NULL */</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="35"><DD>
|
|
A filter primitive that translates between a discriminated C
|
|
<I>union</I>
|
|
|
|
and its corresponding external representation.
|
|
It first
|
|
translates the discriminant of the union located at
|
|
<I>dscmp</I>.
|
|
|
|
This discriminant is always an
|
|
<I>enum_t</I>.
|
|
|
|
Next the union located at
|
|
<I>unp</I>
|
|
|
|
is translated.
|
|
The argument
|
|
<I>choices</I>
|
|
|
|
is a pointer to an array of
|
|
<B>xdr_discrim</B>()
|
|
|
|
structures.
|
|
Each structure contains an ordered pair of
|
|
[<I>value</I>,<I>proc</I>].
|
|
|
|
If the union's discriminant is equal to the associated
|
|
<I>value</I>,
|
|
|
|
then the
|
|
<I>proc</I>
|
|
|
|
is called to translate the union.
|
|
The end of the
|
|
<B>xdr_discrim</B>()
|
|
|
|
structure array is denoted by a routine of value NULL.
|
|
If the discriminant is not found in the
|
|
<I>choices</I>
|
|
|
|
array, then the
|
|
<I>defaultarm</I>
|
|
|
|
procedure is called (if it is not NULL).
|
|
Returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_vector(XDR *</B><I>xdrs</I><B>, char *</B><I>arrp</I><B>, unsigned int </B><I>size</I><B>,</B>
|
|
<B> unsigned int </B><I>elsize</I><B>, xdrproc_t </B><I>elproc</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="36"><DD>
|
|
A filter primitive that translates between fixed-length arrays
|
|
and their corresponding external representations.
|
|
The argument
|
|
<I>arrp</I>
|
|
|
|
is the address of the pointer to the array, while
|
|
<I>size</I>
|
|
|
|
is the element count of the array.
|
|
The argument
|
|
<I>elsize</I>
|
|
|
|
is the
|
|
<I>sizeof</I>
|
|
|
|
each of the array's elements, and
|
|
<I>elproc</I>
|
|
|
|
is an XDR filter that translates between
|
|
the array elements' C form, and their external
|
|
representation.
|
|
This routine returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_void(void);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="37"><DD>
|
|
This routine always returns one.
|
|
It may be passed to RPC routines that require a function argument,
|
|
where nothing is to be done.
|
|
</DL>
|
|
<P>
|
|
|
|
<PRE>
|
|
<B>bool_t xdr_wrapstring(XDR *</B><I>xdrs</I><B>, char **</B><I>sp</I><B>);</B>
|
|
</PRE>
|
|
|
|
<DL COMPACT>
|
|
<DT id="38"><DD>
|
|
A primitive that calls
|
|
<B>xdr_string(xdrs, sp,MAXUN.UNSIGNED );</B>
|
|
|
|
where
|
|
<B>MAXUN.UNSIGNED</B>
|
|
|
|
is the maximum value of an unsigned integer.
|
|
<B>xdr_wrapstring</B>()
|
|
|
|
is handy because the RPC package passes a maximum of two XDR
|
|
routines as arguments, and
|
|
<B>xdr_string</B>(),
|
|
|
|
one of the most frequently used primitives, requires three.
|
|
Returns one if it succeeds, zero otherwise.
|
|
</DL>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>ATTRIBUTES</H2>
|
|
|
|
For an explanation of the terms used in this section, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
|
|
|
|
<TABLE BORDER>
|
|
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<B>xdr_array</B>(),
|
|
|
|
<B>xdr_bool</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>xdr_bytes</B>(),
|
|
|
|
<B>xdr_char</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>xdr_destroy</B>(),
|
|
|
|
<B>xdr_double</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>xdr_enum</B>(),
|
|
|
|
<B>xdr_float</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>xdr_free</B>(),
|
|
|
|
<B>xdr_getpos</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>xdr_inline</B>(),
|
|
|
|
<B>xdr_int</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>xdr_long</B>(),
|
|
|
|
<B>xdrmem_create</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>xdr_opaque</B>(),
|
|
|
|
<B>xdr_pointer</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>xdrrec_create</B>(),
|
|
|
|
<B>xdrrec_eof</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>xdrrec_endofrecord</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>xdrrec_skiprecord</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>xdr_reference</B>(),
|
|
|
|
<B>xdr_setpos</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>xdr_short</B>(),
|
|
|
|
<B>xdrstdio_create</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>xdr_string</B>(),
|
|
|
|
<B>xdr_u_char</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>xdr_u_int</B>(),
|
|
|
|
<B>xdr_u_long</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>xdr_u_short</B>(),
|
|
|
|
<B>xdr_union</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>xdr_vector</B>(),
|
|
|
|
<B>xdr_void</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>xdr_wrapstring</B>()
|
|
|
|
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+rpc">rpc</A></B>(3)
|
|
|
|
<P>
|
|
|
|
The following manuals:
|
|
<DL COMPACT><DT id="39"><DD>
|
|
eXternal Data Representation Standard: Protocol Specification
|
|
<BR>
|
|
|
|
eXternal Data Representation: Sun Technical Notes
|
|
<BR>
|
|
|
|
<I>XDR: External Data Representation Standard</I>,
|
|
|
|
RFC 1014, Sun Microsystems, Inc.,
|
|
USC-ISI.
|
|
</DL>
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="40"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="41"><A HREF="#lbAC">SYNOPSIS AND DESCRIPTION</A><DD>
|
|
<DT id="42"><A HREF="#lbAD">ATTRIBUTES</A><DD>
|
|
<DT id="43"><A HREF="#lbAE">SEE ALSO</A><DD>
|
|
<DT id="44"><A HREF="#lbAF">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:00 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|