# Digital TCP/IP Services for OpenVMS
ONC RPC Programming

Previous | Contents

While decoding, if *spp is NULL, this routine allocates the necessary storage to hold the NULL-terminated string and sets *spp to point to the allocated storage.

This routine is the same as the xdr_wrapstring routine, except that this routine allows you to specify maxsize.

## Return Values

> TRUE | Indicates success.
> FALSE | Indicates failure.

# xdr_u_char

> Serializes and deserializes unsigned characters.

## Format

> ### #include <ucx$rpcxdr.h>

> ### bool_t xdr_u_char(XDR *xdrs, char *ucp);

## ARGUMENTS

> ### xdrs

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

> ### ucp

> A pointer to a character.

## DESCRIPTION

> A filter primitive that translates between internal representation of unsigned characters and their XDR representations.

## Return Values

> TRUE | Indicates success.
> FALSE | Indicates failure.

# xdr_u_hyper

> Serializes and deserializes unsigned VAX quadwords (known in XDR as hyper-integers).

## Format

> ### #include <ucx$rpcxdr.h>

> ### bool_t xdr_u_hyper(XDR *xdrs, unsigned quad *uhp);

## ARGUMENTS

> ### xdrs

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

> ### uhp

> A pointer to the unsigned hyper-integer.

## DESCRIPTION

> A filter primitive that translates between unsigned hyper-integers and their external representations.

## Return Values

> TRUE | Indicates success.
> FALSE | Indicates failure.

# xdr_u_int

> Serializes and deserializes unsigned integers.

## Format

> ### #include <ucx$rpcxdr.h>

> ### bool_t xdr_u_int(XDR *xdrs, unsigned *uip);

## ARGUMENTS

> ### xdrs

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

> ### uip

> A pointer to the unsigned integer.

## DESCRIPTION

> A filter primitive that translates between unsigned integers and their external representations.

## Return Values

> TRUE | Indicates success.
> FALSE | Indicates failure.

# xdr_u_long

> Serializes and deserializes unsigned long integers.

## Format

> ### #include <ucx$rpcxdr.h>

> ### bool_t xdr_u_long(XDR *xdrs, unsigned long *ulp);

## ARGUMENTS

> ### xdrs

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

> ### ulp

> A pointer to the unsigned long integer.

## DESCRIPTION

> A filter primitive that translates between unsigned long integers and their external representations.

## Return Values

> TRUE | Indicates success.
> FALSE | Indicates failure.

# xdr_u_short

> Serializes and deserializes unsigned short integers.

## Format

> ### #include <ucx$rpcxdr.h>

> ### bool_t xdr_u_short(XDR *xdrs, unsigned short *usp);

## ARGUMENTS

> ### xdrs

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

> ### usp

> A pointer to the unsigned short integer.

## DESCRIPTION

> A filter primitive that translates between unsigned short integers and their external representations.

## Return Values

> TRUE | Indicates success.
> FALSE | Indicates failure.

# xdr_union

> Serializes and deserializes discriminant unions.

## Format

> ### #include <ucx$rpcxdr.h>

> ### bool_t xdr_union(XDR *xdrs, enum *dscmp, char *unp, struct xdr_discrim *choices, xdrproc_t default);

## ARGUMENTS

> ### xdrs

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

> ### dscmp

> A pointer to the union's discriminant.

> ### unp

> A pointer to the union's data.

> ### choices

> A pointer to an array of xdr_discrim structures. Each structure contains an ordered pair of [value,proc]. The final structure in the array is denoted by a pointer with the value NULL.

> ### default

> The address of the default XDR routine to call if the dscmp argument is not found in the choices array.

## DESCRIPTION

> A filter primitive that translates between a discriminated union and its corresponding external representation. The xdr_union routine first translates the discriminant of the union located at dscmp. This discriminant is always of type enum_t.

> Next, the routine translates the union data located at unp. To translate the union data the xdr_union routine first searches the structure pointed to by the choices argument for the union discriminant passed in the dscmp argument. If a match is found, the xdr_union routine calls proc to translate the union data.

