Windows PowerShell command on Get-command xdr_union
MyWebUniversity

Manual Pages for UNIX Operating System command usage for man xdr_union

Networking Services Library Functions xdr_complex(3NSL)

NAME

xdr_complex, xdr_array, xdr_bytes, xdr_opaque, xdr_pointer,

xdr_reference, xdr_string, xdr_union, xdr_vector,

xdr_wrapstring - library routines for external data

representation

DESCRIPTION

XDR library routines allow C programmers to describe complex

data structures in a machine-independent fashion. Protocols

such as remote procedure calls (RPC) use these routines to describe the format of the data. These routines are the XDR library routines for complex data structures. They require

the creation of XDR streams. See xdr_create(3NSL).

Routines See rpc(3NSL) for the definition of the XDR data structure. Note that any buffers passed to the XDR routines must be properly aligned. It is suggested either that malloc() be used to allocate these buffers, or that the programmer insure that the buffer address is divisible evenly by four.

#include

bool_t xdr_array(XDR *xdrs, caddr_t *arrp, uint_t *sizep,

const uint_t maxsize, const uint_t elsize, const xdrproc_t

elproc);

xdr_array() 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 size of each of the array's elements, and elproc is an XDR routine that translates between the array elements' C form and their external representation. If *aarp is NULL when decoding,

xdr_array() allocates memory and *aarp points to it.

This routine returns TRUE if it succeeds, FALSE other-

wise.

bool_t xdr_bytes(XDR *xdrs, char **sp, uint_t *sizep, const

uint_t maxsize);

xdr_bytes() 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. If *sp is NULL when decoding, xdr_bytes()

allocates memory and *sp points to it. This routine returns TRUE if it succeeds, FALSE otherwise.

SunOS 5.11 Last change: 30 Dec 1996 1

Networking Services Library Functions xdr_complex(3NSL)

bool_t xdr_opaque(XDR *xdrs, caddr_t cp, const uint_t cnt);

xdr_opaque() 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 TRUE if it succeeds, FALSE otherwise.

bool_t xdr_pointer(XDR *xdrs, char **objpp, uint_t objsize,

const xdrproc_t xdrobj);

Like xdr_reference() except that it serializes null

pointers, whereas xdr_reference() does not. Thus,

xdr_pointer() can represent recursive data structures,

such as binary trees or linked lists. If *objpp is NULL

when decoding, xdr_pointer() allocates memory and *objpp

points to it.

bool_t xdr_reference(XDR *xdrs, caddr_t *pp, uint_t size,

const xdrproc_t proc);

xdr_reference() provides pointer chasing within struc-

tures. The parameter pp is the address of the pointer; size is the sizeof the structure that *pp points to; and proc is an XDR procedure that translates the structure between its C form and its external representation. If

*pp is NULL when decoding, xdr_reference() allocates

memory and *pp points to it. This routine returns 1 if it succeeds, 0 otherwise. Warning: this routine does not understand null pointers.

Use xdr_pointer() instead.

bool_t xdr_string(XDR *xdrs, char **sp, const uint_t max-

size);

xdr_string() 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. If *sp is NULL when decoding,

xdr_string() allocates memory and *sp points to it. This

routine returns TRUE if it succeeds, FALSE otherwise.

Note: xdr_string() can be used to send an empty string

(""), but not a null string.

bool_t xdr_union(XDR *xdrs, enum_t *dscmp, char *unp, const

struct xdr_discrim *choices, const xdrproc_t (*defaultarm));

SunOS 5.11 Last change: 30 Dec 1996 2

Networking Services Library Functions xdr_complex(3NSL)

xdr_union() translates between a discriminated C union

and its corresponding external representation. It first translates the discriminant of the union located at

dscmp. This discriminant is always an enum_t. Next the

union located at unp is translated. The parameter

choices is a pointer to an array of xdr_discrim struc-

tures. 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 xdr_discrim struc-

ture 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). It returns TRUE if it succeeds, FALSE otherwise.

bool_t xdr_vector(XDR *xdrs, char *arrp, const uint_t size,

const uint_t elsize, const xdrproc_t elproc);

xdr_vector() translates between fixed-length arrays and

their corresponding external representations. The param-

eter arrp is the address of the pointer to the array,

while size is the element count of the array. The param-

eter elsize is the sizeof each of the array's elements, and elproc is an XDR routine that translates between the

array elements' C form and their external representa-

tion. This routine returns TRUE if it succeeds, FALSE otherwise.

bool_t xdr_wrapstring(XDR *xdrs, char **sp);

A routine that calls xdr_string(xdrs, sp, maxuint);

where maxuint is the maximum value of an unsigned integer.

Many routines, such as xdr_array(), xdr_pointer(), and

xdr_vector() take a function pointer of type

xdrproc_t(), which takes two arguments. xdr_string(),

one of the most frequently used routines, requires three

arguments, while xdr_wrapstring() only requires two. For

these routines, xdr_wrapstring() is desirable. This rou-

tine returns TRUE if it succeeds, FALSE otherwise.

ATTRIBUTES

See attributes(5) for descriptions of the following attri-

butes:

SunOS 5.11 Last change: 30 Dec 1996 3

Networking Services Library Functions xdr_complex(3NSL)

____________________________________________________________

| ATTRIBUTE TYPE | ATTRIBUTE VALUE |

|_____________________________|_____________________________|

| MT-Level | Safe |

|_____________________________|_____________________________|

SEE ALSO

malloc(3C), rpc(3NSL), xdr_admin(3NSL), xdr_create(3NSL),

xdr_simple(3NSL), attributes(5)

SunOS 5.11 Last change: 30 Dec 1996 4




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