Passing Arbitrary Data Types

The RPC interface can handle arbitrary data structures, regardless of the different byte orders or structure layout conventions on different machines, by converting the structures to a network standard called XDR before sending them over the wire.

The process of converting from a particular machine representation to XDR format is called serializing, and the reverse process is called deserializing.

The input and output parameters of the callrpc and registerrpc routines can be a built-in or user-supplied procedure. For more information, see Showing How RPC Passes Arbitrary Data Types Example.

The XDR language has the following built-in subroutines:

Although the xdr_string subroutine exists, it passes three parameters to its XDR routine. The xdr_string subroutine cannot be used with the callrpc and registerrpc subroutines, which pass only two parameters. However, the xdr_string routine can be called with the xdr_wrapstring routine, which also has only two parameters.

If completion is successful, XDR subroutines return a nonzero value (that is, a True value in the C language). Otherwise, they return a value of zero (False).

In addition to the built-in primitives are the following prefabricated building blocks:

Note: An RPC client and server system that uses the TCP protocol cannot get or put more than 64 megabytes (MB) in one RPC call. The constant TCP_MAX_REQUEST_SIZE limits this.

In addition to this constant, there is also a user limit on the size, which is 44 bytes less than the limit. In addition, security protocols may take an additional 800 bytes off the limit.