HP-UX Reference (11i v3 07/02) - 3 Library Functions N-Z (vol 7)
x
xdr_complex(3N) xdr_complex(3N)
translates the structure between its C form and its external representation. If
*pp is null when
decoding,
xdr_reference()
allocates memory and *pp points to it. This routine returns
1 if it
succeeds,
0 otherwise.
Warning: this routine does not understand
NULL pointers. Use xdr_pointer()
instead.
bool_t xdr_string()
xdr_string()
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
*
sp is null
when decoding,
xdr_string() allocates memory and *sp points to it. This routine returns
TRUE
if it succeeds, FALSE otherwise. Note: xdr_string() can be used to send an empty string (" "),
but not a NULL string.
bool_t xdr_union()
xdr_union()
translates between a discriminated C
union and its corresponding external
representation. It first translates the discriminant of the union located at 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 TRUE if it succeeds, FALSE otherwise.
bool_t xdr_vector()
xdr_vector()
translates between fixed-length arrays and their corresponding external representa-
tions. 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
sizeof 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
TRUE if it succeeds, FALSE otherwise.
bool_t xdr_wrapstring()
A routine that calls xdr_string( xdrs, sp, maxuint); where maxuint is the maximum value of
an unsigned integer.
Many routines, such as xdr_array() , xdr_pointer()
, and xdr_vector() take a function
pointer of type
xdrproc_t() , which takes two arguments. xdr_string() , one of the most fre-
quently used routines, requires three arguments, while xdr_wrapstring()
only requires two.
For these routines,
xdr_wrapstring()
is desirable. This routine returns TRUE if it succeeds,
FALSE 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 fork()
and before exec(). These functions should not be called by a multithreaded application that support
asynchronous cancellation or asynchronous signals.
SEE ALSO
rpc(3N), xdr_admin(3N), xdr_create(3N), xdr_simple(3N).
670 Hewlett-Packard Company − 2 − HP-UX 11i Version 3: February 2007