Translates between discriminated unions and their external representations.
C Library (libc.a)
#include <rpc/xdr.h>
xdr_union (xdrs, dscmp, unp, armchoices, defaultarm)
XDR * xdrs;
enum_t * dscmp;
char * unp;
struct xdr_discrim * armchoices;
xdrproc_t (* defaultarm);
The xdr_union subroutine is a filter primitive that translates between discriminated C unions and their corresponding external representations. It first translates the discriminant of the union located at the address pointed to by the dscmp parameter. This discriminant is always an enum_t value. Next, this subroutine translates the union located at the address pointed to by the unp parameter.
The armchoices parameter is a pointer to an array of xdr_discrim structures. Each structure contains an ordered pair of parameters [value, proc]. If the union's discriminant is equal to the associated value, then the specified process is called to translate the union. The end of the xdr_discrim structure array is denoted by a routine having a null value. If the discriminant is not found in the choices array, then the defaultarm structure is called (if it is not null).
Item | Description |
---|---|
xdrs | Points to the eXternal Data Representation (XDR) stream handle. |
dscmp | Specifies the address of the union's discriminant. The discriminant is an enumeration (enum_t) value. |
unp | Specifies the address of the union. |
armchoices | Points to an array of xdr_discrim structures. |
defaultarm | A structure provided in case no discriminants are found. This parameter can have a null value. |
Upon successful completion, this subroutine returns a value of 1. If unsuccessful, it returns a value of 0.