Serializes and deserializes discriminant unions.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_union(XDR *xdrs, enum *dscmp, char *unp, struct
xdr_discrim *choices, xdrproc_t default);
1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
dscmp
A pointer to the union's discriminant.
unp
A pointer to the union's data.
choices
A pointer to an array of xdr_discrim structures. Each structure
contains an ordered pair of [value,proc]. The final structure in
the array is denoted by a pointer with the value NULL.
default
The address of the default XDR routine to call if the dscmp
argument is not found in the choices array.
2 – Description
A filter primitive that translates between a discriminated union
and its corresponding external representation. The xdr_union
routine first translates the discriminant of the union located at
dscmp. This discriminant is always of type enum_t.
Next, the routine translates the union data located at unp. To
translate the union data the xdr_union routine first searches
the structure pointed to by the choices argument for the union
discriminant passed in the dscmp argument. If a match is found,
the xdr_union routine calls proc to translate the union data.
The end of the xdr_discrim structure array must contain an entry
with the value NULL for proc. If the xdr_union routine reaches
this entry before finding a match, the routine calls the default
procedure (if it is not NULL).
3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.