Next: , Previous: , Up: Implementation of XDR   [Contents][Index]


4.2.2 XDR Standard Data Types

All the basic data types defined by XDR are defined in the (rpc xdr types) module.

Scheme Variable: xdr-integer
Scheme Variable: xdr-unsigned-integer
Scheme Variable: xdr-hyper-integer
Scheme Variable: xdr-unsigned-hyper-integer

XDR’s 32-bit and 64-bit signed and unsigned integer types. This type decodes to/encodes from Scheme exact numbers.

Scheme Variable: xdr-float
Scheme Variable: xdr-double

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).

Scheme Variable: xdr-void

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 %void value (which may be compared via eq?) 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.

Scheme Procedure: make-xdr-enumeration name enum-alist

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-error is raised if an incorrect value (i.e., one not listed in enum-alist) is found.

Scheme Variable: xdr-boolean

XDR’s boolean type which is an enumeration. It encodes to/decodes from Scheme symbols TRUE and FALSE.

Several fixed-size and variable-size are predefined in the standard.

Scheme Procedure: make-xdr-fixed-length-opaque-array size

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.

Scheme Procedure: make-xdr-variable-length-opaque-array limit

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 #f in 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.

Scheme Procedure: make-xdr-string limit

This is a synonym of make-xdr-variable-length-opaque-array since XDR’s string type actually represents ASCII strings, i.e., sequences of octets.

Scheme Variable: xdr-variable-length-opaque-array
Scheme Variable: xdr-string

These convenience variables contain the unlimited variable-length opaque array.


Next: , Previous: , Up: Implementation of XDR   [Contents][Index]