XDR routines and library functions
Data exchanged between systems engaged in ONC RPC must always flow in a standard format specified by XDR, because different machine architectures have different representations of the same information. Both client and server use XDR routines to convert the input and output parameters between XDR format and the local data format. You either write these yourself, or specify an XDR library function.

Notice that in Figure 1, the same XDR routine, inproc, is used to encode and decode the data as it flows from client to server, and similarly for outproc as it flows back to the client. The source for inproc is the same in the client and server, but XDR library functions in the routines are compiled to encode or decode as appropriate. Such routines are termed bidirectional, and they help to ensure that the encoding and decoding is done symmetrically in the two routines.
XDR library functions
XDR library functions are a set of C® functions supplied with ONC RPC, which application programmers can use when writing XDR routines.
- For parameters that are simple single-field C data types
- Use an XDR library function for inproc and outproc.
- For parameters that are C data type vectors, arrays, strings, and so on
- Use an XDR library function for inproc and outproc.
- For more complex structures
- Write an XDR routine, using XDR library functions as required. Alternatively, use the RPCGEN compiler, described in RPCGEN compiler, to create an XDR routine from an XDR data description.