Open System Services NFS Overview
External Data Representation (XDR)
The external data representation (XDR), defined by RFC 1014, is a standard for the description
and encoding of data. It provides a common way to represent a set of data types over a network.
The NFS Protocol Specification is written using the XDR data description language.
The representation of all XDR data types requires a multiple of four bytes (or 32 bits) of data. The
bytes are numbered 0 through n-1. The bytes are read or written to a byte stream so that byte m
always precedes byte m+1. If the n bytes needed to contain the data are not a multiple of four,
the n bytes are followed by 1 to 3 padding bytes to make the total byte count a multiple of four.
XDR Data Types
XDR supports the following data types:
Integer (32 bit)
An XDR signed integer is a 32-bit number that encodes an integer in the range -2147483648
through 2147483647. The integer is represented in two’s complement notation. The most and
least significant bytes are 0 and 3, respectively. The data description of integers is integer.
Unsigned integer (32 bit)
An XDR unsigned integer is a 32-bit number that encodes a nonnegative integer in the range
0 through 4294967295. It is represented by an unsigned binary number whose most and
least significant bytes are 0 and 3, respectively. The data description of unsigned integers is
unsigned.
Enumeration
Enumerations have the same representation as integers. Enumerations are useful for describing
subsets of the integers.
Boolean
Booleans are important enough and occur frequently enough to warrant their own explicit type
in the standard.
Hyper integer and unsigned hyper integer (64 bit)
The standard also defines 64-bit (8-byte) numbers called hyper integers and unsigned hyper
integers. Their representations are the obvious extensions of the integer and unsigned integer
data types. The most and least significant bytes are 0 and 7, respectively.
Floating point (32 bit)
The standard defines the encoding for the floating-point data type float (32 bits or 4 bytes).
The encoding used is the IEEE standard for normalized single-precision floating-point numbers.
See the IEEE floating-point standard for more information.
Double-precision floating point (64 bit)
The standard defines the encoding for the floating-point data type double (64 bits or 8 bytes).
The encoding used is the IEEE standard for normalized double-precision floating-point numbers.
See the IEEE floating-point standard for more information.
Fixed-length opaque data
At times, fixed-length uninterpreted data needs to be passed among systems. This data is called
fixed-length opaque.
Variable-length opaque data
At times, variable-length uninterpreted data needs to be passed among systems. This data is
called variable-length opaque.
String
The standard defines a string of n bytes (numbered 0 through n-1) to be the number n encoded
as unsigned, and followed by the n bytes of the string. If n is not a multiple of four, the n bytes
are followed by 1 to 3 padding bytes to make the total byte-count a multiple of four.
Fixed-length array
Fixed-length arrays of elements numbered 0 through n-1 are encoded by individually encoding
the elements of the array in their natural order, 0 through n-1.
External Data Representation (XDR) 23