RFC 4506 / START HERE
XDR typed binary data, before the details
XDR means External Data Representation. It defines a language for describing data types and an encoding for their values.
An encoder and decoder agree on a shared description, or schema. XDR gives numbers, byte strings, arrays and structures a common layout across different computers: big-endian numbers and values aligned to four-byte units. It is a data representation, not a transport or authentication protocol.
The idea in one picture
Value types
Four-byte units
Read values
A simplified picture of the idea; the chapters explain the actual mechanisms.
Why it exists
RFC 4506 is the May 2006 Internet Standard, STD 67. It replaces RFC 1832 without technical encoding changes, adding security and IANA discussion and clearer reference categories. XDR underlies formats used by ONC RPC and NFS; it does not copy a C program’s memory layout onto a network.
A familiar example
Imagine a fictional program sending a record containing an identifier and a short label to a different kind of computer. Both sides use the same type description, follow counts and padding, and check bounds before using the data. Correct decoding alone does not make a filename safe or authorize an operation.
Helpful background
You can start here without reading another RFC. If these ideas are unfamiliar, these short introductions may help.
What you’ll learn next
Begin with chapter one, or choose a topic.
- Agree on types and four-byte unitsA shared data description gives byte sequences their meaning. XDR uses a common byte order and four-byte alignment across machines.→
- Interpret scalar values using their declared typesSignedness, legal enum values and floating-point layout come from the data description. A boolean is a four-byte enum, not one byte.→
- Encode opaque bytes and counted ASCII stringsFixed opaque data has no count prefix. Variable opaque data and strings have a four-byte byte count, then payload and residual zero padding.→
- Compose arrays and structures in declaration orderArray counts refer to elements. Each element is already an XDR value; structure fields follow their declaration order.→
- Select one union arm or optional valueA discriminant comes first and selects one arm. Optional data encodes presence, not a native pointer address.→
- Decode with bounds and application checksA valid representation is not authorization, a safe native string or a guarantee that all of its bytes have arrived.→
This introduction explains RFC 4506 (2006). Read the original RFC ↗