> The end of the xdr_discrim structure array must contain an entry with the value NULL for proc. If the xdr_union routine reaches this entry before finding a match, the routine calls the default procedure (if it is not NULL).

## Return Values

> TRUE | Indicates success.
> FALSE | Indicates failure.

# xdr_vector

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

## Format

> ### #include <ucx$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 <ucx$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 <ucx$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 <ucx$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 <ucx$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 <ucx$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 <ucx$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 <ucx$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 is 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 if there is more data in the buffer.

## Return Values

> TRUE | Indicates success.
> FALSE | Indicates failure.

# xdrstdio_create

> Initializes a stdio XDR stream.

## Format

> ### #include <ucx$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 |

# Appendix A
Acronyms

Table A-1 shows TCP/IP acronyms and other acronyms related to open networking.

Table A-1 Acronyms
Acronym | Meaning
--- | ---
ACL | access control list
ACP | ancillary control process
API | application programming interface
ARP | Address Resolution Protocol
AST | asynchronous system trap
BIND | Berkeley Internet Name Domain
BOOTP | Bootstrap Protocol
BSD | Berkeley Standard Distribution
CFS | container file system
CRA | Cambridge Research Associates
CSLIP | Compressed Serial Line Internet Protocol
DARPA | Defense Advanced Research Projects Agency
DA | domain administrator
DCE | data circuit-terminating equipment
DDN | Defense Data Network
DMCS | Digital Multinational Character Set
DNIC | data network identification code
DNS | Domain Name Service
DST | Daylight Savings Time
EBCDIC | Extended Binary Coded Decimal Interchange Code
EOF | end of file
EOL | end of line
FDDI | Fiber Distributed Data Interface
FID | file identification
FQDN | Fully Qualified Domain Name
FTN | FORTRAN carriage control
FTP | File Transfer Protocol
GID | group identification
GMT | Greenwich Mean Time
ICMP | Internet Control Message Protocol
IDS | IBM 3270 Information Display System
IP | Internet Protocol
IRP | I/O request packets
ISDN | Integrated Services Digital Networks
IVP | Installation Verification Procedure
LAN | local area network
LFDP | long-format data packet
LMF | License Management Facility
LNA | local network address
LPD | Line Printer Daemon Protocol
LPR | Line Printer Protocol
MBUF | memory buffer
MFD | Master File Directory
MIB | Management Information Base
MTU | message transfer unit
NFS | Network File System
NRCS | National Replacement Character Set
NS | name server
NTP | Network Time Protocol
ODS | On-Disk Structure
ONC RPC | open network computing remote procedure calls
OOB | Out of Band
PAK | Product Authorization Key
PDU | protocol data unit
PID | process identification
PPP | Point-to-Point Protocol
PRN | print file format control
PSDN | Packet Switching Data Network
PWIP | PATHWORKS Internet Protocol
RARP | Reverse Address Resolution Protocol
REXEC | Remote Executive
RFC | Request for Comments
RIP | Routing Information Protocol
RLOGIN | Remote Login
RLP | Remote Line Printer
RCP | Remote Copy
RMS | Record Management Services
RPC | remote procedure calls
RRQ | read request
RR | resource record
RSH | Remote Shell
SDC | Socket Device Channel
SLIP | Serial Line Internet Protocol
SMTP | Simple Mail Transfer Protocol
SNMP | Simple Network Management Protocol
SOA | Start of Authority
SPR | Software Performance Report
SRI | Stanford Research Institute
STD | Standard Time Zone
TCP | Transmission Control Protocol
TFTP | Trivial File Transfer Protocol
TP | Time Protocol
UAF | User Authorization File
UCB | unit control blocks
UCP | UCX Management Control Program
UCX | Digital TCP/IP Services for OpenVMS
UDP | User Datagram Protocol
UIC | User Identification Code
UID | user identification
UTC | Universal Coordinated Time
UUCP | UNIX-to-UNIX Copy Program
VFC | variable with fixed-length control
WAN | wide area network
WKS | Well Known Services
XDR | external data representation
XID | exchange identification
YP | Yellow Pages

Index | Contents