Showing the Use of Pointers in XDR Example
This section explains the use of pointers in XDR example.
If a structure contains a person's name and a pointer to a gnumbers structure,
which in turn specifies the person's gross assets and liabilities,
the structure can be written as follows:
struct pgn {
char *name;
struct gnumbers *gnp;
};
The corresponding eXternal Data Representation (XDR) routine for
this structure is:
bool_t
xdr_pgn(xdrs, pp)
XDR *xdrs;
struct pgn *pp;
{
if (xdr_string(xdrs, &pp->name, NLEN) &&
xdr_reference(xdrs, &pp->gnp,
sizeof(struct gnumbers), xdr_gnumbers))
return(TRUE);
return(FALSE);
}