up | Inhaltsverzeichniss | Kommentar

Manual page for XDR_ADMIN(3N)

xdr_getpos, xdr_inline, xdrrec_endofrecord, xdrrec_eof, xdrrec_readbytes, xdrrec_skiprecord, xdr_setpos - library routines for management of the XDR stream

DESCRIPTION

XDR library routines allow C programmers to describe arbitrary 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 deal specifically with the management of the XDR stream.

Routines

The XDR data structure is defined in the RPC/XDR Library Definitions of the [a manual with the abbreviation NETP].

#include <rpc/xdr.h>

u_int xdr_getpos(xdrs)
XDR *xdrs;

Invoke 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(xdrs, len) XDR *xdrs; int len;

Invoke the in-line routine associated with the XDR stream, xdrs. The routine returns a pointer to a contiguous piece of the stream's buffer; len is the byte length of the desired buffer. Note: A pointer is cast to long *.

Warning: xdr_inline() may return NULL 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 xdrrec_endofrecord(xdrs, sendnow)
XDR *xdrs;
int sendnow;

This routine can be invoked only on streams created by xdrrec_create() (see xdr_create.3n The data in the output buffer is marked as a completed record, and the output buffer is optionally written out if sendnow is non-zero. This routine returns TRUE if it succeeds, FALSE otherwise.

bool_t xdrrec_eof(xdrs)
XDR *xdrs;
int empty;

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

int xdrrec_readbytes(xdrs, addr, nbytes)
XDR *xdrs;
caddr_t addr;
u_int nbytes;

This routine can be invoked only on streams created by xdrrec_create() (see xdr_create.3n It attempts to read nbytes bytes from the XDR stream into the buffer pointed to by addr. On success it returns the number of bytes read. Returns -1 on failure. A return value of 0 indicates an end of record.

bool_t xdrrec_skiprecord(xdrs)
XDR *xdrs;

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

bool_t xdr_setpos(xdrs, pos)
XDR *xdrs;
u_int pos;

Invoke the set position routine associated with the XDR stream xdrs. The parameter pos is a position value obtained from xdr_getpos(). This routine returns 1 if the XDR stream could be repositioned, and 0 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.

SEE ALSO

xdr.3n xdr_complex.3n xdr_create.3n xdr_simple.3n


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97