draft-ietf-nfsv4-rfc1832bis-06.txt   rfc4506.txt 
Network Working Group M. Eisler
Internet-Draft Editor
Document: draft-ietf-nfsv4-rfc1832bis-06.txt Network Appliance, Inc.
May 2005
XDR: External Data Representation Standard Network Working Group M. Eisler, Ed.
Request for Comments: 4506 Network Appliance, Inc.
Status of this Memo STD: 67 May 2006
Obsoletes: 1832
Category: Standards Track
By submitting this Internet-Draft, I certify that any applicable XDR: External Data Representation Standard
patent or other IPR claims of which I am aware have been disclosed,
or will be disclosed, and any of which I become aware will be
disclosed, in accordance with RFC 3668.
Internet-Drafts are working documents of the Internet Engineering Status of This Memo
Task Force (IETF), its areas, and its working groups. Note that
other groups may also distribute working documents as
Internet-Drafts.
Internet-Drafts are draft documents valid for a maximum of six months This document specifies an Internet standards track protocol for the
and may be updated, replaced, or obsoleted by other documents at any Internet community, and requests discussion and suggestions for
time. It is inappropriate to use Internet-Drafts as reference improvements. Please refer to the current edition of the "Internet
material or to cite them other than a "work in progress." Official Protocol Standards" (STD 1) for the standardization state
and status of this protocol. Distribution of this memo is unlimited.
The list of current Internet-Drafts can be accessed at Copyright Notice
http://www.ietf.org/1id-abstracts.html
The list of Internet-Draft Shadow Directories can be accessed at Copyright (C) The Internet Society (2006).
http://www.ietf.org/shadow.html
ABSTRACT Abstract
This document describes the External Data Representation Standard This document describes the External Data Representation Standard
(XDR) protocol as it is currently deployed and accepted. (XDR) protocol as it is currently deployed and accepted. This
document obsoletes RFC 1832.
TABLE OF CONTENTS
1. Changes from RFC1832 . . . . . . . . . . . . . . . . . . . . . 2
2. INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . 2
3. BASIC BLOCK SIZE . . . . . . . . . . . . . . . . . . . . . . . 3
4. XDR DATA TYPES . . . . . . . . . . . . . . . . . . . . . . . . 3
4.1. Integer . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.2. Unsigned Integer . . . . . . . . . . . . . . . . . . . . . . 4
4.3. Enumeration . . . . . . . . . . . . . . . . . . . . . . . . 4
4.4. Boolean . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.5. Hyper Integer and Unsigned Hyper Integer . . . . . . . . . . 5
4.6. Floating-point . . . . . . . . . . . . . . . . . . . . . . . 5
4.7. Double-precision Floating-point . . . . . . . . . . . . . . 6
4.8. Quadruple-precision Floating-point . . . . . . . . . . . . . 7
4.9. Fixed-length Opaque Data . . . . . . . . . . . . . . . . . . 8
4.10. Variable-length Opaque Data . . . . . . . . . . . . . . . . 9
4.11. String . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.12. Fixed-length Array . . . . . . . . . . . . . . . . . . . 10
4.13. Variable-length Array . . . . . . . . . . . . . . . . . . 11
4.14. Structure . . . . . . . . . . . . . . . . . . . . . . . . 11
4.15. Discriminated Union . . . . . . . . . . . . . . . . . . . 12
4.16. Void . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.17. Constant . . . . . . . . . . . . . . . . . . . . . . . . 13
4.18. Typedef . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.19. Optional-data . . . . . . . . . . . . . . . . . . . . . . 14
4.20. Areas for Future Enhancement . . . . . . . . . . . . . . 15
5. DISCUSSION . . . . . . . . . . . . . . . . . . . . . . . . . 16
6. THE XDR LANGUAGE SPECIFICATION . . . . . . . . . . . . . . . 17
6.1. Notational Conventions . . . . . . . . . . . . . . . . . . 17
6.2. Lexical Notes . . . . . . . . . . . . . . . . . . . . . . 18
6.3. Syntax Information . . . . . . . . . . . . . . . . . . . . 18
6.4. Syntax Notes . . . . . . . . . . . . . . . . . . . . . . . 20
7. AN EXAMPLE OF AN XDR DATA DESCRIPTION . . . . . . . . . . . 20
8. Security Considerations . . . . . . . . . . . . . . . . . . 21
9. IANA Considerations . . . . . . . . . . . . . . . . . . . . 23
10. TRADEMARKS AND OWNERS . . . . . . . . . . . . . . . . . . . 23
11. ANSI/IEEE Standard 754-1985 . . . . . . . . . . . . . . . . 23
12. NORMATIVE REFERENCES . . . . . . . . . . . . . . . . . . . 25
13. INFORMATIVE REFERENCES . . . . . . . . . . . . . . . . . . 25
14. Editor's Address . . . . . . . . . . . . . . . . . . . . . 25
15. Acknowledgements . . . . . . . . . . . . . . . . . . . . . 25
16. IPR Notices . . . . . . . . . . . . . . . . . . . . . . . . 26
17. Copyright Notice . . . . . . . . . . . . . . . . . . . . . 26
1. Changes from RFC1832 Table of Contents
This document makes no technical changes to RFC1832 and is published 1. Introduction ....................................................3
for the purpose of noting IANA considerations, augmenting security 2. Changes from RFC 1832 ...........................................3
considerations, and distinguishing normative from informative 3. Basic Block Size ................................................3
references. 4. XDR Data Types ..................................................4
4.1. Integer ....................................................4
4.2. Unsigned Integer ...........................................4
4.3. Enumeration ................................................5
4.4. Boolean ....................................................5
4.5. Hyper Integer and Unsigned Hyper Integer ...................5
4.6. Floating-Point .............................................6
4.7. Double-Precision Floating-Point ............................7
4.8. Quadruple-Precision Floating-Point .........................8
4.9. Fixed-Length Opaque Data ...................................9
4.10. Variable-Length Opaque Data ...............................9
4.11. String ...................................................10
4.12. Fixed-Length Array .......................................11
4.13. Variable-Length Array ....................................11
4.14. Structure ................................................12
4.15. Discriminated Union ......................................12
4.16. Void .....................................................13
4.17. Constant .................................................13
4.18. Typedef ..................................................13
4.19. Optional-Data ............................................14
4.20. Areas for Future Enhancement .............................16
5. Discussion .....................................................16
6. The XDR Language Specification .................................17
6.1. Notational Conventions ....................................17
6.2. Lexical Notes .............................................18
6.3. Syntax Information ........................................18
6.4. Syntax Notes ..............................................20
7. An Example of an XDR Data Description ..........................21
8. Security Considerations ........................................22
9. IANA Considerations ............................................23
10. Trademarks and Owners .........................................23
11. ANSI/IEEE Standard 754-1985 ...................................24
12. Normative References ..........................................25
13. Informative References ........................................25
14. Acknowledgements ..............................................26
2. INTRODUCTION 1. Introduction
XDR is a standard for the description and encoding of data. It is XDR is a standard for the description and encoding of data. It is
useful for transferring data between different computer useful for transferring data between different computer
architectures, and has been used to communicate data between such architectures, and it has been used to communicate data between such
diverse machines as the SUN WORKSTATION*, VAX*, IBM-PC*, and Cray*. diverse machines as the SUN WORKSTATION*, VAX*, IBM-PC*, and Cray*.
XDR fits into the ISO presentation layer, and is roughly analogous in XDR fits into the ISO presentation layer and is roughly analogous in
purpose to X.409, ISO Abstract Syntax Notation. The major difference purpose to X.409, ISO Abstract Syntax Notation. The major difference
between these two is that XDR uses implicit typing, while X.409 uses between these two is that XDR uses implicit typing, while X.409 uses
explicit typing. explicit typing.
XDR uses a language to describe data formats. The language can only XDR uses a language to describe data formats. The language can be
be used only to describe data; it is not a programming language. used only to describe data; it is not a programming language. This
This language allows one to describe intricate data formats in a language allows one to describe intricate data formats in a concise
concise manner. The alternative of using graphical representations manner. The alternative of using graphical representations (itself
(itself an informal language) quickly becomes incomprehensible when an informal language) quickly becomes incomprehensible when faced
faced with complexity. The XDR language itself is similar to the C with complexity. The XDR language itself is similar to the C
language [KERN], just as Courier [COUR] is similar to Mesa. Protocols language [KERN], just as Courier [COUR] is similar to Mesa.
such as ONC RPC (Remote Procedure Call) and the NFS* (Network File Protocols such as ONC RPC (Remote Procedure Call) and the NFS*
System) use XDR to describe the format of their data. (Network File System) use XDR to describe the format of their data.
The XDR standard makes the following assumption: that bytes (or The XDR standard makes the following assumption: that bytes (or
octets) are portable, where a byte is defined to be 8 bits of data. octets) are portable, where a byte is defined as 8 bits of data. A
A given hardware device should encode the bytes onto the various given hardware device should encode the bytes onto the various media
media in such a way that other hardware devices may decode the bytes in such a way that other hardware devices may decode the bytes
without loss of meaning. For example, the Ethernet* standard without loss of meaning. For example, the Ethernet* standard
suggests that bytes be encoded in "little-endian" style [COHE], or suggests that bytes be encoded in "little-endian" style [COHE], or
least significant bit first. least significant bit first.
3. BASIC BLOCK SIZE 2. Changes from RFC 1832
This document makes no technical changes to RFC 1832 and is published
for the purposes of noting IANA considerations, augmenting security
considerations, and distinguishing normative from informative
references.
3. Basic Block Size
The representation of all items requires a multiple of four bytes (or The representation of all items requires a multiple of four bytes (or
32 bits) of data. The bytes are numbered 0 through n-1. The bytes 32 bits) of data. The bytes are numbered 0 through n-1. The bytes
are read or written to some byte stream such that byte m always are read or written to some byte stream such that byte m always
precedes byte m+1. If the n bytes needed to contain the data are not precedes byte m+1. If the n bytes needed to contain the data are not
a multiple of four, then the n bytes are followed by enough (0 to 3) a multiple of four, then the n bytes are followed by enough (0 to 3)
residual zero bytes, r, to make the total byte count a multiple of 4. residual zero bytes, r, to make the total byte count a multiple of 4.
We include the familiar graphic box notation for illustration and We include the familiar graphic box notation for illustration and
comparison. In most illustrations, each box (delimited by a plus comparison. In most illustrations, each box (delimited by a plus
skipping to change at page 3, line 35 skipping to change at page 4, line 4
The representation of all items requires a multiple of four bytes (or The representation of all items requires a multiple of four bytes (or
32 bits) of data. The bytes are numbered 0 through n-1. The bytes 32 bits) of data. The bytes are numbered 0 through n-1. The bytes
are read or written to some byte stream such that byte m always are read or written to some byte stream such that byte m always
precedes byte m+1. If the n bytes needed to contain the data are not precedes byte m+1. If the n bytes needed to contain the data are not
a multiple of four, then the n bytes are followed by enough (0 to 3) a multiple of four, then the n bytes are followed by enough (0 to 3)
residual zero bytes, r, to make the total byte count a multiple of 4. residual zero bytes, r, to make the total byte count a multiple of 4.
We include the familiar graphic box notation for illustration and We include the familiar graphic box notation for illustration and
comparison. In most illustrations, each box (delimited by a plus comparison. In most illustrations, each box (delimited by a plus
sign at the 4 corners and vertical bars and dashes) depicts a byte. sign at the 4 corners and vertical bars and dashes) depicts a byte.
Ellipses (...) between boxes show zero or more additional bytes where Ellipses (...) between boxes show zero or more additional bytes where
required. required.
+--------+--------+...+--------+--------+...+--------+ +--------+--------+...+--------+--------+...+--------+
| byte 0 | byte 1 |...|byte n-1| 0 |...| 0 | BLOCK | byte 0 | byte 1 |...|byte n-1| 0 |...| 0 | BLOCK
+--------+--------+...+--------+--------+...+--------+ +--------+--------+...+--------+--------+...+--------+
|<-----------n bytes---------->|<------r bytes------>| |<-----------n bytes---------->|<------r bytes------>|
|<-----------n+r (where (n+r) mod 4 = 0)>----------->| |<-----------n+r (where (n+r) mod 4 = 0)>----------->|
4. XDR DATA TYPES 4. XDR Data Types
Each of the sections that follow describes a data type defined in the Each of the sections that follow describes a data type defined in the
XDR standard, shows how it is declared in the language, and includes XDR standard, shows how it is declared in the language, and includes
a graphic illustration of its encoding. a graphic illustration of its encoding.
For each data type in the language we show a general paradigm For each data type in the language we show a general paradigm
declaration. Note that angle brackets (< and >) denote declaration. Note that angle brackets (< and >) denote variable-
variable length sequences of data and square brackets ([ and ]) length sequences of data and that square brackets ([ and ]) denote
denote fixed-length sequences of data. "n", "m" and "r" denote fixed-length sequences of data. "n", "m", and "r" denote integers.
integers. For the full language specification and more formal For the full language specification and more formal definitions of
definitions of terms such as "identifier" and "declaration", refer terms such as "identifier" and "declaration", refer to Section 6,
to section 6: "The XDR Language Specification". "The XDR Language Specification".
For some data types, more specific examples are included. A more For some data types, more specific examples are included. A more
extensive example of a data description is in section 7: "An Example extensive example of a data description is in Section 7, "An Example
of an XDR Data Description". of an XDR Data Description".
4.1. Integer 4.1. Integer
An XDR signed integer is a 32-bit datum that encodes an integer in An XDR signed integer is a 32-bit datum that encodes an integer in
the range [-2147483648,2147483647]. The integer is represented in the range [-2147483648,2147483647]. The integer is represented in
two's complement notation. The most and least significant bytes are two's complement notation. The most and least significant bytes are
0 and 3, respectively. Integers are declared as follows: 0 and 3, respectively. Integers are declared as follows:
int identifier; int identifier;
(MSB) (LSB) (MSB) (LSB)
+-------+-------+-------+-------+ +-------+-------+-------+-------+
|byte 0 |byte 1 |byte 2 |byte 3 | INTEGER |byte 0 |byte 1 |byte 2 |byte 3 | INTEGER
+-------+-------+-------+-------+ +-------+-------+-------+-------+
<------------32 bits------------> <------------32 bits------------>
4.2. Unsigned Integer 4.2. Unsigned Integer
An XDR unsigned integer is a 32-bit datum that encodes a nonnegative An XDR unsigned integer is a 32-bit datum that encodes a non-negative
integer in the range [0,4294967295]. It is represented by an integer in the range [0,4294967295]. It is represented by an
unsigned binary number whose most and least significant bytes are 0 unsigned binary number whose most and least significant bytes are 0
and 3, respectively. An unsigned integer is declared as follows: and 3, respectively. An unsigned integer is declared as follows:
unsigned int identifier; unsigned int identifier;
(MSB) (LSB) (MSB) (LSB)
+-------+-------+-------+-------+ +-------+-------+-------+-------+
|byte 0 |byte 1 |byte 2 |byte 3 | UNSIGNED INTEGER |byte 0 |byte 1 |byte 2 |byte 3 | UNSIGNED INTEGER
+-------+-------+-------+-------+ +-------+-------+-------+-------+
skipping to change at page 5, line 12 skipping to change at page 5, line 26
Enumerations are handy for describing subsets of the integers. Enumerations are handy for describing subsets of the integers.
Enumerated data is declared as follows: Enumerated data is declared as follows:
enum { name-identifier = constant, ... } identifier; enum { name-identifier = constant, ... } identifier;
For example, the three colors red, yellow, and blue could be For example, the three colors red, yellow, and blue could be
described by an enumerated type: described by an enumerated type:
enum { RED = 2, YELLOW = 3, BLUE = 5 } colors; enum { RED = 2, YELLOW = 3, BLUE = 5 } colors;
It is an error to encode as an enum any other integer than those that It is an error to encode as an enum any integer other than those that
have been given assignments in the enum declaration. have been given assignments in the enum declaration.
4.4. Boolean 4.4. Boolean
Booleans are important enough and occur frequently enough to warrant Booleans are important enough and occur frequently enough to warrant
their own explicit type in the standard. Booleans are declared as their own explicit type in the standard. Booleans are declared as
follows: follows:
bool identifier; bool identifier;
This is equivalent to: This is equivalent to:
enum { FALSE = 0, TRUE = 1 } identifier; enum { FALSE = 0, TRUE = 1 } identifier;
4.5. Hyper Integer and Unsigned Hyper Integer 4.5. Hyper Integer and Unsigned Hyper Integer
The standard also defines 64-bit (8-byte) numbers called hyper The standard also defines 64-bit (8-byte) numbers called hyper
integer and unsigned hyper integer. Their representations are the integers and unsigned hyper integers. Their representations are the
obvious extensions of integer and unsigned integer defined above. obvious extensions of integer and unsigned integer defined above.
They are represented in two's complement notation. The most and They are represented in two's complement notation. The most and
least significant bytes are 0 and 7, respectively. Their least significant bytes are 0 and 7, respectively. Their
declarations: declarations:
hyper identifier; unsigned hyper identifier; hyper identifier; unsigned hyper identifier;
(MSB) (LSB) (MSB) (LSB)
+-------+-------+-------+-------+-------+-------+-------+-------+ +-------+-------+-------+-------+-------+-------+-------+-------+
|byte 0 |byte 1 |byte 2 |byte 3 |byte 4 |byte 5 |byte 6 |byte 7 | |byte 0 |byte 1 |byte 2 |byte 3 |byte 4 |byte 5 |byte 6 |byte 7 |
+-------+-------+-------+-------+-------+-------+-------+-------+ +-------+-------+-------+-------+-------+-------+-------+-------+
<----------------------------64 bits----------------------------> <----------------------------64 bits---------------------------->
HYPER INTEGER HYPER INTEGER
UNSIGNED HYPER INTEGER UNSIGNED HYPER INTEGER
4.6. Floating-point 4.6. Floating-Point
The standard defines the floating-point data type "float" (32 bits or The standard defines the floating-point data type "float" (32 bits or
4 bytes). The encoding used is the IEEE standard for normalized 4 bytes). The encoding used is the IEEE standard for normalized
single-precision floating-point numbers [IEEE]. The following three single-precision floating-point numbers [IEEE]. The following three
fields describe the single-precision floating-point number: fields describe the single-precision floating-point number:
S: The sign of the number. Values 0 and 1 represent positive and S: The sign of the number. Values 0 and 1 represent positive and
negative, respectively. One bit. negative, respectively. One bit.
E: The exponent of the number, base 2. 8 bits are devoted to this E: The exponent of the number, base 2. 8 bits are devoted to this
skipping to change at page 6, line 44 skipping to change at page 7, line 11
these numbers refer to the mathematical positions of the bits, and these numbers refer to the mathematical positions of the bits, and
NOT to their actual physical locations (which vary from medium to NOT to their actual physical locations (which vary from medium to
medium). medium).
The IEEE specifications should be consulted concerning the encoding The IEEE specifications should be consulted concerning the encoding
for signed zero, signed infinity (overflow), and denormalized numbers for signed zero, signed infinity (overflow), and denormalized numbers
(underflow) [IEEE]. According to IEEE specifications, the "NaN" (not (underflow) [IEEE]. According to IEEE specifications, the "NaN" (not
a number) is system dependent and should not be interpreted within a number) is system dependent and should not be interpreted within
XDR as anything other than "NaN". XDR as anything other than "NaN".
4.7. Double-precision Floating-point 4.7. Double-Precision Floating-Point
The standard defines the encoding for the double-precision floating- The standard defines the encoding for the double-precision floating-
point data type "double" (64 bits or 8 bytes). The encoding used is point data type "double" (64 bits or 8 bytes). The encoding used is
the IEEE standard for normalized double-precision floating-point the IEEE standard for normalized double-precision floating-point
numbers [IEEE]. The standard encodes the following three fields, numbers [IEEE]. The standard encodes the following three fields,
which describe the double-precision floating-point number: which describe the double-precision floating-point number:
S: The sign of the number. Values 0 and 1 represent positive and S: The sign of the number. Values 0 and 1 represent positive and
negative, respectively. One bit. negative, respectively. One bit.
skipping to change at page 7, line 44 skipping to change at page 8, line 11
that these numbers refer to the mathematical positions of the bits, that these numbers refer to the mathematical positions of the bits,
and NOT to their actual physical locations (which vary from medium to and NOT to their actual physical locations (which vary from medium to
medium). medium).
The IEEE specifications should be consulted concerning the encoding The IEEE specifications should be consulted concerning the encoding
for signed zero, signed infinity (overflow), and denormalized numbers for signed zero, signed infinity (overflow), and denormalized numbers
(underflow) [IEEE]. According to IEEE specifications, the "NaN" (not (underflow) [IEEE]. According to IEEE specifications, the "NaN" (not
a number) is system dependent and should not be interpreted within a number) is system dependent and should not be interpreted within
XDR as anything other than "NaN". XDR as anything other than "NaN".
4.8. Quadruple-precision Floating-point 4.8. Quadruple-Precision Floating-Point
The standard defines the encoding for the quadruple-precision The standard defines the encoding for the quadruple-precision
floating-point data type "quadruple" (128 bits or 16 bytes). The floating-point data type "quadruple" (128 bits or 16 bytes). The
encoding used is designed to be a simple analog of of the encoding encoding used is designed to be a simple analog of the encoding used
used for single and double-precision floating-point numbers using one for single- and double-precision floating-point numbers using one
form of IEEE double extended precision. The standard encodes the form of IEEE double extended precision. The standard encodes the
following three fields, which describe the quadruple-precision following three fields, which describe the quadruple-precision
floating-point number: floating-point number:
S: The sign of the number. Values 0 and 1 represent positive and S: The sign of the number. Values 0 and 1 represent positive and
negative, respectively. One bit. negative, respectively. One bit.
E: The exponent of the number, base 2. 15 bits are devoted to E: The exponent of the number, base 2. 15 bits are devoted to
this field. The exponent is biased by 16383. this field. The exponent is biased by 16383.
skipping to change at page 8, line 41 skipping to change at page 9, line 8
the most and least significant bits of a quadruple-precision the most and least significant bits of a quadruple-precision
floating-point number are 0 and 127. The beginning bit (and most floating-point number are 0 and 127. The beginning bit (and most
significant bit) offsets of S, E , and F are 0, 1, and 16, significant bit) offsets of S, E , and F are 0, 1, and 16,
respectively. Note that these numbers refer to the mathematical respectively. Note that these numbers refer to the mathematical
positions of the bits, and NOT to their actual physical locations positions of the bits, and NOT to their actual physical locations
(which vary from medium to medium). (which vary from medium to medium).
The encoding for signed zero, signed infinity (overflow), and The encoding for signed zero, signed infinity (overflow), and
denormalized numbers are analogs of the corresponding encodings for denormalized numbers are analogs of the corresponding encodings for
single and double-precision floating-point numbers [SPAR], [HPRE]. single and double-precision floating-point numbers [SPAR], [HPRE].
The "NaN" encoding as it applies to quadruple-precision The "NaN" encoding as it applies to quadruple-precision floating-
floating-point numbers is system dependent and should not be point numbers is system dependent and should not be interpreted
interpreted within XDR as anything other than "NaN". within XDR as anything other than "NaN".
4.9. Fixed-length Opaque Data 4.9. Fixed-Length Opaque Data
At times, fixed-length uninterpreted data needs to be passed among At times, fixed-length uninterpreted data needs to be passed among
machines. This data is called "opaque" and is declared as follows: machines. This data is called "opaque" and is declared as follows:
opaque identifier[n]; opaque identifier[n];
where the constant n is the (static) number of bytes necessary to where the constant n is the (static) number of bytes necessary to
contain the opaque data. If n is not a multiple of four, then the n contain the opaque data. If n is not a multiple of four, then the n
bytes are followed by enough (0 to 3) residual zero bytes, r, to make bytes are followed by enough (0 to 3) residual zero bytes, r, to make
the total byte count of the opaque object a multiple of four. the total byte count of the opaque object a multiple of four.
0 1 ... 0 1 ...
+--------+--------+...+--------+--------+...+--------+ +--------+--------+...+--------+--------+...+--------+
| byte 0 | byte 1 |...|byte n-1| 0 |...| 0 | | byte 0 | byte 1 |...|byte n-1| 0 |...| 0 |
+--------+--------+...+--------+--------+...+--------+ +--------+--------+...+--------+--------+...+--------+
|<-----------n bytes---------->|<------r bytes------>| |<-----------n bytes---------->|<------r bytes------>|
|<-----------n+r (where (n+r) mod 4 = 0)------------>| |<-----------n+r (where (n+r) mod 4 = 0)------------>|
FIXED-LENGTH OPAQUE FIXED-LENGTH OPAQUE
4.10. Variable-length Opaque Data 4.10. Variable-Length Opaque Data
The standard also provides for variable-length (counted) opaque data, The standard also provides for variable-length (counted) opaque data,
defined as a sequence of n (numbered 0 through n-1) arbitrary bytes defined as a sequence of n (numbered 0 through n-1) arbitrary bytes
to be the number n encoded as an unsigned integer (as described to be the number n encoded as an unsigned integer (as described
below), and followed by the n bytes of the sequence. below), and followed by the n bytes of the sequence.
Byte m of the sequence always precedes byte m+1 of the sequence, and Byte m of the sequence always precedes byte m+1 of the sequence, and
byte 0 of the sequence always follows the sequence's length (count). byte 0 of the sequence always follows the sequence's length (count).
If n is not a multiple of four, then the n bytes are followed by If n is not a multiple of four, then the n bytes are followed by
enough (0 to 3) residual zero bytes, r, to make the total byte count enough (0 to 3) residual zero bytes, r, to make the total byte count
skipping to change at page 10, line 37 skipping to change at page 11, line 4
string filename<255>; string filename<255>;
0 1 2 3 4 5 ... 0 1 2 3 4 5 ...
+-----+-----+-----+-----+-----+-----+...+-----+-----+...+-----+ +-----+-----+-----+-----+-----+-----+...+-----+-----+...+-----+
| length n |byte0|byte1|...| n-1 | 0 |...| 0 | | length n |byte0|byte1|...| n-1 | 0 |...| 0 |
+-----+-----+-----+-----+-----+-----+...+-----+-----+...+-----+ +-----+-----+-----+-----+-----+-----+...+-----+-----+...+-----+
|<-------4 bytes------->|<------n bytes------>|<---r bytes--->| |<-------4 bytes------->|<------n bytes------>|<---r bytes--->|
|<----n+r (where (n+r) mod 4 = 0)---->| |<----n+r (where (n+r) mod 4 = 0)---->|
STRING STRING
It is an error to encode a length greater than the maximum described It is an error to encode a length greater than the maximum described
in the specification. in the specification.
4.12. Fixed-length Array 4.12. Fixed-Length Array
Declarations for fixed-length arrays of homogeneous elements are in Declarations for fixed-length arrays of homogeneous elements are in
the following form: the following form:
type-name identifier[n]; type-name identifier[n];
Fixed-length arrays of elements numbered 0 through n-1 are encoded by Fixed-length arrays of elements numbered 0 through n-1 are encoded by
individually encoding the elements of the array in their natural individually encoding the elements of the array in their natural
order, 0 through n-1. Each element's size is a multiple of four order, 0 through n-1. Each element's size is a multiple of four
bytes. Though all elements are of the same type, the elements may bytes. Though all elements are of the same type, the elements may
skipping to change at page 11, line 16 skipping to change at page 11, line 29
strings, all elements are of type "string", yet each element will strings, all elements are of type "string", yet each element will
vary in its length. vary in its length.
+---+---+---+---+---+---+---+---+...+---+---+---+---+ +---+---+---+---+---+---+---+---+...+---+---+---+---+
| element 0 | element 1 |...| element n-1 | | element 0 | element 1 |...| element n-1 |
+---+---+---+---+---+---+---+---+...+---+---+---+---+ +---+---+---+---+---+---+---+---+...+---+---+---+---+
|<--------------------n elements------------------->| |<--------------------n elements------------------->|
FIXED-LENGTH ARRAY FIXED-LENGTH ARRAY
4.13. Variable-length Array 4.13. Variable-Length Array
Counted arrays provide the ability to encode variable-length arrays Counted arrays provide the ability to encode variable-length arrays
of homogeneous elements. The array is encoded as the element count n of homogeneous elements. The array is encoded as the element count n
(an unsigned integer) followed by the encoding of each of the array's (an unsigned integer) followed by the encoding of each of the array's
elements, starting with element 0 and progressing through element n- elements, starting with element 0 and progressing through element
1. The declaration for variable-length arrays follows this form: n-1. The declaration for variable-length arrays follows this form:
type-name identifier<m>; type-name identifier<m>;
or or
type-name identifier<>; type-name identifier<>;
The constant m specifies the maximum acceptable element count of an The constant m specifies the maximum acceptable element count of an
array; if m is not specified, as in the second declaration, it is array; if m is not specified, as in the second declaration, it is
assumed to be (2**32) - 1. assumed to be (2**32) - 1.
0 1 2 3 0 1 2 3
skipping to change at page 12, line 18 skipping to change at page 12, line 31
+-------------+-------------+... +-------------+-------------+...
| component A | component B |... STRUCTURE | component A | component B |... STRUCTURE
+-------------+-------------+... +-------------+-------------+...
4.15. Discriminated Union 4.15. Discriminated Union
A discriminated union is a type composed of a discriminant followed A discriminated union is a type composed of a discriminant followed
by a type selected from a set of prearranged types according to the by a type selected from a set of prearranged types according to the
value of the discriminant. The type of discriminant is either "int", value of the discriminant. The type of discriminant is either "int",
"unsigned int", or an enumerated type, such as "bool". The component "unsigned int", or an enumerated type, such as "bool". The component
types are called "arms" of the union, and are preceded by the value types are called "arms" of the union and are preceded by the value of
of the discriminant which implies their encoding. Discriminated the discriminant that implies their encoding. Discriminated unions
unions are declared as follows: are declared as follows:
union switch (discriminant-declaration) { union switch (discriminant-declaration) {
case discriminant-value-A: case discriminant-value-A:
arm-declaration-A; arm-declaration-A;
case discriminant-value-B: case discriminant-value-B:
arm-declaration-B; arm-declaration-B;
... ...
default: default-declaration; default: default-declaration;
} identifier; } identifier;
skipping to change at page 13, line 39 skipping to change at page 14, line 4
"typedef" does not declare any data either, but serves to define new "typedef" does not declare any data either, but serves to define new
identifiers for declaring data. The syntax is: identifiers for declaring data. The syntax is:
typedef declaration; typedef declaration;
The new type name is actually the variable name in the declaration The new type name is actually the variable name in the declaration
part of the typedef. For example, the following defines a new type part of the typedef. For example, the following defines a new type
called "eggbox" using an existing type called "egg": called "eggbox" using an existing type called "egg":
typedef egg eggbox[DOZEN]; typedef egg eggbox[DOZEN];
Variables declared using the new type name have the same type as the Variables declared using the new type name have the same type as the
new type name would have in the typedef, if it was considered a new type name would have in the typedef, if it were considered a
variable. For example, the following two declarations are equivalent variable. For example, the following two declarations are equivalent
in declaring the variable "fresheggs": in declaring the variable "fresheggs":
eggbox fresheggs; egg fresheggs[DOZEN]; eggbox fresheggs; egg fresheggs[DOZEN];
When a typedef involves a struct, enum, or union definition, there is When a typedef involves a struct, enum, or union definition, there is
another (preferred) syntax that may be used to define the same type. another (preferred) syntax that may be used to define the same type.
In general, a typedef of the following form: In general, a typedef of the following form:
typedef <<struct, union, or enum definition>> identifier; typedef <<struct, union, or enum definition>> identifier;
skipping to change at page 14, line 19 skipping to change at page 14, line 32
typedef enum { /* using typedef */ typedef enum { /* using typedef */
FALSE = 0, FALSE = 0,
TRUE = 1 TRUE = 1
} bool; } bool;
enum bool { /* preferred alternative */ enum bool { /* preferred alternative */
FALSE = 0, FALSE = 0,
TRUE = 1 TRUE = 1
}; };
The reason this syntax is preferred is one does not have to wait This syntax is preferred because one does not have to wait until the
until the end of a declaration to figure out the name of the new end of a declaration to figure out the name of the new type.
type.
4.19. Optional-data 4.19. Optional-Data
Optional-data is one kind of union that occurs so frequently that we Optional-data is one kind of union that occurs so frequently that we
give it a special syntax of its own for declaring it. It is declared give it a special syntax of its own for declaring it. It is declared
as follows: as follows:
type-name *identifier; type-name *identifier;
This is equivalent to the following union: This is equivalent to the following union:
union switch (bool opted) { union switch (bool opted) {
skipping to change at page 14, line 39 skipping to change at page 15, line 4
type-name *identifier; type-name *identifier;
This is equivalent to the following union: This is equivalent to the following union:
union switch (bool opted) { union switch (bool opted) {
case TRUE: case TRUE:
type-name element; type-name element;
case FALSE: case FALSE:
void; void;
} identifier; } identifier;
It is also equivalent to the following variable-length array It is also equivalent to the following variable-length array
declaration, since the boolean "opted" can be interpreted as the declaration, since the boolean "opted" can be interpreted as the
length of the array: length of the array:
type-name identifier<1>; type-name identifier<1>;
Optional-data is not so interesting in itself, but it is very useful Optional-data is not so interesting in itself, but it is very useful
for describing recursive data-structures such as linked-lists and for describing recursive data-structures such as linked-lists and
trees. For example, the following defines a type "stringlist" that trees. For example, the following defines a type "stringlist" that
that encodes lists of zero or more arbitrary length strings: encodes lists of zero or more arbitrary length strings:
struct stringentry { struct stringentry {
string item<>; string item<>;
stringentry *next; stringentry *next;
}; };
typedef stringentry *stringlist; typedef stringentry *stringlist;
It could have been equivalently declared as the following union: It could have been equivalently declared as the following union:
skipping to change at page 16, line 5 skipping to change at page 16, line 20
The intent of the XDR standard was not to describe every kind of data The intent of the XDR standard was not to describe every kind of data
that people have ever sent or will ever want to send from machine to that people have ever sent or will ever want to send from machine to
machine. Rather, it only describes the most commonly used data-types machine. Rather, it only describes the most commonly used data-types
of high-level languages such as Pascal or C so that applications of high-level languages such as Pascal or C so that applications
written in these languages will be able to communicate easily over written in these languages will be able to communicate easily over
some medium. some medium.
One could imagine extensions to XDR that would let it describe almost One could imagine extensions to XDR that would let it describe almost
any existing protocol, such as TCP. The minimum necessary for this any existing protocol, such as TCP. The minimum necessary for this
are support for different block sizes and byte-orders. The XDR is support for different block sizes and byte-orders. The XDR
discussed here could then be considered the 4-byte big-endian member discussed here could then be considered the 4-byte big-endian member
of a larger XDR family. of a larger XDR family.
5. DISCUSSION 5. Discussion
(1) Why use a language for describing data? What's wrong with (1) Why use a language for describing data? What's wrong with
diagrams? diagrams?
There are many advantages in using a data-description language such There are many advantages in using a data-description language such
as XDR versus using diagrams. Languages are more formal than as XDR versus using diagrams. Languages are more formal than
diagrams and lead to less ambiguous descriptions of data. Languages diagrams and lead to less ambiguous descriptions of data. Languages
are also easier to understand and allow one to think of other issues are also easier to understand and allow one to think of other issues
instead of the low-level details of bit-encoding. Also, there is a instead of the low-level details of bit encoding. Also, there is a
close analogy between the types of XDR and a high-level language such close analogy between the types of XDR and a high-level language such
as C or Pascal. This makes the implementation of XDR encoding and as C or Pascal. This makes the implementation of XDR encoding and
decoding modules an easier task. Finally, the language specification decoding modules an easier task. Finally, the language specification
itself is an ASCII string that can be passed from machine to machine itself is an ASCII string that can be passed from machine to machine
to perform on-the-fly data interpretation. to perform on-the-fly data interpretation.
(2) Why is there only one byte-order for an XDR unit? (2) Why is there only one byte-order for an XDR unit?
Supporting two byte-orderings requires a higher level protocol for Supporting two byte-orderings requires a higher-level protocol for
determining in which byte-order the data is encoded. Since XDR is determining in which byte-order the data is encoded. Since XDR is
not a protocol, this can't be done. The advantage of this, though, not a protocol, this can't be done. The advantage of this, though,
is that data in XDR format can be written to a magnetic tape, for is that data in XDR format can be written to a magnetic tape, for
example, and any machine will be able to interpret it, since no example, and any machine will be able to interpret it, since no
higher level protocol is necessary for determining the byte-order. higher-level protocol is necessary for determining the byte-order.
(3) Why is the XDR byte-order big-endian instead of little-endian? (3) Why is the XDR byte-order big-endian instead of little-endian?
Isn't this unfair to little-endian machines such as the VAX(r), which Isn't this unfair to little-endian machines such as the VAX(r),
has to convert from one form to the other? which has to convert from one form to the other?
Yes, it is unfair, but having only one byte-order means you have to Yes, it is unfair, but having only one byte-order means you have to
be unfair to somebody. Many architectures, such as the Motorola be unfair to somebody. Many architectures, such as the Motorola
68000* and IBM 370*, support the big-endian byte-order. 68000* and IBM 370*, support the big-endian byte-order.
(4) Why is the XDR unit four bytes wide? (4) Why is the XDR unit four bytes wide?
There is a tradeoff in choosing the XDR unit size. Choosing a small There is a tradeoff in choosing the XDR unit size. Choosing a small
size such as two makes the encoded data small, but causes alignment size, such as two, makes the encoded data small, but causes alignment
problems for machines that aren't aligned on these boundaries. A problems for machines that aren't aligned on these boundaries. A
large size such as eight means the data will be aligned on virtually large size, such as eight, means the data will be aligned on
every machine, but causes the encoded data to grow too big. We chose virtually every machine, but causes the encoded data to grow too big.
four as a compromise. Four is big enough to support most We chose four as a compromise. Four is big enough to support most
architectures efficiently, except for rare machines such as the architectures efficiently, except for rare machines such as the
eight-byte aligned Cray*. Four is also small enough to keep the eight-byte-aligned Cray*. Four is also small enough to keep the
encoded data restricted to a reasonable size. encoded data restricted to a reasonable size.
(5) Why must variable-length data be padded with zeros? (5) Why must variable-length data be padded with zeros?
It is desirable that the same data encode into the same thing on all It is desirable that the same data encode into the same thing on all
machines, so that encoded data can be meaningfully compared or machines, so that encoded data can be meaningfully compared or
checksummed. Forcing the padded bytes to be zero ensures this. checksummed. Forcing the padded bytes to be zero ensures this.
(6) Why is there no explicit data-typing? (6) Why is there no explicit data-typing?
Data-typing has a relatively high cost for what small advantages it Data-typing has a relatively high cost for what small advantages it
may have. One cost is the expansion of data due to the inserted type may have. One cost is the expansion of data due to the inserted type
fields. Another is the added cost of interpreting these type fields fields. Another is the added cost of interpreting these type fields
and acting accordingly. And most protocols already know what type and acting accordingly. And most protocols already know what type
they expect, so data-typing supplies only redundant information. they expect, so data-typing supplies only redundant information.
However, one can still get the benefits of data-typing using XDR. One However, one can still get the benefits of data-typing using XDR.
way is to encode two things: first a string which is the XDR data One way is to encode two things: first, a string that is the XDR data
description of the encoded data, and then the encoded data itself. description of the encoded data, and then the encoded data itself.
Another way is to assign a value to all the types in XDR, and then Another way is to assign a value to all the types in XDR, and then
define a universal type which takes this value as its discriminant define a universal type that takes this value as its discriminant and
and for each value, describes the corresponding data type. for each value, describes the corresponding data type.
6. THE XDR LANGUAGE SPECIFICATION 6. The XDR Language Specification
6.1. Notational Conventions 6.1. Notational Conventions
This specification uses an extended Back-Naur Form notation for This specification uses an extended Back-Naur Form notation for
describing the XDR language. Here is a brief description of the describing the XDR language. Here is a brief description of the
notation: notation:
(1) The characters '|', '(', ')', '[', ']', '"', and '*' are special. (1) The characters '|', '(', ')', '[', ']', '"', and '*' are special.
(2) Terminal symbols are strings of any characters surrounded by (2) Terminal symbols are strings of any characters surrounded by
double quotes. (3) Non-terminal symbols are strings of non-special double quotes. (3) Non-terminal symbols are strings of non-special
skipping to change at page 18, line 12 skipping to change at page 18, line 25
"a very rainy day" "a very rainy day"
"a very, very rainy day" "a very, very rainy day"
"a very cold and rainy day" "a very cold and rainy day"
"a very, very, very cold and rainy night" "a very, very, very cold and rainy night"
6.2. Lexical Notes 6.2. Lexical Notes
(1) Comments begin with '/*' and terminate with '*/'. (2) White (1) Comments begin with '/*' and terminate with '*/'. (2) White
space serves to separate items and is otherwise ignored. (3) An space serves to separate items and is otherwise ignored. (3) An
identifier is a letter followed by an optional sequence of letters, identifier is a letter followed by an optional sequence of letters,
digits or underbar ('_'). The case of identifiers is not ignored. digits, or underbar ('_'). The case of identifiers is not ignored.
(4) A decimal constant expresses a number in base 10, and is a (4) A decimal constant expresses a number in base 10 and is a
sequence of one or more decimal digits, where the first digit is not sequence of one or more decimal digits, where the first digit is not
a zero, and is optionally preceded by a minus-sign ('-'). (5) A a zero, and is optionally preceded by a minus-sign ('-'). (5) A
hexadecimal constant expresses a number in base 16, and must be hexadecimal constant expresses a number in base 16, and must be
preceded by '0x', followed by one or hexadecimal digits ('A', 'B', preceded by '0x', followed by one or hexadecimal digits ('A', 'B',
'C', 'D', E', 'F', 'a', 'b', 'c', 'd', 'e', 'f', '0', '1', '2', '3', 'C', 'D', E', 'F', 'a', 'b', 'c', 'd', 'e', 'f', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9'). (6) An octal constant expresses a '4', '5', '6', '7', '8', '9'). (6) An octal constant expresses a
number in base 8, always leads with digit 0, and is a sequence of number in base 8, always leads with digit 0, and is a sequence of one
one or more octal digits ('0', '1', '2', '3', '4', '5', '6', '7'). or more octal digits ('0', '1', '2', '3', '4', '5', '6', '7').
6.3. Syntax Information 6.3. Syntax Information
declaration: declaration:
type-specifier identifier type-specifier identifier
| type-specifier identifier "[" value "]" | type-specifier identifier "[" value "]"
| type-specifier identifier "<" [ value ] ">" | type-specifier identifier "<" [ value ] ">"
| "opaque" identifier "[" value "]" | "opaque" identifier "[" value "]"
| "opaque" identifier "<" [ value ] ">" | "opaque" identifier "<" [ value ] ">"
| "string" identifier "<" [ value ] ">" | "string" identifier "<" [ value ] ">"
skipping to change at page 20, line 4 skipping to change at page 20, line 16
type-def: type-def:
"typedef" declaration ";" "typedef" declaration ";"
| "enum" identifier enum-body ";" | "enum" identifier enum-body ";"
| "struct" identifier struct-body ";" | "struct" identifier struct-body ";"
| "union" identifier union-body ";" | "union" identifier union-body ";"
definition: definition:
type-def type-def
| constant-def | constant-def
specification: specification:
definition * definition *
6.4. Syntax Notes 6.4. Syntax Notes
(1) The following are keywords and cannot be used as identifiers: (1) The following are keywords and cannot be used as identifiers:
"bool", "case", "const", "default", "double", "quadruple", "enum", "bool", "case", "const", "default", "double", "quadruple", "enum",
"float", "hyper", "int", "opaque", "string", "struct", "switch", "float", "hyper", "int", "opaque", "string", "struct", "switch",
"typedef", "union", "unsigned" and "void". "typedef", "union", "unsigned", and "void".
(2) Only unsigned constants may be used as size specifications for (2) Only unsigned constants may be used as size specifications for
arrays. If an identifier is used, it must have been declared arrays. If an identifier is used, it must have been declared
previously as an unsigned constant in a "const" definition. previously as an unsigned constant in a "const" definition.
(3) Constant and type identifiers within the scope of a specification (3) Constant and type identifiers within the scope of a specification
are in the same name space and must be declared uniquely within this are in the same name space and must be declared uniquely within this
scope. scope.
(4) Similarly, variable names must be unique within the scope of (4) Similarly, variable names must be unique within the scope of
struct and union declarations. Nested struct and union declarations struct and union declarations. Nested struct and union declarations
create new scopes. create new scopes.
(5) The discriminant of a union must be of a type that evaluates to (5) The discriminant of a union must be of a type that evaluates to
an integer. That is, "int", "unsigned int", "bool", an enumerated an integer. That is, "int", "unsigned int", "bool", an enumerated
type or any typedefed type that evaluates to one of these is legal. type, or any typedefed type that evaluates to one of these is legal.
Also, the case values must be one of the legal values of the Also, the case values must be one of the legal values of the
discriminant. Finally, a case value may not be specified more than discriminant. Finally, a case value may not be specified more than
once within the scope of a union declaration. once within the scope of a union declaration.
7. AN EXAMPLE OF AN XDR DATA DESCRIPTION 7. An Example of an XDR Data Description
Here is a short XDR data description of a thing called a "file", Here is a short XDR data description of a thing called a "file",
which might be used to transfer files from one machine to another. which might be used to transfer files from one machine to another.
const MAXUSERNAME = 32; /* max length of a user name */ const MAXUSERNAME = 32; /* max length of a user name */
const MAXFILELEN = 65535; /* max length of a file */ const MAXFILELEN = 65535; /* max length of a file */
const MAXNAMELEN = 255; /* max length of a file name */ const MAXNAMELEN = 255; /* max length of a file name */
/* /*
* Types of files: * Types of files:
skipping to change at page 22, line 10 skipping to change at page 22, line 33
not inherently give rise to any particular security considerations. not inherently give rise to any particular security considerations.
Protocols that carry XDR-formatted data, such as NFSv4, are Protocols that carry XDR-formatted data, such as NFSv4, are
responsible for providing any necessary security services to secure responsible for providing any necessary security services to secure
the data they transport. the data they transport.
Care must be take to properly encode and decode data to avoid Care must be take to properly encode and decode data to avoid
attacks. Known and avoidable risks include: attacks. Known and avoidable risks include:
* Buffer overflow attacks. Where feasible, protocols should be * Buffer overflow attacks. Where feasible, protocols should be
defined with explicit limits (via the "<" [ value ] ">" notation defined with explicit limits (via the "<" [ value ] ">" notation
instead of "<" ">") on elements with variable length data types. instead of "<" ">") on elements with variable-length data types.
Regardless of the feasibility of an explicit limit on the Regardless of the feasibility of an explicit limit on the
variable length of an element of a given protocol, decoders need variable length of an element of a given protocol, decoders need
to ensure the incoming size does not exceed the length of any to ensure the incoming size does not exceed the length of any
provisioned receiver buffers. provisioned receiver buffers.
* Nul octets embedded in an encoded value of type string. If the * Nul octets embedded in an encoded value of type string. If the
decoder's native string format uses nul terminated strings, then decoder's native string format uses nul-terminated strings, then
the apparent size of the decoded object will be less than the the apparent size of the decoded object will be less than the
amount of memory allocated for the string. Some memory amount of memory allocated for the string. Some memory
deallocation interfaces take a size argument. The caller of the deallocation interfaces take a size argument. The caller of the
deallocation interface would likely determine the size of the deallocation interface would likely determine the size of the
string by counting to the location of the nul octet, and adding string by counting to the location of the nul octet and adding
one. This discrepancy can cause memory leakage (because less one. This discrepancy can cause memory leakage (because less
memory is actually returned to the free pool than allocated), memory is actually returned to the free pool than allocated),
leading to system failure and a denial of service attack. leading to system failure and a denial of service attack.
* Decoding of characters in strings that are legal ASCII * Decoding of characters in strings that are legal ASCII
characters but nonetheless are illegal for the intended characters but nonetheless are illegal for the intended
application. For example some operating systems treat the '/' application. For example, some operating systems treat the '/'
character as a component separator in path names. For a protocol character as a component separator in path names. For a
that encodes a string in the argument to a file creation protocol that encodes a string in the argument to a file
operation, the decoder needs to ensure sure '/' is not inside creation operation, the decoder needs to ensure that '/' is not
the component name. Otherwise, a file with an illegal '/' in inside the component name. Otherwise, a file with an illegal
its name will be created, making it difficult to remove, and is '/' in its name will be created, making it difficult to remove,
therefore a denial of service attack. and is therefore a denial of service attack.
* Denial of service caused by recursive decoder or encoder * Denial of service caused by recursive decoder or encoder
subroutines. A recursive decoder or encoder might process data subroutines. A recursive decoder or encoder might process data
that has a structured type with a member of type optional data that has a structured type with a member of type optional data
that directly or indirectly refers to the structured type (i.e. that directly or indirectly refers to the structured type (i.e.,
a linked list). For example, a linked list). For example,
struct m { struct m {
int x; int x;
struct m *next; struct m *next;
}; };
An encoder or decoder subroutine might be written to recursively An encoder or decoder subroutine might be written to recursively
call itself each time another element of type "struct m" is call itself each time another element of type "struct m" is
found. An attacker could construct a long linked list of "struct found. An attacker could construct a long linked list of
m" elements in the request or response which then causes a stack "struct m" elements in the request or response, which then
overflow on the decoder or encoder. Decoders and encoders causes a stack overflow on the decoder or encoder. Decoders and
should be written non-recursively, or impose a limit on list encoders should be written non-recursively or impose a limit on
length. list length.
9. IANA Considerations 9. IANA Considerations
It is possible, if not likely, that new data types will be added to It is possible, if not likely, that new data types will be added to
XDR in the future. The process for adding new types is via a XDR in the future. The process for adding new types is via a
standards track RFC and not registration of new types with IANA. standards track RFC and not registration of new types with IANA.
Standards track RFCs that update or replace this document should be Standards track RFCs that update or replace this document should be
documented as such in the RFC Editor's database of RFCs. documented as such in the RFC Editor's database of RFCs.
10. TRADEMARKS AND OWNERS 10. Trademarks and Owners
SUN WORKSTATION Sun Microsystems, Inc. SUN WORKSTATION Sun Microsystems, Inc.
VAX Hewlett-Packard Company VAX Hewlett-Packard Company
IBM-PC International Business Machines Corporation IBM-PC International Business Machines Corporation
Cray Cray Inc. Cray Cray Inc.
NFS Sun Microsystems, Inc. NFS Sun Microsystems, Inc.
Ethernet Xerox Corporation. Ethernet Xerox Corporation.
Motorola 68000 Motorola, Inc. Motorola 68000 Motorola, Inc.
IBM 370 International Business Machines Corporation IBM 370 International Business Machines Corporation
11. ANSI/IEEE Standard 754-1985 11. ANSI/IEEE Standard 754-1985
The definition of NaNs, signed zero and infinity, and denormalized The definition of NaNs, signed zero and infinity, and denormalized
numbers from [IEEE] is reproduced here for convenience. The numbers from [IEEE] is reproduced here for convenience. The
definitions for quadruple-precision floating point numbers are definitions for quadruple-precision floating point numbers are
analogs of those for single and double-precision floating point analogs of those for single and double-precision floating point
numbers, and are defined in [IEEE]. numbers and are defined in [IEEE].
In the following, 'S' stands for the sign bit, 'E' for the exponent, In the following, 'S' stands for the sign bit, 'E' for the exponent,
and 'F' for the fractional part. The symbol 'u' stands for an and 'F' for the fractional part. The symbol 'u' stands for an
undefined bit (0 or 1). undefined bit (0 or 1).
For single-precision floating point numbers: For single-precision floating point numbers:
Type S (1 bit) E (8 bits) F (23 bits) Type S (1 bit) E (8 bits) F (23 bits)
---- --------- ---------- ----------- ---- --------- ---------- -----------
signalling NaN u 255 (max) .0uuuuu---u signalling NaN u 255 (max) .0uuuuu---u
skipping to change at page 25, line 5 skipping to change at page 25, line 31
Subnormal numbers are represented as follows: Subnormal numbers are represented as follows:
Precision Exponent Value Precision Exponent Value
--------- -------- ----- --------- -------- -----
Single 0 (-1)**S * 2**(-126) * 0.F Single 0 (-1)**S * 2**(-126) * 0.F
Double 0 (-1)**S * 2**(-1022) * 0.F Double 0 (-1)**S * 2**(-1022) * 0.F
Quadruple 0 (-1)**S * 2**(-16382) * 0.F Quadruple 0 (-1)**S * 2**(-16382) * 0.F
12. NORMATIVE REFERENCES 12. Normative References
[IEEE] "IEEE Standard for Binary Floating-Point Arithmetic", [IEEE] "IEEE Standard for Binary Floating-Point Arithmetic",
ANSI/IEEE Standard 754-1985, Institute of Electrical and ANSI/IEEE Standard 754-1985, Institute of Electrical and
Electronics Engineers, August 1985. Electronics Engineers, August 1985.
13. INFORMATIVE REFERENCES 13. Informative References
[KERN] Brian W. Kernighan & Dennis M. Ritchie, "The C Programming [KERN] Brian W. Kernighan & Dennis M. Ritchie, "The C Programming
Language", Bell Laboratories, Murray Hill, New Jersey, 1978. Language", Bell Laboratories, Murray Hill, New Jersey, 1978.
[COHE] Danny Cohen, "On Holy Wars and a Plea for Peace", IEEE [COHE] Danny Cohen, "On Holy Wars and a Plea for Peace", IEEE
Computer, October 1981. Computer, October 1981.
[COUR] "Courier: The Remote Procedure Call Protocol", XEROX [COUR] "Courier: The Remote Procedure Call Protocol", XEROX
Corporation, XSIS 038112, December 1981. Corporation, XSIS 038112, December 1981.
[SPAR] "The SPARC Architecture Manual: Version 8", Prentice Hall, [SPAR] "The SPARC Architecture Manual: Version 8", Prentice Hall,
ISBN 0-13-825001-4. ISBN 0-13-825001-4.
[HPRE] "HP Precision Architecture Handbook", June 1987, 5954-9906. [HPRE] "HP Precision Architecture Handbook", June 1987, 5954-9906.
14. Editor's Address 14. Acknowledgements
Bob Lyon was Sun's visible force behind ONC RPC in the 1980s. Sun
Microsystems, Inc., is listed as the author of RFC 1014. Raj
Srinivasan and the rest of the old ONC RPC working group edited RFC
1014 into RFC 1832, from which this document is derived. Mike Eisler
and Bill Janssen submitted the implementation reports for this
standard. Kevin Coffman, Benny Halevy, and Jon Peterson reviewed
this document and gave feedback. Peter Astrand and Bryan Olson
pointed out several errors in RFC 1832 which are corrected in this
document.
Editor's Address
Mike Eisler Mike Eisler
5765 Chase Point Circle 5765 Chase Point Circle
Colorado Springs, CO 80919 Colorado Springs, CO 80919
USA USA
Phone: 719-599-9026 Phone: 719-599-9026
EMail: mike.ietf.xdr@eisler.com EMail: email2mre-rfc4506@yahoo.com
Please address comments to: nfsv4@ietf.org Please address comments to: nfsv4@ietf.org
15. Acknowledgements Full Copyright Statement
Bob Lyon was Sun's visible force behind ONC RPC in the 1980s. Sun Copyright (C) The Internet Society (2006).
Microsystems, Inc. is listed as the author of RFC1014, which RFC1832
was heavily derived from. Raj Srinivasan in turn edited RFC1014 into
RFC1832. Raj and the rest of the old ONC RPC working group produced
RFC1832 from which this document is derived. Mike Eisler and Bill
Janssen submitted the implementation reports for this standard. Kevin
Coffman, Benny Halevy, and Jon Peterson reviewed this document and
gave feedback. Peter Astrand and Bryan Olson pointed out several
errors in RFC1832 which are corrected in this document.
16. IPR Notices This document is subject to the rights, licenses and restrictions
contained in BCP 78, and except as set forth therein, the authors
retain all their rights.
This document and the information contained herein are provided on an
"AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Intellectual Property
The IETF takes no position regarding the validity or scope of any The IETF takes no position regarding the validity or scope of any
intellectual property or other rights that might be claimed to Intellectual Property Rights or other rights that might be claimed to
pertain to the implementation or use of the technology described in pertain to the implementation or use of the technology described in
this document or the extent to which any license under such rights this document or the extent to which any license under such rights
might or might not be available; neither does it represent that it might or might not be available; nor does it represent that it has
has made any effort to identify any such rights. Information on the made any independent effort to identify any such rights. Information
IETF's procedures with respect to rights in standards-track and on the procedures with respect to rights in RFC documents can be
standards-related documentation can be found in BCP-11. Copies of found in BCP 78 and BCP 79.
claims of rights made available for publication and any assurances of
licenses to be made available, or the result of an attempt made to Copies of IPR disclosures made to the IETF Secretariat and any
obtain a general license or permission for the use of such assurances of licenses to be made available, or the result of an
proprietary rights by implementors or users of this specification can attempt made to obtain a general license or permission for the use of
be obtained from the IETF Secretariat. such proprietary rights by implementers or users of this
specification can be obtained from the IETF on-line IPR repository at
http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention any The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary copyrights, patents or patent applications, or other proprietary
rights which may cover technology that may be required to practice rights that may cover technology that may be required to implement
this standard. Please address the information to the IETF Executive this standard. Please address the information to the IETF at
Director. ietf-ipr@ietf.org.
17. Copyright Notice
Copyright (C) The Internet Society (2005). This document is subject Acknowledgement
to the rights, licenses and restrictions contained in BCP 78, and
except as set forth therein, the authors retain all their rights.
This document and the information contained herein are provided on an Funding for the RFC Editor function is provided by the IETF
"AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS Administrative Support Activity (IASA).
OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
 End of changes. 81 change blocks. 
204 lines changed or deleted 203 lines changed or added

This html diff was produced by rfcdiff 1.31. The latest version is available from http://www.levkowetz.com/ietf/tools/rfcdiff/