Manual Pages for UNIX Darwin command on man xdr
MyWebUniversity

Manual Pages for UNIX Darwin command on man xdr

XDR(3N) XDR(3N)

NAME

xdr - library routines for external data representation

SYNOPSIS AND DESCRIPTION

These routines allow C programmers to describe arbitrary data struc-

tures in a machine-independent fashion. Data for remote procedure

calls are transmitted using these routines. xxddrraarrrraayy((xxddrrss,, aarrrrpp,, ssiizzeepp,, mmaaxxssiizzee,, eellssiizzee,, eellpprroocc)) XXDDRR **xxddrrss;; cchhaarr ****aarrrrpp;; uuiinntt **ssiizzeepp,, mmaaxxssiizzee,, eellssiizzee;; xxddrrpprroocctt eellpprroocc;;

A filter primitive that translates between variable-length

arrays and their corresponding external representations. The parameter arrp is the address of the pointer to the array, while sizep is the address of the element count of the array; this element count cannot exceed maxsize. The parameter elsize is the sizeof each of the array's elements, and elproc is an XDR filter that translates between the array elements' C form, and their external representation. This routine returns one if it succeeds, zero otherwise. xxddrrbbooooll((xxddrrss,, bbpp)) XXDDRR **xxddrrss;; bboooolltt **bbpp;; A filter primitive that translates between booleans (C integers) and their external representations. When encoding data, this filter produces values of either one or zero. This routine returns one if it succeeds, zero otherwise. xxddrrbbyytteess((xxddrrss,, sspp,, ssiizzeepp,, mmaaxxssiizzee)) XXDDRR **xxddrrss;; cchhaarr ****sspp;; uuiinntt **ssiizzeepp,, mmaaxxssiizzee;; A filter primitive that translates between counted byte strings and their external representations. The parameter sp is the address of the string pointer. The length of the string is located at address sizep; strings cannot be longer than maxsize. This routine returns one if it succeeds, zero otherwise. xxddrrcchhaarr((xxddrrss,, ccpp)) XXDDRR **xxddrrss;; cchhaarr **ccpp;; A filter primitive that translates between C characters and their external representations. This routine returns one if it succeeds, zero otherwise. Note: encoded characters are not packed, and occupy 4 bytes each. For arrays of characters, it is worthwhile to consider xxddrrbbyytteess(()), xxddrrooppaaqquuee(()) or xxddrrssttrriinngg(()). vvooiidd xxddrrddeessttrrooyy((xxddrrss)) XXDDRR **xxddrrss;; A macro that invokes the destroy routine associated with the XDR

stream, xdrs. Destruction usually involves freeing private data

structures associated with the stream. Using xdrs after invok-

ing xxddrrddeessttrrooyy(()) is undefined. xxddrrddoouubbllee((xxddrrss,, ddpp)) XXDDRR **xxddrrss;; ddoouubbllee **ddpp;; A filter primitive that translates between C ddoouubbllee precision numbers and their external representations. This routine returns one if it succeeds, zero otherwise. xxddrreennuumm((xxddrrss,, eepp)) XXDDRR **xxddrrss;; eennuummtt **eepp;; A filter primitive that translates between C eennuumms (actually integers) and their external representations. This routine returns one if it succeeds, zero otherwise. xxddrrffllooaatt((xxddrrss,, ffpp)) XXDDRR **xxddrrss;; ffllooaatt **ffpp;; A filter primitive that translates between C ffllooaatts and their

external representations. This routine returns one if it suc-

ceeds, zero otherwise. vvooiidd xxddrrffrreeee((pprroocc,, oobbjjpp)) xxddrrpprroocctt pprroocc;; cchhaarr **oobbjjpp;; Generic freeing routine. The first argument is the XDR routine for the object being freed. The second argument is a pointer to the object itself. Note: the pointer passed to this routine is not freed, but what it points to is freed (recursively). uuiinntt xxddrrggeettppooss((xxddrrss)) XXDDRR **xxddrrss;;

