#include <rpc/xdr.h> bool_t xdr_reference(XDR *xdrs, caddr_t *pp, u_int size, const xdrproc_t proc);
The xdr_reference() function is a filter primitive that provides pointer chasing within structures. This primitive allows the serializing, deserializing, and freeing of any pointers within one structure that are referenced by another structure.
The xdr_reference() function does not attach special meaning to a null pointer during serialization, and passing the address of a null pointer may cause a memory error. Therefore, the programmer must describe data with a two-sided discriminated union. One side is used when the pointer is valid; the other side, when the pointer is null.
Pointer chasing is the substitution of the pointer itself with the actual structure it points to.
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_reference() is used:
#include <xdr.h> typedef struct node { int value; struct node *p; } node ; /* * Do not call it with p_node==NULL, because it will fail. */ bool_t xdr_list(XDR *xdrs, node **p_node) { return xdr_reference(xdrs,(caddr_t)p_node, sizeof(node),(xdrproc_t)xdr_node) } bool_t xdr_node(XDR *xdrs, node *p_node) { xdr_int(xdrs,&(p_node->value)); return xdr_list(xdrs,&(p_node->p)); }
Top | Remote Procedure Call (RPC) APIs | APIs by category |