hp.com home products and services support and drivers solutions how to buy
cd-rom home
End of Jump to page title
HP OpenVMS systems
documentation

Jump to content


HP TCP/IP Services for OpenVMS

HP TCP/IP Services for OpenVMS
ONC RPC Programming


Previous Contents Index


xdr_vector

Serializes and deserializes the elements of a fixed-length array (known as a vector).

Format

#include <tcpip$rpcxdr.h>

bool_t xdr_vector(XDR *xdrs, char **vecpp, u_int elnum, u_int elsize, xdrproc_t elproc);


Arguments

xdrs

A pointer to an XDR stream handle created by one of the XDR stream-handle creation routines.

vecpp

A pointer to a pointer to the array.

elnum

The number of elements in the array.

elsize

The size, in bytes, of each element.

elproc

The XDR routine to handle each element.

Description

A routine that calls elproc to prepare the elements of an array for XDR messages.

Return Values

TRUE Indicates success.
FALSE Indicates failure.

xdr_void

When there is no data to convert, this routine is passed to ONC RPC routines that require an XDR procedure parameter.

Format

#include <tcpip$rpcxdr.h>

bool_t xdr_void();


Description

This routine is used as a placeholder for a program that passes no data in a remote procedure call. Most client and server routines expect an XDR routine to be called, even when there is no data to pass.

Return Values

This routine always returns TRUE.

xdr_wrapstring

Serializes and deserializes NULL -terminated strings.

Format

#include <tcpip$rpcxdr.h>

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


Arguments

xdrs

A pointer to an XDR stream handle created by one of the XDR stream-handle creation routines.

spp

A pointer to a pointer to a string.

Description

A primitive that calls xdr_string(xdrs, sp, MAXUNSIGNED) , where MAXUNSIGNED is the maximum value of an unsigned integer. This routine is useful because the ONC RPC client and server routines pass the XDR stream handle and a single pointer as parameters to any referenced XDR routines. The xdr_string routine, one of the most frequently used ONC RPC primitives, requires three parameters.

While decoding, if *sp is NULL , the necessary storage is allocated to hold the NULL-terminated string and *sp is set to point to it.


Return Values

TRUE Indicates success.
FALSE Indicates failure.

xdrmem_create

Initializes an XDR stream descriptor for a memory buffer.

Format

#include <tcpip$rpcxdr.h>

void xdrmem_create(XDR *xdrs, char *addr, u_int size, enum xdr_op op);


Arguments

xdrs

A pointer to the XDR stream handle being created. The routine xdrmem_create fills in xdrs with encoding and decoding information.

addr

A pointer to the memory buffer.

size

The length of the memory buffer.

op

An XDR operation, one of: XDR_ENCODE , XDR_DECODE , and XDR_FREE .

Description

The stream handle xdrs is initialized with the operation op , the buffer addr and size , and the operations context for an xdrmem stream.

Return Values

None  

xdrrec_create

Initializes a record-oriented XDR stream descriptor.

Format

#include <tcpip$rpcxdr.h>

void xdrrec_create(XDR *xdrs, u_int sendsize, u_int recvsize, char *tcp_handle, int (*readit)(), int (*writeit)());


Arguments

xdrs

A pointer to the XDR stream handle being created. The routine xdrrec_create fills in xdrs with encoding and decoding information.

sendsize

The send buffer size.

recvsize

The receive buffer size.

tcp_handle

A pointer to an opaque handle that is passed as the first parameter to the procedures (*readit)() and (*writeit)().

(*readit)()

Read procedure that takes the opaque handle tcp_handle . The routine must use the following format:


int readit(char *tcp_handle, char *buffer, u_long len) 
where tcp_handle is the client or server handle, buffer is the buffer to fill, and len is the number of bytes to read. The readit routine should return either the number of bytes read or the value -1 if an error occurs.

(*writeit)()

Write procedure that takes the opaque handle tcp_handle . The routine must use the following format:


int writeit(char *tcp_handle, char *buffer, u_long len) 
where tcp_handle is the client or server handle, buffer is the buffer to write, and len is the number of bytes to write. The readit routine should return either the number of bytes written or the value -1 if an error occurs.


Description

The stream descriptor for xdrs initializes the maximum allowable size for a request recvsize and reply sendsize , the addresses of the routine to perform the read (readit) and write (writeit) , and the TCP handle used for network I/O.

Return Values

None  

xdrrec_endofrecord

Generates an end-of-record for an XDR record.

Format

#include <tcpip$rpcxdr.h>

bool_t xdrrec_endofrecord (XDR *xdrs, bool_t sendnow);


Arguments

xdrs

A pointer to an XDR stream handle created by one of the XDR stream-handle creation routines.

sendnow

Indicates whether the record should be sent. If sendnow is TRUE, xdrrec_endofrecord sends the record by calling the writeit routine specified in the call to xdrrec_create . If sendnow is FALSE, xdrrec_endofrecord marks the end of the record and calls writeit when the buffer is full.

Description

This routine lets an application support batch calls and pipelined procedure calls.

Return Values

TRUE Indicates success.
FALSE Indicates failure.

xdrrec_eof

Moves the buffer pointer to the end of the current record and returns an indication if any more data exists in the buffer.

Format

#include <tcpip$rpcxdr.h>

bool_t xdrrec_eof (XDR *xdrs);


Arguments

xdrs

A pointer to an XDR stream handle created by one of the XDR stream-handle creation routines.

Description

Returns TRUE if there is no more input in the buffer after consuming the rest of the current record.

Return Values

TRUE Indicates no more input in the buffer.
FALSE Indicates more input in the buffer.

xdrrec_skiprecord

Guarantees proper record alignment during deserialization from an incoming stream.

Format

#include <tcpip$rpcxdr.h>

bool_t xdrrec_skiprecord (XDR *xdrs);


Arguments

xdrs

A pointer to an XDR stream handle created by one of the XDR stream-handle creation routines.

Description

This routine ensures that the stream is properly aligned in preparation for a subsequent read. It is recommended that, when a record stream is being used, this routine be called prior to any operations that would read from the stream.

This routine is similar to the xdrrec_eof routine, except that this routine does not verify whether there is more data in the buffer.


Return Values

TRUE Indicates success.
FALSE Indicates failure.

xdrstdio_create

Initializes an stdio XDR stream.

Format

#include <tcpip$rpcxdr.h>

void xdrstdio_create (XDR *xdrs, FILE *file, enum xdr_op op);


Arguments

xdrs

A pointer to the XDR stream handle being created. The routine xdrstdio_create fills in xdrs with encoding and decoding information..

file

A pointer to the FILE structure that is to be associated with the stream.

op

An XDR operation, one of: XDR_ENCODE , XDR_DECODE , and XDR_FREE .

Description

Initializes a stdio stream for the specified file.

Return Values

None  


Index Contents