Next: XDR Encoding and Decoding, Previous: XDR Type Representations, Up: Implementation of XDR
All the basic data types defined by XDR are defined in the (rpc
xdr types) module.
XDR's 32-bit and 64-bit signed and unsigned integer types. This type decodes to/encodes from Scheme exact numbers.
32-bit and 64-bit IEEE-754 floating point numbers. This type decodes to/encodes from Scheme inexact numbers. Note that XDR also defines a “quadruple-precision floating point type” (i.e., 128-bit long) that is currently not available (FIXME).
The “void” type that yields zero bits. Any Scheme value is suitable as an input when encoding with this type. When decoding this type, the
%voidvalue (which may be compared viaeq?) is returned.
XDR provides support for “enumerations”, similar to that found in C. An enumeration type maps symbols to integers and are actually encoded as 32-bit integers.
Return an enumeration type that obeys the symbol-integer mapping provided in enum-alist which should be a list of symbol-integer pairs. The returned type decodes to/encodes from Scheme symbols, as provided in enum-alist. Upon decoding/encoding of an enumeration, an
&xdr-enumeration-erroris raised if an incorrect value (i.e., one not listed in enum-alist) is found.
XDR's boolean type which is an enumeration. It encodes to/decodes from Scheme symbols
TRUEandFALSE.
Several fixed-size and variable-size are predefined in the standard.
Return a fixed-length “opaque” array of size octets. An opaque array is simply a sequence of octets.
The returned XDR type object is actually an
<xdr-struct-type>object. Thus, it encodes from/decodes to Scheme lists of exact integers. Conversion to a Scheme string, if needed, is left to the user.
Return a variable-length opaque array. As for
make-xdr-vector-type(see XDR Type Representations), limit can be either a number specifying the maximum number of elements that can be held by the created type, or#fin which case the variable-length array can hold up to 2^32 - 1 octets.The returned XDR type object is actually an
<xdr-vector-type>object. Thus, it encodes from/decodes to Scheme vectors of exact integers.