メインコンテンツまでスキップ

17. Packet Formats

17. Packet Formats

All numeric values are encoded in network byte order (that is, big-endian) and all field sizes are in bits. Hexadecimal notation is used for describing the value of fields.

17.1 Packet Number Encoding and Decoding

Packet numbers are integers in the range 0 to 2^62-1 (Section 12.3). When present in a packet, they are encoded in 1 to 4 bytes. The number of bits required to represent the packet number is reduced by including only the least significant bits of the packet number.

The encoded packet number is protected as described in Section 5.4 of [QUIC-TLS].

The sender MUST use a packet number size able to represent more than twice as large a range as the difference between the largest acknowledged packet number and the packet number being sent. A peer receiving the packet will then correctly decode the packet number, unless the packet is delayed in transit such that it arrives after many higher-numbered packets have been received.

As a result, the size of the packet number encoding is at least one more than the base-2 logarithm of the number of contiguous unacknowledged packet numbers, including the new packet.

17.2 Long Header Packets

Long headers are used for packets that are sent prior to the establishment of 1-RTT keys. Once 1-RTT keys are available, a sender switches to sending packets using the short header (Section 17.3). The long form allows for special packets -- such as the Version Negotiation packet -- to be represented in this uniform fixed-length packet format.

Packets with long headers are identified by the Header Form bit being set to 1.

17.2.1 Version Negotiation Packet

A Version Negotiation packet is inherently not version-specific. Upon receipt by a client, it will be identified as a Version Negotiation packet based on the Version field having a value of 0.

17.2.2 Initial Packet

An Initial packet uses long headers with a type value of 0x00. It carries the first CRYPTO frames sent by the client and server to perform key exchange, and it carries ACK frames in either direction.

17.2.3 0-RTT

A 0-RTT packet uses long headers with a type value of 0x01. A 0-RTT packet has a packet number space (Section 12.3) of ApplicationData.

17.2.4 Handshake Packet

A Handshake packet uses long headers with a type value of 0x02. It is used to carry cryptographic handshake messages and acknowledgments from the server and client.

17.2.5 Retry Packet

A Retry packet uses a long packet header with a type value of 0x03. It carries an address validation token created by the server. It is used by a server that wishes to perform a retry (see Section 8.1).

17.3 Short Header Packets

This version of QUIC defines a single packet type that uses the short packet header.

17.3.1 1-RTT Packet

A 1-RTT packet uses a short packet header. It is used after the version and 1-RTT keys are negotiated.

17.4 Latency Spin Bit

The latency spin bit, located at bit 0x20 of the short header, enables passive latency monitoring from observation points on the network path. The spin bit is only present in the short packet header, since it is possible to measure the initial RTT of a connection by observing the handshake. Therefore, the spin bit is available after version negotiation and connection establishment are completed.