Translates between discriminated unions and their external representations.
#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).
Upon successful completion, this subroutine returns a value of 1. If unsuccessful, it returns a value of 0.
This subroutine is part of Base Operating System (BOS) Runtime.
List of XDR Programming References.
eXternal Data Representation (XDR) Overview for Programming and Understanding XDR Library Filter Primitives in AIX 5L Version 5.1 Communications Programming Concepts.