]>
Commit | Line | Data |
---|---|---|
a1eaacb1 | 1 | '\" t |
2297bf0e MK |
2 | .\" This page was taken from the 4.4BSD-Lite CDROM (BSD license) |
3 | .\" | |
6d1cd1d7 | 4 | .\" %%%LICENSE_START(BSD_ONELINE_CDROM) |
cc3832e9 | 5 | .\" This page was taken from the 4.4BSD-Lite CDROM (BSD license) |
8ff7380d | 6 | .\" %%%LICENSE_END |
cc3832e9 | 7 | .\" |
fea681da | 8 | .\" @(#)xdr.3n 2.2 88/08/03 4.0 RPCSRC; from 1.16 88/03/14 SMI |
e7c7da90 MK |
9 | .\" |
10 | .\" 2007-12-30, mtk, Convert function prototypes to modern C syntax | |
11 | .\" | |
4c1c5274 | 12 | .TH xdr 3 (date) "Linux man-pages (unreleased)" |
fea681da MK |
13 | .SH NAME |
14 | xdr \- library routines for external data representation | |
42009080 AC |
15 | .SH LIBRARY |
16 | Standard C library | |
17 | .RI ( libc ", " \-lc ) | |
47297adb | 18 | .SH SYNOPSIS AND DESCRIPTION |
fea681da MK |
19 | These routines allow C programmers to describe |
20 | arbitrary data structures in a machine-independent fashion. | |
21 | Data for remote procedure calls are transmitted using these | |
22 | routines. | |
dbfe9c70 | 23 | .PP |
5b20a7a2 MK |
24 | The prototypes below are declared in |
25 | .I <rpc/xdr.h> | |
26 | and make use of the following types: | |
dbfe9c70 | 27 | .PP |
b7a12afe | 28 | .RS 4 |
b8302363 | 29 | .EX |
d5a7e77e | 30 | .BI "typedef int " bool_t ; |
dbfe9c70 | 31 | .PP |
511bb71b | 32 | .BI "typedef bool_t (*" xdrproc_t ")(XDR *, void *,...);" |
b8302363 | 33 | .EE |
b7a12afe | 34 | .RE |
dd3568a1 | 35 | .PP |
5b20a7a2 MK |
36 | For the declaration of the |
37 | .I XDR | |
38 | type, see | |
39 | .IR <rpc/xdr.h> . | |
dd3568a1 | 40 | .PP |
fea681da | 41 | .nf |
5b20a7a2 MK |
42 | .BI "bool_t xdr_array(XDR *" xdrs ", char **" arrp ", unsigned int *" sizep , |
43 | .BI " unsigned int " maxsize ", unsigned int " elsize , | |
44 | .BI " xdrproc_t " elproc ); | |
fea681da | 45 | .fi |
fea681da | 46 | .IP |
5b20a7a2 | 47 | A filter primitive that translates between variable-length arrays |
c13182ef | 48 | and their corresponding external representations. |
c4bb193f | 49 | The argument |
fea681da MK |
50 | .I arrp |
51 | is the address of the pointer to the array, while | |
52 | .I sizep | |
53 | is the address of the element count of the array; | |
54 | this element count cannot exceed | |
55 | .IR maxsize . | |
c4bb193f | 56 | The argument |
fea681da MK |
57 | .I elsize |
58 | is the | |
59 | .I sizeof | |
60 | each of the array's elements, and | |
61 | .I elproc | |
5b20a7a2 | 62 | is an XDR filter that translates between |
fea681da MK |
63 | the array elements' C form, and their external |
64 | representation. | |
65 | This routine returns one if it succeeds, zero otherwise. | |
dd3568a1 | 66 | .PP |
fea681da | 67 | .nf |
5b20a7a2 | 68 | .BI "bool_t xdr_bool(XDR *" xdrs ", bool_t *" bp ); |
fea681da | 69 | .fi |
fea681da MK |
70 | .IP |
71 | A filter primitive that translates between booleans (C | |
72 | integers) | |
c13182ef MK |
73 | and their external representations. |
74 | When encoding data, this | |
fea681da MK |
75 | filter produces values of either one or zero. |
76 | This routine returns one if it succeeds, zero otherwise. | |
dd3568a1 | 77 | .PP |
fea681da | 78 | .nf |
5b20a7a2 MK |
79 | .BI "bool_t xdr_bytes(XDR *" xdrs ", char **" sp ", unsigned int *" sizep , |
80 | .BI " unsigned int " maxsize ); | |
fea681da | 81 | .fi |
fea681da MK |
82 | .IP |
83 | A filter primitive that translates between counted byte | |
84 | strings and their external representations. | |
c4bb193f | 85 | The argument |
fea681da | 86 | .I sp |
c13182ef MK |
87 | is the address of the string pointer. |
88 | The length of the | |
fea681da MK |
89 | string is located at address |
90 | .IR sizep ; | |
91 | strings cannot be longer than | |
92 | .IR maxsize . | |
93 | This routine returns one if it succeeds, zero otherwise. | |
dd3568a1 | 94 | .PP |
fea681da | 95 | .nf |
5b20a7a2 | 96 | .BI "bool_t xdr_char(XDR *" xdrs ", char *" cp ); |
fea681da | 97 | .fi |
fea681da MK |
98 | .IP |
99 | A filter primitive that translates between C characters | |
100 | and their external representations. | |
101 | This routine returns one if it succeeds, zero otherwise. | |
c13182ef MK |
102 | Note: encoded characters are not packed, and occupy 4 bytes each. |
103 | For arrays of characters, it is worthwhile to | |
fea681da | 104 | consider |
63aa9df0 | 105 | .BR xdr_bytes (), |
aa0da2b9 | 106 | .BR xdr_opaque (), |
fea681da | 107 | or |
63aa9df0 | 108 | .BR xdr_string (). |
dd3568a1 | 109 | .PP |
fea681da | 110 | .nf |
5b20a7a2 | 111 | .BI "void xdr_destroy(XDR *" xdrs ); |
fea681da | 112 | .fi |
fea681da | 113 | .IP |
5b20a7a2 | 114 | A macro that invokes the destroy routine associated with the XDR stream, |
fea681da MK |
115 | .IR xdrs . |
116 | Destruction usually involves freeing private data structures | |
c13182ef MK |
117 | associated with the stream. |
118 | Using | |
fea681da MK |
119 | .I xdrs |
120 | after invoking | |
63aa9df0 | 121 | .BR xdr_destroy () |
fea681da | 122 | is undefined. |
dd3568a1 | 123 | .PP |
fea681da | 124 | .nf |
5b20a7a2 | 125 | .BI "bool_t xdr_double(XDR *" xdrs ", double *" dp ); |
fea681da | 126 | .fi |
fea681da MK |
127 | .IP |
128 | A filter primitive that translates between C | |
9ff08aad | 129 | .I double |
fea681da MK |
130 | precision numbers and their external representations. |
131 | This routine returns one if it succeeds, zero otherwise. | |
dd3568a1 | 132 | .PP |
fea681da | 133 | .nf |
5b20a7a2 | 134 | .BI "bool_t xdr_enum(XDR *" xdrs ", enum_t *" ep ); |
fea681da | 135 | .fi |
fea681da MK |
136 | .IP |
137 | A filter primitive that translates between C | |
f19a0f03 | 138 | .IR enum s |
fea681da MK |
139 | (actually integers) and their external representations. |
140 | This routine returns one if it succeeds, zero otherwise. | |
dd3568a1 | 141 | .PP |
fea681da | 142 | .nf |
5b20a7a2 | 143 | .BI "bool_t xdr_float(XDR *" xdrs ", float *" fp ); |
fea681da | 144 | .fi |
fea681da MK |
145 | .IP |
146 | A filter primitive that translates between C | |
f19a0f03 | 147 | .IR float s |
fea681da MK |
148 | and their external representations. |
149 | This routine returns one if it succeeds, zero otherwise. | |
dd3568a1 | 150 | .PP |
fea681da | 151 | .nf |
5b20a7a2 | 152 | .BI "void xdr_free(xdrproc_t " proc ", char *" objp ); |
fea681da | 153 | .fi |
fea681da | 154 | .IP |
c13182ef | 155 | Generic freeing routine. |
5b20a7a2 MK |
156 | The first argument is the XDR routine for the object being freed. |
157 | The second argument is a pointer to the object itself. | |
158 | Note: the pointer passed to this routine is | |
fea681da MK |
159 | .I not |
160 | freed, but what it points to | |
161 | .I is | |
162 | freed (recursively). | |
dd3568a1 | 163 | .PP |
fea681da | 164 | .nf |
5b20a7a2 | 165 | .BI "unsigned int xdr_getpos(XDR *" xdrs ); |
fea681da | 166 | .fi |
fea681da MK |
167 | .IP |
168 | A macro that invokes the get-position routine | |
5b20a7a2 | 169 | associated with the XDR stream, |
fea681da MK |
170 | .IR xdrs . |
171 | The routine returns an unsigned integer, | |
5b20a7a2 MK |
172 | which indicates the position of the XDR byte stream. |
173 | A desirable feature of XDR | |
fea681da | 174 | streams is that simple arithmetic works with this number, |
5b20a7a2 | 175 | although the XDR stream instances need not guarantee this. |
dd3568a1 | 176 | .PP |
fea681da | 177 | .nf |
5b20a7a2 | 178 | .BI "long *xdr_inline(XDR *" xdrs ", int " len ); |
fea681da | 179 | .fi |
fea681da | 180 | .IP |
d6115148 | 181 | A macro that invokes the inline routine associated with the XDR stream, |
fea681da MK |
182 | .IR xdrs . |
183 | The routine returns a pointer | |
184 | to a contiguous piece of the stream's buffer; | |
185 | .I len | |
186 | is the byte length of the desired buffer. | |
187 | Note: pointer is cast to | |
5049da5b | 188 | .IR "long\ *" . |
fea681da MK |
189 | .IP |
190 | Warning: | |
63aa9df0 | 191 | .BR xdr_inline () |
5b20a7a2 | 192 | may return NULL (0) |
fea681da MK |
193 | if it cannot allocate a contiguous piece of a buffer. |
194 | Therefore the behavior may vary among stream instances; | |
195 | it exists for the sake of efficiency. | |
dd3568a1 | 196 | .PP |
fea681da | 197 | .nf |
5b20a7a2 | 198 | .BI "bool_t xdr_int(XDR *" xdrs ", int *" ip ); |
fea681da | 199 | .fi |
fea681da MK |
200 | .IP |
201 | A filter primitive that translates between C integers | |
202 | and their external representations. | |
203 | This routine returns one if it succeeds, zero otherwise. | |
dd3568a1 | 204 | .PP |
fea681da | 205 | .nf |
5b20a7a2 | 206 | .BI "bool_t xdr_long(XDR *" xdrs ", long *" lp ); |
fea681da | 207 | .fi |
fea681da MK |
208 | .IP |
209 | A filter primitive that translates between C | |
9ff08aad | 210 | .I long |
fea681da MK |
211 | integers and their external representations. |
212 | This routine returns one if it succeeds, zero otherwise. | |
dd3568a1 | 213 | .PP |
fea681da | 214 | .nf |
5b20a7a2 MK |
215 | .BI "void xdrmem_create(XDR *" xdrs ", char *" addr ", unsigned int " size , |
216 | .BI " enum xdr_op " op ); | |
fea681da | 217 | .fi |
fea681da | 218 | .IP |
5b20a7a2 | 219 | This routine initializes the XDR stream object pointed to by |
fea681da MK |
220 | .IR xdrs . |
221 | The stream's data is written to, or read from, | |
222 | a chunk of memory at location | |
223 | .I addr | |
224 | whose length is no more than | |
225 | .I size | |
c13182ef MK |
226 | bytes long. |
227 | The | |
fea681da | 228 | .I op |
5b20a7a2 | 229 | determines the direction of the XDR stream (either |
066cb3d6 MK |
230 | .BR XDR_ENCODE , |
231 | .BR XDR_DECODE , | |
fea681da | 232 | or |
066cb3d6 | 233 | .BR XDR_FREE ). |
dd3568a1 | 234 | .PP |
fea681da | 235 | .nf |
5b20a7a2 | 236 | .BI "bool_t xdr_opaque(XDR *" xdrs ", char *" cp ", unsigned int " cnt ); |
fea681da | 237 | .fi |
fea681da MK |
238 | .IP |
239 | A filter primitive that translates between fixed size opaque data | |
240 | and its external representation. | |
c4bb193f | 241 | The argument |
fea681da MK |
242 | .I cp |
243 | is the address of the opaque object, and | |
244 | .I cnt | |
245 | is its size in bytes. | |
246 | This routine returns one if it succeeds, zero otherwise. | |
dd3568a1 | 247 | .PP |
fea681da | 248 | .nf |
5b20a7a2 MK |
249 | .BI "bool_t xdr_pointer(XDR *" xdrs ", char **" objpp , |
250 | .BI " unsigned int " objsize ", xdrproc_t " xdrobj ); | |
fea681da | 251 | .fi |
fea681da MK |
252 | .IP |
253 | Like | |
63aa9df0 | 254 | .BR xdr_reference () |
b437fdd9 | 255 | except that it serializes null pointers, whereas |
63aa9df0 | 256 | .BR xdr_reference () |
c13182ef MK |
257 | does not. |
258 | Thus, | |
63aa9df0 | 259 | .BR xdr_pointer () |
fea681da MK |
260 | can represent |
261 | recursive data structures, such as binary trees or | |
262 | linked lists. | |
dd3568a1 | 263 | .PP |
fea681da | 264 | .nf |
5b20a7a2 MK |
265 | .BI "void xdrrec_create(XDR *" xdrs ", unsigned int " sendsize , |
266 | .BI " unsigned int " recvsize ", char *" handle , | |
511bb71b MK |
267 | .BI " int (*" readit ")(char *, char *, int)," |
268 | .BI " int (*" writeit ")(char *, char *, int));" | |
fea681da | 269 | .fi |
fea681da | 270 | .IP |
5b20a7a2 | 271 | This routine initializes the XDR stream object pointed to by |
fea681da MK |
272 | .IR xdrs . |
273 | The stream's data is written to a buffer of size | |
274 | .IR sendsize ; | |
5b20a7a2 | 275 | a value of zero indicates the system should use a suitable default. |
c13182ef | 276 | The stream's data is read from a buffer of size |
fea681da | 277 | .IR recvsize ; |
5b20a7a2 | 278 | it too can be set to a suitable default by passing a zero value. |
fea681da MK |
279 | When a stream's output buffer is full, |
280 | .I writeit | |
c13182ef MK |
281 | is called. |
282 | Similarly, when a stream's input buffer is empty, | |
fea681da | 283 | .I readit |
c13182ef MK |
284 | is called. |
285 | The behavior of these two routines is similar to | |
fb186734 MK |
286 | the system calls |
287 | .BR read (2) | |
fea681da | 288 | and |
fb186734 | 289 | .BR write (2), |
fea681da MK |
290 | except that |
291 | .I handle | |
c4bb193f | 292 | is passed to the former routines as the first argument. |
5b20a7a2 | 293 | Note: the XDR stream's |
fea681da MK |
294 | .I op |
295 | field must be set by the caller. | |
296 | .IP | |
f64cc745 | 297 | Warning: to read from an XDR stream created by this API, |
0e6be116 | 298 | you'll need to call |
029d9a07 | 299 | .BR xdrrec_skiprecord () |
0e6be116 MK |
300 | first before calling any other XDR APIs. |
301 | This inserts additional bytes in the stream to provide | |
302 | record boundary information. | |
303 | Also, XDR streams created with different | |
1ae6b2c7 | 304 | .B xdr*_create |
0e6be116 | 305 | APIs are not compatible for the same reason. |
dd3568a1 | 306 | .PP |
fea681da | 307 | .nf |
5b20a7a2 | 308 | .BI "bool_t xdrrec_endofrecord(XDR *" xdrs ", int " sendnow ); |
fea681da | 309 | .fi |
fea681da | 310 | .IP |
5b20a7a2 | 311 | This routine can be invoked only on streams created by |
63aa9df0 | 312 | .BR xdrrec_create (). |
5b20a7a2 | 313 | The data in the output buffer is marked as a completed record, |
fea681da MK |
314 | and the output buffer is optionally written out if |
315 | .I sendnow | |
c7094399 | 316 | is nonzero. |
c13182ef | 317 | This routine returns one if it succeeds, zero otherwise. |
dd3568a1 | 318 | .PP |
fea681da | 319 | .nf |
5b20a7a2 | 320 | .BI "bool_t xdrrec_eof(XDR *" xdrs ); |
fea681da | 321 | .fi |
fea681da | 322 | .IP |
5b20a7a2 | 323 | This routine can be invoked only on streams created by |
63aa9df0 | 324 | .BR xdrrec_create (). |
fea681da MK |
325 | After consuming the rest of the current record in the stream, |
326 | this routine returns one if the stream has no more input, | |
327 | zero otherwise. | |
dd3568a1 | 328 | .PP |
fea681da | 329 | .nf |
5b20a7a2 | 330 | .BI "bool_t xdrrec_skiprecord(XDR *" xdrs ); |
fea681da | 331 | .fi |
fea681da MK |
332 | .IP |
333 | This routine can be invoked only on | |
334 | streams created by | |
63aa9df0 | 335 | .BR xdrrec_create (). |
5b20a7a2 | 336 | It tells the XDR implementation that the rest of the current record |
fea681da MK |
337 | in the stream's input buffer should be discarded. |
338 | This routine returns one if it succeeds, zero otherwise. | |
dd3568a1 | 339 | .PP |
fea681da | 340 | .nf |
5b20a7a2 MK |
341 | .BI "bool_t xdr_reference(XDR *" xdrs ", char **" pp ", unsigned int " size , |
342 | .BI " xdrproc_t " proc ); | |
fea681da | 343 | .fi |
fea681da MK |
344 | .IP |
345 | A primitive that provides pointer chasing within structures. | |
c4bb193f | 346 | The argument |
fea681da MK |
347 | .I pp |
348 | is the address of the pointer; | |
349 | .I size | |
350 | is the | |
351 | .I sizeof | |
352 | the structure that | |
353 | .I *pp | |
354 | points to; and | |
355 | .I proc | |
5b20a7a2 | 356 | is an XDR procedure that filters the structure |
fea681da MK |
357 | between its C form and its external representation. |
358 | This routine returns one if it succeeds, zero otherwise. | |
359 | .IP | |
b437fdd9 | 360 | Warning: this routine does not understand null pointers. |
c13182ef | 361 | Use |
63aa9df0 | 362 | .BR xdr_pointer () |
fea681da | 363 | instead. |
dd3568a1 | 364 | .PP |
fea681da | 365 | .nf |
5b20a7a2 | 366 | .BI "xdr_setpos(XDR *" xdrs ", unsigned int " pos ); |
fea681da | 367 | .fi |
fea681da MK |
368 | .IP |
369 | A macro that invokes the set position routine associated with | |
5b20a7a2 | 370 | the XDR stream |
fea681da | 371 | .IR xdrs . |
c4bb193f | 372 | The argument |
fea681da MK |
373 | .I pos |
374 | is a position value obtained from | |
63aa9df0 | 375 | .BR xdr_getpos (). |
5b20a7a2 | 376 | This routine returns one if the XDR stream could be repositioned, |
fea681da MK |
377 | and zero otherwise. |
378 | .IP | |
5b20a7a2 | 379 | Warning: it is difficult to reposition some types of XDR |
fea681da MK |
380 | streams, so this routine may fail with one |
381 | type of stream and succeed with another. | |
dd3568a1 | 382 | .PP |
fea681da | 383 | .nf |
5b20a7a2 | 384 | .BI "bool_t xdr_short(XDR *" xdrs ", short *" sp ); |
fea681da | 385 | .fi |
fea681da MK |
386 | .IP |
387 | A filter primitive that translates between C | |
f19a0f03 | 388 | .I short |
fea681da MK |
389 | integers and their external representations. |
390 | This routine returns one if it succeeds, zero otherwise. | |
dd3568a1 | 391 | .PP |
fea681da | 392 | .nf |
5b20a7a2 | 393 | .BI "void xdrstdio_create(XDR *" xdrs ", FILE *" file ", enum xdr_op " op ); |
fea681da | 394 | .fi |
fea681da | 395 | .IP |
5b20a7a2 | 396 | This routine initializes the XDR stream object pointed to by |
fea681da | 397 | .IR xdrs . |
5b20a7a2 | 398 | The XDR stream data is written to, or read from, the |
eee0a2ec | 399 | .I stdio |
fea681da MK |
400 | stream |
401 | .IR file . | |
c4bb193f | 402 | The argument |
fea681da | 403 | .I op |
5b20a7a2 | 404 | determines the direction of the XDR stream (either |
066cb3d6 MK |
405 | .BR XDR_ENCODE , |
406 | .BR XDR_DECODE , | |
fea681da | 407 | or |
066cb3d6 | 408 | .BR XDR_FREE ). |
fea681da | 409 | .IP |
5b20a7a2 | 410 | Warning: the destroy routine associated with such XDR streams calls |
fb186734 | 411 | .BR fflush (3) |
fea681da MK |
412 | on the |
413 | .I file | |
414 | stream, but never | |
fb186734 | 415 | .BR fclose (3). |
dd3568a1 | 416 | .PP |
fea681da | 417 | .nf |
5b20a7a2 | 418 | .BI "bool_t xdr_string(XDR *" xdrs ", char **" sp ", unsigned int " maxsize ); |
fea681da | 419 | .fi |
fea681da MK |
420 | .IP |
421 | A filter primitive that translates between C strings and | |
5b20a7a2 | 422 | their corresponding external representations. |
fea681da MK |
423 | Strings cannot be longer than |
424 | .IR maxsize . | |
c13182ef | 425 | Note: |
fea681da MK |
426 | .I sp |
427 | is the address of the string's pointer. | |
428 | This routine returns one if it succeeds, zero otherwise. | |
dd3568a1 | 429 | .PP |
fea681da | 430 | .nf |
5b20a7a2 | 431 | .BI "bool_t xdr_u_char(XDR *" xdrs ", unsigned char *" ucp ); |
fea681da | 432 | .fi |
fea681da MK |
433 | .IP |
434 | A filter primitive that translates between | |
9ff08aad | 435 | .I unsigned |
fea681da MK |
436 | C characters and their external representations. |
437 | This routine returns one if it succeeds, zero otherwise. | |
dd3568a1 | 438 | .PP |
fea681da | 439 | .nf |
771aecbe | 440 | .BI "bool_t xdr_u_int(XDR *" xdrs ", unsigned int *" up ); |
fea681da | 441 | .fi |
fea681da MK |
442 | .IP |
443 | A filter primitive that translates between C | |
9ff08aad | 444 | .I unsigned |
fea681da MK |
445 | integers and their external representations. |
446 | This routine returns one if it succeeds, zero otherwise. | |
dd3568a1 | 447 | .PP |
fea681da | 448 | .nf |
5b20a7a2 | 449 | .BI "bool_t xdr_u_long(XDR *" xdrs ", unsigned long *" ulp ); |
fea681da | 450 | .fi |
fea681da MK |
451 | .IP |
452 | A filter primitive that translates between C | |
9ff08aad | 453 | .I "unsigned long" |
fea681da MK |
454 | integers and their external representations. |
455 | This routine returns one if it succeeds, zero otherwise. | |
dd3568a1 | 456 | .PP |
fea681da | 457 | .nf |
5b20a7a2 | 458 | .BI "bool_t xdr_u_short(XDR *" xdrs ", unsigned short *" usp ); |
fea681da | 459 | .fi |
fea681da MK |
460 | .IP |
461 | A filter primitive that translates between C | |
9ff08aad | 462 | .I "unsigned short" |
fea681da MK |
463 | integers and their external representations. |
464 | This routine returns one if it succeeds, zero otherwise. | |
dd3568a1 | 465 | .PP |
fea681da | 466 | .nf |
2ce1caae AC |
467 | .BI "bool_t xdr_union(XDR *" xdrs ", enum_t *" dscmp ", char *" unp , |
468 | .BI " const struct xdr_discrim *" choices , | |
5b20a7a2 | 469 | .BI " xdrproc_t " defaultarm "); /* may equal NULL */" |
fea681da | 470 | .fi |
fea681da MK |
471 | .IP |
472 | A filter primitive that translates between a discriminated C | |
f19a0f03 | 473 | .I union |
c13182ef MK |
474 | and its corresponding external representation. |
475 | It first | |
fea681da MK |
476 | translates the discriminant of the union located at |
477 | .IR dscmp . | |
478 | This discriminant is always an | |
f19a0f03 | 479 | .IR enum_t . |
fea681da MK |
480 | Next the union located at |
481 | .I unp | |
c13182ef | 482 | is translated. |
c4bb193f | 483 | The argument |
fea681da MK |
484 | .I choices |
485 | is a pointer to an array of | |
63aa9df0 | 486 | .BR xdr_discrim () |
c13182ef MK |
487 | structures. |
488 | Each structure contains an ordered pair of | |
fea681da MK |
489 | .RI [ value , proc ]. |
490 | If the union's discriminant is equal to the associated | |
491 | .IR value , | |
492 | then the | |
493 | .I proc | |
c13182ef MK |
494 | is called to translate the union. |
495 | The end of the | |
63aa9df0 | 496 | .BR xdr_discrim () |
5b20a7a2 | 497 | structure array is denoted by a routine of value NULL. |
fea681da MK |
498 | If the discriminant is not found in the |
499 | .I choices | |
500 | array, then the | |
501 | .I defaultarm | |
5b20a7a2 | 502 | procedure is called (if it is not NULL). |
fea681da | 503 | Returns one if it succeeds, zero otherwise. |
dd3568a1 | 504 | .PP |
fea681da | 505 | .nf |
5b20a7a2 MK |
506 | .BI "bool_t xdr_vector(XDR *" xdrs ", char *" arrp ", unsigned int " size , |
507 | .BI " unsigned int " elsize ", xdrproc_t " elproc ); | |
fea681da | 508 | .fi |
fea681da | 509 | .IP |
5b20a7a2 | 510 | A filter primitive that translates between fixed-length arrays |
c13182ef | 511 | and their corresponding external representations. |
c4bb193f | 512 | The argument |
fea681da MK |
513 | .I arrp |
514 | is the address of the pointer to the array, while | |
515 | .I size | |
c3c1773e | 516 | is the element count of the array. |
c4bb193f | 517 | The argument |
fea681da MK |
518 | .I elsize |
519 | is the | |
520 | .I sizeof | |
521 | each of the array's elements, and | |
522 | .I elproc | |
5b20a7a2 | 523 | is an XDR filter that translates between |
fea681da MK |
524 | the array elements' C form, and their external |
525 | representation. | |
526 | This routine returns one if it succeeds, zero otherwise. | |
dd3568a1 | 527 | .PP |
fea681da | 528 | .nf |
1ae6b2c7 | 529 | .B bool_t xdr_void(void); |
fea681da | 530 | .fi |
fea681da MK |
531 | .IP |
532 | This routine always returns one. | |
c4bb193f | 533 | It may be passed to RPC routines that require a function argument, |
fea681da | 534 | where nothing is to be done. |
dd3568a1 | 535 | .PP |
fea681da | 536 | .nf |
5b20a7a2 | 537 | .BI "bool_t xdr_wrapstring(XDR *" xdrs ", char **" sp ); |
fea681da | 538 | .fi |
fea681da MK |
539 | .IP |
540 | A primitive that calls | |
066cb3d6 | 541 | .B "xdr_string(xdrs, sp,MAXUN.UNSIGNED );" |
fea681da | 542 | where |
d2d293ba | 543 | .B MAXUN.UNSIGNED |
fea681da | 544 | is the maximum value of an unsigned integer. |
63aa9df0 | 545 | .BR xdr_wrapstring () |
5b20a7a2 | 546 | is handy because the RPC package passes a maximum of two XDR |
c4bb193f | 547 | routines as arguments, and |
63aa9df0 | 548 | .BR xdr_string (), |
fea681da MK |
549 | one of the most frequently used primitives, requires three. |
550 | Returns one if it succeeds, zero otherwise. | |
365dc8d3 ZL |
551 | .SH ATTRIBUTES |
552 | For an explanation of the terms used in this section, see | |
553 | .BR attributes (7). | |
554 | .TS | |
555 | allbox; | |
c466875e | 556 | lbx lb lb |
365dc8d3 ZL |
557 | l l l. |
558 | Interface Attribute Value | |
559 | T{ | |
9e54434e BR |
560 | .na |
561 | .nh | |
365dc8d3 ZL |
562 | .BR xdr_array (), |
563 | .BR xdr_bool (), | |
365dc8d3 ZL |
564 | .BR xdr_bytes (), |
565 | .BR xdr_char (), | |
365dc8d3 ZL |
566 | .BR xdr_destroy (), |
567 | .BR xdr_double (), | |
365dc8d3 ZL |
568 | .BR xdr_enum (), |
569 | .BR xdr_float (), | |
365dc8d3 ZL |
570 | .BR xdr_free (), |
571 | .BR xdr_getpos (), | |
365dc8d3 ZL |
572 | .BR xdr_inline (), |
573 | .BR xdr_int (), | |
365dc8d3 ZL |
574 | .BR xdr_long (), |
575 | .BR xdrmem_create (), | |
365dc8d3 ZL |
576 | .BR xdr_opaque (), |
577 | .BR xdr_pointer (), | |
365dc8d3 ZL |
578 | .BR xdrrec_create (), |
579 | .BR xdrrec_eof (), | |
365dc8d3 | 580 | .BR xdrrec_endofrecord (), |
365dc8d3 | 581 | .BR xdrrec_skiprecord (), |
365dc8d3 ZL |
582 | .BR xdr_reference (), |
583 | .BR xdr_setpos (), | |
365dc8d3 ZL |
584 | .BR xdr_short (), |
585 | .BR xdrstdio_create (), | |
365dc8d3 ZL |
586 | .BR xdr_string (), |
587 | .BR xdr_u_char (), | |
365dc8d3 ZL |
588 | .BR xdr_u_int (), |
589 | .BR xdr_u_long (), | |
365dc8d3 ZL |
590 | .BR xdr_u_short (), |
591 | .BR xdr_union (), | |
365dc8d3 ZL |
592 | .BR xdr_vector (), |
593 | .BR xdr_void (), | |
365dc8d3 ZL |
594 | .BR xdr_wrapstring () |
595 | T} Thread safety MT-Safe | |
596 | .TE | |
847e0d88 | 597 | .sp 1 |
47297adb | 598 | .SH SEE ALSO |
fea681da | 599 | .BR rpc (3) |
dd3568a1 | 600 | .PP |
fea681da MK |
601 | The following manuals: |
602 | .RS | |
fea681da MK |
603 | eXternal Data Representation Standard: Protocol Specification |
604 | .br | |
605 | eXternal Data Representation: Sun Technical Notes | |
fea681da | 606 | .br |
066cb3d6 | 607 | .IR "XDR: External Data Representation Standard" , |
d2d293ba MK |
608 | RFC\ 1014, Sun Microsystems, Inc., |
609 | USC-ISI. | |
5d78bcdd | 610 | .RE |