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:
- xdr_bool
- xdr_char
- xdr_u_char
- xdr_enum
- xdr_int
- xdr_u_int
- xdr_long
- xdr_u_long
- xdr_short
- xdr_u_short
- xdr_wrapstring
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:
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.