[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Communications Programming Concepts


XDR Library

The eXternal Data Representation (XDR) library includes subroutines that permit programmers not only to read and write C language constructs, but also to write XDR subroutines that define other data types.

The XDR library includes the following:

See the "Showing the Justification for Using XDR Example" .

XDR with RPC

The XDR subroutines and macros may be called explicitly or by a Remote Procedure Call (RPC) subroutine. When using XDR with RPC, clients do not create data streams. Instead, the RPC interface creates the streams. The RPC interface passes the information about a data stream as opaque data in the form of handles. This opaque data handle is referred to in subroutines as the xdrs parameter. Programmers who use C language programs with XDR subroutines must include the rpc/xdr.h file, which contains the necessary XDR interfaces.

XDR Operation Directions

The XDR subroutines are not dependent on direction. The operation direction represented by xdrs->xop can have an XDR_ENCODE, XDR_DECODE, or XDR_FREE value. These operation values are handled internally by the XDR subroutines, which means the same XDR subroutine can be called to serialize or deserialize data. To achieve this independence, XDR passes the address of the object instead of passing the object itself.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]