1XDR(3) Library Functions Manual XDR(3)
2
3
4
6 xdr - library routines for external data representation
7
9 These routines allow C programmers to describe arbitrary data struc‐
10 tures in a machine-independent fashion. Data for remote procedure
11 calls are transmitted using these routines.
12
13 xdr_array(xdrs, arrp, sizep, maxsize, elsize, elproc)
14 XDR *xdrs;
15 char **arrp;
16 u_int *sizep, maxsize, elsize;
17 xdrproc_t elproc;
18
19 A filter primitive that translates between variable-length
20 arrays and their corresponding external representations. The
21 parameter arrp is the address of the pointer to the array, while
22 sizep is the address of the element count of the array; this
23 element count cannot exceed maxsize. The parameter elsize is
24 the sizeof each of the array's elements, and elproc is an XDR
25 filter that translates between the array elements' C form, and
26 their external representation. This routine returns one if it
27 succeeds, zero otherwise.
28
29 xdr_bool(xdrs, bp)
30 XDR *xdrs;
31 bool_t *bp;
32
33 A filter primitive that translates between booleans (C integers)
34 and their external representations. When encoding data, this
35 filter produces values of either one or zero. This routine
36 returns one if it succeeds, zero otherwise.
37
38 xdr_bytes(xdrs, sp, sizep, maxsize)
39 XDR *xdrs;
40 char **sp;
41 u_int *sizep, maxsize;
42
43 A filter primitive that translates between counted byte strings
44 and their external representations. The parameter sp is the
45 address of the string pointer. The length of the string is
46 located at address sizep; strings cannot be longer than maxsize.
47 This routine returns one if it succeeds, zero otherwise.
48
49 xdr_char(xdrs, cp)
50 XDR *xdrs;
51 char *cp;
52
53 A filter primitive that translates between C characters and
54 their external representations. This routine returns one if it
55 succeeds, zero otherwise. Note: encoded characters are not
56 packed, and occupy 4 bytes each. For arrays of characters, it is
57 worthwhile to consider xdr_bytes(), xdr_opaque() or
58 xdr_string().
59
60 void
61 xdr_destroy(xdrs)
62 XDR *xdrs;
63
64 A macro that invokes the destroy routine associated with the XDR
65 stream, xdrs. Destruction usually involves freeing private data
66 structures associated with the stream. Using xdrs after invok‐
67 ing xdr_destroy() is undefined.
68
69 xdr_double(xdrs, dp)
70 XDR *xdrs;
71 double *dp;
72
73 A filter primitive that translates between C double precision
74 numbers and their external representations. This routine
75 returns one if it succeeds, zero otherwise.
76
77 xdr_enum(xdrs, ep)
78 XDR *xdrs;
79 enum_t *ep;
80
81 A filter primitive that translates between C enums (actually
82 integers) and their external representations. This routine
83 returns one if it succeeds, zero otherwise.
84
85 xdr_float(xdrs, fp)
86 XDR *xdrs;
87 float *fp;
88
89 A filter primitive that translates between C floats and their
90 external representations. This routine returns one if it suc‐