A macro that invokes the get-position routine associated with

the XDR stream, xdrs. The routine returns an unsigned integer,

which indicates the position of the XDR byte stream. A desir-

able feature of XDR streams is that simple arithmetic works with

this number, although the XDR stream instances need not guaran-

tee this. lloonngg ** xxddrriinnlliinnee((xxddrrss,, lleenn)) XXDDRR **xxddrrss;; iinntt lleenn;;

A macro that invokes the in-line routine associated with the XDR

stream, xdrs. The routine returns a pointer to a contiguous

piece of the stream's buffer; len is the byte length of the desired buffer. Note: pointer is cast to lloonngg **. Warning: xxddrriinnlliinnee(()) may return NULL (0) if it cannot allocate a contiguous piece of a buffer. Therefore the behavior may vary among stream instances; it exists for the sake of efficiency. xxddrriinntt((xxddrrss,, iipp)) XXDDRR **xxddrrss;; iinntt **iipp;; A filter primitive that translates between C integers and their

external representations. This routine returns one if it suc-

ceeds, zero otherwise. xxddrrlloonngg((xxddrrss,, llpp)) XXDDRR **xxddrrss;; lloonngg **llpp;; A filter primitive that translates between C lloonngg integers and their external representations. This routine returns one if it succeeds, zero otherwise. vvooiidd xxddrrmmeemmccrreeaattee((xxddrrss,, aaddddrr,, ssiizzee,, oopp)) XXDDRR **xxddrrss;; cchhaarr **aaddddrr;; uuiinntt ssiizzee;; eennuumm xxddrroopp oopp;; This routine initializes the XDR stream object pointed to by

xdrs. The stream's data is written to, or read from, a chunk of

memory at location addr whose length is no more than size bytes long. The op determines the direction of the XDR stream (either XXDDRREENNCCOODDEE, XXDDRRDDEECCOODDEE, or XXDDRRFFRREEEE). xxddrrooppaaqquuee((xxddrrss,, ccpp,, ccnntt)) XXDDRR **xxddrrss;; cchhaarr **ccpp;; uuiinntt ccnntt;; A filter primitive that translates between fixed size opaque data and its external representation. The parameter cp is the address of the opaque object, and cnt is its size in bytes. This routine returns one if it succeeds, zero otherwise. xxddrrppooiinntteerr((xxddrrss,, oobbjjpppp,, oobbjjssiizzee,, xxddrroobbjj)) XXDDRR **xxddrrss;; cchhaarr ****oobbjjpppp;; uuiinntt oobbjjssiizzee;; xxddrrpprroocctt xxddrroobbjj;; Like xxddrrrreeffeerreennccee(()) execpt that it serializes NULL pointers,

whereas xxddrrrreeffeerreennccee(()) does not. Thus, xxddrrppooiinntteerr(()) can rep-

resent recursive data structures, such as binary trees or linked lists. vvooiidd xxddrrrreeccccrreeaattee((xxddrrss,, sseennddssiizzee,, rreeccvvssiizzee,, hhaannddllee,, rreeaaddiitt,, wwrriitteeiitt)) XXDDRR **xxddrrss;; uuiinntt sseennddssiizzee,, rreeccvvssiizzee;; cchhaarr **hhaannddllee;; iinntt ((**rreeaaddiitt)) (()),, ((**wwrriitteeiitt)) (());; This routine initializes the XDR stream object pointed to by

xdrs. The stream's data is written to a buffer of size send-

size; a value of zero indicates the system should use a suitable

default. The stream's data is read from a buffer of size recv-

size; it too can be set to a suitable default by passing a zero value. When a stream's output buffer is full, writeit is

called. Similarly, when a stream's input buffer is empty, rea-

