#include <rpc/xdr.h>
bool_t xdr_enum(XDR *xdrs,
enum_t *ep);
The xdr_enum function is a filter primitive that translates between C-language enumeration (enum) and its external representation.
No authorization is required.
Callers of the xdr_enum() function should ensure that ep points to a 4 byte location in memory. The ENUM(*INT) compiler option should be used when compiling code that calls xdr_enum() to ensure that enumerated data types are represented internally as integers. Failure to do so, may cause unexpected values to be encoded to the XDR data stream.
| 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. |
See Code disclaimer information for information pertaining to code examples.
The following example shows how xdr_enum() is used:
#include <stdio.h>
#include <xdr.h>
typedef enum fruit_state { green, ripe } fruit_state;
typedef enum fruit_weight { small, sufficient } fruit_weight;
typedef struct fruit
{
fruit_state state;
fruit_weight weight;
} fruit;
bool xdr_fruit(XDR *xdrs, fruit *p_fruit)
{
if(!xdr_enum(xdrs,(enum_t *)&(p_fruit->state)))
return FALSE;
return xdr_enum(xdrs,
(enum_t *)&(p_fruit->weight));
}
| Top | Remote Procedure Call (RPC) APIs | APIs by category |