xdr_pointer()--Provide Pointer Chasing within Structures
Syntax
#include <rpc/xdr.h> bool_t xdr_pointer(XDR *xdrs, char **objpp, u_int objsize, const xdrproc_t xdrobj);
Service Program Name: QZNFTRPC
Default Public Authority: *USE
Threadsafe: No
The xdr_pointer() function provides pointer chasing within structures and serializes null pointers. This function can represent recursive data structures, such as binary trees or linked lists.
Pointer chasing is the substitution of the pointer itself with the actual structure it points to.
Parameters
- xdrs (Input)
- A pointer to the External Data Representation (XDR) stream handle.
- objpp (I/O)
- A pointer to the character pointer of the data structure. If decoding and
*objpp==NULL, then the memory is allocated by XDR.
- objsize (Input)
- The size of the structure.
- xdrobj (Input)
- The XDR filter for the object.
Authorities
No authorization is required.
Return Value
TRUE (1) | Successful |
FALSE (0) | Unsuccessful |
Error Conditions
None.
Error Messages
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. |
Example
The following example shows how xdr_pointer() is used.
Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
#include <xdr.h> typedef struct node { int value; struct node *p; } node ; bool_t xdr_list(XDR *xdrs, node **p_node) { return xdr_pointer(xdrs,(caddr *)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)); }
API introduced: V4R2
[ Back to top | Remote Procedure Call (RPC) APIs | APIs by category ]