2 * xdr_update.c: Additions to release 3.0 XDR routines required
3 * for rpcgen. These routines are from release 3.2BETA and
4 * may be updated before final release.
6 * Copyright (C) 1986, Sun Microsystems, Inc.
10 #include <afs/param.h>
17 #ifdef NULL /* Strict ANSI-C aborts if we redefine this */
23 #define LASTUNSIGNED ((u_int)0-1)
28 * XDR a pointer to a possibly recursive data structure. This
29 * differs with xdr_reference in that it can serialize/deserialiaze
32 * What's sent is actually a union:
34 * union object_pointer switch (boolean b) {
35 * case TRUE: object_data data;
36 * case FALSE: void nothing;
39 * > objpp: Pointer to the pointer to the object.
40 * > obj_size: size of the object.
41 * > xdr_obj: routine to XDR an object.
44 bool_t xdr_pointer(register XDR *xdrs, char **objpp,
45 u_int obj_size, xdrproc_t xdr_obj)
50 more_data = (*objpp != NULL);
51 if (! xdr_bool(xdrs,&more_data)) {
58 return(xdr_reference(xdrs,objpp,obj_size,xdr_obj));
64 * XDR a fixed length array. Unlike variable-length arrays,
65 * the storage of fixed length arrays is static and unfreeable.
66 * > basep: base of the array
67 * > size: size of the array
68 * > elemsize: size of each element
69 * > xdr_elem: routine to XDR each element
71 bool_t xdr_vector(register XDR *xdrs, register char *basep,
72 register u_int nelem, register u_int elemsize, register xdrproc_t xdr_elem)
78 for (i = 0; i < nelem; i++) {
79 if (! (*xdr_elem)(xdrs, elptr, LASTUNSIGNED)) {