Summary
- XDR moved agreement away from native memory layouts and into one external, most-significant-byte-first representation built on four-byte units.
- A variable value carried its own count; zero fill restored alignment but did not belong to the value, and had to remain zero so equal values had equal encodings.
- The schema fixed field order and union branches, while framing, authentication, authorization and application meaning remained with other layers.
Three zero octets held the boundary
The worked file example in RFC 4506 begins with a nine-byte filename. XDR writes a four-byte count, the nine filename bytes and then three zero octets. The next field begins on the following four-byte boundary.
Those last three octets are physically present, but they are not characters in the filename. They do not increase its count. They carry no application content. Yet an encoder may not use them as convenient spare space: XDR requires zero fill. The reason is stronger than neat alignment. If one machine filled the gap with memory residue and another used different residue, the same value would acquire different byte representations. Comparison and checksumming would cease to be deterministic.
The blank bytes expose the whole design. Interoperability was not achieved by pretending that every computer arranged memory alike. It came from defining exactly which differences had to disappear at the external boundary.
Native layouts stopped at the encoder
RFC 1014, published in 1987, introduced XDR as a language for describing and encoding data exchanged among architectures as different as workstations, PCs, VAX systems and Cray machines. Sun RPC and NFS were already named users. The description language resembled C, but it was not a programming language and did not transmit a machine's in-memory structure.
An XDR signed integer occupies 32 bits in two's-complement form, with the most significant byte first. Arrays follow natural order. Structure components follow declaration order. The endpoint can keep any convenient native representation internally, but the encoder must surrender that private choice before emitting bytes, and the decoder must rebuild a local object from the shared form.
There is no endian flag at the front. XDR chose one order. Its own discussion acknowledges that one canonical order imposes more conversion on some machines. The gain is that no higher protocol must first negotiate which representation follows. An XDR object stored on media can retain its interpretation after the negotiation context has vanished.
The four-byte unit was also a choice, not a law of nature. Smaller units could reduce padding but fit fewer alignment requirements; larger units could ease alignment on more architectures while inflating the encoding. Four was the selected compromise.
A count separated data from representation
Fixed opaque data has a size supplied by the schema. Variable opaque data carries a 32-bit unsigned count followed by exactly that many arbitrary bytes and enough zero fill to reach the grid. Strings use the same counted shape. A variable array carries an element count, then the elements in order.
This gives a decoder evidence it can test locally. It can compare a count with the maximum declared by the protocol, confirm that enough bytes remain and calculate the next aligned position. A declaration such as a bounded opaque value makes an over-limit encoding invalid. Omitting a schema maximum does not compel a receiver to reserve the language's theoretical limit; the receiver still owns its memory and work limits.
Count, allocation and meaning must remain separate. A counted XDR string can contain a NUL octet even when a local language treats NUL as the end of a string. Trusting one convention while allocating under the other can make parsing, comparison and deallocation disagree. Canonical bytes remove architectural ambiguity only where the schema actually defines it.
The discriminant granted one arm permission to exist
XDR uses implicit typing: ordinary values do not carry a field name and universal type tag beside every component. Both sides must already share the declaration. That makes declaration order constitutional. Reordering two fields in a durable schema is not cosmetic; it changes the type assigned to later bytes.
A discriminated union makes one branch choice explicit. It encodes a discriminant first and then the selected arm. If the declaration has no default arm, an unlisted discriminant has no valid encoding. Optional data is the compact example: a Boolean says whether an element follows; false selects a zero-byte void. Absence is proved by the branch selector, not guessed from an empty payload.
The discriminant has narrow authority. It chooses a type branch inside the agreed schema. It does not authorize a remote procedure, authenticate the sender or prove that the chosen contents are sensible.
Representation never became a record or a verdict
RFC 1832 moved the deployed format onto the Standards Track in 1995. Eleven years later, RFC 4506 became STD 67 and explicitly made no technical change to that wire contract. It added IANA treatment, reference discipline and the security guidance that the earlier text lacked. The longevity belongs to the representation, not to a claim that every decoder was safe.
RFC 5531 shows the boundary cleanly. ONC RPC messages are described in XDR, but RPC over TCP needs a separate record-marking layer to delimit messages in a byte stream. Its fragment header is explicitly not XDR standard form. Successfully decoding one XDR value therefore does not prove where an arbitrary TCP message ends, which call owns it or whether an operation committed.
XDR also supplies no authentication, confidentiality, authorization or replay protection. Its 2006 security section instead places concrete duties on protocols and decoders: bound variable values, reconcile counted strings with native conventions and limit recursive structures. A canonical grammar can make malformed input recognizable; it cannot force software to reject it safely.
Sources and limits
The closed record is RFC 1014, RFC 1832, RFC 4506 and RFC 5531. Together they establish the encoding, revision history, rationale, documented RPC/NFS relationship and record-layer boundary. They do not measure current use, certify a product, describe a captured packet or turn representation agreement into agreement about policy or truth.
Member Briefing
Deeper Profile Context
Sign in with the right membership level to unlock the full briefing and source notes.
Only for Strategic Circle
Strategic Circle
Open to all readers. Unlock profile briefings after joining and signing in.
Join Strategic CircleOnly for Leadership Alliance
Leadership Alliance
For qualified IP-asset owners and management; sign in to unlock alliance briefings.
Join Leadership Alliance
