Skip to main content

12. Packets and Frames

12. Packets and Frames

QUIC endpoints communicate by exchanging packets. Packets have confidentiality and integrity protection (see Section 12.1) and are carried in UDP datagrams (see Section 14).

This version of QUIC uses the long packet header (Section 17.2) during connection establishment. Packets with the long header are Initial (Section 17.2.2), 0-RTT (Section 17.2.3), Handshake (Section 17.2.4), and Retry (Section 17.2.5). Version negotiation uses a version-independent packet with a long header (Section 17.2.1).

Packets with the short header (Section 17.3) are designed for minimal overhead and are used after a connection is established and 1-RTT keys are available.

12.1 Protected Packets

QUIC packets have different levels of cryptographic protection based on the type of packet. Section 17 provides an overview of packet types and their levels of protection.

12.2 Coalescing Packets

Initial (Section 17.2.2), 0-RTT (Section 17.2.3), and Handshake (Section 17.2.4) packets contain a Length field, which determines the end of the packet. The length includes both the Packet Number and Payload fields, both of which are confidential and initially unknown. The length of the Payload field is learned once packet protection is removed.

Using the Length field, a sender can coalesce multiple QUIC packets into one UDP datagram. This can reduce the number of UDP datagrams needed to complete the cryptographic handshake and start sending data. Recipients MUST be able to process coalesced packets.

12.3 Packet Numbers

Packet numbers are integers in the range 0 to 2^62-1. Packet numbers are divided into three spaces in QUIC:

  • Initial space: All Initial packets (Section 17.2.2) are in this space.
  • Handshake space: All Handshake packets (Section 17.2.4) are in this space.
  • Application data space: All 0-RTT (Section 17.2.3) and 1-RTT (Section 17.3.1) packets are in this space.

Packet numbers in each space start at packet number 0. Subsequent packets sent in the same packet number space MUST increase the packet number by at least one.

12.4 Frames and Frame Types

The payload of QUIC packets, after removing packet protection, consists of a sequence of complete frames, as shown in Figure 13. Version Negotiation, Stateless Reset, and Retry packets do not contain frames.

Packet Payload {
Frame (8..),
...
}

Figure 13: QUIC Payload

The payload of a packet that contains frames MUST contain at least one frame, and MAY contain multiple frames and multiple frame types. An endpoint MUST treat receipt of a packet containing no frames as a connection error of type PROTOCOL_VIOLATION. Frames always fit within a single QUIC packet and cannot span multiple packets.

Each frame begins with a Frame Type, indicating its type, followed by additional type-dependent fields:

Frame {
Frame Type (i),
Type-Dependent Fields (..),
}

Figure 14: Generic Frame Layout

12.5 Frames and Number Spaces

Some frames are prohibited in different packet number spaces. The rules for which frames may appear in which packet types are described in Section 17 and summarized in Table 3.

Frame TypeInitial0-RTTHandshake1-RTT
PADDINGYYYY
PINGYYYY
ACKY-YY
RESET_STREAM-Y-Y
STOP_SENDING-Y-Y
CRYPTOY-YY
NEW_TOKEN---Y
STREAM-Y-Y
MAX_DATA-Y-Y
MAX_STREAM_DATA-Y-Y
MAX_STREAMS-Y-Y
DATA_BLOCKED-Y-Y
STREAM_DATA_BLOCKED-Y-Y
STREAMS_BLOCKED-Y-Y
NEW_CONNECTION_ID-Y-Y
RETIRE_CONNECTION_ID---Y
PATH_CHALLENGE-Y-Y
PATH_RESPONSE---Y
CONNECTION_CLOSEYYYY
HANDSHAKE_DONE---Y

Table 3: Frames and Packet Number Spaces