26 .Nm xdrrec_endofrecord ,
28 .Nm xdrrec_skiprecord ,
39 .Nm xdr_u_longlong_t ,
45 .Nd "library routines for external data representation"
54 for function declarations.
56 These routines allow C programmers to describe
57 arbitrary data structures in a machine-independent fashion.
58 Data for remote procedure calls are transmitted using these
61 .Bl -tag -width indent -compact
72 .Fa "xdrproc_t elproc"
76 A filter primitive that translates between variable-length
78 and their corresponding external representations.
82 is the address of the pointer to the array, while
84 is the address of the element count of the array;
85 this element count cannot exceed
92 each of the array's elements, and
96 filter that translates between
97 the array elements' C form, and their external
99 This routine returns one if it succeeds, zero otherwise.
105 .Fn xdr_bool "XDR *xdrs" "bool_t *bp"
108 A filter primitive that translates between booleans (C
110 and their external representations.
111 When encoding data, this
112 filter produces values of either one or zero.
113 This routine returns one if it succeeds, zero otherwise.
119 .Fn xdr_bytes "XDR *xdrs" "char **sp" "u_int *sizep" "u_int maxsize"
122 A filter primitive that translates between counted byte
123 strings and their external representations.
127 is the address of the string pointer.
129 string is located at address
131 strings cannot be longer than
133 This routine returns one if it succeeds, zero otherwise.
139 .Fn xdr_char "XDR *xdrs" "char *cp"
142 A filter primitive that translates between C characters
143 and their external representations.
144 This routine returns one if it succeeds, zero otherwise.
145 Note: encoded characters are not packed, and occupy 4 bytes
147 For arrays of characters, it is worthwhile to
158 .Fn xdr_destroy "XDR *xdrs"
161 A macro that invokes the destroy routine associated with the
165 Destruction usually involves freeing private data structures
166 associated with the stream.
177 .Fn xdr_double "XDR *xdrs" "double *dp"
180 A filter primitive that translates between C
182 precision numbers and their external representations.
183 This routine returns one if it succeeds, zero otherwise.
189 .Fn xdr_enum "XDR *xdrs" "enum_t *ep"
192 A filter primitive that translates between C
194 (actually integers) and their external representations.
195 This routine returns one if it succeeds, zero otherwise.
201 .Fn xdr_float "XDR *xdrs" "float *fp"
204 A filter primitive that translates between C
206 and their external representations.
207 This routine returns one if it succeeds, zero otherwise.
213 .Fn xdr_free "xdrproc_t proc" "void *objp"
216 Generic freeing routine.
217 The first argument is the
219 routine for the object being freed.
221 is a pointer to the object itself.
222 Note: the pointer passed
225 freed, but what it points to
233 .Fn xdr_getpos "XDR *xdrs"
236 A macro that invokes the get\-position routine
241 The routine returns an unsigned integer,
242 which indicates the position of the
245 A desirable feature of
247 streams is that simple arithmetic works with this number,
250 stream instances need not guarantee this.
256 .Fn xdr_hyper "XDR *xdrs" "quad_t *llp"
258 A filter primitive that translates between ANSI C
260 integers and their external representations.
261 This routine returns one if it succeeds, zero otherwise.
267 .Fn xdr_inline "XDR *xdrs" "int len"
270 A macro that invokes the in-line routine associated with the
274 The routine returns a pointer
275 to a contiguous piece of the stream's buffer;
277 is the byte length of the desired buffer.
278 Note: pointer is cast to
286 if it cannot allocate a contiguous piece of a buffer.
287 Therefore the behavior may vary among stream instances;
288 it exists for the sake of efficiency.
294 .Fn xdr_int "XDR *xdrs" "int *ip"
297 A filter primitive that translates between C integers
298 and their external representations.
299 This routine returns one if it succeeds, zero otherwise.
305 .Fn xdr_long "XDR *xdrs" "long *lp"
308 A filter primitive that translates between C
310 integers and their external representations.
311 This routine returns one if it succeeds, zero otherwise.
317 .Fn xdr_longlong_t "XDR *xdrs" "quad_t *llp"
319 A filter primitive that translates between ANSI C
321 integers and their external representations.
322 This routine returns one if it succeeds, zero otherwise.
328 .Fn xdrmem_create "XDR *xdrs" "char *addr" "u_int size" "enum xdr_op op"
331 This routine initializes the
333 stream object pointed to by
335 The stream's data is written to, or read from,
336 a chunk of memory at location
338 whose length is no more than
344 determines the direction of the
357 .Fn xdr_opaque "XDR *xdrs" "char *cp" "u_int cnt"
360 A filter primitive that translates between fixed size opaque
362 and its external representation.
366 is the address of the opaque object, and
368 is its size in bytes.
369 This routine returns one if it succeeds, zero otherwise.
375 .Fn xdr_pointer "XDR *xdrs" "char **objpp" "u_int objsize" "xdrproc_t xdrobj"
380 except that it serializes
388 recursive data structures, such as binary trees or
400 .Fa "int \*(lp*readit\*(rp\*(lp\*(rp"
401 .Fa "int \*(lp*writeit\*(rp\*(lp\*(rp"
405 This routine initializes the
407 stream object pointed to by
409 The stream's data is written to a buffer of size
411 a value of zero indicates the system should use a suitable
413 The stream's data is read from a buffer of size
415 it too can be set to a suitable default by passing a zero
417 When a stream's output buffer is full,
420 Similarly, when a stream's input buffer is empty,
423 The behavior of these two routines is similar to
431 is passed to the former routines as the first argument.
436 field must be set by the caller.
440 stream implements an intermediate record stream.
441 Therefore there are additional bytes in the stream
442 to provide record boundary information.
448 .Fn xdrrec_endofrecord "XDR *xdrs" "int sendnow"
451 This routine can be invoked only on
454 The data in the output buffer is marked as a completed
456 and the output buffer is optionally written out if
459 This routine returns one if it succeeds, zero
466 .Fn xdrrec_eof "XDR *xdrs"
469 This routine can be invoked only on
472 After consuming the rest of the current record in the stream,
473 this routine returns one if the stream has no more input,
480 .Fn xdrrec_skiprecord "XDR *xdrs"
483 This routine can be invoked only on
488 implementation that the rest of the current record
489 in the stream's input buffer should be discarded.
490 This routine returns one if it succeeds, zero otherwise.
496 .Fn xdr_reference "XDR *xdrs" "char **pp" "u_int size" "xdrproc_t proc"
499 A primitive that provides pointer chasing within structures.
503 is the address of the pointer;
513 procedure that filters the structure
514 between its C form and its external representation.
515 This routine returns one if it succeeds, zero otherwise.
517 Warning: this routine does not understand
528 .Fn xdr_setpos "XDR *xdrs" "u_int pos"
531 A macro that invokes the set position routine associated with
539 is a position value obtained from
541 This routine returns one if the
543 stream could be repositioned,
546 Warning: it is difficult to reposition some types of
548 streams, so this routine may fail with one
549 type of stream and succeed with another.
555 .Fn xdr_short "XDR *xdrs" "short *sp"
558 A filter primitive that translates between C
560 integers and their external representations.
561 This routine returns one if it succeeds, zero otherwise.
567 .Fn xdr_sizeof "xdrproc_t func" "void *data"
570 This routine returns the amount of memory required to encode
575 .It Li "#ifdef _STDIO_H_"
576 .It Li "/* XDR using stdio library */"
581 .Fn xdrstdio_create "XDR *xdrs" "FILE *file" "enum xdr_op op"
585 This routine initializes the
587 stream object pointed to by
591 stream data is written to, or read from, the Standard
598 determines the direction of the
606 Warning: the destroy routine associated with such
619 .Fn xdr_string "XDR *xdrs" "char **sp" "u_int maxsize"
622 A filter primitive that translates between C strings and
624 corresponding external representations.
625 Strings cannot be longer than
629 is the address of the string's pointer.
630 This routine returns one if it succeeds, zero otherwise.
636 .Fn xdr_u_char "XDR *xdrs" "unsigned char *ucp"
639 A filter primitive that translates between
641 C characters and their external representations.
642 This routine returns one if it succeeds, zero otherwise.
648 .Fn xdr_u_hyper "XDR *xdrs" "u_quad_t *ullp"
650 A filter primitive that translates between
654 integers and their external representations.
655 This routine returns one if it succeeds, zero otherwise.
661 .Fn xdr_u_int "XDR *xdrs" "unsigned *up"
664 A filter primitive that translates between C
666 integers and their external representations.
667 This routine returns one if it succeeds, zero otherwise.
673 .Fn xdr_u_long "XDR *xdrs" "unsigned long *ulp"
676 A filter primitive that translates between C
678 integers and their external representations.
679 This routine returns one if it succeeds, zero otherwise.
685 .Fn xdr_u_longlong_t "XDR *xdrs" "u_quad_t *ullp"
687 A filter primitive that translates between
691 integers and their external representations.
692 This routine returns one if it succeeds, zero otherwise.
698 .Fn xdr_u_short "XDR *xdrs" "unsigned short *usp"
701 A filter primitive that translates between C
703 integers and their external representations.
704 This routine returns one if it succeeds, zero otherwise.
714 .Fa "const struct xdr_discrim *choices"
715 .Fa "xdrproc_t defaultarm"
719 A filter primitive that translates between a discriminated C
721 and its corresponding external representation.
723 translates the discriminant of the union located at
725 This discriminant is always an
727 Next the union located at
733 is a pointer to an array of
736 Each structure contains an ordered pair of
737 .Bq Va value , proc .
738 If the union's discriminant is equal to the associated
742 is called to translate the union.
745 structure array is denoted by a routine of value
747 If the discriminant is not found in the
751 procedure is called (if it is not
753 Returns one if it succeeds, zero otherwise.
764 .Fa "xdrproc_t elproc"
768 A filter primitive that translates between fixed-length
770 and their corresponding external representations.
774 is the address of the pointer to the array, while
776 is the element count of the array.
782 each of the array's elements, and
786 filter that translates between
787 the array elements' C form, and their external
789 This routine returns one if it succeeds, zero otherwise.
798 This routine always returns one.
801 routines that require a function argument,
802 where nothing is to be done.
808 .Fn xdr_wrapstring "XDR *xdrs" "char **sp"
811 A primitive that calls
812 .Fn xdr_string xdrs sp MAXUN.UNSIGNED ;
815 is the maximum value of an unsigned integer.
821 package passes a maximum of two
823 routines as arguments, and
825 one of the most frequently used primitives, requires three.
826 Returns one if it succeeds, zero otherwise.
831 .%T "eXternal Data Representation Standard: Protocol Specification"
834 .%T "eXternal Data Representation: Sun Technical Notes"
837 .%T "XDR: External Data Representation Standard"
839 .%Q "Sun Microsystems, Inc., USC\-ISI"
844 function first appeared in