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

NAME

6       xdr_admin,  xdr_control,  xdr_getpos,  xdr_inline,  xdrrec_endofrecord,
7       xdrrec_eof, xdrrec_readbytes, xdrrec_skiprecord, xdr_setpos, xdr_sizeof
8       - library routines for external data representation
9

DESCRIPTION

11       XDR  library  routines  allow  C programmers to describe arbitrary data
12       structures in a machine-independent fashion. Protocols such  as  remote
13       procedure  calls (RPC) use these routines to describe the format of the
14       data.
15
16
17       These routines deal specifically with the management of the XDR stream.
18
19   Routines
20       See rpc(3NSL) for the definition of the XDR data structure.  Note  that
21       any buffers passed to the XDR routines must be properly aligned.  It is
22       suggested either that malloc(3C) be used to allocate these buffers,  or
23       that the programmer insure  that the buffer address is divisible evenly
24       by four.
25
26
27       #include <rpc/xdr.h>
28
29       bool_t xdr_control( XDR *xdrs, int req, void *info);
30
31           A function macro to change or retrieve various information about an
32           XDR  stream.  req  indicates  the  type  of operation and info is a
33           pointer  to  the  information.  The  supported  values  of  req  is
34           XDR_GET_BYTES_AVAIL  and  its argument type is xdr_bytesrec *. They
35           return the number of bytes left unconsumed in the stream and a flag
36           indicating whether or not this is the last fragment.
37
38
39       uint_t xdr_getpos(const XDR *xdrs);
40
41           A  macro  that invokes the get-position routine associated with the
42           XDR stream, xdrs. The routine returns an  unsigned  integer,  which
43           indicates  the position of the XDR byte stream. A desirable feature
44           of XDR streams is that simple arithmetic works  with  this  number,
45           although  the  XDR stream instances need not guarantee this. There‐
46           fore, applications written for portability  should  not  depend  on
47           this feature.
48
49
50       long *xdr_inline(XDR *xdrs, const int len);
51
52           A  macro  that  invokes the in-line routine associated with the XDR
53           stream, xdrs. The routine returns a pointer to a  contiguous  piece
54           of  the stream's buffer; len is the byte length of the desired buf‐
55           fer. Note: pointer is cast to long *.
56
57           Warning: xdr_inline() may return NULL (0) if it cannot  allocate  a
58           contiguous piece of a buffer. Therefore the behavior may vary among
59           stream instances; it exists for the sake of efficiency, and  appli‐
60           cations written for portability should not depend on this feature.
61
62
63       bool_t xdrrec_endofrecord(XDR *xdrs, int sendnow);
64
65           This  routine can be invoked only on streams created by xdrrec_cre‐
66           ate(). See xdr_create(3NSL). The  data  in  the  output  buffer  is
67           marked  as  a completed record, and the output buffer is optionally
68           written out if sendnow is non-zero. This routine returns TRUE if it
69           succeeds, FALSE otherwise.
70
71
72       bool_t xdrrec_eof(XDR *xdrs);
73
74           This  routine can be invoked only on streams created by xdrrec_cre‐
75           ate(). After consuming the  rest  of  the  current  record  in  the
76           stream,  this  routine returns TRUE if there is no more data in the
77           stream's input buffer. It returns  FALSE  if  there  is  additional
78           data in the stream's input buffer.
79
80
81       int xdrrec_readbytes(XDR *xdrs, caddr_t addr, uint_t nbytes);
82
83           This  routine can be invoked only on streams created by xdrrec_cre‐
84           ate(). It attempts to read nbytes bytes from the  XDR  stream  into
85           the  buffer  pointed  to by addr. Upon success this routine returns
86           the number of bytes read. Upon  failure, it returns  −1.  A  return
87           value of  0 indicates an end of record.
88
89
90       bool_t xdrrec_skiprecord(XDR *xdrs);
91
92           This  routine can be invoked only on streams created by xdrrec_cre‐
93           ate(). See xdr_create(3NSL). It tells the   XDR implementation that
94           the  rest of the current record in the stream's input buffer should
95           be discarded. This routine returns TRUE  if  it  succeeds,    FALSE
96           otherwise.
97
98
99       bool_t xdr_setpos(XDR *xdrs, const uint_t pos);
100
101           A  macro  that invokes the set position routine associated with the
102           XDR stream xdrs. The parameter pos is  a  position  value  obtained
103           from  xdr_getpos(). This routine returns TRUE if the XDR stream was
104           repositioned, and FALSE otherwise.
105
106           Warning: it is difficult to reposition some types of  XDR  streams,
107           so  this  routine may fail with one type of stream and succeed with
108           another. Therefore, applications written for portability should not
109           depend on this feature.
110
111
112       unsigned long xdr_sizeof(xdrproc_t func, void *data);
113
114           This  routine  returns  the number of bytes required to encode data
115           using the XDR filter function func,  excluding  potential  overhead
116           such as RPC headers or record markers. 0 is returned on error. This
117           information might be used to select between transport protocols, or
118           to determine the buffer size for various lower levels of RPC client
119           and server creation routines, or to allocate storage when   XDR  is
120           used outside of the RPC subsystem.
121
122

ATTRIBUTES

124       See attributes(5) for descriptions of the following attributes:
125
126
127
128
129       ┌─────────────────────────────┬─────────────────────────────┐
130       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
131       ├─────────────────────────────┼─────────────────────────────┤
132       │MT-Level                     │Safe                         │
133       └─────────────────────────────┴─────────────────────────────┘
134

SEE ALSO

136       malloc(3C),  rpc(3NSL),  xdr_complex(3NSL),  xdr_create(3NSL), xdr_sim‐
137       ple(3NSL), attributes(5)
138
139
140
141SunOS 5.11                        30 Dec 1996                  xdr_admin(3NSL)
Impressum