QUIC endpoints exchange UDP datagrams that contain one or more QUIC packets. This section describes the invariant characteristics of a QUIC packet. A version of QUIC could permit multiple QUIC packets in a single UDP datagram, but the invariant properties only describe the first packet in a datagram.
QUIC defines two types of packet headers: long and short. Packets with a long header are identified by the most significant bit of the first byte being set; packets with a short header have that bit cleared.
QUIC packets might be integrity protected, including the header. However, QUIC Version Negotiation packets are not integrity protected; see
Section 6.
Aside from the values described here, the payload of QUIC packets is version specific and of arbitrary length.
Long headers take the form described in
Figure 2.
Long Header Packet {
Header Form (1) = 1,
Version-Specific Bits (7),
Version (32),
Destination Connection ID Length (8),
Destination Connection ID (0..2040),
Source Connection ID Length (8),
Source Connection ID (0..2040),
Version-Specific Data (..),
}
A QUIC packet with a long header has the high bit of the first byte set to 1. All other bits in that byte are version specific.
The next four bytes include a 32-bit Version field. Versions are described in
Section 5.4.
The next byte contains the length in bytes of the Destination Connection ID field that follows it. This length is encoded as an 8-bit unsigned integer. The Destination Connection ID field follows the Destination Connection ID Length field and is between 0 and 255 bytes in length. Connection IDs are described in
Section 5.3.
The next byte contains the length in bytes of the Source Connection ID field that follows it. This length is encoded as an 8-bit unsigned integer. The Source Connection ID field follows the Source Connection ID Length field and is between 0 and 255 bytes in length.
The remainder of the packet contains version-specific content.
Short headers take the form described in
Figure 3.
Short Header Packet {
Header Form (1) = 0,
Version-Specific Bits (7),
Destination Connection ID (..),
Version-Specific Data (..),
}
A QUIC packet with a short header has the high bit of the first byte set to 0.
A QUIC packet with a short header includes a Destination Connection ID immediately following the first byte. The short header does not include the Destination Connection ID Length, Source Connection ID Length, Source Connection ID, or Version fields. The length of the Destination Connection ID is not encoded in packets with a short header and is not constrained by this specification.
The remainder of the packet has version-specific semantics.
A connection ID is an opaque field of arbitrary length.
The primary function of a connection ID is to ensure that changes in addressing at lower protocol layers (UDP, IP, and below) do not cause packets for a QUIC connection to be delivered to the wrong QUIC endpoint. The connection ID is used by endpoints and the intermediaries that support them to ensure that each QUIC packet can be delivered to the correct instance of an endpoint. At the endpoint, the connection ID is used to identify the QUIC connection for which the packet is intended.
The connection ID is chosen by each endpoint using version-specific methods. Packets for the same QUIC connection might use different connection ID values.
The Version field contains a 4-byte identifier. This value can be used by endpoints to identify a QUIC version. A Version field with a value of 0x00000000 is reserved for version negotiation; see
Section 6. All other values are potentially valid.
The properties described in this document apply to all versions of QUIC. A protocol that does not conform to the properties described in this document is not QUIC. Future documents might describe additional properties that apply to a specific QUIC version or to a range of QUIC versions.