Visual RFC.
ALL RFCs / RFC 8489
Read the RFC ↗
RFC 8489 / PROTOCOL MECHANISMS

Parse the STUN header and attributes

03

A 20-byte header contains type, message length, magic cookie, and transaction ID, followed by padded attributes.

Related RFCs and changes

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

DIAGRAM§ 5 ↗
RFC 8489 · § 5EXAMPLE
3 / 3
Parse the STUN header and attributesA 20-byte header contains type, message length, magic cookie, and transaction ID, followed by padded attributes.20-BYTE STUN HEADER · SCHEMATICtype / length0x2112A44296-bit transaction IDtypelengthattribute datapadNext attribute starts after alignment paddingAttribute length excludes its padding
03
Skip its padding before reading the next attribute.

Skip its padding before reading the next attribute.

Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
KEY POINT

The magic cookie is 0x2112A442; the leading message bits distinguish the format.

  • The magic cookie is 0x2112A442; the leading message bits distinguish the format.
  • Attribute lengths exclude padding; alignment still affects where the next attribute begins.
DETAILS

The drawing is a simplified worked example. Follow the linked RFC and its updates for implementation requirements.

Read the RFC section ↗

Diagrams simplify the RFC. Read the linked sections for complete requirements.

Privacy
All chapters in this RFC
  1. Learn the server-observed address
  2. Match a response to its transaction
  3. Parse the STUN header and attributes
  4. Use credentials for message integrity
  5. Separate discovery from connectivity and privacy
RFC 9700 / CHAPTERS

Chapters

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

RFC status and corrections ↗