1xdr_simple(3NSL) Networking Services Library Functions xdr_simple(3NSL)
2
3
4
6 xdr_simple, xdr_bool, xdr_char, xdr_double, xdr_enum, xdr_float,
7 xdr_free, xdr_hyper, xdr_int, xdr_long, xdr_longlong_t, xdr_quadruple,
8 xdr_short, xdr_u_char, xdr_u_hyper, xdr_u_int, xdr_u_long, xdr_u_long‐
9 long_t, xdr_u_short, xdr_void - library routines for external data rep‐
10 resentation
11
13 #include<rpc/xdr.h>
14
15
16
17 bool_t xdr_bool(XDR *xdrs, bool_t *bp);
18
19
20 bool_t xdr_char(XDR *xdrs, char *cp);
21
22
23 bool_t xdr_double(XDR *xdrs, double *dp);
24
25
26 bool_t xdr_enum(XDR *xdrs, enum_t *ep);
27
28
29 bool_t xdr_float(XDR *xdrs, float *fp);
30
31
32 void xdr_free(xdrproc_t proc, char *objp);
33
34
35 bool_t xdr_hyper(XDR *xdrs, longlong_t *llp);
36
37
38 bool_t xdr_int(XDR *xdrs, int *ip);
39
40
41 bool_t xdr_long(XDR *xdrs, longt *lp);
42
43
44 bool_t xdr_longlong_t(XDR *xdrs, longlong_t *llp);
45
46
47 bool_t xdr_quadruple(XDR *xdrs, long double *pq);
48
49
50 bool_t xdr_short(XDR *xdrs, short *sp);
51
52
53 bool_t xdr_u_char(XDR *xdrs, unsigned char *ucp);
54
55
56 bool_t xdr_u_hyper(XDR *xdrs, u_longlong_t *ullp);
57
58
59 bool_t xdr_u_int(XDR *xdrs, unsigned *up);
60
61
62 bool_t xdr_u_long(XDR *xdrs, unsigned long *ulp);
63
64
65 bool_t xdr_u_longlong_t(XDR *xdrs, u_longlong_t *ullp);
66
67
68 bool_t xdr_u_short(XDR xdrs, unsigned short *usp);
69
70
71 bool_t xdr_void(void)
72
73
75 The XDR library routines allow C programmers to describe simple data
76 structures in a machine-independent fashion. Protocols such as remote
77 procedure calls (RPC) use these routines to describe the format of the
78 data.
79
80
81 These routines require the creation of XDR streams (see xdr_cre‐
82 ate(3NSL)).
83
84 Routines
85 See rpc(3NSL) for the definition of the XDR data structure. Note that
86 any buffers passed to the XDR routines must be properly aligned. It is
87 suggested that malloc(3C) be used to allocate these buffers or that the
88 programmer insure that the buffer address is divisible evenly by four.
89
90 xdr_bool() xdr_bool() translates between booleans (C inte‐
91 gers) and their external representations. When
92 encoding data, this filter produces values of
93 either 1 or 0. This routine returns TRUE if it
94 succeeds, FALSE otherwise.
95
96
97 xdr_char() xdr_char() translates between C characters and
98 their external representations. This routine
99 returns TRUE if it succeeds, FALSE otherwise.
100 Note: encoded characters are not packed, and
101 occupy 4 bytes each. For arrays of characters, it
102 is worthwhile to consider xdr_bytes(),
103 xdr_opaque(), or xdr_string() (see xdr_com‐
104 plex(3NSL)).
105
106
107 xdr_double() xdr_double() translates between C double preci‐
108 sion numbers and their external representations.
109 This routine returns TRUE if it succeeds, FALSE
110 otherwise.
111
112
113 xdr_enum() xdr_enum() translates between C enums (actually
114 integers) and their external representations.
115 This routine returns TRUE if it succeeds, FALSE
116 otherwise.
117
118
119 xdr_float() xdr_float() translates between C floats and their
120 external representations. This routine returns
121 TRUE if it succeeds, FALSE otherwise.
122
123
124 xdr_free() Generic freeing routine. The first argument is
125 the XDR routine for the object being freed. The
126 second argument is a pointer to the object
127 itself. Note: the pointer passed to this routine
128 is not freed, but what it points to is freed
129 (recursively, depending on the XDR routine).
130
131
132 xdr_hyper() xdr_hyper() translates between ANSI C long long
133 integers and their external representations. This
134 routine returns TRUE if it succeeds, FALSE other‐
135 wise.
136
137
138 xdr_int() xdr_int() translates between C integers and their
139 external representations. This routine returns
140 TRUE if it succeeds, FALSE otherwise.
141
142
143 xdr_long() xdr_long() translates between C long integers and
144 their external representations. This routine
145 returns TRUE if it succeeds, FALSE otherwise.
146
147 In a 64-bit environment, this routine returns an
148 error if the value of lp is outside the range
149 [INT32_MIN, INT32_MAX]. The xdr_int() routine is
150 recommended in place of this routine.
151
152
153 xdr_longlong_t() xdr_longlong_t() translates between ANSI C long
154 long integers and their external representations.
155 This routine returns TRUE if it succeeds, FALSE
156 otherwise. This routine is identical to
157 xdr_hyper().
158
159
160 xdr_quadruple() xdr_quadruple() translates between IEEE quadruple
161 precision floating point numbers and their exter‐
162 nal representations. This routine returns TRUE if
163 it succeeds, FALSE otherwise.
164
165
166 xdr_short() xdr_short() translates between C short integers
167 and their external representations. This routine
168 returns TRUE if it succeeds, FALSE otherwise.
169
170
171 xdr_u_char() xdr_u_char() translates between unsigned C char‐
172 acters and their external representations. This
173 routine returns TRUE if it succeeds, FALSE other‐
174 wise.
175
176
177 xdr_u_hyper() xdr_u_hyper() translates between unsigned ANSI C
178 long long integers and their external representa‐
179 tions. This routine returns TRUE if it succeeds,
180 FALSE otherwise.
181
182
183 xdr_u_int() A filter primitive that translates between a C
184 unsigned integer and its external representation.
185 This routine returns TRUE if it succeeds, FALSE
186 otherwise.
187
188
189 xdr_u_long() xdr_u_long() translates between C unsigned long
190 integers and their external representations. This
191 routine returns TRUE if it succeeds, FALSE other‐
192 wise.
193
194 In a 64-bit environment, this routine returns an
195 error if the value of ulp is outside the range
196 [0, UINT32_MAX]. The xdr_u_int() routine is rec‐
197 ommended in place of this routine.
198
199
200 xdr_u_longlong_t() xdr_u_longlong_t() translates between unsigned
201 ANSI C long long integers and their external
202 representations. This routine returns TRUE if it
203 succeeds, FALSE otherwise. This routine is iden‐
204 tical to xdr_u_hyper().
205
206
207 xdr_u_short() xdr_u_short() translates between C unsigned short
208 integers and their external representations. This
209 routine returns TRUE if it succeeds, FALSE other‐
210 wise.
211
212
213 xdr_void() This routine always returns TRUE. It may be
214 passed to RPC routines that require a function
215 parameter, where nothing is to be done.
216
217
219 See attributes(5) for descriptions of the following attributes:
220
221
222
223
224 ┌───────────────────────────────────────────────────────────┐
225 │ ATTRIBUTE TYPE ATTRIBUTE VALUE │
226 │MT-Level Safe │
227 └───────────────────────────────────────────────────────────┘
228
230 malloc(3C), rpc(3NSL), xdr_admin(3NSL), xdr_complex(3NSL), xdr_cre‐
231 ate(3NSL), attributes(5)
232
233
234
235SunOS 5.11 27 Aug 2001 xdr_simple(3NSL)