@@ -52,7 +52,7 @@ normative:
52
52
org : Mozilla
53
53
role : editor
54
54
-
55
- ins : S. Turner, Ed.
55
+ ins : S. Turner
56
56
name : Sean Turner
57
57
org : sn3rd
58
58
role : editor
@@ -475,8 +475,8 @@ The fields in a Regular packet past the Common Header are the following:
475
475
476
476
* Packet Number: The lower 8, 16, 32, or 48 bits of the packet number, based on
477
477
the PACKET_NUMBER_SIZE flag. Each Regular packet is assigned a packet number
478
- by the sender. The first packet sent by an endpoint MUST have a packet number
479
- of 1 .
478
+ by the sender. The first packet number is randomized (see
479
+ {{initial-packet-number}} .
480
480
481
481
* Encrypted Payload: The remainder of a Regular packet is both authenticated and
482
482
encrypted once packet protection keys are available. {{QUIC-TLS}} describes
@@ -535,6 +535,17 @@ at any point in the connection. In other words,
535
535
536
536
(TODO : Clarify how packet number size can change mid-connection.)
537
537
538
+
539
+ # ## Initial Packet Number
540
+
541
+ The initial value for packet number MUST be a 31-bit random number. That is,
542
+ the value is selected from an uniform random distribution between 0 and 2^31-1.
543
+
544
+ The first set of packets sent by an endpoint MUST include the low 32-bits of the
545
+ packet number. Once any packet has been acknowledged, subsequent packets can
546
+ use a shorter packet number encoding.
547
+
548
+
538
549
# ## Frames and Frame Types {#frames}
539
550
540
551
A Regular packet MUST contain at least one frame, and MAY contain multiple
@@ -920,28 +931,29 @@ A STREAM frame is shown below.
920
931
0 1 2 3
921
932
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
922
933
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
934
+ | [Data Length (16)] |
935
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
923
936
| Stream ID (8/16/24/32) ...
924
937
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
925
938
| Offset (0/16/24/32/40/48/56/64) ...
926
939
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
927
- | [Data Length (16)] |
928
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
929
940
| Stream Data (*) ...
930
941
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
931
942
~~~
932
943
{: # stream-format title="STREAM Frame Format"}
933
944
934
945
The STREAM frame contains the following fields :
935
946
947
+ * Data Length: An optional 16-bit unsigned number specifying the length of the
948
+ Stream Data field in this STREAM frame. This field is present when the `D`
949
+ bit is set to 1.
950
+
936
951
* Stream ID: A variable-sized unsigned ID unique to this stream.
937
952
938
953
* Offset: A variable-sized unsigned number specifying the byte offset in the
939
954
stream for the data in this STREAM frame. The first byte in the stream has an
940
955
offset of 0.
941
956
942
- * Data Length: An optional 16-bit unsigned number specifying the length of the
943
- Stream Data field in this STREAM frame.
944
-
945
957
* Stream Data: The bytes from the designated stream to be delivered.
946
958
947
959
A STREAM frame MUST have either non-zero data length or the FIN bit set.
@@ -1007,36 +1019,36 @@ An ACK frame is shown below.
1007
1019
0 1 2 3
1008
1020
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
1009
1021
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1010
- | Largest Acked (8/16/32/48) ...
1022
+ |[Num Blocks(8)]| NumTS (8) | Largest Acked (8/16/32/48) ...
1011
1023
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1012
1024
| Ack Delay (16) |
1013
1025
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1014
- |[Num Blocks(8)]| Ack Block Section (*) ...
1026
+ | Ack Block Section (*) ...
1015
1027
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1016
- | NumTS (8) | Timestamp Section (*) ...
1028
+ | Timestamp Section (*) ...
1017
1029
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1018
1030
~~~
1019
1031
{: # ack-format title="ACK Frame Format"}
1020
1032
1021
1033
The fields in the ACK frame are as follows :
1022
1034
1035
+ * Num Blocks (opt): An optional 8-bit unsigned value specifying the number of
1036
+ additional ack blocks (besides the required First Ack Block) in this ACK
1037
+ frame. Only present if the 'N' flag bit is 1.
1038
+
1039
+ * Num Timestamps: An unsigned 8-bit number specifying the total number of
1040
+ <packet number, timestamp> pairs in the Timestamp Section.
1041
+
1023
1042
* Largest Acked: A variable-sized unsigned value representing the largest packet
1024
1043
number the peer is acking in this packet (typically the largest that the peer
1025
1044
has seen thus far.)
1026
1045
1027
1046
* Ack Delay: Time from when the largest acked packet, as indicated in the
1028
1047
Largest Acked field, was received by this peer to when this ack was sent.
1029
1048
1030
- * Num Blocks (opt): An optional 8-bit unsigned value specifying the number of
1031
- additional ack blocks (besides the required First Ack Block) in this ACK
1032
- frame. Only present if the 'N' flag bit is 1.
1033
-
1034
1049
* Ack Block Section: Contains one or more blocks of packet numbers which have
1035
1050
been successfully received. See {{ack-block-section}}.
1036
1051
1037
- * Num Timestamps: An unsigned 8-bit number specifying the total number of
1038
- <packet number, timestamp> pairs in the Timestamp Section.
1039
-
1040
1052
* Timestamp Section: Contains zero or more timestamps reporting transit delay of
1041
1053
received packets. See {{timestamp-section}}.
1042
1054
@@ -1387,9 +1399,7 @@ bundle any set of frames in a packet. All QUIC packets MUST contain a packet
1387
1399
number and MAY contain one or more frames ({{frames}}). Packet numbers MUST be
1388
1400
unique within a connection and MUST NOT be reused within the same connection.
1389
1401
Packet numbers MUST be assigned to packets in a strictly monotonically
1390
- increasing order. The initial packet number used, at both the client and the
1391
- server, MUST be 0. That is, the first packet in both directions of the
1392
- connection MUST have a packet number of 0.
1402
+ increasing order.
1393
1403
1394
1404
A sender SHOULD minimize per-packet bandwidth and computational costs by
1395
1405
bundling as many frames as possible within a QUIC packet. A sender MAY wait for
@@ -1532,8 +1542,8 @@ shown in the following figure and described below.
1532
1542
1533
1543
app: application API signals to QUIC
1534
1544
reserve_stream: causes a StreamID to be reserved for later use
1535
- read_close: causes stream to be half-closed without receiving a FIN
1536
- write_close: causes stream to be half-closed without sending a FIN
1545
+ read_close: causes stream to be half-closed without a FIN
1546
+ write_close: causes stream to be half-closed without a FIN
1537
1547
~~~
1538
1548
{: #stream-lifecycle title="Lifecycle of a stream"}
1539
1549
@@ -1708,6 +1718,15 @@ receives a STREAM frame that causes its advertised concurrent stream limit to be
1708
1718
exceeded MUST treat this as a stream error of type QUIC_TOO_MANY_OPEN_STREAMS
1709
1719
({{error-handling}}).
1710
1720
1721
+ All streams, including stream 1, count toward this limit. Thus, a concurrent
1722
+ stream limit of 0 will cause a connection to be unusable. Application protocols
1723
+ that use QUIC might require a certain minimum number of streams to function
1724
+ correctly. If a peer advertises an MSPC value that is too small for the
1725
+ selected application protocol to function, an endpoint MUST terminate the
1726
+ connection with an error of type QUIC_TOO_MANY_OPEN_STREAMS
1727
+ ({{error-handling}}).
1728
+
1729
+
1711
1730
## Sending and Receiving Data
1712
1731
1713
1732
Once a stream is created, endpoints may use the stream to send and receive data.
0 commit comments