Connected: An Internet Encyclopedia
1.4 External Data Representation

Up: Connected: An Internet Encyclopedia
Up: Requests For Comments
Up: RFC 1813
Up: 1. Introduction
Prev: 1.3 Remote Procedure Call
Next: 1.5 Authentication and Permission Checking

1.4 External Data Representation

1.4 External Data Representation

The eXternal Data Representation (XDR) specification provides a standard way of representing a set of data types on a network. This solves the problem of different byte orders, structure alignment, and data type representation on different, communicating machines.

In this document, the RPC Data Description Language is used to specify the XDR format parameters and results to each of the RPC service procedures that an NFS server provides. The RPC Data Description Language is similar to declarations in the C programming language. A few new constructs have been added. The notation:

      string  name[SIZE];
      string  data<DSIZE>;

defines name, which is a fixed size block of SIZE bytes, and data, which is a variable sized block of up to DSIZE bytes. This notation indicates fixed-length arrays and arrays with a variable number of elements up to a fixed maximum. A variable-length definition with no size specified means there is no maximum size for the field.

The discriminated union definition:

      union example switch (enum status) {
           case OK:
              struct {
                 filename      file1;
                 filename      file2;
                 integer       count;
              }
           case ERROR:
              struct {
                 errstat       error;
                 integer       errno;
              }
           default:
              void;
      }

defines a structure where the first thing over the network is an enumeration type called status. If the value of status is OK, the next thing on the network will be the structure containing file1, file2, and count. Else, if the value of status is ERROR, the next thing on the network will be a structure containing error and errno. If the value of status is neither OK nor ERROR, then there is no more data in the structure.

The XDR type, hyper, is an 8 byte (64 bit) quantity. It is used in the same way as the integer type. For example:

      hyper          foo;
      unsigned hyper bar;

foo is an 8 byte signed value, while bar is an 8 byte unsigned value. Although RPC/XDR compilers exist to generate client and server stubs from RPC Data Description Language input, NFS implementations do not require their use. Any software that provides equivalent encoding and decoding to the canonical network order of data defined by XDR can be used to interoperate with other NFS implementations.

XDR is described in [RFC1014].


Next: 1.5 Authentication and Permission Checking

Connected: An Internet Encyclopedia
1.4 External Data Representation