dit is called. The behavior of these two routines is similar to the system calls rreeaadd and wwrriittee, except that handle is passed to the former routines as the first parameter. Note: the XDR stream's op field must be set by the caller. Warning: this XDR stream implements an intermediate record stream. Therefore there are additional bytes in the stream to provide record boundary information. xxddrrrreecceennddooffrreeccoorrdd((xxddrrss,, sseennddnnooww)) XXDDRR **xxddrrss;; iinntt sseennddnnooww;;

This routine can be invoked only on streams created by xxddrr-

rreeccccrreeaattee(()). The data in the output buffer is marked as a com-

pleted record, and the output buffer is optionally written out

if sendnow is non-zero. This routine returns one if it succeeds,

zero otherwise. xxddrrrreecceeooff((xxddrrss)) XXDDRR **xxddrrss;; iinntt eemmppttyy;;

This routine can be invoked only on streams created by xxddrr-

rreeccccrreeaattee(()). After consuming the rest of the current record in the stream, this routine returns one if the stream has no more input, zero otherwise. xxddrrrreeccsskkiipprreeccoorrdd((xxddrrss)) XXDDRR **xxddrrss;;

This routine can be invoked only on streams created by xxddrr-

rreeccccrreeaattee(()). It tells the XDR implementation that the rest of

the current record in the stream's input buffer should be dis-

carded. This routine returns one if it succeeds, zero other-

wise. xxddrrrreeffeerreennccee((xxddrrss,, pppp,, ssiizzee,, pprroocc)) XXDDRR **xxddrrss;; cchhaarr ****pppp;; uuiinntt ssiizzee;; xxddrrpprroocctt pprroocc;; A primitive that provides pointer chasing within structures. The parameter pp is the address of the pointer; size is the

sizeof the structure that *pp points to; and proc is an XDR pro-

cedure that filters the structure between its C form and its

external representation. This routine returns one if it suc-

ceeds, zero otherwise. Warning: this routine does not understand NULL pointers. Use xxddrrppooiinntteerr(()) instead. xxddrrsseettppooss((xxddrrss,, ppooss)) XXDDRR **xxddrrss;; uuiinntt ppooss;; A macro that invokes the set position routine associated with

the XDR stream xdrs. The parameter pos is a position value

obtained from xxddrrggeettppooss(()). This routine returns one if the XDR stream could be repositioned, and zero otherwise. Warning: it is difficult to reposition some types of XDR streams, so this routine may fail with one type of stream and succeed with another. xxddrrsshhoorrtt((xxddrrss,, sspp)) XXDDRR **xxddrrss;; sshhoorrtt **sspp;; A filter primitive that translates between C sshhoorrtt integers and their external representations. This routine returns one if it succeeds, zero otherwise. vvooiidd xxddrrssttddiiooccrreeaattee((xxddrrss,, ffiillee,, oopp)) XXDDRR **xxddrrss;; FFIILLEE **ffiillee;; eennuumm xxddrroopp oopp;; This routine initializes the XDR stream object pointed to by

xdrs. The XDR stream data is written to, or read from, the

Standard II//OO stream file. The parameter op determines the direction of the XDR stream (either XXDDRREENNCCOODDEE, XXDDRRDDEECCOODDEE, or XXDDRRFFRREEEE). Warning: the destroy routine associated with such XDR streams calls fffflluusshh(()) on the file stream, but never ffcclloossee(()). xxddrrssttrriinngg((xxddrrss,, sspp,, mmaaxxssiizzee)) XXDDRR **xxddrrss;; cchhaarr ****sspp;; uuiinntt mmaaxxssiizzee;; A filter primitive that translates between C strings and their corresponding external representations. Strings cannot be longer than maxsize. Note: sp is the address of the string's

pointer. This routine returns one if it succeeds, zero other-

