Visual RFC.
ALL RFCs / RFC 4506
Read the RFC ↗
RFC 4506 / External data representation

Compose arrays and structures in declaration order

04

Array counts refer to elements. Each element is already an XDR value; structure fields follow their declaration order.

RFC 4506 · § 4.12EXAMPLE
4 / 4
Compose arrays and structures in declaration orderFixed two-string array has8-byte cat and12-byte picnic encodings, shown proportionately8:12. Each element has its own byte count/pad; no array-count prefix.Compose encoded values in the declared orderFixed array of two strings: cat, picniccat: 8bytespicnic: 12bytesEach element has its own count and paddingArray has no additional element countSame type does not mean same encoded sizeEach component is already an XDR value
04
Keep each element’s own encoding

The fixed array has two elements with different encoded sizes. The geometric spans are8:12 bytes and each string retains its own count/padding.

Source for this drawing: RFC 4506 · Read RFC section 4.12 ↗

Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
New to this? Start hereA quick picture + helpful background

First, agree how to read the message.

An encoding tells a reader how to interpret bytes. A format tells it how values fit together. Correctly reading a value does not make that value trustworthy.

Helpful first, if these ideas are unfamiliar

These pictures are analogies to help you learn. The linked RFC explains the actual rules.

Related RFCs and changes

“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.

KEY POINT

Do not confuse an array element count with a byte length or native structure padding.

  • A fixed-length array encodes its elements in natural order without adding an array count. Each element’s encoding occupies a multiple of four bytes. unsigned int values[3] holding7,8,9 therefore occupies twelve bytes (§4.12).
  • A variable-length array begins with a four-byte unsigned ELEMENT count. unsigned int values<4> holding the same three values carries count 3, then7,8,9: sixteen bytes total. The count is 3, not twelve payload bytes, and it cannot exceed the declared element bound (§4.13).
  • A structure encodes components in declaration order. For the illustrative struct record { unsigned int id; string label<8>; }, id 7 precedes the encoded string cat. The twelve encoded bytes contain no field-name strings and no extra padding copied from a C compiler’s native layout (§4.14).
  • An array’s elements have the same declared type but may have different encoded lengths. A fixed two-element string array containing cat and picnic uses8 bytes for the first counted string and 12 for the second: twenty total, with no array count. Each string has its own byte count and residual padding (§§4.11–4.12).
  • The bounded helpers compose already encoded values; they are not a full type checker or an XDR schema compiler. Type aliases and symbolic constants affect descriptions but do not themselves insert bytes. The next chapters distinguish selected union arms, void and optional data (§§4.16–4.19).
DETAILS

Illustrative values and bounded offline encoding/decoding models. Not a complete XDR compiler, RPC/NFS implementation, transport, memory allocator or security verifier.

Read the RFC section ↗

All chapters in RFC 4506

Drawing view

Scroll the drawing to see every part. Playback controls stay above it.

RFC 9700 / CHAPTERS

Chapters

For full details, tables, algorithms, and exceptions, read the original RFC.

RFC status and corrections ↗