int
xdr_array(
XDR *xdrs
, char **arrp
, u_int *sizep
, u_int maxsize
, u_int elsize
, xdrproc_t elproc
)
int
xdr_bool(
XDR *xdrs
, bool_t *bp
)
int
xdr_bytes(
XDR *xdrs
, char **sp
, u_int *sizep
, u_int maxsize
)
int
xdr_char(
XDR *xdrs
, char *cp
)
void
xdr_destroy(
XDR *xdrs
)
int
xdr_double(
XDR *xdrs
, double *dp
)
int
xdr_enum(
XDR *xdrs
, enum_t *ep
)
int
xdr_float(
XDR *xdrs
, float *fp
)
void
xdr_free(
xdrproc_t proc
, char *objp
)
u_int
xdr_getpos(
XDR *xdrs
)
int
xdr_hyper(
XDR *xdrs
, longlong_t *llp
)
long
*
xdr_inline(
XDR *xdrs
, int len
)
int
xdr_int(
XDR *xdrs
, int *ip
)
int
xdr_long(
XDR *xdrs
, long *lp
)
int
xdr_longlong_t(
XDR *xdrs
, longlong_t *llp
)
void
xdrmem_create(
XDR *xdrs
, char *addr
, u_int size
, enum xdr_op op
)
int
xdr_opaque(
XDR *xdrs
, char *cp
, u_int cnt
)
int
xdr_pointer(
XDR *xdrs
, char **objpp
, u_int objsize
, xdrproc_t xdrobj
)
void
xdrrec_create(
XDR *xdrs
, u_int sendsize
, u_int recvsize
, char *handle
, int (*readit)()
, int (*writeit)()
)
int
xdrrec_endofrecord(
XDR *xdrs
, int sendnow
)
int
xdrrec_eof(
XDR *xdrs
)
int
xdrrec_skiprecord(
XDR *xdrs
)
int
xdr_reference(
XDR *xdrs
, char **pp
, u_int size
, xdrproc_t proc
)
int
xdr_setpos(
XDR *xdrs
, u_int pos
)
int
xdr_short(
XDR *xdrs
, short *sp
)
void
xdrstdio_create(
XDR *xdrs
, FILE *file
, enum xdr_op op
)
int
xdr_string(
XDR *xdrs
, char **sp
, u_int maxsize
)
int
xdr_u_char(
XDR *xdrs
, unsigned char *ucp
)
int
xdr_u_hyper(
XDR *xdrs
, u_longlong_t *ullp
)
int
xdr_u_int(
XDR *xdrs
, unsigned *up
)
int
xdr_u_long(
XDR *xdrs
, unsigned long *ulp
)
int
xdr_u_longlong_t(
XDR *xdrs
, u_longlong_t *ullp
)
int
xdr_u_short(
XDR *xdrs
, unsigned short *usp
)
int
xdr_union(
XDR *xdrs
, int *dscmp
, char *unp
, struct xdr_discrim *choices
, bool_t (*defaultarm)()
)
int
xdr_vector(
XDR *xdrs
, char *arrp
, u_int size
, u_int elsize
, xdrproc_t elproc
)
int
xdr_void(
void
)
int
xdr_wrapstring(
XDR *xdrs
, char **sp
)
)
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
sizeof
each of the array's elements, and
elproc
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.
)
)
is 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.
)
),
xdr_opaque(
)
or
xdr_string(
).
)
xdrs
.
Destruction usually involves freeing private data structures
associated with the stream.
Using
xdrs
after invoking
xdr_destroy(
)
is undefined.
)
)
)
)
)
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.
)
)
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: pointer is cast to
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.
)
)
)
)
xdrs
.
The stream's data is written to, or read from,
a chunk of memory at location
addr
whose length is no more than
size
bytes long.
The
op
determines the direction of the XDR stream (either
XDR_ENCODE
,
XDR_DECODE
,
or
XDR_FREE
).
)
cp
is the address of the opaque object, and
cnt
is its size in bytes.
This routine returns one if it succeeds, zero otherwise.
)
)
except that it serializes
NULL
pointers, whereas
xdr_reference(
)
does not.
Thus,
xdr_pointer(
)
can represent recursive data structures, such as binary trees or
linked lists.
)
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,
writeit
is called.
Similarly, when a stream's input buffer is empty,
readit
is called.
The behavior of these two routines is similar to the system calls
read(2)
and
write(2),
except that
handle
is passed to the former routines as the first parameter.
Note: the XDR stream's
op
field must be set by the caller.
Warning: this XDR stream implements an intermediate record stream. Therefore there are additional bytes in the stream to provide record boundary information.
)
).
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 one if it succeeds, zero otherwise.
)
).
After consuming the rest of the current record in the stream,
this routine returns one if the stream has no more input,
zero otherwise.
)
).
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.
)
pp
is the address of the pointer;
size
is the
sizeof
the structure that
*pp
points to; and
proc
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.
Warning: this routine does not understand
NULL
pointers.
Use
xdr_pointer()
instead.
)
xdrs
.
The parameter
pos
is 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.
)
)
xdrs
.
The XDR stream data is written to, or read from, the Standard I/O
stream
file
.
The parameter
op
determines 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 file stream, but never fclose(3).
)
maxsize
.
Note:
is the address of the string's pointer.
This routine returns one if it succeeds, zero otherwise.
)
)
)
)
)
)
)
dscmp
.
This discriminant is always an enum_t.
Next the union located at
unp
is translated.
The parameter
choices
is 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
proc
is 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
choices
array, then the
defaultarm
procedure is called (if it is not
NULL
).
Returns one if it succeeds, zero otherwise.
)
arrp
is the address of the pointer to the array, while
size
is the element count of the array.
The parameter
elsize
is the
sizeof
each of the array's elements, and
elproc
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.
)
)
xdrs
)
where
MAXUN.UNSIGNED
is the maximum value of an unsigned integer.
xdr_wrapstring(
)
is handy because the RPC package passes a maximum of two XDR
routines as parameters, and
xdr_string(
),
one of the most frequently used primitives, requires three.
Returns one if it succeeds, zero otherwise.
The following manuals: