1XDR(3)                     Linux Programmer's Manual                    XDR(3)
2
3
4

NAME

6       xdr - library routines for external data representation
7

SYNOPSIS AND DESCRIPTION

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       The  prototypes  below  are declared in <rpc/xdr.h> and make use of the
14       following types:
15
16           typedef int bool_t;
17
18           typedef bool_t (*xdrproc_t)(XDR *, void *,...);
19
20       For the declaration of the XDR type, see <rpc/xdr.h>.
21
22       bool_t xdr_array(XDR *xdrs, char **arrp, unsigned int *sizep,
23                        unsigned int maxsize, unsigned int elsize,
24                        xdrproc_t elproc);
25
26              A filter primitive that translates between  variable-length  ar‐
27              rays  and their corresponding external representations.  The ar‐
28              gument arrp is the address of the pointer to  the  array,  while
29              sizep is the address of the element count of the array; this el‐
30              ement count cannot exceed maxsize.  The argument elsize  is  the
31              sizeof each of the array's elements, and elproc is an XDR filter
32              that translates between the array elements' C  form,  and  their
33              external  representation.   This  routine returns one if it suc‐
34              ceeds, zero otherwise.
35
36       bool_t xdr_bool(XDR *xdrs, bool_t *bp);
37
38              A filter primitive that translates between booleans (C integers)
39              and  their  external  representations.  When encoding data, this
40              filter produces values of either one or zero.  This routine  re‐
41              turns one if it succeeds, zero otherwise.
42
43       bool_t xdr_bytes(XDR *xdrs, char **sp, unsigned int *sizep,
44                        unsigned int maxsize);
45
46              A  filter primitive that translates between counted byte strings
47              and their external representations.  The argument sp is the  ad‐
48              dress  of  the  string pointer.  The length of the string is lo‐
49              cated at address sizep; strings cannot be longer  than  maxsize.
50              This routine returns one if it succeeds, zero otherwise.
51
52       bool_t xdr_char(XDR *xdrs, char *cp);
53
54              A  filter  primitive  that  translates  between C characters and
55              their external representations.  This routine returns one if  it
56              succeeds,  zero  otherwise.   Note:  encoded  characters are not
57              packed, and occupy 4 bytes each.  For arrays of  characters,  it
58              is   worthwhile   to   consider  xdr_bytes(),  xdr_opaque(),  or
59              xdr_string().
60
61       void xdr_destroy(XDR *xdrs);
62
63              A macro that invokes the destroy routine associated with the XDR
64              stream, xdrs.  Destruction usually involves freeing private data
65              structures associated with the stream.  Using xdrs after  invok‐
66              ing xdr_destroy() is undefined.
67
68       bool_t xdr_double(XDR *xdrs, double *dp);
69
70              A  filter  primitive  that translates between C double precision
71              numbers and their external representations.   This  routine  re‐
72              turns one if it succeeds, zero otherwise.
73
74       bool_t xdr_enum(XDR *xdrs, enum_t *ep);
75
76              A filter primitive that translates between C enums (actually in‐
77              tegers)