Commit | Line | Data |
---|---|---|
af359dea C |
1 | .\" @(#)xdr.3n 2.2 88/08/03 4.0 RPCSRC; from 1.16 88/03/14 SMI |
2 | .TH XDR 3N "16 February 1988" | |
3 | .SH NAME | |
4 | xdr \- library routines for external data representation | |
5 | .SH SYNOPSIS AND DESCRIPTION | |
6 | .LP | |
7 | These routines allow C programmers to describe | |
8 | arbitrary data structures in a machine-independent fashion. | |
9 | Data for remote procedure calls are transmitted using these | |
10 | routines. | |
11 | .LP | |
12 | .ft B | |
13 | .nf | |
14 | .sp .5 | |
15 | xdr_array(xdrs, arrp, sizep, maxsize, elsize, elproc) | |
16 | \s-1XDR\s0 *xdrs; | |
17 | char **arrp; | |
18 | u_int *sizep, maxsize, elsize; | |
19 | xdrproc_t elproc; | |
20 | .fi | |
21 | .ft R | |
22 | .IP | |
23 | A filter primitive that translates between variable-length | |
24 | arrays | |
25 | and their corresponding external representations. The | |
26 | parameter | |
27 | .I arrp | |
28 | is the address of the pointer to the array, while | |
29 | .I sizep | |
30 | is the address of the element count of the array; | |
31 | this element count cannot exceed | |
32 | .IR maxsize . | |
33 | The parameter | |
34 | .I elsize | |
35 | is the | |
36 | .I sizeof | |
37 | each of the array's elements, and | |
38 | .I elproc | |
39 | is an | |
40 | .SM XDR | |
41 | filter that translates between | |
42 | the array elements' C form, and their external | |
43 | representation. | |
44 | This routine returns one if it succeeds, zero otherwise. | |
45 | .br | |
46 | .if t .ne 8 | |
47 | .LP | |
48 | .ft B | |
49 | .nf | |
50 | .sp .5 | |
51 | xdr_bool(xdrs, bp) | |
52 | \s-1XDR\s0 *xdrs; | |
53 | bool_t *bp; | |
54 | .fi | |
55 | .ft R | |
56 | .IP | |
57 | A filter primitive that translates between booleans (C | |
58 | integers) | |
59 | and their external representations. When encoding data, this | |
60 | filter produces values of either one or zero. | |
61 | This routine returns one if it succeeds, zero otherwise. | |
62 | .br | |
63 | .if t .ne 10 | |
64 | .LP | |
65 | .ft B | |
66 | .nf | |
67 | .sp .5 | |
68 | xdr_bytes(xdrs, sp, sizep, maxsize) | |
69 | \s-1XDR\s0 *xdrs; | |
70 | char **sp; | |
71 | u_int *sizep, maxsize; | |
72 | .fi | |
73 | .ft R | |
74 | .IP | |
75 | A filter primitive that translates between counted byte | |
76 | strings and their external representations. | |
77 | The parameter | |
78 | .I sp | |
79 | is the address of the string pointer. The length of the | |
80 | string is located at address | |
81 | .IR sizep ; | |
82 | strings cannot be longer than | |
83 | .IR maxsize . | |
84 | This routine returns one if it succeeds, zero otherwise. | |
85 | .br | |
86 | .if t .ne 7 | |
87 | .LP | |
88 | .ft B | |
89 | .nf | |
90 | .sp .5 | |
91 | xdr_char(xdrs, cp) | |
92 | \s-1XDR\s0 *xdrs; | |
93 | char *cp; | |
94 | .fi | |
95 | .ft R | |
96 | .IP | |
97 | A filter primitive that translates between C characters | |
98 | and their external representations. | |
99 | This routine returns one if it succeeds, zero otherwise. | |
100 | Note: encoded characters are not packed, and occupy 4 bytes | |
101 | each. For arrays of characters, it is worthwhile to | |
102 | consider | |
103 | .BR xdr_bytes(\|) , | |
104 | .B xdr_opaque(\|) | |
105 | or | |
106 | .BR xdr_string(\|) . | |
107 | .br | |
108 | .if t .ne 8 | |
109 | .LP | |
110 | .ft B | |
111 | .nf | |
112 | .sp .5 | |
113 | void | |
114 | xdr_destroy(xdrs) | |
115 | \s-1XDR\s0 *xdrs; | |
116 | .fi | |
117 | .ft R | |
118 | .IP | |
119 | A macro that invokes the destroy routine associated with the | |
120 | .SM XDR | |
121 | stream, | |
122 | .IR xdrs . | |
123 | Destruction usually involves freeing private data structures | |
124 | associated with the stream. Using | |
125 | .I xdrs | |
126 | after invoking | |
127 | .B xdr_destroy(\|) | |
128 | is undefined. | |
129 | .br | |
130 | .if t .ne 7 | |
131 | .LP | |
132 | .ft B | |
133 | .nf | |
134 | .sp .5 | |
135 | xdr_double(xdrs, dp) | |
136 | \s-1XDR\s0 *xdrs; | |
137 | double *dp; | |
138 | .fi | |
139 | .ft R | |
140 | .IP | |
141 | A filter primitive that translates between C | |
142 | .B double | |
143 | precision numbers and their external representations. | |
144 | This routine returns one if it succeeds, zero otherwise. | |
145 | .br | |
146 | .if t .ne 7 | |
147 | .LP | |
148 | .ft B | |
149 | .nf | |
150 | .sp .5 | |
151 | xdr_enum(xdrs, ep) | |
152 | \s-1XDR\s0 *xdrs; | |
153 | enum_t *ep; | |
154 | .fi | |
155 | .ft R | |
156 | .IP | |
157 | A filter primitive that translates between C | |
158 | .BR enum s | |
159 | (actually integers) and their external representations. | |
160 | This routine returns one if it succeeds, zero otherwise. | |
161 | .br | |
162 | .if t .ne 8 | |
163 | .LP | |
164 | .ft B | |
165 | .nf | |
166 | .sp .5 | |
167 | xdr_float(xdrs, fp) | |
168 | \s-1XDR\s0 *xdrs; | |
169 | float *fp; | |
170 | .fi | |
171 | .ft R | |
172 | .IP | |
173 | A filter primitive that translates between C | |
174 | .BR float s | |
175 | and their external representations. | |
176 | This routine returns one if it succeeds, zero otherwise. | |
177 | .br | |
178 | .if t .ne 9 | |
179 | .LP | |
180 | .ft B | |
181 | .nf | |
182 | .sp .5 | |
183 | void | |
184 | xdr_free(proc, objp) | |
185 | xdrproc_t proc; | |
186 | char *objp; | |
187 | .fi | |
188 | .ft R | |
189 | .IP | |
190 | Generic freeing routine. The first argument is the | |
191 | .SM XDR | |
192 | routine for the object being freed. The second argument | |
193 | is a pointer to the object itself. Note: the pointer passed | |
194 | to this routine is | |
195 | .I not | |
196 | freed, but what it points to | |
197 | .I is | |
198 | freed (recursively). | |
199 | .br | |
200 | .if t .ne 8 | |
201 | .LP | |
202 | .ft B | |
203 | .nf | |
204 | .sp .5 | |
205 | u_int | |
206 | xdr_getpos(xdrs) | |
207 | \s-1XDR\s0 *xdrs; | |
208 | .fi | |
209 | .ft R | |
210 | .IP | |
211 | A macro that invokes the get-position routine | |
212 | associated with the | |
213 | .SM XDR | |
214 | stream, | |
215 | .IR xdrs . | |
216 | The routine returns an unsigned integer, | |
217 | which indicates the position of the | |
218 | .SM XDR | |
219 | byte stream. | |
220 | A desirable feature of | |
221 | .SM XDR | |
222 | streams is that simple arithmetic works with this number, | |
223 | although the | |
224 | .SM XDR | |
225 | stream instances need not guarantee this. | |
226 | .br | |
227 | .if t .ne 4 | |
228 | .LP | |
229 | .ft B | |
230 | .nf | |
231 | .sp .5 | |
232 | .br | |
233 | long * | |
234 | xdr_inline(xdrs, len) | |
235 | \s-1XDR\s0 *xdrs; | |
236 | int len; | |
237 | .fi | |
238 | .ft R | |
239 | .IP | |
240 | A macro that invokes the in-line routine associated with the | |
241 | .SM XDR | |
242 | stream, | |
243 | .IR xdrs . | |
244 | The routine returns a pointer | |
245 | to a contiguous piece of the stream's buffer; | |
246 | .I len | |
247 | is the byte length of the desired buffer. | |
248 | Note: pointer is cast to | |
249 | .BR "long *" . | |
250 | .IP | |
251 | Warning: | |
252 | .B xdr_inline(\|) | |
253 | may return | |
254 | .SM NULL | |
255 | (0) | |
256 | if it cannot allocate a contiguous piece of a buffer. | |
257 | Therefore the behavior may vary among stream instances; | |
258 | it exists for the sake of efficiency. | |
259 | .br | |
260 | .if t .ne 7 | |
261 | .LP | |
262 | .ft B | |
263 | .nf | |
264 | .sp .5 | |
265 | xdr_int(xdrs, ip) | |
266 | \s-1XDR\s0 *xdrs; | |
267 | int *ip; | |
268 | .fi | |
269 | .ft R | |
270 | .IP | |
271 | A filter primitive that translates between C integers | |
272 | and their external representations. | |
273 | This routine returns one if it succeeds, zero otherwise. | |
274 | .br | |
275 | .if t .ne 7 | |
276 | .LP | |
277 | .ft B | |
278 | .nf | |
279 | .sp .5 | |
280 | xdr_long(xdrs, lp) | |
281 | \s-1XDR\s0 *xdrs; | |
282 | long *lp; | |
283 | .fi | |
284 | .ft R | |
285 | .IP | |
286 | A filter primitive that translates between C | |
287 | .B long | |
288 | integers and their external representations. | |
289 | This routine returns one if it succeeds, zero otherwise. | |
290 | .br | |
291 | .if t .ne 12 | |
292 | .LP | |
293 | .ft B | |
294 | .nf | |
295 | .sp .5 | |
296 | void | |
297 | xdrmem_create(xdrs, addr, size, op) | |
298 | \s-1XDR\s0 *xdrs; | |
299 | char *addr; | |
300 | u_int size; | |
301 | enum xdr_op op; | |
302 | .fi | |
303 | .ft R | |
304 | .IP | |
305 | This routine initializes the | |
306 | .SM XDR | |
307 | stream object pointed to by | |
308 | .IR xdrs . | |
309 | The stream's data is written to, or read from, | |
310 | a chunk of memory at location | |
311 | .I addr | |
312 | whose length is no more than | |
313 | .I size | |
314 | bytes long. The | |
315 | .I op | |
316 | determines the direction of the | |
317 | .SM XDR | |
318 | stream | |
319 | (either | |
320 | .BR \s-1XDR_ENCODE\s0 , | |
321 | .BR \s-1XDR_DECODE\s0 , | |
322 | or | |
323 | .BR \s-1XDR_FREE\s0 ). | |
324 | .br | |
325 | .if t .ne 10 | |
326 | .LP | |
327 | .ft B | |
328 | .nf | |
329 | .sp .5 | |
330 | xdr_opaque(xdrs, cp, cnt) | |
331 | \s-1XDR\s0 *xdrs; | |
332 | char *cp; | |
333 | u_int cnt; | |
334 | .fi | |
335 | .ft R | |
336 | .IP | |
337 | A filter primitive that translates between fixed size opaque | |
338 | data | |
339 | and its external representation. | |
340 | The parameter | |
341 | .I cp | |
342 | is the address of the opaque object, and | |
343 | .I cnt | |
344 | is its size in bytes. | |
345 | This routine returns one if it succeeds, zero otherwise. | |
346 | .br | |
347 | .if t .ne 10 | |
348 | .LP | |
349 | .ft B | |
350 | .nf | |
351 | .sp .5 | |
352 | xdr_pointer(xdrs, objpp, objsize, xdrobj) | |
353 | \s-1XDR\s0 *xdrs; | |
354 | char **objpp; | |
355 | u_int objsize; | |
356 | xdrproc_t xdrobj; | |
357 | .fi | |
358 | .ft R | |
359 | .IP | |
360 | Like | |
361 | .B xdr_reference(\|) | |
362 | execpt that it serializes | |
363 | .SM NULL | |
364 | pointers, whereas | |
365 | .B xdr_reference(\|) | |
366 | does not. Thus, | |
367 | .B xdr_pointer(\|) | |
368 | can represent | |
369 | recursive data structures, such as binary trees or | |
370 | linked lists. | |
371 | .br | |
372 | .if t .ne 15 | |
373 | .LP | |
374 | .ft B | |
375 | .nf | |
376 | .sp .5 | |
377 | void | |
378 | xdrrec_create(xdrs, sendsize, recvsize, handle, readit, writeit) | |
379 | \s-1XDR\s0 *xdrs; | |
380 | u_int sendsize, recvsize; | |
381 | char *handle; | |
382 | int (*readit) (\|), (*writeit) (\|); | |
383 | .fi | |
384 | .ft R | |
385 | .IP | |
386 | This routine initializes the | |
387 | .SM XDR | |
388 | stream object pointed to by | |
389 | .IR xdrs . | |
390 | The stream's data is written to a buffer of size | |
391 | .IR sendsize ; | |
392 | a value of zero indicates the system should use a suitable | |
393 | default. The stream's data is read from a buffer of size | |
394 | .IR recvsize ; | |
395 | it too can be set to a suitable default by passing a zero | |
396 | value. | |
397 | When a stream's output buffer is full, | |
398 | .I writeit | |
399 | is called. Similarly, when a stream's input buffer is empty, | |
400 | .I readit | |
401 | is called. The behavior of these two routines is similar to | |
402 | the | |
403 | system calls | |
404 | .B read | |
405 | and | |
406 | .BR write , | |
407 | except that | |
408 | .I handle | |
409 | is passed to the former routines as the first parameter. | |
410 | Note: the | |
411 | .SM XDR | |
412 | stream's | |
413 | .I op | |
414 | field must be set by the caller. | |
415 | .IP | |
416 | Warning: this | |
417 | .SM XDR | |
418 | stream implements an intermediate record stream. | |
419 | Therefore there are additional bytes in the stream | |
420 | to provide record boundary information. | |
421 | .br | |
422 | .if t .ne 9 | |
423 | .LP | |
424 | .ft B | |
425 | .nf | |
426 | .sp .5 | |
427 | xdrrec_endofrecord(xdrs, sendnow) | |
428 | \s-1XDR\s0 *xdrs; | |
429 | int sendnow; | |
430 | .fi | |
431 | .ft R | |
432 | .IP | |
433 | This routine can be invoked only on | |
434 | streams created by | |
435 | .BR xdrrec_create(\|) . | |
436 | The data in the output buffer is marked as a completed | |
437 | record, | |
438 | and the output buffer is optionally written out if | |
439 | .I sendnow | |
440 | is non-zero. This routine returns one if it succeeds, zero | |
441 | otherwise. | |
442 | .br | |
443 | .if t .ne 8 | |
444 | .LP | |
445 | .ft B | |
446 | .nf | |
447 | .sp .5 | |
448 | xdrrec_eof(xdrs) | |
449 | \s-1XDR\s0 *xdrs; | |
450 | int empty; | |
451 | .fi | |
452 | .ft R | |
453 | .IP | |
454 | This routine can be invoked only on | |
455 | streams created by | |
456 | .BR xdrrec_create(\|) . | |
457 | After consuming the rest of the current record in the stream, | |
458 | this routine returns one if the stream has no more input, | |
459 | zero otherwise. | |
460 | .br | |
461 | .if t .ne 3 | |
462 | .LP | |
463 | .ft B | |
464 | .nf | |
465 | .sp .5 | |
466 | xdrrec_skiprecord(xdrs) | |
467 | \s-1XDR\s0 *xdrs; | |
468 | .fi | |
469 | .ft R | |
470 | .IP | |
471 | This routine can be invoked only on | |
472 | streams created by | |
473 | .BR xdrrec_create(\|) . | |
474 | It tells the | |
475 | .SM XDR | |
476 | implementation that the rest of the current record | |
477 | in the stream's input buffer should be discarded. | |
478 | This routine returns one if it succeeds, zero otherwise. | |
479 | .br | |
480 | .if t .ne 11 | |
481 | .LP | |
482 | .ft B | |
483 | .nf | |
484 | .sp .5 | |
485 | xdr_reference(xdrs, pp, size, proc) | |
486 | \s-1XDR\s0 *xdrs; | |
487 | char **pp; | |
488 | u_int size; | |
489 | xdrproc_t proc; | |
490 | .fi | |
491 | .ft R | |
492 | .IP | |
493 | A primitive that provides pointer chasing within structures. | |
494 | The parameter | |
495 | .I pp | |
496 | is the address of the pointer; | |
497 | .I size | |
498 | is the | |
499 | .I sizeof | |
500 | the structure that | |
501 | .I *pp | |
502 | points to; and | |
503 | .I proc | |
504 | is an | |
505 | .SM XDR | |
506 | procedure that filters the structure | |
507 | between its C form and its external representation. | |
508 | This routine returns one if it succeeds, zero otherwise. | |
509 | .IP | |
510 | Warning: this routine does not understand | |
511 | .SM NULL | |
512 | pointers. Use | |
513 | .B xdr_pointer(\|) | |
514 | instead. | |
515 | .br | |
516 | .if t .ne 10 | |
517 | .LP | |
518 | .ft B | |
519 | .nf | |
520 | .sp .5 | |
521 | xdr_setpos(xdrs, pos) | |
522 | \s-1XDR\s0 *xdrs; | |
523 | u_int pos; | |
524 | .fi | |
525 | .ft R | |
526 | .IP | |
527 | A macro that invokes the set position routine associated with | |
528 | the | |
529 | .SM XDR | |
530 | stream | |
531 | .IR xdrs . | |
532 | The parameter | |
533 | .I pos | |
534 | is a position value obtained from | |
535 | .BR xdr_getpos(\|) . | |
536 | This routine returns one if the | |
537 | .SM XDR | |
538 | stream could be repositioned, | |
539 | and zero otherwise. | |
540 | .IP | |
541 | Warning: it is difficult to reposition some types of | |
542 | .SM XDR | |
543 | streams, so this routine may fail with one | |
544 | type of stream and succeed with another. | |
545 | .br | |
546 | .if t .ne 8 | |
547 | .LP | |
548 | .ft B | |
549 | .nf | |
550 | .sp .5 | |
551 | xdr_short(xdrs, sp) | |
552 | \s-1XDR\s0 *xdrs; | |
553 | short *sp; | |
554 | .fi | |
555 | .ft R | |
556 | .IP | |
557 | A filter primitive that translates between C | |
558 | .B short | |
559 | integers and their external representations. | |
560 | This routine returns one if it succeeds, zero otherwise. | |
561 | .br | |
562 | .if t .ne 10 | |
563 | .LP | |
564 | .ft B | |
565 | .nf | |
566 | .sp .5 | |
567 | void | |
568 | xdrstdio_create(xdrs, file, op) | |
569 | \s-1XDR\s0 *xdrs; | |
570 | \s-1FILE\s0 *file; | |
571 | enum xdr_op op; | |
572 | .fi | |
573 | .ft R | |
574 | .IP | |
575 | This routine initializes the | |
576 | .SM XDR | |
577 | stream object pointed to by | |
578 | .IR xdrs . | |
579 | The | |
580 | .SM XDR | |
581 | stream data is written to, or read from, the Standard | |
582 | .B I/O | |
583 | stream | |
584 | .IR file . | |
585 | The parameter | |
586 | .I op | |
587 | determines the direction of the | |
588 | .SM XDR | |
589 | stream (either | |
590 | .BR \s-1XDR_ENCODE\s0 , | |
591 | .BR \s-1XDR_DECODE\s0 , | |
592 | or | |
593 | .BR \s-1XDR_FREE\s0 ). | |
594 | .IP | |
595 | Warning: the destroy routine associated with such | |
596 | .SM XDR | |
597 | streams calls | |
598 | .B fflush(\|) | |
599 | on the | |
600 | .I file | |
601 | stream, but never | |
602 | .BR fclose(\|) . | |
603 | .br | |
604 | .if t .ne 9 | |
605 | .LP | |
606 | .ft B | |
607 | .nf | |
608 | .sp .5 | |
609 | xdr_string(xdrs, sp, maxsize) | |
610 | \s-1XDR\s0 | |
611 | *xdrs; | |
612 | char **sp; | |
613 | u_int maxsize; | |
614 | .fi | |
615 | .ft R | |
616 | .IP | |
617 | A filter primitive that translates between C strings and | |
618 | their | |
619 | corresponding external representations. | |
620 | Strings cannot be longer than | |
621 | .IR maxsize . | |
622 | Note: | |
623 | .I sp | |
624 | is the address of the string's pointer. | |
625 | This routine returns one if it succeeds, zero otherwise. | |
626 | .br | |
627 | .if t .ne 8 | |
628 | .LP | |
629 | .ft B | |
630 | .nf | |
631 | .sp .5 | |
632 | xdr_u_char(xdrs, ucp) | |
633 | \s-1XDR\s0 *xdrs; | |
634 | unsigned char *ucp; | |
635 | .fi | |
636 | .ft R | |
637 | .IP | |
638 | A filter primitive that translates between | |
639 | .B unsigned | |
640 | C characters and their external representations. | |
641 | This routine returns one if it succeeds, zero otherwise. | |
642 | .br | |
643 | .if t .ne 9 | |
644 | .LP | |
645 | .ft B | |
646 | .nf | |
647 | .sp .5 | |
648 | xdr_u_int(xdrs, up) | |
649 | \s-1XDR\s0 *xdrs; | |
650 | unsigned *up; | |
651 | .fi | |
652 | .ft R | |
653 | .IP | |
654 | A filter primitive that translates between C | |
655 | .B unsigned | |
656 | integers and their external representations. | |
657 | This routine returns one if it succeeds, zero otherwise. | |
658 | .br | |
659 | .if t .ne 7 | |
660 | .LP | |
661 | .ft B | |
662 | .nf | |
663 | .sp .5 | |
664 | xdr_u_long(xdrs, ulp) | |
665 | \s-1XDR\s0 *xdrs; | |
666 | unsigned long *ulp; | |
667 | .fi | |
668 | .ft R | |
669 | .IP | |
670 | A filter primitive that translates between C | |
671 | .B "unsigned long" | |
672 | integers and their external representations. | |
673 | This routine returns one if it succeeds, zero otherwise. | |
674 | .br | |
675 | .if t .ne 7 | |
676 | .LP | |
677 | .ft B | |
678 | .nf | |
679 | .sp .5 | |
680 | xdr_u_short(xdrs, usp) | |
681 | \s-1XDR\s0 *xdrs; | |
682 | unsigned short *usp; | |
683 | .fi | |
684 | .ft R | |
685 | .IP | |
686 | A filter primitive that translates between C | |
687 | .B "unsigned short" | |
688 | integers and their external representations. | |
689 | This routine returns one if it succeeds, zero otherwise. | |
690 | .br | |
691 | .if t .ne 16 | |
692 | .LP | |
693 | .ft B | |
694 | .nf | |
695 | .sp .5 | |
696 | xdr_union(xdrs, dscmp, unp, choices, dfault) | |
697 | \s-1XDR\s0 *xdrs; | |
698 | int *dscmp; | |
699 | char *unp; | |
700 | struct xdr_discrim *choices; | |
701 | bool_t (*defaultarm) (\|); /* may equal \s-1NULL\s0 */ | |
702 | .fi | |
703 | .ft R | |
704 | .IP | |
705 | A filter primitive that translates between a discriminated C | |
706 | .B union | |
707 | and its corresponding external representation. It first | |
708 | translates the discriminant of the union located at | |
709 | .IR dscmp . | |
710 | This discriminant is always an | |
711 | .BR enum_t . | |
712 | Next the union located at | |
713 | .I unp | |
714 | is translated. The parameter | |
715 | .I choices | |
716 | is a pointer to an array of | |
717 | .B xdr_discrim(\|) | |
718 | structures. Each structure contains an ordered pair of | |
719 | .RI [ value , proc ]. | |
720 | If the union's discriminant is equal to the associated | |
721 | .IR value , | |
722 | then the | |
723 | .I proc | |
724 | is called to translate the union. The end of the | |
725 | .B xdr_discrim(\|) | |
726 | structure array is denoted by a routine of value | |
727 | .SM NULL\s0. | |
728 | If the discriminant is not found in the | |
729 | .I choices | |
730 | array, then the | |
731 | .I defaultarm | |
732 | procedure is called (if it is not | |
733 | .SM NULL\s0). | |
734 | Returns one if it succeeds, zero otherwise. | |
735 | .br | |
736 | .if t .ne 6 | |
737 | .LP | |
738 | .ft B | |
739 | .nf | |
740 | .sp .5 | |
741 | xdr_vector(xdrs, arrp, size, elsize, elproc) | |
742 | \s-1XDR\s0 *xdrs; | |
743 | char *arrp; | |
744 | u_int size, elsize; | |
745 | xdrproc_t elproc; | |
746 | .fi | |
747 | .ft R | |
748 | .IP | |
749 | A filter primitive that translates between fixed-length | |
750 | arrays | |
751 | and their corresponding external representations. The | |
752 | parameter | |
753 | .I arrp | |
754 | is the address of the pointer to the array, while | |
755 | .I size | |
756 | is is the element count of the array. The parameter | |
757 | .I elsize | |
758 | is the | |
759 | .I sizeof | |
760 | each of the array's elements, and | |
761 | .I elproc | |
762 | is an | |
763 | .SM XDR | |
764 | filter that translates between | |
765 | the array elements' C form, and their external | |
766 | representation. | |
767 | This routine returns one if it succeeds, zero otherwise. | |
768 | .br | |
769 | .if t .ne 5 | |
770 | .LP | |
771 | .ft B | |
772 | .nf | |
773 | .sp .5 | |
774 | xdr_void(\|) | |
775 | .fi | |
776 | .ft R | |
777 | .IP | |
778 | This routine always returns one. | |
779 | It may be passed to | |
780 | .SM RPC | |
781 | routines that require a function parameter, | |
782 | where nothing is to be done. | |
783 | .br | |
784 | .if t .ne 10 | |
785 | .LP | |
786 | .ft B | |
787 | .nf | |
788 | .sp .5 | |
789 | xdr_wrapstring(xdrs, sp) | |
790 | \s-1XDR\s0 *xdrs; | |
791 | char **sp; | |
792 | .fi | |
793 | .ft R | |
794 | .IP | |
795 | A primitive that calls | |
796 | .B "xdr_string(xdrs, sp,\s-1MAXUN.UNSIGNED\s0 );" | |
797 | where | |
798 | .B | |
799 | .SM MAXUN.UNSIGNED | |
800 | is the maximum value of an unsigned integer. | |
801 | .B xdr_wrapstring(\|) | |
802 | is handy because the | |
803 | .SM RPC | |
804 | package passes a maximum of two | |
805 | .SM XDR | |
806 | routines as parameters, and | |
807 | .BR xdr_string(\|) , | |
808 | one of the most frequently used primitives, requires three. | |
809 | Returns one if it succeeds, zero otherwise. | |
810 | .SH SEE ALSO | |
811 | .BR rpc (3N) | |
812 | .LP | |
813 | The following manuals: | |
814 | .RS | |
815 | .ft I | |
816 | eXternal Data Representation Standard: Protocol Specification | |
817 | .br | |
818 | eXternal Data Representation: Sun Technical Notes | |
819 | .ft R | |
820 | .br | |
821 | .IR "\s-1XDR\s0: External Data Representation Standard" , | |
822 | .SM RFC1014, Sun Microsystems, Inc., | |
823 | .SM USC-ISI\s0. |