wise. xxddrruucchhaarr((xxddrrss,, uuccpp)) XXDDRR **xxddrrss;; uunnssiiggnneedd cchhaarr **uuccpp;; A filter primitive that translates between uunnssiiggnneedd C characters and their external representations. This routine returns one if it succeeds, zero otherwise. xxddrruuiinntt((xxddrrss,, uupp)) XXDDRR **xxddrrss;; uunnssiiggnneedd **uupp;; A filter primitive that translates between C uunnssiiggnneedd integers and their external representations. This routine returns one if it succeeds, zero otherwise. xxddrruulloonngg((xxddrrss,, uullpp)) XXDDRR **xxddrrss;; uunnssiiggnneedd lloonngg **uullpp;;

A filter primitive that translates between C uunnssiiggnneedd lloonngg inte-

gers and their external representations. This routine returns one if it succeeds, zero otherwise. xxddrruusshhoorrtt((xxddrrss,, uusspp)) XXDDRR **xxddrrss;; uunnssiiggnneedd sshhoorrtt **uusspp;; A filter primitive that translates between C uunnssiiggnneedd sshhoorrtt integers and their external representations. This routine returns one if it succeeds, zero otherwise. xxddrruunniioonn((xxddrrss,, ddssccmmpp,, uunnpp,, cchhooiicceess,, ddffaauulltt)) XXDDRR **xxddrrss;; iinntt **ddssccmmpp;; cchhaarr **uunnpp;; ssttrruucctt xxddrrddiissccrriimm **cchhooiicceess;; bboooolltt ((**ddeeffaauullttaarrmm)) (());; //** mmaayy eeqquuaall NNUULLLL **// A filter primitive that translates between a discriminated C uunniioonn and its corresponding external representation. It first translates the discriminant of the union located at dscmp. This discriminant is always an eennuummtt. Next the union located at unp is translated. The parameter choices is a pointer to an array of xxddrrddiissccrriimm(()) structures. Each structure contains an ordered pair of [value,proc]. If the union's discriminant is equal to the associated value, then the proc is called to translate the union. The end of the xxddrrddiissccrriimm(()) structure array is denoted by a routine of value NULL. If the discriminant is not found in the choices array, then the defaultarm procedure is called (if it is not NULL). Returns one if it succeeds, zero otherwise. xxddrrvveeccttoorr((xxddrrss,, aarrrrpp,, ssiizzee,, eellssiizzee,, eellpprroocc)) XXDDRR **xxddrrss;; cchhaarr **aarrrrpp;; uuiinntt ssiizzee,, eellssiizzee;; xxddrrpprroocctt eellpprroocc;;

A filter primitive that translates between fixed-length arrays

and their corresponding external representations. The parameter arrp is the address of the pointer to the array, while size is is the element count of the array. The parameter elsize is the sizeof each of the array's elements, and elproc is an XDR filter that translates between the array elements' C form, and their

external representation. This routine returns one if it suc-

ceeds, zero otherwise. xxddrrvvooiidd(())

This routine always returns one. It may be passed to RPC rou-

tines that require a function parameter, where nothing is to be done. xxddrrwwrraappssttrriinngg((xxddrrss,, sspp)) XXDDRR **xxddrrss;; cchhaarr ****sspp;; A primitive that calls xxddrrssttrriinngg((xxddrrss,, sspp,,MMAAXXUUNN..UUNNSSIIGGNNEEDD ));;

where MMAAXXUUNN..UUNNSSIIGGNNEEDD is the maximum value of an unsigned inte-

ger. xxddrrwwrraappssttrriinngg(()) is handy because the RPC package passes a maximum of two XDR routines as parameters, and xxddrrssttrriinngg(()), one of the most frequently used primitives, requires three. Returns one if it succeeds, zero otherwise.

SEE ALSO

rrppcc(3N) The following manuals: eXternal Data Representation Standard: Protocol Specification eXternal Data Representation: Sun Technical Notes XDR: External Data Representation Standard, RFC1014, Sun

Microsystems, Inc., USC-ISI.

16 February 1988 XDR(3N)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™