#include <rpc/xdr.h> bool_t xdr_array(XDR *xdrs, caddr_t *arrp, u_int *sizep, const u_int maxsize, const u_int elsize, const xdrproc_t elproc);
The xdr_array() function is a filter primitive that translates between variable-length arrays and their corresponding external representations. This function is called to encode or decode each element of the array.
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. |
See Code disclaimer information for information pertaining to code examples.
The following example shows how xdr_array() is used:
#include <stdio.h> #include <values.h> #include <xdr.h> #define ARRAY_SIZE 256 typedef struct xarray { int size; int *p_array; } xarray ; bool_t xdr_xarray(XDR *xdrs, xarray *p_xarray ) { /* * Force XDR to allocate memory while decoding */ if((xdrs->x_op==XDR_DECODE)&& (p_xarray->p_array!=NULL)) { free(p_xarray->p_array); p_xarray->p_array=NULL; } /* * This code has a dual job : * A) While decoding, it allocated memory, stores the decoded * xarray in it, and updates size field in xarray * struct. * B) While decoding it stores xarray's size and the data * itself in XDR. */ return xdr_array( xdrs, (char**)(&(p_xarray->p_array)), &(p_xarray->size), MAX_INT, sizeof(int), (xdrproc_t)xdr_int)) }
Top | Remote Procedure Call (RPC) APIs | APIs by category |