#include <rpc/xdr.h> bool_t xdr_union(XDR *xdrs, enum_t *dscmp, char *unp, const struct xdr_discrim *choices, const xdrproc_t (*defaultarm));
The xdr_union() function is a filter primitive that translates between discriminated C unions and their corresponding external representations.
No authorization is required.
TRUE (1) | Successful |
FALSE (0) | Unsuccessful |
None.
Message ID | Error Message Text |
---|---|
CPE3418 E | Possible APAR condition or hardware failure. |
CPF3CF2 E | Error(s) occurred during running of &1 API. |
CPF9872 E | Program or service program &1 in library &2 ended. Reason code &3. |
The size of any enum data types passed to the xdr_union() must be defined as 4 bytes.
See Code disclaimer information for information pertaining to code examples.
The following example shows how xdr_union() is used:
#include <stdio.h> #include <xdr.h> #pragma enum size(4) /* Set enum size to 4 bytes */ typedef enum time_type {END=0,DC,CT} time_type ; #pragma enum size() /* Reset enum size */ typedef union time_value { int discrete_time; float continuous_time; } time_value ; typedef struct time { time_type type; time_value value; } time; bool_t xdr_time(XDR *xdrs, time *p_time) { struct xdr_discrim handlers[] = { {DT,(xdrproc_t)xdr_int}, {CT,(xdrproc_t)xdr_float}, {END,NULL} }; return xdr_union(xdrs,(enum_t *)(&(p_time->type)), (caddr_t)&(p_time->value),handlers,NULL); }
Top | Remote Procedure Call (RPC) APIs | APIs by category |