1xdr_create(3NSL)     Networking Services Library Functions    xdr_create(3NSL)
2
3
4

NAME

6       xdr_create,  xdr_destroy, xdrmem_create, xdrrec_create, xdrstdio_create
7       - library routines for external data representation stream creation
8

SYNOPSIS

10       #include <rpc/xdr.h>
11
12       void xdr_destroy(XDR *xdrs);
13
14
15       void xdrmem_create(XDR *xdrs, const caddr_t addr, const uint_t size,
16            const enum xdr_op op);
17
18
19       void xdrrec_create(XDR *xdrs, const uint_t sendsz, const uint_t recvsz,
20            const caddr_t handle, const int (*readit)const void *read_handle,
21            char *buf, const int len, const int (*writeit)
22            const void *write_handle, const char *buf, const int len);
23
24
25       void xdrstdio_create(XDR *xdrs, FILE *
26            file, const enum xdr_op op);
27
28

DESCRIPTION

30       The XDR library routines allow C programmers to describe arbitrary data
31       structures  in  a machine-independent fashion. Protocols such as remote
32       procedure calls (RPC) use these routines to describe the format of  the
33       data.
34
35
36       These  routines  deal  with the creation of  XDR streams, which must be
37       created before any data can be translated into XDR format.
38
39   Routines
40       See rpc(3NSL) for the definition of the XDR  CLIENT  and  SVCXPRT  data
41       structures.  Any  buffers  passed  to the XDR routines must be properly
42       aligned. Use malloc(3C) to allocate these buffers or be sure  that  the
43       buffer address is divisible evenly by four.
44
45       xdr_destroy()        A  macro  that invokes the destroy routine associ‐
46                            ated with  the  XDR  stream,  xdrs.  Private  data
47                            structures  associated  with the stream are freed.
48                            Using xdrs after xdr_destroy() is invoked is unde‐
49                            fined.
50
51
52       xdrmem_create()      This  routine  initializes  the  XDR stream object
53                            pointed to by xdrs. The stream's data  is  written
54                            to or read from a chunk of memory at location addr
55                            whose length is no less than size bytes long.  The
56                            op determines the direction of the XDR stream. The
57                            value of op can be either XDR_ENCODE,  XDR_DECODE,
58                            or XDR_FREE.
59
60
61       xdrrec_create()      This  routine  initializes  the  read-oriented XDR
62                            stream object pointed to  by  xdrs.  The  stream's
63                            data  is  written  to  a  buffer of size sendsz. A
64                            value of 0 indicates the system should use a suit‐
65                            able  default.   The  stream's data is read from a
66                            buffer of size recvsz. It too  can  be  set  to  a
67                            suitable  default  by  passing  a 0 value.  When a
68                            stream's output buffer is full, writeit is called.
69                            Similarly,  when a stream's input buffer is empty,
70                            xdrrec_create()  calls  readit.  The  behavior  of
71                            these  two routines is similar to the system calls
72                            read() and write(),  except  that  an  appropriate
73                            handle,  read_handle or write_handle, is passed to
74                            the former routines as the first parameter instead
75                            of  a  file  descriptor. See read(2) and write(2),
76                            respectively. The XDR stream's op  field  must  be
77                            set by the caller.
78
79                            This  XDR stream implements an intermediate record
80                            stream. Therefore, additional bytes in the  stream
81                            are provided for record boundary information.
82
83
84       xdrstdio_create()    This  routine  initializes  the  XDR stream object
85                            pointed to by xdrs. The XDR stream data is written
86                            to  or read from the standard I/O stream file. The
87                            parameter op determines the direction of  the  XDR
88                            stream.  The value of op can be either XDR_ENCODE,
89                            XDR_DECODE, or XDR_FREE.
90
91                            The destroy routine associated  with  XDR  streams
92                            calls  fflush()  on  the  file  stream,  but never
93                            fclose(). See fclose(3C).
94
95
96
97       A failure of any of these functions can be detected by first initializ‐
98       ing   the  x_ops  field  in  the  XDR structure (xdrs-> x_ops) to  NULL
99       before calling the  xdr*_create() function.   If  the  x_ops  field  is
100       still  NULL, after the return from the xdr*_create() function, the call
101       has failed.  If the x_ops field contains some other value, assume  that
102       the call has succeeded.
103

ATTRIBUTES

105       See attributes(5) for descriptions of the following attributes:
106
107
108
109
110       ┌─────────────────────────────┬─────────────────────────────┐
111       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
112       ├─────────────────────────────┼─────────────────────────────┤
113       │MT-Level                     │MT-Safe                      │
114       └─────────────────────────────┴─────────────────────────────┘
115

SEE ALSO

117       read(2),  write(2), fclose(3C), malloc(3C), rpc(3NSL), xdr_admin(3NSL),
118       xdr_complex(3NSL), xdr_simple(3NSL), attributes(5)
119
120
121
122SunOS 5.11                        26 Sep 2000                 xdr_create(3NSL)
Impressum