1eae561b3SGarrett Wollman.\" @(#)xdr.3n 2.2 88/08/03 4.0 RPCSRC; from 1.16 88/03/14 SMI 27f3dea24SPeter Wemm.\" $FreeBSD$ 3e83201b4SWolfram Schneider.\" 41abae7eeSRuslan Ermilov.Dd February 16, 1988 51abae7eeSRuslan Ermilov.Dt XDR 3 61abae7eeSRuslan Ermilov.Os 71abae7eeSRuslan Ermilov.Sh NAME 81abae7eeSRuslan Ermilov.Nm xdr 91abae7eeSRuslan Ermilov.Nd "library routines for external data representation" 101abae7eeSRuslan Ermilov.Sh LIBRARY 111abae7eeSRuslan Ermilov.Lb libc 121abae7eeSRuslan Ermilov.Sh SYNOPSIS 131abae7eeSRuslan Ermilov.Fd "#include <rpc/xdr.h>" 141abae7eeSRuslan Ermilov.Pp 151abae7eeSRuslan ErmilovSee 161abae7eeSRuslan Ermilov.Sx DESCRIPTION 171abae7eeSRuslan Ermilovfor function declarations. 181abae7eeSRuslan Ermilov.Sh DESCRIPTION 19eae561b3SGarrett WollmanThese routines allow C programmers to describe 20eae561b3SGarrett Wollmanarbitrary data structures in a machine-independent fashion. 21eae561b3SGarrett WollmanData for remote procedure calls are transmitted using these 22eae561b3SGarrett Wollmanroutines. 231abae7eeSRuslan Ermilov.Pp 241abae7eeSRuslan Ermilov.Bl -tag -width indent -compact 251abae7eeSRuslan Ermilov.It Xo 261abae7eeSRuslan Ermilov.Ft int 271abae7eeSRuslan Ermilov.Xc 281abae7eeSRuslan Ermilov.It Xo 291abae7eeSRuslan Ermilov.Fo xdr_array 301abae7eeSRuslan Ermilov.Fa "XDR *xdrs" 311abae7eeSRuslan Ermilov.Fa "char **arrp" 321abae7eeSRuslan Ermilov.Fa "u_int *sizep" 331abae7eeSRuslan Ermilov.Fa "u_int maxsize" 341abae7eeSRuslan Ermilov.Fa "u_int elsize" 351abae7eeSRuslan Ermilov.Fa "xdrproc_t elproc" 361abae7eeSRuslan Ermilov.Fc 371abae7eeSRuslan Ermilov.Xc 381abae7eeSRuslan Ermilov.Pp 39eae561b3SGarrett WollmanA filter primitive that translates between variable-length 40eae561b3SGarrett Wollmanarrays 41c6ff3a1bSSheldon Hearnand their corresponding external representations. 42c6ff3a1bSSheldon HearnThe 43eae561b3SGarrett Wollmanparameter 441abae7eeSRuslan Ermilov.Fa arrp 45eae561b3SGarrett Wollmanis the address of the pointer to the array, while 461abae7eeSRuslan Ermilov.Fa sizep 47eae561b3SGarrett Wollmanis the address of the element count of the array; 48eae561b3SGarrett Wollmanthis element count cannot exceed 491abae7eeSRuslan Ermilov.Fa maxsize . 50eae561b3SGarrett WollmanThe parameter 511abae7eeSRuslan Ermilov.Fa elsize 52eae561b3SGarrett Wollmanis the 531abae7eeSRuslan Ermilov.Ic sizeof 54eae561b3SGarrett Wollmaneach of the array's elements, and 551abae7eeSRuslan Ermilov.Fa elproc 56eae561b3SGarrett Wollmanis an 571abae7eeSRuslan Ermilov.Tn XDR 58eae561b3SGarrett Wollmanfilter that translates between 59eae561b3SGarrett Wollmanthe array elements' C form, and their external 60eae561b3SGarrett Wollmanrepresentation. 61eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 621abae7eeSRuslan Ermilov.Pp 631abae7eeSRuslan Ermilov.It Xo 641abae7eeSRuslan Ermilov.Ft int 651abae7eeSRuslan Ermilov.Xc 661abae7eeSRuslan Ermilov.It Xo 671abae7eeSRuslan Ermilov.Fn xdr_bool "XDR *xdrs" "bool_t *bp" 681abae7eeSRuslan Ermilov.Xc 691abae7eeSRuslan Ermilov.Pp 70eae561b3SGarrett WollmanA filter primitive that translates between booleans (C 71eae561b3SGarrett Wollmanintegers) 72c6ff3a1bSSheldon Hearnand their external representations. 73c6ff3a1bSSheldon HearnWhen encoding data, this 74eae561b3SGarrett Wollmanfilter produces values of either one or zero. 75eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 761abae7eeSRuslan Ermilov.Pp 771abae7eeSRuslan Ermilov.It Xo 781abae7eeSRuslan Ermilov.Ft int 791abae7eeSRuslan Ermilov.Xc 801abae7eeSRuslan Ermilov.It Xo 811abae7eeSRuslan Ermilov.Fn xdr_bytes "XDR *xdrs" "char **sp" "u_int *sizep" "u_int maxsize" 821abae7eeSRuslan Ermilov.Xc 831abae7eeSRuslan Ermilov.Pp 84eae561b3SGarrett WollmanA filter primitive that translates between counted byte 85eae561b3SGarrett Wollmanstrings and their external representations. 86eae561b3SGarrett WollmanThe parameter 871abae7eeSRuslan Ermilov.Fa sp 88c6ff3a1bSSheldon Hearnis the address of the string pointer. 89c6ff3a1bSSheldon HearnThe length of the 90eae561b3SGarrett Wollmanstring is located at address 911abae7eeSRuslan Ermilov.Fa sizep ; 92eae561b3SGarrett Wollmanstrings cannot be longer than 931abae7eeSRuslan Ermilov.Fa maxsize . 94eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 951abae7eeSRuslan Ermilov.Pp 961abae7eeSRuslan Ermilov.It Xo 971abae7eeSRuslan Ermilov.Ft int 981abae7eeSRuslan Ermilov.Xc 991abae7eeSRuslan Ermilov.It Xo 1001abae7eeSRuslan Ermilov.Fn xdr_char "XDR *xdrs" "char *cp" 1011abae7eeSRuslan Ermilov.Xc 1021abae7eeSRuslan Ermilov.Pp 103eae561b3SGarrett WollmanA filter primitive that translates between C characters 104eae561b3SGarrett Wollmanand their external representations. 105eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 106eae561b3SGarrett WollmanNote: encoded characters are not packed, and occupy 4 bytes 107c6ff3a1bSSheldon Hearneach. 108c6ff3a1bSSheldon HearnFor arrays of characters, it is worthwhile to 109eae561b3SGarrett Wollmanconsider 1101abae7eeSRuslan Ermilov.Fn xdr_bytes , 1111abae7eeSRuslan Ermilov.Fn xdr_opaque 112eae561b3SGarrett Wollmanor 1131abae7eeSRuslan Ermilov.Fn xdr_string . 1141abae7eeSRuslan Ermilov.Pp 1151abae7eeSRuslan Ermilov.It Xo 1161abae7eeSRuslan Ermilov.Ft void 1171abae7eeSRuslan Ermilov.Xc 1181abae7eeSRuslan Ermilov.It Xo 1191abae7eeSRuslan Ermilov.Fn xdr_destroy "XDR *xdrs" 1201abae7eeSRuslan Ermilov.Xc 1211abae7eeSRuslan Ermilov.Pp 122eae561b3SGarrett WollmanA macro that invokes the destroy routine associated with the 1231abae7eeSRuslan Ermilov.Tn XDR 124eae561b3SGarrett Wollmanstream, 1251abae7eeSRuslan Ermilov.Fa xdrs . 126eae561b3SGarrett WollmanDestruction usually involves freeing private data structures 1271abae7eeSRuslan Ermilovassociated with the stream. 1281abae7eeSRuslan ErmilovUsing 1291abae7eeSRuslan Ermilov.Fa xdrs 130eae561b3SGarrett Wollmanafter invoking 1311abae7eeSRuslan Ermilov.Fn xdr_destroy 132eae561b3SGarrett Wollmanis undefined. 1331abae7eeSRuslan Ermilov.Pp 1341abae7eeSRuslan Ermilov.It Xo 1351abae7eeSRuslan Ermilov.Ft int 1361abae7eeSRuslan Ermilov.Xc 1371abae7eeSRuslan Ermilov.It Xo 1381abae7eeSRuslan Ermilov.Fn xdr_double "XDR *xdrs" "double *dp" 1391abae7eeSRuslan Ermilov.Xc 1401abae7eeSRuslan Ermilov.Pp 141eae561b3SGarrett WollmanA filter primitive that translates between C 1421abae7eeSRuslan Ermilov.Vt double 143eae561b3SGarrett Wollmanprecision numbers and their external representations. 144eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 1451abae7eeSRuslan Ermilov.Pp 1461abae7eeSRuslan Ermilov.It Xo 1471abae7eeSRuslan Ermilov.Ft int 1481abae7eeSRuslan Ermilov.Xc 1491abae7eeSRuslan Ermilov.It Xo 1501abae7eeSRuslan Ermilov.Fn xdr_enum "XDR *xdrs" "enum_t *ep" 1511abae7eeSRuslan Ermilov.Xc 1521abae7eeSRuslan Ermilov.Pp 153eae561b3SGarrett WollmanA filter primitive that translates between C 1541abae7eeSRuslan Ermilov.Vt enum Ns s 155eae561b3SGarrett Wollman(actually integers) and their external representations. 156eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 1571abae7eeSRuslan Ermilov.Pp 1581abae7eeSRuslan Ermilov.It Xo 1591abae7eeSRuslan Ermilov.Ft int 1601abae7eeSRuslan Ermilov.Xc 1611abae7eeSRuslan Ermilov.It Xo 1621abae7eeSRuslan Ermilov.Fn xdr_float "XDR *xdrs" "float *fp" 1631abae7eeSRuslan Ermilov.Xc 1641abae7eeSRuslan Ermilov.Pp 165eae561b3SGarrett WollmanA filter primitive that translates between C 1661abae7eeSRuslan Ermilov.Vt float Ns s 167eae561b3SGarrett Wollmanand their external representations. 168eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 1691abae7eeSRuslan Ermilov.Pp 1701abae7eeSRuslan Ermilov.It Xo 1711abae7eeSRuslan Ermilov.Ft void 1721abae7eeSRuslan Ermilov.Xc 1731abae7eeSRuslan Ermilov.It Xo 1741abae7eeSRuslan Ermilov.Fn xdr_free "xdrproc_t proc" "char *objp" 1751abae7eeSRuslan Ermilov.Xc 1761abae7eeSRuslan Ermilov.Pp 177c6ff3a1bSSheldon HearnGeneric freeing routine. 178c6ff3a1bSSheldon HearnThe first argument is the 1791abae7eeSRuslan Ermilov.Tn XDR 180c6ff3a1bSSheldon Hearnroutine for the object being freed. 181c6ff3a1bSSheldon HearnThe second argument 182c6ff3a1bSSheldon Hearnis a pointer to the object itself. 183c6ff3a1bSSheldon HearnNote: the pointer passed 184eae561b3SGarrett Wollmanto this routine is 1851abae7eeSRuslan Ermilov.Em not 186eae561b3SGarrett Wollmanfreed, but what it points to 1871abae7eeSRuslan Ermilov.Em is 188eae561b3SGarrett Wollmanfreed (recursively). 1891abae7eeSRuslan Ermilov.Pp 1901abae7eeSRuslan Ermilov.It Xo 1911abae7eeSRuslan Ermilov.Ft u_int 1921abae7eeSRuslan Ermilov.Xc 1931abae7eeSRuslan Ermilov.It Xo 1941abae7eeSRuslan Ermilov.Fn xdr_getpos "XDR *xdrs" 1951abae7eeSRuslan Ermilov.Xc 1961abae7eeSRuslan Ermilov.Pp 1971abae7eeSRuslan ErmilovA macro that invokes the get\-position routine 198eae561b3SGarrett Wollmanassociated with the 1991abae7eeSRuslan Ermilov.Tn XDR 200eae561b3SGarrett Wollmanstream, 2011abae7eeSRuslan Ermilov.Fa xdrs . 202eae561b3SGarrett WollmanThe routine returns an unsigned integer, 203eae561b3SGarrett Wollmanwhich indicates the position of the 2041abae7eeSRuslan Ermilov.Tn XDR 205eae561b3SGarrett Wollmanbyte stream. 206eae561b3SGarrett WollmanA desirable feature of 2071abae7eeSRuslan Ermilov.Tn XDR 208eae561b3SGarrett Wollmanstreams is that simple arithmetic works with this number, 209eae561b3SGarrett Wollmanalthough the 2101abae7eeSRuslan Ermilov.Tn XDR 211eae561b3SGarrett Wollmanstream instances need not guarantee this. 2121abae7eeSRuslan Ermilov.Pp 2131abae7eeSRuslan Ermilov.It Xo 2141abae7eeSRuslan Ermilov.Ft "long *" 2151abae7eeSRuslan Ermilov.Xc 2161abae7eeSRuslan Ermilov.It Xo 2171abae7eeSRuslan Ermilov.Fn xdr_inline "XDR *xdrs" "int len" 2181abae7eeSRuslan Ermilov.Xc 2191abae7eeSRuslan Ermilov.Pp 220eae561b3SGarrett WollmanA macro that invokes the in-line routine associated with the 2211abae7eeSRuslan Ermilov.Tn XDR 222eae561b3SGarrett Wollmanstream, 2231abae7eeSRuslan Ermilov.Fa xdrs . 224eae561b3SGarrett WollmanThe routine returns a pointer 225eae561b3SGarrett Wollmanto a contiguous piece of the stream's buffer; 2261abae7eeSRuslan Ermilov.Fa len 227eae561b3SGarrett Wollmanis the byte length of the desired buffer. 228eae561b3SGarrett WollmanNote: pointer is cast to 2291abae7eeSRuslan Ermilov.Vt "long *" . 2301abae7eeSRuslan Ermilov.Pp 231eae561b3SGarrett WollmanWarning: 2321abae7eeSRuslan Ermilov.Fn xdr_inline 233eae561b3SGarrett Wollmanmay return 2341abae7eeSRuslan Ermilov.Dv NULL 235eae561b3SGarrett Wollman(0) 236eae561b3SGarrett Wollmanif it cannot allocate a contiguous piece of a buffer. 237eae561b3SGarrett WollmanTherefore the behavior may vary among stream instances; 238eae561b3SGarrett Wollmanit exists for the sake of efficiency. 2391abae7eeSRuslan Ermilov.Pp 2401abae7eeSRuslan Ermilov.It Xo 2411abae7eeSRuslan Ermilov.Ft int 2421abae7eeSRuslan Ermilov.Xc 2431abae7eeSRuslan Ermilov.It Xo 2441abae7eeSRuslan Ermilov.Fn xdr_int "XDR *xdrs" "int *ip" 2451abae7eeSRuslan Ermilov.Xc 2461abae7eeSRuslan Ermilov.Pp 247eae561b3SGarrett WollmanA filter primitive that translates between C integers 248eae561b3SGarrett Wollmanand their external representations. 249eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 2501abae7eeSRuslan Ermilov.Pp 2511abae7eeSRuslan Ermilov.It Xo 2521abae7eeSRuslan Ermilov.Ft int 2531abae7eeSRuslan Ermilov.Xc 2541abae7eeSRuslan Ermilov.It Xo 2551abae7eeSRuslan Ermilov.Fn xdr_long "XDR *xdrs" "long *lp" 2561abae7eeSRuslan Ermilov.Xc 2571abae7eeSRuslan Ermilov.Pp 258eae561b3SGarrett WollmanA filter primitive that translates between C 2591abae7eeSRuslan Ermilov.Vt long 260eae561b3SGarrett Wollmanintegers and their external representations. 261eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 2621abae7eeSRuslan Ermilov.Pp 2631abae7eeSRuslan Ermilov.It Xo 2641abae7eeSRuslan Ermilov.Ft void 2651abae7eeSRuslan Ermilov.Xc 2661abae7eeSRuslan Ermilov.It Xo 2671abae7eeSRuslan Ermilov.Fn xdrmem_create "XDR *xdrs" "char *addr" "u_int size" "enum xdr_op op" 2681abae7eeSRuslan Ermilov.Xc 2691abae7eeSRuslan Ermilov.Pp 270eae561b3SGarrett WollmanThis routine initializes the 2711abae7eeSRuslan Ermilov.Tn XDR 272eae561b3SGarrett Wollmanstream object pointed to by 2731abae7eeSRuslan Ermilov.Fa xdrs . 274eae561b3SGarrett WollmanThe stream's data is written to, or read from, 275eae561b3SGarrett Wollmana chunk of memory at location 2761abae7eeSRuslan Ermilov.Fa addr 277eae561b3SGarrett Wollmanwhose length is no more than 2781abae7eeSRuslan Ermilov.Fa size 2791abae7eeSRuslan Ermilovbytes long. 2801abae7eeSRuslan ErmilovThe 2811abae7eeSRuslan Ermilov.Fa op 282eae561b3SGarrett Wollmandetermines the direction of the 2831abae7eeSRuslan Ermilov.Tn XDR 284eae561b3SGarrett Wollmanstream 285eae561b3SGarrett Wollman(either 2861abae7eeSRuslan Ermilov.Dv XDR_ENCODE , 2871abae7eeSRuslan Ermilov.Dv XDR_DECODE , 288eae561b3SGarrett Wollmanor 2891abae7eeSRuslan Ermilov.Dv XDR_FREE ) . 2901abae7eeSRuslan Ermilov.Pp 2911abae7eeSRuslan Ermilov.It Xo 2921abae7eeSRuslan Ermilov.Ft int 2931abae7eeSRuslan Ermilov.Xc 2941abae7eeSRuslan Ermilov.It Xo 2951abae7eeSRuslan Ermilov.Fn xdr_opaque "XDR *xdrs" "char *cp" "u_int cnt" 2961abae7eeSRuslan Ermilov.Xc 2971abae7eeSRuslan Ermilov.Pp 298eae561b3SGarrett WollmanA filter primitive that translates between fixed size opaque 299eae561b3SGarrett Wollmandata 300eae561b3SGarrett Wollmanand its external representation. 301eae561b3SGarrett WollmanThe parameter 3021abae7eeSRuslan Ermilov.Fa cp 303eae561b3SGarrett Wollmanis the address of the opaque object, and 3041abae7eeSRuslan Ermilov.Fa cnt 305eae561b3SGarrett Wollmanis its size in bytes. 306eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 3071abae7eeSRuslan Ermilov.Pp 3081abae7eeSRuslan Ermilov.It Xo 3091abae7eeSRuslan Ermilov.Ft int 3101abae7eeSRuslan Ermilov.Xc 3111abae7eeSRuslan Ermilov.It Xo 3121abae7eeSRuslan Ermilov.Fn xdr_pointer "XDR *xdrs" "char **objpp" "u_int objsize" "xdrproc_t xdrobj" 3131abae7eeSRuslan Ermilov.Xc 3141abae7eeSRuslan Ermilov.Pp 315eae561b3SGarrett WollmanLike 3161abae7eeSRuslan Ermilov.Fn xdr_reference 3171abae7eeSRuslan Ermilovexcept that it serializes 3181abae7eeSRuslan Ermilov.Dv NULL 319eae561b3SGarrett Wollmanpointers, whereas 3201abae7eeSRuslan Ermilov.Fn xdr_reference 3211abae7eeSRuslan Ermilovdoes not. 3221abae7eeSRuslan ErmilovThus, 3231abae7eeSRuslan Ermilov.Fn xdr_pointer 324eae561b3SGarrett Wollmancan represent 325eae561b3SGarrett Wollmanrecursive data structures, such as binary trees or 326eae561b3SGarrett Wollmanlinked lists. 3271abae7eeSRuslan Ermilov.Pp 3281abae7eeSRuslan Ermilov.It Xo 3291abae7eeSRuslan Ermilov.Ft void 3301abae7eeSRuslan Ermilov.Xc 3311abae7eeSRuslan Ermilov.It Xo 3321abae7eeSRuslan Ermilov.Fo xdrrec_create 3331abae7eeSRuslan Ermilov.Fa "XDR *xdrs" 3341abae7eeSRuslan Ermilov.Fa "u_int sendsize" 3351abae7eeSRuslan Ermilov.Fa "u_int recvsize" 3361abae7eeSRuslan Ermilov.Fa "char *handle" 3371abae7eeSRuslan Ermilov.Fa "int \*(lp*readit\*(rp\*(lp\*(rp" 3381abae7eeSRuslan Ermilov.Fa "int \*(lp*writeit\*(rp\*(lp\*(rp" 3391abae7eeSRuslan Ermilov.Fc 3401abae7eeSRuslan Ermilov.Xc 3411abae7eeSRuslan Ermilov.Pp 342eae561b3SGarrett WollmanThis routine initializes the 3431abae7eeSRuslan Ermilov.Tn XDR 344eae561b3SGarrett Wollmanstream object pointed to by 3451abae7eeSRuslan Ermilov.Fa xdrs . 346eae561b3SGarrett WollmanThe stream's data is written to a buffer of size 3471abae7eeSRuslan Ermilov.Fa sendsize ; 348eae561b3SGarrett Wollmana value of zero indicates the system should use a suitable 349c6ff3a1bSSheldon Hearndefault. 350c6ff3a1bSSheldon HearnThe stream's data is read from a buffer of size 3511abae7eeSRuslan Ermilov.Fa recvsize ; 352eae561b3SGarrett Wollmanit too can be set to a suitable default by passing a zero 353eae561b3SGarrett Wollmanvalue. 354eae561b3SGarrett WollmanWhen a stream's output buffer is full, 3551abae7eeSRuslan Ermilov.Fn writeit 3561abae7eeSRuslan Ermilovis called. 3571abae7eeSRuslan ErmilovSimilarly, when a stream's input buffer is empty, 3581abae7eeSRuslan Ermilov.Fn readit 3591abae7eeSRuslan Ermilovis called. 3601abae7eeSRuslan ErmilovThe behavior of these two routines is similar to 361eae561b3SGarrett Wollmanthe 362eae561b3SGarrett Wollmansystem calls 3631abae7eeSRuslan Ermilov.Xr read 2 364eae561b3SGarrett Wollmanand 3651abae7eeSRuslan Ermilov.Xr write 2 , 366eae561b3SGarrett Wollmanexcept that 3671abae7eeSRuslan Ermilov.Fa handle 368eae561b3SGarrett Wollmanis passed to the former routines as the first parameter. 369eae561b3SGarrett WollmanNote: the 3701abae7eeSRuslan Ermilov.Tn XDR 371eae561b3SGarrett Wollmanstream's 3721abae7eeSRuslan Ermilov.Fa op 373eae561b3SGarrett Wollmanfield must be set by the caller. 3741abae7eeSRuslan Ermilov.Pp 375eae561b3SGarrett WollmanWarning: this 3761abae7eeSRuslan Ermilov.Tn XDR 377eae561b3SGarrett Wollmanstream implements an intermediate record stream. 378eae561b3SGarrett WollmanTherefore there are additional bytes in the stream 379eae561b3SGarrett Wollmanto provide record boundary information. 3801abae7eeSRuslan Ermilov.Pp 3811abae7eeSRuslan Ermilov.It Xo 3821abae7eeSRuslan Ermilov.Ft int 3831abae7eeSRuslan Ermilov.Xc 3841abae7eeSRuslan Ermilov.It Xo 3851abae7eeSRuslan Ermilov.Fn xdrrec_endofrecord "XDR *xdrs" "int sendnow" 3861abae7eeSRuslan Ermilov.Xc 3871abae7eeSRuslan Ermilov.Pp 388eae561b3SGarrett WollmanThis routine can be invoked only on 389eae561b3SGarrett Wollmanstreams created by 3901abae7eeSRuslan Ermilov.Fn xdrrec_create . 391eae561b3SGarrett WollmanThe data in the output buffer is marked as a completed 392eae561b3SGarrett Wollmanrecord, 393eae561b3SGarrett Wollmanand the output buffer is optionally written out if 3941abae7eeSRuslan Ermilov.Fa sendnow 395c6ff3a1bSSheldon Hearnis non-zero. 396c6ff3a1bSSheldon HearnThis routine returns one if it succeeds, zero 397eae561b3SGarrett Wollmanotherwise. 3981abae7eeSRuslan Ermilov.Pp 3991abae7eeSRuslan Ermilov.It Xo 4001abae7eeSRuslan Ermilov.Ft int 4011abae7eeSRuslan Ermilov.Xc 4021abae7eeSRuslan Ermilov.It Xo 4031abae7eeSRuslan Ermilov.Fn xdrrec_eof "XDR *xdrs" 4041abae7eeSRuslan Ermilov.Xc 4051abae7eeSRuslan Ermilov.Pp 406eae561b3SGarrett WollmanThis routine can be invoked only on 407eae561b3SGarrett Wollmanstreams created by 4081abae7eeSRuslan Ermilov.Fn xdrrec_create . 409eae561b3SGarrett WollmanAfter consuming the rest of the current record in the stream, 410eae561b3SGarrett Wollmanthis routine returns one if the stream has no more input, 411eae561b3SGarrett Wollmanzero otherwise. 4121abae7eeSRuslan Ermilov.Pp 4131abae7eeSRuslan Ermilov.It Xo 4141abae7eeSRuslan Ermilov.Ft int 4151abae7eeSRuslan Ermilov.Xc 4161abae7eeSRuslan Ermilov.It Xo 4171abae7eeSRuslan Ermilov.Fn xdrrec_skiprecord "XDR *xdrs" 4181abae7eeSRuslan Ermilov.Xc 4191abae7eeSRuslan Ermilov.Pp 420eae561b3SGarrett WollmanThis routine can be invoked only on 421eae561b3SGarrett Wollmanstreams created by 4221abae7eeSRuslan Ermilov.Fn xdrrec_create . 423eae561b3SGarrett WollmanIt tells the 4241abae7eeSRuslan Ermilov.Tn XDR 425eae561b3SGarrett Wollmanimplementation that the rest of the current record 426eae561b3SGarrett Wollmanin the stream's input buffer should be discarded. 427eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 4281abae7eeSRuslan Ermilov.Pp 4291abae7eeSRuslan Ermilov.It Xo 4301abae7eeSRuslan Ermilov.Ft int 4311abae7eeSRuslan Ermilov.Xc 4321abae7eeSRuslan Ermilov.It Xo 4331abae7eeSRuslan Ermilov.Fn xdr_reference "XDR *xdrs" "char **pp" "u_int size" "xdrproc_t proc" 4341abae7eeSRuslan Ermilov.Xc 4351abae7eeSRuslan Ermilov.Pp 436eae561b3SGarrett WollmanA primitive that provides pointer chasing within structures. 437eae561b3SGarrett WollmanThe parameter 4381abae7eeSRuslan Ermilov.Fa pp 439eae561b3SGarrett Wollmanis the address of the pointer; 4401abae7eeSRuslan Ermilov.Fa size 441eae561b3SGarrett Wollmanis the 4421abae7eeSRuslan Ermilov.Ic sizeof 443eae561b3SGarrett Wollmanthe structure that 4441abae7eeSRuslan Ermilov.Fa *pp 445eae561b3SGarrett Wollmanpoints to; and 4461abae7eeSRuslan Ermilov.Fa proc 447eae561b3SGarrett Wollmanis an 4481abae7eeSRuslan Ermilov.Tn XDR 449eae561b3SGarrett Wollmanprocedure that filters the structure 450eae561b3SGarrett Wollmanbetween its C form and its external representation. 451eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 4521abae7eeSRuslan Ermilov.Pp 453eae561b3SGarrett WollmanWarning: this routine does not understand 4541abae7eeSRuslan Ermilov.Dv NULL 455c6ff3a1bSSheldon Hearnpointers. 456c6ff3a1bSSheldon HearnUse 4571abae7eeSRuslan Ermilov.Fn xdr_pointer 458eae561b3SGarrett Wollmaninstead. 4591abae7eeSRuslan Ermilov.Pp 4601abae7eeSRuslan Ermilov.It Xo 4611abae7eeSRuslan Ermilov.Ft int 4621abae7eeSRuslan Ermilov.Xc 4631abae7eeSRuslan Ermilov.It Xo 4641abae7eeSRuslan Ermilov.Fn xdr_setpos "XDR *xdrs" "u_int pos" 4651abae7eeSRuslan Ermilov.Xc 4661abae7eeSRuslan Ermilov.Pp 467eae561b3SGarrett WollmanA macro that invokes the set position routine associated with 468eae561b3SGarrett Wollmanthe 4691abae7eeSRuslan Ermilov.Tn XDR 470eae561b3SGarrett Wollmanstream 4711abae7eeSRuslan Ermilov.Fa xdrs . 472eae561b3SGarrett WollmanThe parameter 4731abae7eeSRuslan Ermilov.Fa pos 474eae561b3SGarrett Wollmanis a position value obtained from 4751abae7eeSRuslan Ermilov.Fn xdr_getpos . 476eae561b3SGarrett WollmanThis routine returns one if the 4771abae7eeSRuslan Ermilov.Tn XDR 478eae561b3SGarrett Wollmanstream could be repositioned, 479eae561b3SGarrett Wollmanand zero otherwise. 4801abae7eeSRuslan Ermilov.Pp 481eae561b3SGarrett WollmanWarning: it is difficult to reposition some types of 4821abae7eeSRuslan Ermilov.Tn XDR 483eae561b3SGarrett Wollmanstreams, so this routine may fail with one 484eae561b3SGarrett Wollmantype of stream and succeed with another. 4851abae7eeSRuslan Ermilov.Pp 4861abae7eeSRuslan Ermilov.It Xo 4871abae7eeSRuslan Ermilov.Ft int 4881abae7eeSRuslan Ermilov.Xc 4891abae7eeSRuslan Ermilov.It Xo 4901abae7eeSRuslan Ermilov.Fn xdr_short "XDR *xdrs" "short *sp" 4911abae7eeSRuslan Ermilov.Xc 4921abae7eeSRuslan Ermilov.Pp 493eae561b3SGarrett WollmanA filter primitive that translates between C 4941abae7eeSRuslan Ermilov.Vt short 495eae561b3SGarrett Wollmanintegers and their external representations. 496eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 4971abae7eeSRuslan Ermilov.Pp 4981abae7eeSRuslan Ermilov.It Xo 4991abae7eeSRuslan Ermilov.Ft void 5001abae7eeSRuslan Ermilov.Xc 5011abae7eeSRuslan Ermilov.It Xo 5021abae7eeSRuslan Ermilov.Fn xdrstdio_create "XDR *xdrs" "FILE *file" "enum xdr_op op" 5031abae7eeSRuslan Ermilov.Xc 5041abae7eeSRuslan Ermilov.Pp 505eae561b3SGarrett WollmanThis routine initializes the 5061abae7eeSRuslan Ermilov.Tn XDR 507eae561b3SGarrett Wollmanstream object pointed to by 5081abae7eeSRuslan Ermilov.Fa xdrs . 509eae561b3SGarrett WollmanThe 5101abae7eeSRuslan Ermilov.Tn XDR 511eae561b3SGarrett Wollmanstream data is written to, or read from, the Standard 5121abae7eeSRuslan Ermilov.Tn I/O 513eae561b3SGarrett Wollmanstream 5141abae7eeSRuslan Ermilov.Fa file . 515eae561b3SGarrett WollmanThe parameter 5161abae7eeSRuslan Ermilov.Fa op 517eae561b3SGarrett Wollmandetermines the direction of the 5181abae7eeSRuslan Ermilov.Tn XDR 519eae561b3SGarrett Wollmanstream (either 5201abae7eeSRuslan Ermilov.Dv XDR_ENCODE , 5211abae7eeSRuslan Ermilov.Dv XDR_DECODE , 522eae561b3SGarrett Wollmanor 5231abae7eeSRuslan Ermilov.Dv XDR_FREE ) . 5241abae7eeSRuslan Ermilov.Pp 525eae561b3SGarrett WollmanWarning: the destroy routine associated with such 5261abae7eeSRuslan Ermilov.Tn XDR 527eae561b3SGarrett Wollmanstreams calls 5281abae7eeSRuslan Ermilov.Xr fflush 3 529eae561b3SGarrett Wollmanon the 5301abae7eeSRuslan Ermilov.Fa file 531eae561b3SGarrett Wollmanstream, but never 5321abae7eeSRuslan Ermilov.Xr fclose 3 . 5331abae7eeSRuslan Ermilov.Pp 5341abae7eeSRuslan Ermilov.It Xo 5351abae7eeSRuslan Ermilov.Ft int 5361abae7eeSRuslan Ermilov.Xc 5371abae7eeSRuslan Ermilov.It Xo 5381abae7eeSRuslan Ermilov.Fn xdr_string "XDR *xdrs" "char **sp" "u_int maxsize" 5391abae7eeSRuslan Ermilov.Xc 5401abae7eeSRuslan Ermilov.Pp 541eae561b3SGarrett WollmanA filter primitive that translates between C strings and 542eae561b3SGarrett Wollmantheir 543eae561b3SGarrett Wollmancorresponding external representations. 544eae561b3SGarrett WollmanStrings cannot be longer than 5451abae7eeSRuslan Ermilov.Fa maxsize . 546eae561b3SGarrett WollmanNote: 5471abae7eeSRuslan Ermilov.Fa sp 548eae561b3SGarrett Wollmanis the address of the string's pointer. 549eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 5501abae7eeSRuslan Ermilov.Pp 5511abae7eeSRuslan Ermilov.It Xo 5521abae7eeSRuslan Ermilov.Ft int 5531abae7eeSRuslan Ermilov.Xc 5541abae7eeSRuslan Ermilov.It Xo 5551abae7eeSRuslan Ermilov.Fn xdr_u_char "XDR *xdrs" "unsigned char *ucp" 5561abae7eeSRuslan Ermilov.Xc 5571abae7eeSRuslan Ermilov.Pp 558eae561b3SGarrett WollmanA filter primitive that translates between 5591abae7eeSRuslan Ermilov.Vt unsigned 560eae561b3SGarrett WollmanC characters and their external representations. 561eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 5621abae7eeSRuslan Ermilov.Pp 5631abae7eeSRuslan Ermilov.It Xo 5641abae7eeSRuslan Ermilov.Ft int 5651abae7eeSRuslan Ermilov.Xc 5661abae7eeSRuslan Ermilov.It Xo 5671abae7eeSRuslan Ermilov.Fn xdr_u_int "XDR *xdrs" "unsigned *up" 5681abae7eeSRuslan Ermilov.Xc 5691abae7eeSRuslan Ermilov.Pp 570eae561b3SGarrett WollmanA filter primitive that translates between C 5711abae7eeSRuslan Ermilov.Vt unsigned 572eae561b3SGarrett Wollmanintegers and their external representations. 573eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 5741abae7eeSRuslan Ermilov.Pp 5751abae7eeSRuslan Ermilov.It Xo 5761abae7eeSRuslan Ermilov.Ft int 5771abae7eeSRuslan Ermilov.Xc 5781abae7eeSRuslan Ermilov.It Xo 5791abae7eeSRuslan Ermilov.Fn xdr_u_long "XDR *xdrs" "unsigned long *ulp" 5801abae7eeSRuslan Ermilov.Xc 5811abae7eeSRuslan Ermilov.Pp 582eae561b3SGarrett WollmanA filter primitive that translates between C 5831abae7eeSRuslan Ermilov.Vt "unsigned long" 584eae561b3SGarrett Wollmanintegers and their external representations. 585eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 5861abae7eeSRuslan Ermilov.Pp 5871abae7eeSRuslan Ermilov.It Xo 5881abae7eeSRuslan Ermilov.Ft int 5891abae7eeSRuslan Ermilov.Xc 5901abae7eeSRuslan Ermilov.It Xo 5911abae7eeSRuslan Ermilov.Fn xdr_u_short "XDR *xdrs" "unsigned short *usp" 5921abae7eeSRuslan Ermilov.Xc 5931abae7eeSRuslan Ermilov.Pp 594eae561b3SGarrett WollmanA filter primitive that translates between C 5951abae7eeSRuslan Ermilov.Vt "unsigned short" 596eae561b3SGarrett Wollmanintegers and their external representations. 597eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 5981abae7eeSRuslan Ermilov.Pp 5991abae7eeSRuslan Ermilov.It Xo 6001abae7eeSRuslan Ermilov.Ft int 6011abae7eeSRuslan Ermilov.Xc 6021abae7eeSRuslan Ermilov.It Xo 6031abae7eeSRuslan Ermilov.Fo xdr_union 6041abae7eeSRuslan Ermilov.Fa "XDR *xdrs" 6051abae7eeSRuslan Ermilov.Fa "int *dscmp" 6061abae7eeSRuslan Ermilov.Fa "char *unp" 6071abae7eeSRuslan Ermilov.Fa "struct xdr_discrim *choices" 6081abae7eeSRuslan Ermilov.Fa "bool_t \*(lp*defaultarm\*(rp\*(lp\*(rp" 6091abae7eeSRuslan Ermilov.Fc 6101abae7eeSRuslan Ermilov.Xc 6111abae7eeSRuslan Ermilov.Pp 612eae561b3SGarrett WollmanA filter primitive that translates between a discriminated C 6131abae7eeSRuslan Ermilov.Vt union 614c6ff3a1bSSheldon Hearnand its corresponding external representation. 615c6ff3a1bSSheldon HearnIt first 616eae561b3SGarrett Wollmantranslates the discriminant of the union located at 6171abae7eeSRuslan Ermilov.Fa dscmp . 618eae561b3SGarrett WollmanThis discriminant is always an 6191abae7eeSRuslan Ermilov.Vt enum_t . 620eae561b3SGarrett WollmanNext the union located at 6211abae7eeSRuslan Ermilov.Fa unp 6221abae7eeSRuslan Ermilovis translated. 6231abae7eeSRuslan ErmilovThe parameter 6241abae7eeSRuslan Ermilov.Fa choices 625eae561b3SGarrett Wollmanis a pointer to an array of 6261abae7eeSRuslan Ermilov.Vt xdr_discrim 627c6ff3a1bSSheldon Hearnstructures. 628c6ff3a1bSSheldon HearnEach structure contains an ordered pair of 6291abae7eeSRuslan Ermilov.Bq Va value , proc . 630eae561b3SGarrett WollmanIf the union's discriminant is equal to the associated 6311abae7eeSRuslan Ermilov.Va value , 632eae561b3SGarrett Wollmanthen the 6331abae7eeSRuslan Ermilov.Fn proc 6341abae7eeSRuslan Ermilovis called to translate the union. 6351abae7eeSRuslan ErmilovThe end of the 6361abae7eeSRuslan Ermilov.Vt xdr_discrim 637eae561b3SGarrett Wollmanstructure array is denoted by a routine of value 6381abae7eeSRuslan Ermilov.Dv NULL . 639eae561b3SGarrett WollmanIf the discriminant is not found in the 6401abae7eeSRuslan Ermilov.Fa choices 641eae561b3SGarrett Wollmanarray, then the 6421abae7eeSRuslan Ermilov.Fn defaultarm 643eae561b3SGarrett Wollmanprocedure is called (if it is not 6441abae7eeSRuslan Ermilov.Dv NULL ) . 645eae561b3SGarrett WollmanReturns one if it succeeds, zero otherwise. 6461abae7eeSRuslan Ermilov.Pp 6471abae7eeSRuslan Ermilov.It Xo 6481abae7eeSRuslan Ermilov.Ft int 6491abae7eeSRuslan Ermilov.Xc 6501abae7eeSRuslan Ermilov.It Xo 6511abae7eeSRuslan Ermilov.Fo xdr_vector 6521abae7eeSRuslan Ermilov.Fa "XDR *xdrs" 6531abae7eeSRuslan Ermilov.Fa "char *arrp" 6541abae7eeSRuslan Ermilov.Fa "u_int size" 6551abae7eeSRuslan Ermilov.Fa "u_int elsize" 6561abae7eeSRuslan Ermilov.Fa "xdrproc_t elproc" 6571abae7eeSRuslan Ermilov.Fc 6581abae7eeSRuslan Ermilov.Xc 6591abae7eeSRuslan Ermilov.Pp 660eae561b3SGarrett WollmanA filter primitive that translates between fixed-length 661eae561b3SGarrett Wollmanarrays 6621abae7eeSRuslan Ermilovand their corresponding external representations. 6631abae7eeSRuslan ErmilovThe 664eae561b3SGarrett Wollmanparameter 6651abae7eeSRuslan Ermilov.Fa arrp 666eae561b3SGarrett Wollmanis the address of the pointer to the array, while 6671abae7eeSRuslan Ermilov.Fa size 6681abae7eeSRuslan Ermilovis the element count of the array. 6691abae7eeSRuslan ErmilovThe parameter 6701abae7eeSRuslan Ermilov.Fa elsize 671eae561b3SGarrett Wollmanis the 6721abae7eeSRuslan Ermilov.Ic sizeof 673eae561b3SGarrett Wollmaneach of the array's elements, and 6741abae7eeSRuslan Ermilov.Fa elproc 675eae561b3SGarrett Wollmanis an 6761abae7eeSRuslan Ermilov.Tn XDR 677eae561b3SGarrett Wollmanfilter that translates between 678eae561b3SGarrett Wollmanthe array elements' C form, and their external 679eae561b3SGarrett Wollmanrepresentation. 680eae561b3SGarrett WollmanThis routine returns one if it succeeds, zero otherwise. 6811abae7eeSRuslan Ermilov.Pp 6821abae7eeSRuslan Ermilov.It Xo 6831abae7eeSRuslan Ermilov.Ft int 6841abae7eeSRuslan Ermilov.Xc 6851abae7eeSRuslan Ermilov.It Xo 6861abae7eeSRuslan Ermilov.Fn xdr_void void 6871abae7eeSRuslan Ermilov.Xc 6881abae7eeSRuslan Ermilov.Pp 689eae561b3SGarrett WollmanThis routine always returns one. 690eae561b3SGarrett WollmanIt may be passed to 6911abae7eeSRuslan Ermilov.Tn RPC 692eae561b3SGarrett Wollmanroutines that require a function parameter, 693eae561b3SGarrett Wollmanwhere nothing is to be done. 6941abae7eeSRuslan Ermilov.Pp 6951abae7eeSRuslan Ermilov.It Xo 6961abae7eeSRuslan Ermilov.Ft int 6971abae7eeSRuslan Ermilov.Xc 6981abae7eeSRuslan Ermilov.It Xo 6991abae7eeSRuslan Ermilov.Fn xdr_wrapstring "XDR *xdrs" "char **sp" 7001abae7eeSRuslan Ermilov.Xc 7011abae7eeSRuslan Ermilov.Pp 702eae561b3SGarrett WollmanA primitive that calls 7031abae7eeSRuslan Ermilov.Fn xdr_string xdrs sp MAXUN.UNSIGNED ; 704eae561b3SGarrett Wollmanwhere 7051abae7eeSRuslan Ermilov.Dv MAXUN.UNSIGNED 706eae561b3SGarrett Wollmanis the maximum value of an unsigned integer. 7071abae7eeSRuslan Ermilov.Fn xdr_wrapstring 708eae561b3SGarrett Wollmanis handy because the 7091abae7eeSRuslan Ermilov.Tn RPC 710eae561b3SGarrett Wollmanpackage passes a maximum of two 7111abae7eeSRuslan Ermilov.Tn XDR 712eae561b3SGarrett Wollmanroutines as parameters, and 7131abae7eeSRuslan Ermilov.Fn xdr_string , 714eae561b3SGarrett Wollmanone of the most frequently used primitives, requires three. 715eae561b3SGarrett WollmanReturns one if it succeeds, zero otherwise. 7161abae7eeSRuslan Ermilov.El 7171abae7eeSRuslan Ermilov.Sh SEE ALSO 7181abae7eeSRuslan Ermilov.Xr rpc 3 7191abae7eeSRuslan Ermilov.Rs 7201abae7eeSRuslan Ermilov.%T "eXternal Data Representation Standard: Protocol Specification" 7211abae7eeSRuslan Ermilov.Re 7221abae7eeSRuslan Ermilov.Rs 7231abae7eeSRuslan Ermilov.%T "eXternal Data Representation: Sun Technical Notes" 7241abae7eeSRuslan Ermilov.Re 7251abae7eeSRuslan Ermilov.Rs 7261abae7eeSRuslan Ermilov.%T "XDR: External Data Representation Standard" 7271abae7eeSRuslan Ermilov.%O RFC1014 7281abae7eeSRuslan Ermilov.%Q "Sun Microsystems, Inc., USC\-ISI" 7291abae7eeSRuslan Ermilov.Re 730