xdr_reference Subroutine

Purpose

Provides pointer chasing within structures.

Library

C Library (libc.a)

Syntax

#include <rpc/xdr.h>

xdr_reference ( xdrs,  pp,  size,  proc)
XDR *xdrs;
char **pp;
u_int size;
xdrproc_t proc;

Description

The xdr_reference subroutine 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 subroutine does not attach special meaning to a null pointer during serialization. Attempting to pass the address of a null pointer can cause a memory error. The programmer must describe data with a two-armed discriminated union. One arm is used when the pointer is valid; the other arm, when the pointer is null.

Parameters

Item Description
xdrs Points to the eXternal Data Representation (XDR) stream handle.
pp Specifies the address of the pointer to the structure. When decoding data, XDR allocates storage if the pointer is null.
size Specifies the byte size of the structure pointed to by the pp parameter.
proc Translates the structure between its C form and its external representation. This parameter is the XDR procedure that describes the structure.

Return Values

Upon successful completion, this subroutine returns a value of 1. If unsuccessful, it returns a value of 0.