ONC+ Developer's Guide

Array Example 2

You could implement a party of network users as an array of netuser structure. The declaration and its associated XDR routines are as shown in the following code example.


Example A–8 Array Example #2

struct party {

 	u_int p_len;
 	struct netuser *p_nusers;
};
#define PLEN 500 /* max number of users in a party */
bool_t
xdr_party(xdrs, pp)
 	XDR *xdrs;
 	struct party *pp;
{
 	return(xdr_array(xdrs, &pp->p_nusers, &pp->p_len, PLEN,
 	 sizeof (struct netuser), xdr_netuser));
}