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