xref: /netbsd-src/lib/libc/rpc/xdr.3 (revision d89020203c367a8ce7194ef380bea379773405a6)
19e15c989Scgd.\"	@(#)xdr.3n	2.2 88/08/03 4.0 RPCSRC; from 1.16 88/03/14 SMI
2*d8902020Swiz.\"	$NetBSD: xdr.3,v 1.14 2011/07/08 19:28:22 wiz Exp $
363d7b677Scgd.\"
4*d8902020Swiz.Dd July 4, 2011
54472b403Swiz.Dt XDR 3
64472b403Swiz.Os
74472b403Swiz.Sh NAME
84472b403Swiz.Nm xdr ,
94472b403Swiz.Nm xdr_array ,
104472b403Swiz.Nm xdr_bool ,
114472b403Swiz.Nm xdr_bytes ,
124472b403Swiz.Nm xdr_char ,
134472b403Swiz.Nm xdr_destroy ,
144472b403Swiz.Nm xdr_double ,
154472b403Swiz.Nm xdr_enum ,
164472b403Swiz.Nm xdr_float ,
174472b403Swiz.Nm xdr_free ,
184472b403Swiz.Nm xdr_getpos ,
194472b403Swiz.Nm xdr_hyper ,
204472b403Swiz.Nm xdr_inline ,
214472b403Swiz.Nm xdr_int ,
224472b403Swiz.Nm xdr_long ,
234472b403Swiz.Nm xdr_longlong_t ,
244472b403Swiz.Nm xdrmem_create ,
254472b403Swiz.Nm xdr_opaque ,
264472b403Swiz.Nm xdr_pointer ,
274472b403Swiz.Nm xdrrec_create ,
284472b403Swiz.Nm xdrrec_endofrecord ,
294472b403Swiz.Nm xdrrec_eof ,
304472b403Swiz.Nm xdrrec_skiprecord ,
314472b403Swiz.Nm xdr_reference ,
324472b403Swiz.Nm xdr_setpos ,
334472b403Swiz.Nm xdr_short ,
34b4a55eb6Smanu.Nm xdr_sizeof ,
354472b403Swiz.Nm xdrstdio_create ,
364472b403Swiz.Nm xdr_string ,
374472b403Swiz.Nm xdr_u_char ,
384472b403Swiz.Nm xdr_u_hyper ,
394472b403Swiz.Nm xdr_u_long ,
404472b403Swiz.Nm xdr_u_longlong_t ,
414472b403Swiz.Nm xdr_u_short ,
424472b403Swiz.Nm xdr_union ,
434472b403Swiz.Nm xdr_vector ,
444472b403Swiz.Nm xdr_void ,
454472b403Swiz.Nm xdr_wrapstring
464472b403Swiz.Nd library routines for external data representation
474472b403Swiz.Sh SYNOPSIS
484472b403Swiz.Ft int
494472b403Swiz.Fn xdr_array "XDR *xdrs" "char **arrp" "u_int *sizep" "u_int maxsize" \
504472b403Swiz"u_int elsize" "xdrproc_t elproc"
514472b403Swiz.Ft int
524472b403Swiz.Fn xdr_bool "XDR *xdrs" "bool_t *bp"
534472b403Swiz.Ft int
544472b403Swiz.Fn xdr_bytes "XDR *xdrs" "char **sp" "u_int *sizep" "u_int maxsize"
554472b403Swiz.Ft int
564472b403Swiz.Fn xdr_char "XDR *xdrs" "char *cp"
574472b403Swiz.Ft void
584472b403Swiz.Fn xdr_destroy "XDR *xdrs"
594472b403Swiz.Ft int
604472b403Swiz.Fn xdr_double "XDR *xdrs" "double *dp"
614472b403Swiz.Ft int
624472b403Swiz.Fn xdr_enum "XDR *xdrs" "enum_t *ep"
634472b403Swiz.Ft int
644472b403Swiz.Fn xdr_float "XDR *xdrs" "float *fp"
654472b403Swiz.Ft void
664472b403Swiz.Fn xdr_free "xdrproc_t proc" "char *objp"
674472b403Swiz.Ft u_int
684472b403Swiz.Fn xdr_getpos "XDR *xdrs"
694472b403Swiz.Ft int
704472b403Swiz.Fn xdr_hyper "XDR *xdrs" "longlong_t *llp"
714472b403Swiz.Ft long *
724472b403Swiz.Fn xdr_inline "XDR *xdrs" "int len"
734472b403Swiz.Ft int
744472b403Swiz.Fn xdr_int "XDR *xdrs" "int *ip"
754472b403Swiz.Ft int
764472b403Swiz.Fn xdr_long "XDR *xdrs" "long *lp"
774472b403Swiz.Ft int
784472b403Swiz.Fn xdr_longlong_t "XDR *xdrs" "longlong_t *llp"
794472b403Swiz.Ft void
804472b403Swiz.Fn xdrmem_create "XDR *xdrs" "char *addr" "u_int size" \
814472b403Swiz"enum xdr_op op"
824472b403Swiz.Ft int
834472b403Swiz.Fn xdr_opaque "XDR *xdrs" "char *cp" "u_int cnt"
844472b403Swiz.Ft int
854472b403Swiz.Fn xdr_pointer "XDR *xdrs" "char **objpp" "u_int objsize" \
864472b403Swiz"xdrproc_t xdrobj"
874472b403Swiz.Ft void
884472b403Swiz.Fn xdrrec_create "XDR *xdrs" "u_int sendsize" "u_int recvsize" \
894472b403Swiz"char *handle" "int (*readit)()" "int (*writeit)()"
904472b403Swiz.Ft int
914472b403Swiz.Fn xdrrec_endofrecord "XDR *xdrs" "int sendnow"
924472b403Swiz.Ft int
934472b403Swiz.Fn xdrrec_eof "XDR *xdrs"
944472b403Swiz.Ft int
954472b403Swiz.Fn xdrrec_skiprecord "XDR *xdrs"
964472b403Swiz.Ft int
974472b403Swiz.Fn xdr_reference "XDR *xdrs" "char **pp" "u_int size" \
984472b403Swiz"xdrproc_t proc"
994472b403Swiz.Ft int
1004472b403Swiz.Fn xdr_setpos "XDR *xdrs" "u_int pos"
1014472b403Swiz.Ft int
1024472b403Swiz.Fn xdr_short "XDR *xdrs" "short *sp"
103b4a55eb6Smanu.Ft nsigned long
104b4a55eb6Smanu.Fn xdr_sizeof "xdrproc_t func" "void *data"
1054472b403Swiz.Ft void
1064472b403Swiz.Fn xdrstdio_create "XDR *xdrs" "FILE *file" "enum xdr_op op"
1074472b403Swiz.Ft int
1084472b403Swiz.Fn xdr_string "XDR *xdrs" "char **sp" "u_int maxsize"
1094472b403Swiz.Ft int
1104472b403Swiz.Fn xdr_u_char "XDR *xdrs" "unsigned char *ucp"
1114472b403Swiz.Ft int
1124472b403Swiz.Fn xdr_u_hyper "XDR *xdrs" "u_longlong_t *ullp"
1134472b403Swiz.Ft int
1144472b403Swiz.Fn xdr_u_int "XDR *xdrs" "unsigned *up"
1154472b403Swiz.Ft int
1164472b403Swiz.Fn xdr_u_long "XDR *xdrs" "unsigned long *ulp"
1174472b403Swiz.Ft int
1184472b403Swiz.Fn xdr_u_longlong_t "XDR *xdrs" "u_longlong_t *ullp"
1194472b403Swiz.Ft int
1204472b403Swiz.Fn xdr_u_short "XDR *xdrs" "unsigned short *usp"
1214472b403Swiz.Ft int
1224472b403Swiz.Fn xdr_union "XDR *xdrs" "int *dscmp" "char *unp" \
1234472b403Swiz"struct xdr_discrim *choices" "bool_t (*defaultarm)(\|)"
1244472b403Swiz.Ft int
1254472b403Swiz.Fn xdr_vector "XDR *xdrs" "char *arrp" "u_int size" \
1264472b403Swiz"u_int elsize" "xdrproc_t elproc"
1274472b403Swiz.Ft int
1284472b403Swiz.Fn xdr_void "void"
1294472b403Swiz.Ft int
1304472b403Swiz.Fn xdr_wrapstring "XDR *xdrs" "char **sp"
1314472b403Swiz.Sh DESCRIPTION
13263d7b677ScgdThese routines allow C programmers to describe
13363d7b677Scgdarbitrary data structures in a machine-independent fashion.
13463d7b677ScgdData for remote procedure calls are transmitted using these
13563d7b677Scgdroutines.
1364472b403Swiz.Bl -tag -width xxx
1374472b403Swiz.It Fn xdr_array
13863d7b677ScgdA filter primitive that translates between variable-length
1396569c5c5Swizarrays and their corresponding external representations.
1406569c5c5SwizThe parameter
1414472b403Swiz.Fa arrp
14263d7b677Scgdis the address of the pointer to the array, while
1434472b403Swiz.Fa sizep
14463d7b677Scgdis the address of the element count of the array;
14563d7b677Scgdthis element count cannot exceed
1464472b403Swiz.Fa maxsize .
14763d7b677ScgdThe parameter
1484472b403Swiz.Fa elsize
14963d7b677Scgdis the
1504472b403Swiz.Em sizeof
15163d7b677Scgdeach of the array's elements, and
1524472b403Swiz.Fa elproc
1534472b403Swizis an XDR filter that translates between the array elements' C form,
1544472b403Swizand their external representation.
15563d7b677ScgdThis routine returns one if it succeeds, zero otherwise.
1564472b403Swiz.It Fn xdr_bool
1574472b403SwizA filter primitive that translates between booleans (C integers)
1586569c5c5Swizand their external representations.
1594472b403SwizWhen encoding data, this filter produces values of either one or
1604472b403Swizzero.
16163d7b677ScgdThis routine returns one if it succeeds, zero otherwise.
1624472b403Swiz.It Fn xdr_bytes
16363d7b677ScgdA filter primitive that translates between counted byte
16463d7b677Scgdstrings and their external representations.
16563d7b677ScgdThe parameter
1664472b403Swiz.Fa sp
1676569c5c5Swizis the address of the string pointer.
1686569c5c5SwizThe length of the string is located at address
1694472b403Swiz.Fa sizep ;
17063d7b677Scgdstrings cannot be longer than
1714472b403Swiz.Fa maxsize .
17263d7b677ScgdThis routine returns one if it succeeds, zero otherwise.
1734472b403Swiz.It Fn xdr_char
17463d7b677ScgdA filter primitive that translates between C characters
17563d7b677Scgdand their external representations.
17663d7b677ScgdThis routine returns one if it succeeds, zero otherwise.
1776569c5c5SwizNote: encoded characters are not packed, and occupy 4 bytes each.
1786569c5c5SwizFor arrays of characters, it is worthwhile to consider
1794472b403Swiz.Fn xdr_bytes ,
1804472b403Swiz.Fn xdr_opaque
18163d7b677Scgdor
1824472b403Swiz.Fn xdr_string .
1834472b403Swiz.It Fn xdr_destroy
1844472b403SwizA macro that invokes the destroy routine associated with the XDR
18563d7b677Scgdstream,
1864472b403Swiz.Fa xdrs .
18763d7b677ScgdDestruction usually involves freeing private data structures
1886569c5c5Swizassociated with the stream.
1896569c5c5SwizUsing
1904472b403Swiz.Fa xdrs
19163d7b677Scgdafter invoking
1924472b403Swiz.Fn xdr_destroy
19363d7b677Scgdis undefined.
1944472b403Swiz.It Fn xdr_double
1954472b403SwizA filter primitive that translates between C double precision numbers
19663d7b677Scgdand their external representations.
19763d7b677ScgdThis routine returns one if it succeeds, zero otherwise.
1984472b403Swiz.It Fn xdr_enum
1994472b403SwizA filter primitive that translates between C enums (actually integers)
2004472b403Swizand their external representations.
2014472b403SwizThis routine returns one if it succeeds, zero otherwise.
2024472b403Swiz.It Fn xdr_float
2034472b403SwizA filter primitive that translates between C floats
2044472b403Swizand their external representations.
2054472b403SwizThis routine returns one if it succeeds, zero otherwise.
2064472b403Swiz.It Fn xdr_free
2076569c5c5SwizGeneric freeing routine.
2084472b403SwizThe first argument is the XDR routine for the object being freed.
2096569c5c5SwizThe second argument is a pointer to the object itself.
2106569c5c5SwizNote: the pointer passed to this routine is
2114472b403Swiz.Em not
21263d7b677Scgdfreed, but what it points to
2134472b403Swiz.Em is
21463d7b677Scgdfreed (recursively).
2154472b403Swiz.It Fn xdr_getpos
2164472b403SwizA macro that invokes the get-position routine associated with the XDR
21763d7b677Scgdstream,
2184472b403Swiz.Fa xdrs .
2194472b403SwizThe routine returns an unsigned integer, which indicates the position
2204472b403Swizof the XDR byte stream.
2214472b403SwizA desirable feature of XDR streams is that simple arithmetic works
2224472b403Swizwith this number, although the XDR stream instances need not guarantee
2234472b403Swizthis.
2244472b403Swiz.It Fn xdr_hyper
22522b2fb08SthorpejA filter primitive that translates between ANSI C long long integers
22622b2fb08Sthorpejand their external representations.
22722b2fb08SthorpejThis routine returns one if it succeeds, zero otherwise.
2284472b403Swiz.It Fn xdr_inline
2294472b403SwizA macro that invokes the in-line routine associated with the XDR
23063d7b677Scgdstream,
2314472b403Swiz.Fa xdrs .
23263d7b677ScgdThe routine returns a pointer
23363d7b677Scgdto a contiguous piece of the stream's buffer;
2344472b403Swiz.Fa len
23563d7b677Scgdis the byte length of the desired buffer.
23663d7b677ScgdNote: pointer is cast to
2374472b403Swiz.Vt "long *" .
2384472b403Swiz.Pp
23963d7b677ScgdWarning:
2404472b403Swiz.Fn xdr_inline
24163d7b677Scgdmay return
2424472b403Swiz.Dv NULL
24363d7b677Scgdif it cannot allocate a contiguous piece of a buffer.
24463d7b677ScgdTherefore the behavior may vary among stream instances;
24563d7b677Scgdit exists for the sake of efficiency.
2464472b403Swiz.It Fn xdr_int
24763d7b677ScgdA filter primitive that translates between C integers
24863d7b677Scgdand their external representations.
24963d7b677ScgdThis routine returns one if it succeeds, zero otherwise.
2504472b403Swiz.It Fn xdr_long
2514472b403SwizA filter primitive that translates between C long integers
2524472b403Swizand their external representations.
25363d7b677ScgdThis routine returns one if it succeeds, zero otherwise.
2544472b403Swiz.It Fn xdr_longlong_t
25522b2fb08SthorpejA filter primitive that translates between ANSI C long long integers
25622b2fb08Sthorpejand their external representations.
25722b2fb08SthorpejThis routine returns one if it succeeds, zero otherwise.
2584472b403Swiz.It Fn xdrmem_create
2594472b403SwizThis routine initializes the XDR stream object pointed to by
2604472b403Swiz.Fa xdrs .
26163d7b677ScgdThe stream's data is written to, or read from,
26263d7b677Scgda chunk of memory at location
2634472b403Swiz.Fa addr
26463d7b677Scgdwhose length is no more than
2654472b403Swiz.Fa size
2666569c5c5Swizbytes long.
2676569c5c5SwizThe
2684472b403Swiz.Fa op
2694472b403Swizdetermines the direction of the XDR stream (either
2704472b403Swiz.Dv XDR_ENCODE ,
2714472b403Swiz.Dv XDR_DECODE ,
27263d7b677Scgdor
2734472b403Swiz.Dv XDR_FREE ) .
2744472b403Swiz.It Fn xdr_opaque
2754472b403SwizA filter primitive that translates between fixed size opaque data
27663d7b677Scgdand its external representation.
27763d7b677ScgdThe parameter
2784472b403Swiz.Fa cp
27963d7b677Scgdis the address of the opaque object, and
2804472b403Swiz.Fa cnt
28163d7b677Scgdis its size in bytes.
28263d7b677ScgdThis routine returns one if it succeeds, zero otherwise.
2834472b403Swiz.It Fn xdr_pointer
28463d7b677ScgdLike
2854472b403Swiz.Fn xdr_reference
2864472b403Swizexcept that it serializes
2874472b403Swiz.Dv NULL
28863d7b677Scgdpointers, whereas
2894472b403Swiz.Fn xdr_reference
2906569c5c5Swizdoes not.
2916569c5c5SwizThus,
2924472b403Swiz.Fn xdr_pointer
2934472b403Swizcan represent recursive data structures, such as binary trees or
29463d7b677Scgdlinked lists.
2954472b403Swiz.It Fn xdrrec_create
2964472b403SwizThis routine initializes the XDR stream object pointed to by
2974472b403Swiz.Fa xdrs .
29863d7b677ScgdThe stream's data is written to a buffer of size
2994472b403Swiz.Fa sendsize ;
3004472b403Swiza value of zero indicates the system should use a suitable default.
3016569c5c5SwizThe stream's data is read from a buffer of size
3024472b403Swiz.Fa recvsize ;
3034472b403Swizit too can be set to a suitable default by passing a zero value.
30463d7b677ScgdWhen a stream's output buffer is full,
3054472b403Swiz.Fa writeit
3066569c5c5Swizis called.
3076569c5c5SwizSimilarly, when a stream's input buffer is empty,
3084472b403Swiz.Fa readit
3096569c5c5Swizis called.
3104472b403SwizThe behavior of these two routines is similar to the system calls
3114472b403Swiz.Xr read 2
31263d7b677Scgdand
3134472b403Swiz.Xr write 2 ,
31463d7b677Scgdexcept that
3154472b403Swiz.Fa handle
31663d7b677Scgdis passed to the former routines as the first parameter.
3174472b403SwizNote: the XDR stream's
3184472b403Swiz.Fa op
31963d7b677Scgdfield must be set by the caller.
3204472b403Swiz.Pp
3214472b403SwizWarning: this XDR stream implements an intermediate record stream.
32263d7b677ScgdTherefore there are additional bytes in the stream
32363d7b677Scgdto provide record boundary information.
3244472b403Swiz.It Fn xdrrec_endofrecord
3254472b403SwizThis routine can be invoked only on streams created by
3264472b403Swiz.Fn xdrrec_create .
3274472b403SwizThe data in the output buffer is marked as a completed record,
32863d7b677Scgdand the output buffer is optionally written out if
3294472b403Swiz.Fa sendnow
3306569c5c5Swizis non-zero.
3316569c5c5SwizThis routine returns one if it succeeds, zero otherwise.
3324472b403Swiz.It Fn xdrrec_eof
3336569c5c5SwizThis routine can be invoked only on streams created by
3344472b403Swiz.Fn xdrrec_create .
33563d7b677ScgdAfter consuming the rest of the current record in the stream,
33663d7b677Scgdthis routine returns one if the stream has no more input,
33763d7b677Scgdzero otherwise.
3384472b403Swiz.It Fn xdrrec_skiprecord
3396569c5c5SwizThis routine can be invoked only on streams created by
3404472b403Swiz.Fn xdrrec_create .
3414472b403SwizIt tells the XDR implementation that the rest of the current record
34263d7b677Scgdin the stream's input buffer should be discarded.
34363d7b677ScgdThis routine returns one if it succeeds, zero otherwise.
3444472b403Swiz.It Fn xdr_reference
34563d7b677ScgdA primitive that provides pointer chasing within structures.
34663d7b677ScgdThe parameter
3474472b403Swiz.Fa pp
34863d7b677Scgdis the address of the pointer;
3494472b403Swiz.Fa size
35063d7b677Scgdis the
3514472b403Swiz.Em sizeof
35263d7b677Scgdthe structure that
3534472b403Swiz.Fa *pp
35463d7b677Scgdpoints to; and
3554472b403Swiz.Fa proc
3564472b403Swizis an XDR procedure that filters the structure
35763d7b677Scgdbetween its C form and its external representation.
35863d7b677ScgdThis routine returns one if it succeeds, zero otherwise.
3594472b403Swiz.Pp
36063d7b677ScgdWarning: this routine does not understand
3614472b403Swiz.Dv NULL
3626569c5c5Swizpointers.
3636569c5c5SwizUse
3644472b403Swiz.Fn xdr_pointer
36563d7b677Scgdinstead.
3664472b403Swiz.It Fn xdr_setpos
3674472b403SwizA macro that invokes the set position routine associated with the XDR
36863d7b677Scgdstream
3694472b403Swiz.Fa xdrs .
37063d7b677ScgdThe parameter
3714472b403Swiz.Fa pos
37263d7b677Scgdis a position value obtained from
3734472b403Swiz.Fn xdr_getpos .
3744472b403SwizThis routine returns one if the XDR stream could be repositioned,
37563d7b677Scgdand zero otherwise.
3764472b403Swiz.Pp
3774472b403SwizWarning: it is difficult to reposition some types of XDR streams, so
3784472b403Swizthis routine may fail with one type of stream and succeed with
3794472b403Swizanother.
3804472b403Swiz.It Fn xdr_short
3814472b403SwizA filter primitive that translates between C short integers
3824472b403Swizand their external representations.
38363d7b677ScgdThis routine returns one if it succeeds, zero otherwise.
384b4a55eb6Smanu.It Fn xdr_sizeof
385b4a55eb6SmanuThis routine returns the amount of memory required to encode
386b4a55eb6Smanu.Fa data
387b4a55eb6Smanuusing filter
388b4a55eb6Smanu.Fa func .
3894472b403Swiz.It Fn xdrstdio_create
3904472b403SwizThis routine initializes the XDR stream object pointed to by
3914472b403Swiz.Fa xdrs .
3924472b403SwizThe XDR stream data is written to, or read from, the Standard I/O
39363d7b677Scgdstream
3944472b403Swiz.Fa file .
39563d7b677ScgdThe parameter
3964472b403Swiz.Fa op
3974472b403Swizdetermines the direction of the XDR stream (either
3984472b403Swiz.Dv XDR_ENCODE ,
3994472b403Swiz.Dv XDR_DECODE ,
40063d7b677Scgdor
4014472b403Swiz.Dv XDR_FREE ) .
4024472b403Swiz.Pp
4034472b403SwizWarning: the destroy routine associated with such XDR streams calls
4044472b403Swiz.Xr fflush 3
4054472b403Swizon the file stream, but never
4064472b403Swiz.Xr fclose 3 .
4074472b403Swiz.It Fn xdr_string
40863d7b677ScgdA filter primitive that translates between C strings and
4096569c5c5Swiztheir corresponding external representations.
41063d7b677ScgdStrings cannot be longer than
4114472b403Swiz.Fa maxsize .
41263d7b677ScgdNote:
4134472b403Swiz.Fa sp
41463d7b677Scgdis the address of the string's pointer.
41563d7b677ScgdThis routine returns one if it succeeds, zero otherwise.
4164472b403Swiz.It Fn xdr_u_char
4174472b403SwizA filter primitive that translates between unsigned C characters
41822b2fb08Sthorpejand their external representations.
41922b2fb08SthorpejThis routine returns one if it succeeds, zero otherwise.
4204472b403Swiz.It Fn xdr_u_hyper
4214472b403SwizA filter primitive that translates between unsigned ANSI C long long
42263d7b677Scgdintegers and their external representations.
42363d7b677ScgdThis routine returns one if it succeeds, zero otherwise.
4244472b403Swiz.It Fn xdr_u_int
4254472b403SwizA filter primitive that translates between C unsigned integers
42622b2fb08Sthorpej and their external representations.
42722b2fb08SthorpejThis routine returns one if it succeeds, zero otherwise.
4284472b403Swiz.It Fn xdr_u_long
4294472b403SwizA filter primitive that translates between C unsigned long integers
4304472b403Swizand their external representations.
4314472b403SwizThis routine returns one if it succeeds, zero otherwise.
4324472b403Swiz.It Fn xdr_u_longlong_t
4334472b403SwizA filter primitive that translates between unsigned ANSI C long long
43463d7b677Scgdintegers and their external representations.
43563d7b677ScgdThis routine returns one if it succeeds, zero otherwise.
4364472b403Swiz.It Fn xdr_u_short
4374472b403SwizA filter primitive that translates between C unsigned short integers
4384472b403Swizand their external representations.
4394472b403SwizThis routine returns one if it succeeds, zero otherwise.
4404472b403Swiz.It Fn xdr_union
4414472b403SwizA filter primitive that translates between a discriminated C union
4426569c5c5Swizand its corresponding external representation.
4436569c5c5SwizIt first translates the discriminant of the union located at
4444472b403Swiz.Fa dscmp .
4454472b403SwizThis discriminant is always an enum_t.
44663d7b677ScgdNext the union located at
4474472b403Swiz.Fa unp
4486569c5c5Swizis translated.
4496569c5c5SwizThe parameter
4504472b403Swiz.Fa choices
45163d7b677Scgdis a pointer to an array of
4524472b403Swiz.Fn xdr_discrim
4536569c5c5Swizstructures.
4546569c5c5SwizEach structure contains an ordered pair of
4554472b403Swiz.Fa [ value ,
4564472b403Swiz.Fa proc ] .
45763d7b677ScgdIf the union's discriminant is equal to the associated
4584472b403Swiz.Fa value ,
45963d7b677Scgdthen the
4604472b403Swiz.Fa proc
4616569c5c5Swizis called to translate the union.
4626569c5c5SwizThe end of the
4634472b403Swiz.Fn xdr_discrim
46463d7b677Scgdstructure array is denoted by a routine of value
4654472b403Swiz.Dv NULL .
46663d7b677ScgdIf the discriminant is not found in the
4674472b403Swiz.Fa choices
46863d7b677Scgdarray, then the
4694472b403Swiz.Fa defaultarm
47063d7b677Scgdprocedure is called (if it is not
4714472b403Swiz.Dv NULL ) .
47263d7b677ScgdReturns one if it succeeds, zero otherwise.
4734472b403Swiz.It Fn xdr_vector
47463d7b677ScgdA filter primitive that translates between fixed-length
4756569c5c5Swizarrays and their corresponding external representations.
4766569c5c5SwizThe parameter
4774472b403Swiz.Fa arrp
47863d7b677Scgdis the address of the pointer to the array, while
4794472b403Swiz.Fa size
4806569c5c5Swizis the element count of the array.
4816569c5c5SwizThe parameter
4824472b403Swiz.Fa elsize
48363d7b677Scgdis the
4844472b403Swiz.Em sizeof
48563d7b677Scgdeach of the array's elements, and
4864472b403Swiz.Fa elproc
4874472b403Swizis an XDR filter that translates between the array elements' C form,
4884472b403Swizand their external representation.
48963d7b677ScgdThis routine returns one if it succeeds, zero otherwise.
4904472b403Swiz.It Fn xdr_void
49163d7b677ScgdThis routine always returns one.
4924472b403SwizIt may be passed to RPC routines that require a function parameter,
49363d7b677Scgdwhere nothing is to be done.
4944472b403Swiz.It Fn xdr_wrapstring
49563d7b677ScgdA primitive that calls
4964472b403Swiz.Fn xdr_string "xdrs" "sp" "MAXUN.UNSIGNED" ;
49763d7b677Scgdwhere
4984472b403Swiz.Dv MAXUN.UNSIGNED
49963d7b677Scgdis the maximum value of an unsigned integer.
5004472b403Swiz.Fn xdr_wrapstring
5014472b403Swizis handy because the RPC package passes a maximum of two XDR
50263d7b677Scgdroutines as parameters, and
5034472b403Swiz.Fn xdr_string ,
50463d7b677Scgdone of the most frequently used primitives, requires three.
50563d7b677ScgdReturns one if it succeeds, zero otherwise.
5064472b403Swiz.El
5074472b403Swiz.Sh SEE ALSO
5084472b403Swiz.Xr rpc 3
5094472b403Swiz.Pp
51063d7b677ScgdThe following manuals:
5114472b403Swiz.Rs
5124472b403Swiz.%B "eXternal Data Representation Standard: Protocol Specification"
5134472b403Swiz.Re
5144472b403Swiz.Rs
5154472b403Swiz.%B "eXternal Data Representation: Sun Technical Notes"
5169a790c1dSjoerg.Re
5174472b403Swiz.Rs
5184472b403Swiz.%A Sun Microsystems, Inc., USC-ISI
5194472b403Swiz.%T "XDR: External Data Representation Standard"
52047190e80Swiz.%R "RFC 1014, USC-ISI"
5214472b403Swiz.%V 1014
5224472b403Swiz.Re
523