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