blob: 258cf02fb869d37c5ee0072837c00615ba26df94 [file] [log] [blame]
[email protected]8b37a092012-10-18 21:53:491// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef NET_QUIC_QUIC_PROTOCOL_H_
6#define NET_QUIC_QUIC_PROTOCOL_H_
7
[email protected]e537f742012-12-07 15:33:538#include <stddef.h>
[email protected]8b37a092012-10-18 21:53:499#include <limits>
rtenneti4b06ae72014-08-26 03:43:4310#include <list>
[email protected]a674b4c2012-12-05 03:44:3011#include <map>
[email protected]5640d0a2012-10-22 18:17:0212#include <ostream>
[email protected]e537f742012-12-07 15:33:5313#include <set>
14#include <string>
[email protected]8b37a092012-10-18 21:53:4915#include <utility>
16#include <vector>
17
18#include "base/basictypes.h"
[email protected]14c1c232013-06-11 17:52:4419#include "base/containers/hash_tables.h"
[email protected]8b37a092012-10-18 21:53:4920#include "base/logging.h"
[email protected]d069c11a2013-04-13 00:01:5521#include "base/strings/string_piece.h"
[email protected]165e0752012-11-16 07:49:4422#include "net/base/int128.h"
[email protected]79d13dcb2014-02-05 07:23:1323#include "net/base/ip_endpoint.h"
[email protected]8b37a092012-10-18 21:53:4924#include "net/base/net_export.h"
[email protected]5dafdb62013-11-14 01:24:2625#include "net/quic/iovector.h"
[email protected]fee17f72013-02-03 07:47:4126#include "net/quic/quic_bandwidth.h"
[email protected]2a960e02012-11-11 14:48:1027#include "net/quic/quic_time.h"
[email protected]8b37a092012-10-18 21:53:4928
29namespace net {
30
[email protected]97cf3022013-09-05 14:30:1631class QuicAckNotifier;
[email protected]8b37a092012-10-18 21:53:4932class QuicPacket;
[email protected]b064310782013-05-30 21:12:1733struct QuicPacketHeader;
[email protected]8b37a092012-10-18 21:53:4934
[email protected]3aa9ca72014-02-27 19:39:4335typedef uint64 QuicConnectionId;
[email protected]8b37a092012-10-18 21:53:4936typedef uint32 QuicStreamId;
37typedef uint64 QuicStreamOffset;
38typedef uint64 QuicPacketSequenceNumber;
[email protected]c995c572013-01-18 05:43:2039typedef QuicPacketSequenceNumber QuicFecGroupNumber;
[email protected]86a318d2013-01-23 21:16:0440typedef uint64 QuicPublicResetNonceProof;
[email protected]9db443912013-02-25 05:27:0341typedef uint8 QuicPacketEntropyHash;
[email protected]c244c5a12013-05-07 20:55:0442typedef uint32 QuicHeaderId;
[email protected]2532de12013-05-09 12:29:3343// QuicTag is the type of a tag in the wire protocol.
44typedef uint32 QuicTag;
45typedef std::vector<QuicTag> QuicTagVector;
[email protected]79d13dcb2014-02-05 07:23:1346typedef std::map<QuicTag, std::string> QuicTagValueMap;
[email protected]497bfb22014-01-08 01:28:0347// TODO(rtenneti): Didn't use SpdyPriority because SpdyPriority is uint8 and
48// QuicPriority is uint32. Use SpdyPriority when we change the QUIC_VERSION.
[email protected]8edeb8d2013-08-28 06:11:4349typedef uint32 QuicPriority;
[email protected]cff7b7b2013-01-11 08:49:0750
[email protected]8b37a092012-10-18 21:53:4951// TODO(rch): Consider Quic specific names for these constants.
[email protected]8e01c062013-10-31 07:35:3152// Default and initial maximum size in bytes of a QUIC packet.
[email protected]310d37b2014-08-02 06:15:3753const QuicByteCount kDefaultMaxPacketSize = 1350;
[email protected]8e01c062013-10-31 07:35:3154// The maximum packet size of any QUIC packet, based on ethernet's max size,
[email protected]41fb6372013-12-10 05:26:4055// minus the IP and UDP headers. IPv6 has a 40 byte header, UPD adds an
56// additional 8 bytes. This is a total overhead of 48 bytes. Ethernet's
57// max packet size is 1500 bytes, 1500 - 48 = 1452.
58const QuicByteCount kMaxPacketSize = 1452;
[email protected]ce7bb1412014-05-17 15:51:3359// Default maximum packet size used in Linux TCP implementations.
60const QuicByteCount kDefaultTCPMSS = 1460;
[email protected]8e01c062013-10-31 07:35:3161
rtenneti3fe4ebbc2014-11-16 16:43:4762// We match SPDY's use of 32 when secure (since we'd compete with SPDY).
63const QuicPacketCount kInitialCongestionWindowSecure = 32;
64// Be conservative, and just use double a typical TCP ICWND for HTTP.
65const QuicPacketCount kInitialCongestionWindowInsecure = 20;
[email protected]8e01c062013-10-31 07:35:3166
[email protected]7d561352014-06-20 09:09:2167// Default size of initial flow control window, for both stream and session.
[email protected]9bb57c72014-03-31 20:36:0468const uint32 kDefaultFlowControlSendWindow = 16 * 1024; // 16 KB
69
rtenneti8d2a808d2014-11-26 01:10:0970// Minimum size of the CWND, in packets, when doing bandwidth resumption.
71const QuicPacketCount kMinCongestionWindowForBandwidthResumption = 10;
72
73// Maximum size of the CWND, in packets, for TCP congestion control algorithms.
74const QuicPacketCount kMaxTcpCongestionWindow = 200;
[email protected]0ac0c5b2013-11-20 05:55:5875
rtenneti23186682014-10-30 01:49:3376// Default size of the socket receive buffer in bytes.
[email protected]648f81142014-08-15 21:38:4677const QuicByteCount kDefaultSocketReceiveBuffer = 256 * 1024;
rtenneti23186682014-10-30 01:49:3378// Minimum size of the socket receive buffer in bytes.
79// Smaller values are ignored.
80const QuicByteCount kMinSocketReceiveBuffer = 16 * 1024;
[email protected]a97b3182014-08-08 08:10:1881
rtennetifc97ab62014-11-11 22:17:4982// Don't allow a client to suggest an RTT shorter than 10ms.
83const uint32 kMinInitialRoundTripTimeUs = 10 * kNumMicrosPerMilli;
84
[email protected]8e01c062013-10-31 07:35:3185// Don't allow a client to suggest an RTT longer than 15 seconds.
[email protected]2d43c40122014-04-21 14:51:2786const uint32 kMaxInitialRoundTripTimeUs = 15 * kNumMicrosPerSecond;
[email protected]8b37a092012-10-18 21:53:4987
88// Maximum number of open streams per connection.
89const size_t kDefaultMaxStreamsPerConnection = 100;
90
[email protected]af806e62013-05-22 14:47:5091// Number of bytes reserved for public flags in the packet header.
92const size_t kPublicFlagsSize = 1;
[email protected]5351cc4b2013-03-03 07:22:4193// Number of bytes reserved for version number in the packet header.
94const size_t kQuicVersionSize = 4;
[email protected]c995c572013-01-18 05:43:2095// Number of bytes reserved for private flags in the packet header.
96const size_t kPrivateFlagsSize = 1;
97// Number of bytes reserved for FEC group in the packet header.
98const size_t kFecGroupSize = 1;
[email protected]5351cc4b2013-03-03 07:22:4199
100// Signifies that the QuicPacket will contain version of the protocol.
101const bool kIncludeVersion = true;
[email protected]c995c572013-01-18 05:43:20102
[email protected]5351cc4b2013-03-03 07:22:41103// Index of the first byte in a QUIC packet which is used in hash calculation.
104const size_t kStartOfHashData = 0;
[email protected]8b37a092012-10-18 21:53:49105
106// Limit on the delta between stream IDs.
[email protected]c5cc9bd2014-03-31 23:17:14107const QuicStreamId kMaxStreamIdDelta = 200;
[email protected]c244c5a12013-05-07 20:55:04108// Limit on the delta between header IDs.
[email protected]c5cc9bd2014-03-31 23:17:14109const QuicHeaderId kMaxHeaderIdDelta = 200;
[email protected]8b37a092012-10-18 21:53:49110
111// Reserved ID for the crypto stream.
[email protected]8b37a092012-10-18 21:53:49112const QuicStreamId kCryptoStreamId = 1;
113
[email protected]4d640792013-12-18 22:21:08114// Reserved ID for the headers stream.
115const QuicStreamId kHeadersStreamId = 3;
116
[email protected]648f81142014-08-15 21:38:46117// Maximum delayed ack time, in ms.
pkastingacec86f2014-10-14 23:08:55118const int64 kMaxDelayedAckTimeMs = 25;
[email protected]648f81142014-08-15 21:38:46119
rtennetib5512bb2014-09-29 19:17:15120// The timeout before the handshake succeeds.
121const int64 kInitialIdleTimeoutSecs = 5;
122// The default idle timeout.
123const int64 kDefaultIdleTimeoutSecs = 30;
rtenneti31e9fd62014-09-16 05:22:15124// The maximum idle timeout that can be negotiated.
125const int64 kMaximumIdleTimeoutSecs = 60 * 10; // 10 minutes.
126// The default timeout for a connection until the crypto handshake succeeds.
rtennetib5512bb2014-09-29 19:17:15127const int64 kMaxTimeForCryptoHandshakeSecs = 10; // 10 secs.
[email protected]8b37a092012-10-18 21:53:49128
rtenneti93bce7ece2014-10-13 22:38:41129// Default limit on the number of undecryptable packets the connection buffers
130// before the CHLO/SHLO arrive.
131const size_t kDefaultMaxUndecryptablePackets = 10;
132
[email protected]525948df2014-04-21 06:26:58133// Default ping timeout.
134const int64 kPingTimeoutSecs = 15; // 15 secs.
135
[email protected]ca4e0d92014-08-22 16:33:22136// Minimum number of RTTs between Server Config Updates (SCUP) sent to client.
137const int kMinIntervalBetweenServerConfigUpdatesRTTs = 10;
138
139// Minimum time between Server Config Updates (SCUP) sent to client.
140const int kMinIntervalBetweenServerConfigUpdatesMs = 1000;
141
rtenneti33da8ab2014-11-04 04:17:00142// Minimum number of packets between Server Config Updates (SCUP).
143const int kMinPacketsBetweenServerConfigUpdates = 100;
144
rtennetib5512bb2014-09-29 19:17:15145// The number of open streams that a server will accept is set to be slightly
146// larger than the negotiated limit. Immediately closing the connection if the
147// client opens slightly too many streams is not ideal: the client may have sent
148// a FIN that was lost, and simultaneously opened a new stream. The number of
149// streams a server accepts is a fixed increment over the negotiated limit, or a
150// percentage increase, whichever is larger.
rtenneti31e9fd62014-09-16 05:22:15151const float kMaxStreamsMultiplier = 1.1f;
rtennetib5512bb2014-09-29 19:17:15152const int kMaxStreamsMinimumIncrement = 10;
rtenneti31e9fd62014-09-16 05:22:15153
[email protected]b007e632013-10-28 08:39:25154// We define an unsigned 16-bit floating point value, inspired by IEEE floats
155// (http://en.wikipedia.org/wiki/Half_precision_floating-point_format),
156// with 5-bit exponent (bias 1), 11-bit mantissa (effective 12 with hidden
157// bit) and denormals, but without signs, transfinites or fractions. Wire format
158// 16 bits (little-endian byte order) are split into exponent (high 5) and
159// mantissa (low 11) and decoded as:
160// uint64 value;
161// if (exponent == 0) value = mantissa;
162// else value = (mantissa | 1 << 11) << (exponent - 1)
163const int kUFloat16ExponentBits = 5;
164const int kUFloat16MaxExponent = (1 << kUFloat16ExponentBits) - 2; // 30
165const int kUFloat16MantissaBits = 16 - kUFloat16ExponentBits; // 11
166const int kUFloat16MantissaEffectiveBits = kUFloat16MantissaBits + 1; // 12
167const uint64 kUFloat16MaxValue = // 0x3FFC0000000
168 ((GG_UINT64_C(1) << kUFloat16MantissaEffectiveBits) - 1) <<
169 kUFloat16MaxExponent;
170
[email protected]c67a82cb2013-09-24 02:53:21171enum TransmissionType {
[email protected]2532de12013-05-09 12:29:33172 NOT_RETRANSMISSION,
[email protected]b9475b582014-03-20 20:04:33173 FIRST_TRANSMISSION_TYPE = NOT_RETRANSMISSION,
174 HANDSHAKE_RETRANSMISSION, // Retransmits due to handshake timeouts.
rtenneti31e9fd62014-09-16 05:22:15175 ALL_UNACKED_RETRANSMISSION, // Retransmits all unacked packets.
176 ALL_INITIAL_RETRANSMISSION, // Retransmits all initially encrypted packets.
[email protected]b9475b582014-03-20 20:04:33177 LOSS_RETRANSMISSION, // Retransmits due to loss detection.
178 RTO_RETRANSMISSION, // Retransmits due to retransmit time out.
179 TLP_RETRANSMISSION, // Tail loss probes.
180 LAST_TRANSMISSION_TYPE = TLP_RETRANSMISSION,
[email protected]74bda142013-03-31 02:49:11181};
182
183enum HasRetransmittableData {
[email protected]2532de12013-05-09 12:29:33184 NO_RETRANSMITTABLE_DATA,
185 HAS_RETRANSMITTABLE_DATA,
[email protected]74bda142013-03-31 02:49:11186};
187
[email protected]575cce62013-08-03 02:06:43188enum IsHandshake {
189 NOT_HANDSHAKE,
190 IS_HANDSHAKE
191};
192
[email protected]bbb10072014-06-13 07:41:59193// Indicates FEC protection level for data being written.
194enum FecProtection {
195 MUST_FEC_PROTECT, // Callee must FEC protect this data.
[email protected]a5b98172014-06-18 07:01:59196 MAY_FEC_PROTECT // Callee does not have to but may FEC protect this data.
197};
198
[email protected]bc356fe2014-06-19 11:14:14199// Indicates FEC policy.
[email protected]a5b98172014-06-18 07:01:59200enum FecPolicy {
201 FEC_PROTECT_ALWAYS, // All data in the stream should be FEC protected.
202 FEC_PROTECT_OPTIONAL // Data in the stream does not need FEC protection.
[email protected]bbb10072014-06-13 07:41:59203};
204
[email protected]be24ab22012-10-22 03:01:52205enum QuicFrameType {
[email protected]6ae6e342014-02-06 02:21:42206 // Regular frame types. The values set here cannot change without the
207 // introduction of a new QUIC version.
[email protected]c995c572013-01-18 05:43:20208 PADDING_FRAME = 0,
[email protected]6ae6e342014-02-06 02:21:42209 RST_STREAM_FRAME = 1,
210 CONNECTION_CLOSE_FRAME = 2,
211 GOAWAY_FRAME = 3,
212 WINDOW_UPDATE_FRAME = 4,
213 BLOCKED_FRAME = 5,
[email protected]93dd91f2014-02-27 00:09:03214 STOP_WAITING_FRAME = 6,
[email protected]d8c522112014-04-23 09:23:25215 PING_FRAME = 7,
[email protected]6ae6e342014-02-06 02:21:42216
217 // STREAM, ACK, and CONGESTION_FEEDBACK frames are special frames. They are
218 // encoded differently on the wire and their values do not need to be stable.
[email protected]97cf3022013-09-05 14:30:16219 STREAM_FRAME,
220 ACK_FRAME,
221 CONGESTION_FEEDBACK_FRAME,
[email protected]be24ab22012-10-22 03:01:52222 NUM_FRAME_TYPES
[email protected]8b37a092012-10-18 21:53:49223};
224
[email protected]3aa9ca72014-02-27 19:39:43225enum QuicConnectionIdLength {
226 PACKET_0BYTE_CONNECTION_ID = 0,
227 PACKET_1BYTE_CONNECTION_ID = 1,
228 PACKET_4BYTE_CONNECTION_ID = 4,
229 PACKET_8BYTE_CONNECTION_ID = 8
[email protected]b064310782013-05-30 21:12:17230};
231
232enum InFecGroup {
233 NOT_IN_FEC_GROUP,
234 IN_FEC_GROUP,
235};
236
[email protected]25c31dc2013-06-05 17:56:04237enum QuicSequenceNumberLength {
238 PACKET_1BYTE_SEQUENCE_NUMBER = 1,
239 PACKET_2BYTE_SEQUENCE_NUMBER = 2,
240 PACKET_4BYTE_SEQUENCE_NUMBER = 4,
241 PACKET_6BYTE_SEQUENCE_NUMBER = 6
242};
243
[email protected]8e01c062013-10-31 07:35:31244// Used to indicate a QuicSequenceNumberLength using two flag bits.
245enum QuicSequenceNumberLengthFlags {
246 PACKET_FLAGS_1BYTE_SEQUENCE = 0, // 00
247 PACKET_FLAGS_2BYTE_SEQUENCE = 1, // 01
248 PACKET_FLAGS_4BYTE_SEQUENCE = 1 << 1, // 10
249 PACKET_FLAGS_6BYTE_SEQUENCE = 1 << 1 | 1, // 11
250};
251
[email protected]f62262b2013-07-05 20:57:30252// The public flags are specified in one byte.
[email protected]c995c572013-01-18 05:43:20253enum QuicPacketPublicFlags {
254 PACKET_PUBLIC_FLAGS_NONE = 0,
[email protected]f62262b2013-07-05 20:57:30255
256 // Bit 0: Does the packet header contains version info?
257 PACKET_PUBLIC_FLAGS_VERSION = 1 << 0,
258
259 // Bit 1: Is this packet a public reset packet?
260 PACKET_PUBLIC_FLAGS_RST = 1 << 1,
261
[email protected]3aa9ca72014-02-27 19:39:43262 // Bits 2 and 3 specify the length of the ConnectionId as follows:
[email protected]f62262b2013-07-05 20:57:30263 // ----00--: 0 bytes
264 // ----01--: 1 byte
265 // ----10--: 4 bytes
266 // ----11--: 8 bytes
[email protected]3aa9ca72014-02-27 19:39:43267 PACKET_PUBLIC_FLAGS_0BYTE_CONNECTION_ID = 0,
268 PACKET_PUBLIC_FLAGS_1BYTE_CONNECTION_ID = 1 << 2,
269 PACKET_PUBLIC_FLAGS_4BYTE_CONNECTION_ID = 1 << 3,
270 PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID = 1 << 3 | 1 << 2,
[email protected]f62262b2013-07-05 20:57:30271
272 // Bits 4 and 5 describe the packet sequence number length as follows:
273 // --00----: 1 byte
274 // --01----: 2 bytes
275 // --10----: 4 bytes
276 // --11----: 6 bytes
[email protected]8e01c062013-10-31 07:35:31277 PACKET_PUBLIC_FLAGS_1BYTE_SEQUENCE = PACKET_FLAGS_1BYTE_SEQUENCE << 4,
278 PACKET_PUBLIC_FLAGS_2BYTE_SEQUENCE = PACKET_FLAGS_2BYTE_SEQUENCE << 4,
279 PACKET_PUBLIC_FLAGS_4BYTE_SEQUENCE = PACKET_FLAGS_4BYTE_SEQUENCE << 4,
280 PACKET_PUBLIC_FLAGS_6BYTE_SEQUENCE = PACKET_FLAGS_6BYTE_SEQUENCE << 4,
[email protected]f62262b2013-07-05 20:57:30281
282 // All bits set (bits 6 and 7 are not currently used): 00111111
283 PACKET_PUBLIC_FLAGS_MAX = (1 << 6) - 1
[email protected]c995c572013-01-18 05:43:20284};
[email protected]8b37a092012-10-18 21:53:49285
[email protected]f62262b2013-07-05 20:57:30286// The private flags are specified in one byte.
[email protected]c995c572013-01-18 05:43:20287enum QuicPacketPrivateFlags {
288 PACKET_PRIVATE_FLAGS_NONE = 0,
[email protected]f62262b2013-07-05 20:57:30289
290 // Bit 0: Does this packet contain an entropy bit?
[email protected]b064310782013-05-30 21:12:17291 PACKET_PRIVATE_FLAGS_ENTROPY = 1 << 0,
[email protected]f62262b2013-07-05 20:57:30292
293 // Bit 1: Payload is part of an FEC group?
294 PACKET_PRIVATE_FLAGS_FEC_GROUP = 1 << 1,
295
296 // Bit 2: Payload is FEC as opposed to frames?
297 PACKET_PRIVATE_FLAGS_FEC = 1 << 2,
298
299 // All bits set (bits 3-7 are not currently used): 00000111
300 PACKET_PRIVATE_FLAGS_MAX = (1 << 3) - 1
[email protected]c995c572013-01-18 05:43:20301};
302
[email protected]48878092013-07-26 14:51:56303// The available versions of QUIC. Guaranteed that the integer value of the enum
304// will match the version number.
305// When adding a new version to this enum you should add it to
[email protected]8bbfaeb72013-08-09 06:38:26306// kSupportedQuicVersions (if appropriate), and also add a new case to the
307// helper methods QuicVersionToQuicTag, QuicTagToQuicVersion, and
308// QuicVersionToString.
[email protected]48878092013-07-26 14:51:56309enum QuicVersion {
310 // Special case to indicate unknown/unsupported QUIC version.
311 QUIC_VERSION_UNSUPPORTED = 0,
312
[email protected]7afc2ebe2014-07-18 16:06:23313 QUIC_VERSION_19 = 19, // Connection level flow control.
[email protected]0c6b10ad2014-07-02 19:47:00314 QUIC_VERSION_21 = 21, // Headers/crypto streams are flow controlled.
[email protected]9693157b2014-08-08 11:13:49315 QUIC_VERSION_22 = 22, // Send Server Config Update messages on crypto stream.
rtenneti4b06ae72014-08-26 03:43:43316 QUIC_VERSION_23 = 23, // Timestamp in the ack frame.
[email protected]48878092013-07-26 14:51:56317};
318
319// This vector contains QUIC versions which we currently support.
320// This should be ordered such that the highest supported version is the first
321// element, with subsequent elements in descending order (versions can be
322// skipped as necessary).
[email protected]31ae854842013-11-27 00:05:46323//
[email protected]310d37b2014-08-02 06:15:37324// IMPORTANT: if you are adding to this list, follow the instructions at
[email protected]31ae854842013-11-27 00:05:46325// http://sites/quic/adding-and-removing-versions
rtenneti4b06ae72014-08-26 03:43:43326static const QuicVersion kSupportedQuicVersions[] = {QUIC_VERSION_23,
327 QUIC_VERSION_22,
rtenneti6afc6f42014-10-21 02:15:15328 QUIC_VERSION_19};
[email protected]48878092013-07-26 14:51:56329
330typedef std::vector<QuicVersion> QuicVersionVector;
331
[email protected]b007e632013-10-28 08:39:25332// Returns a vector of QUIC versions in kSupportedQuicVersions.
333NET_EXPORT_PRIVATE QuicVersionVector QuicSupportedVersions();
[email protected]ea2ab47b2013-08-13 00:44:11334
[email protected]48878092013-07-26 14:51:56335// QuicTag is written to and read from the wire, but we prefer to use
336// the more readable QuicVersion at other levels.
337// Helper function which translates from a QuicVersion to a QuicTag. Returns 0
338// if QuicVersion is unsupported.
339NET_EXPORT_PRIVATE QuicTag QuicVersionToQuicTag(const QuicVersion version);
340
341// Returns appropriate QuicVersion from a QuicTag.
342// Returns QUIC_VERSION_UNSUPPORTED if version_tag cannot be understood.
343NET_EXPORT_PRIVATE QuicVersion QuicTagToQuicVersion(const QuicTag version_tag);
344
345// Helper function which translates from a QuicVersion to a string.
346// Returns strings corresponding to enum names (e.g. QUIC_VERSION_6).
347NET_EXPORT_PRIVATE std::string QuicVersionToString(const QuicVersion version);
348
349// Returns comma separated list of string representations of QuicVersion enum
[email protected]b007e632013-10-28 08:39:25350// values in the supplied |versions| vector.
351NET_EXPORT_PRIVATE std::string QuicVersionVectorToString(
352 const QuicVersionVector& versions);
[email protected]48878092013-07-26 14:51:56353
354// Version and Crypto tags are written to the wire with a big-endian
355// representation of the name of the tag. For example
356// the client hello tag (CHLO) will be written as the
357// following 4 bytes: 'C' 'H' 'L' 'O'. Since it is
358// stored in memory as a little endian uint32, we need
359// to reverse the order of the bytes.
360
361// MakeQuicTag returns a value given the four bytes. For example:
362// MakeQuicTag('C', 'H', 'L', 'O');
363NET_EXPORT_PRIVATE QuicTag MakeQuicTag(char a, char b, char c, char d);
364
[email protected]9cda5fd2014-06-03 10:20:28365// Returns true if the tag vector contains the specified tag.
[email protected]cc1aa272014-06-30 19:48:22366NET_EXPORT_PRIVATE bool ContainsQuicTag(const QuicTagVector& tag_vector,
367 QuicTag tag);
[email protected]9cda5fd2014-06-03 10:20:28368
[email protected]b064310782013-05-30 21:12:17369// Size in bytes of the data or fec packet header.
[email protected]79d13dcb2014-02-05 07:23:13370NET_EXPORT_PRIVATE size_t GetPacketHeaderSize(const QuicPacketHeader& header);
[email protected]b064310782013-05-30 21:12:17371
[email protected]25c31dc2013-06-05 17:56:04372NET_EXPORT_PRIVATE size_t GetPacketHeaderSize(
[email protected]3aa9ca72014-02-27 19:39:43373 QuicConnectionIdLength connection_id_length,
[email protected]25c31dc2013-06-05 17:56:04374 bool include_version,
375 QuicSequenceNumberLength sequence_number_length,
376 InFecGroup is_in_fec_group);
[email protected]b064310782013-05-30 21:12:17377
[email protected]b064310782013-05-30 21:12:17378// Index of the first byte in a QUIC packet of FEC protected data.
[email protected]25c31dc2013-06-05 17:56:04379NET_EXPORT_PRIVATE size_t GetStartOfFecProtectedData(
[email protected]3aa9ca72014-02-27 19:39:43380 QuicConnectionIdLength connection_id_length,
[email protected]25c31dc2013-06-05 17:56:04381 bool include_version,
382 QuicSequenceNumberLength sequence_number_length);
[email protected]b064310782013-05-30 21:12:17383// Index of the first byte in a QUIC packet of encrypted data.
[email protected]25c31dc2013-06-05 17:56:04384NET_EXPORT_PRIVATE size_t GetStartOfEncryptedData(
[email protected]3aa9ca72014-02-27 19:39:43385 QuicConnectionIdLength connection_id_length,
[email protected]25c31dc2013-06-05 17:56:04386 bool include_version,
387 QuicSequenceNumberLength sequence_number_length);
[email protected]b064310782013-05-30 21:12:17388
[email protected]74bda142013-03-31 02:49:11389enum QuicRstStreamErrorCode {
390 QUIC_STREAM_NO_ERROR = 0,
[email protected]8b37a092012-10-18 21:53:49391
[email protected]24e5bc52013-09-18 15:36:58392 // There was some error which halted stream processing.
393 QUIC_ERROR_PROCESSING_STREAM,
[email protected]8b37a092012-10-18 21:53:49394 // We got two fin or reset offsets which did not match.
395 QUIC_MULTIPLE_TERMINATION_OFFSETS,
396 // We got bad payload and can not respond to it at the protocol level.
397 QUIC_BAD_APPLICATION_PAYLOAD,
[email protected]74bda142013-03-31 02:49:11398 // Stream closed due to connection error. No reset frame is sent when this
399 // happens.
400 QUIC_STREAM_CONNECTION_ERROR,
401 // GoAway frame sent. No more stream can be created.
402 QUIC_STREAM_PEER_GOING_AWAY,
[email protected]06ff5152013-08-29 01:03:05403 // The stream has been cancelled.
404 QUIC_STREAM_CANCELLED,
rtenneti4a5df262014-11-07 00:43:58405 // Closing stream locally, sending a RST to allow for proper flow control
406 // accounting. Sent in response to a RST from the peer.
407 QUIC_RST_ACKNOWLEDGEMENT,
[email protected]8b37a092012-10-18 21:53:49408
[email protected]74bda142013-03-31 02:49:11409 // No error. Used as bound while iterating.
410 QUIC_STREAM_LAST_ERROR,
411};
[email protected]8b37a092012-10-18 21:53:49412
[email protected]51cc1342014-04-18 23:44:37413// Because receiving an unknown QuicRstStreamErrorCode results in connection
414// teardown, we use this to make sure any errors predating a given version are
415// downgraded to the most appropriate existing error.
416NET_EXPORT_PRIVATE QuicRstStreamErrorCode AdjustErrorForVersion(
417 QuicRstStreamErrorCode error_code,
418 QuicVersion version);
419
[email protected]89264042013-08-21 07:35:24420// These values must remain stable as they are uploaded to UMA histograms.
421// To add a new error code, use the current value of QUIC_LAST_ERROR and
422// increment QUIC_LAST_ERROR.
[email protected]74bda142013-03-31 02:49:11423enum QuicErrorCode {
424 QUIC_NO_ERROR = 0,
425
426 // Connection has reached an invalid state.
[email protected]89264042013-08-21 07:35:24427 QUIC_INTERNAL_ERROR = 1,
[email protected]74bda142013-03-31 02:49:11428 // There were data frames after the a fin or reset.
[email protected]89264042013-08-21 07:35:24429 QUIC_STREAM_DATA_AFTER_TERMINATION = 2,
[email protected]8b37a092012-10-18 21:53:49430 // Control frame is malformed.
[email protected]89264042013-08-21 07:35:24431 QUIC_INVALID_PACKET_HEADER = 3,
[email protected]be24ab22012-10-22 03:01:52432 // Frame data is malformed.
[email protected]89264042013-08-21 07:35:24433 QUIC_INVALID_FRAME_DATA = 4,
434 // The packet contained no payload.
435 QUIC_MISSING_PAYLOAD = 48,
[email protected]8b37a092012-10-18 21:53:49436 // FEC data is malformed.
[email protected]89264042013-08-21 07:35:24437 QUIC_INVALID_FEC_DATA = 5,
438 // STREAM frame data is malformed.
439 QUIC_INVALID_STREAM_DATA = 46,
[email protected]42a3eba2014-04-30 10:52:55440 // STREAM frame data is not encrypted.
441 QUIC_UNENCRYPTED_STREAM_DATA = 61,
[email protected]89264042013-08-21 07:35:24442 // RST_STREAM frame data is malformed.
443 QUIC_INVALID_RST_STREAM_DATA = 6,
444 // CONNECTION_CLOSE frame data is malformed.
445 QUIC_INVALID_CONNECTION_CLOSE_DATA = 7,
446 // GOAWAY frame data is malformed.
447 QUIC_INVALID_GOAWAY_DATA = 8,
[email protected]6ae6e342014-02-06 02:21:42448 // WINDOW_UPDATE frame data is malformed.
449 QUIC_INVALID_WINDOW_UPDATE_DATA = 57,
450 // BLOCKED frame data is malformed.
451 QUIC_INVALID_BLOCKED_DATA = 58,
[email protected]93dd91f2014-02-27 00:09:03452 // STOP_WAITING frame data is malformed.
453 QUIC_INVALID_STOP_WAITING_DATA = 60,
[email protected]89264042013-08-21 07:35:24454 // ACK frame data is malformed.
455 QUIC_INVALID_ACK_DATA = 9,
456 // CONGESTION_FEEDBACK frame data is malformed.
457 QUIC_INVALID_CONGESTION_FEEDBACK_DATA = 47,
[email protected]14e8106c2013-03-14 16:25:33458 // Version negotiation packet is malformed.
[email protected]89264042013-08-21 07:35:24459 QUIC_INVALID_VERSION_NEGOTIATION_PACKET = 10,
[email protected]899951652013-05-16 12:52:39460 // Public RST packet is malformed.
[email protected]89264042013-08-21 07:35:24461 QUIC_INVALID_PUBLIC_RST_PACKET = 11,
[email protected]8b37a092012-10-18 21:53:49462 // There was an error decrypting.
[email protected]89264042013-08-21 07:35:24463 QUIC_DECRYPTION_FAILURE = 12,
[email protected]8b37a092012-10-18 21:53:49464 // There was an error encrypting.
[email protected]89264042013-08-21 07:35:24465 QUIC_ENCRYPTION_FAILURE = 13,
[email protected]8b37a092012-10-18 21:53:49466 // The packet exceeded kMaxPacketSize.
[email protected]89264042013-08-21 07:35:24467 QUIC_PACKET_TOO_LARGE = 14,
[email protected]8b37a092012-10-18 21:53:49468 // Data was sent for a stream which did not exist.
[email protected]89264042013-08-21 07:35:24469 QUIC_PACKET_FOR_NONEXISTENT_STREAM = 15,
[email protected]9db443912013-02-25 05:27:03470 // The peer is going away. May be a client or server.
[email protected]89264042013-08-21 07:35:24471 QUIC_PEER_GOING_AWAY = 16,
[email protected]8b37a092012-10-18 21:53:49472 // A stream ID was invalid.
[email protected]89264042013-08-21 07:35:24473 QUIC_INVALID_STREAM_ID = 17,
[email protected]24e5bc52013-09-18 15:36:58474 // A priority was invalid.
475 QUIC_INVALID_PRIORITY = 49,
[email protected]8b37a092012-10-18 21:53:49476 // Too many streams already open.
[email protected]89264042013-08-21 07:35:24477 QUIC_TOO_MANY_OPEN_STREAMS = 18,
[email protected]9693157b2014-08-08 11:13:49478 // The peer must send a FIN/RST for each stream, and has not been doing so.
479 QUIC_TOO_MANY_UNFINISHED_STREAMS = 66,
[email protected]86a318d2013-01-23 21:16:04480 // Received public reset for this connection.
[email protected]89264042013-08-21 07:35:24481 QUIC_PUBLIC_RESET = 19,
[email protected]c244c5a12013-05-07 20:55:04482 // Invalid protocol version.
[email protected]89264042013-08-21 07:35:24483 QUIC_INVALID_VERSION = 20,
[email protected]92bf17c2014-03-03 21:14:03484
485 // deprecated: QUIC_STREAM_RST_BEFORE_HEADERS_DECOMPRESSED = 21
486
[email protected]c244c5a12013-05-07 20:55:04487 // The Header ID for a stream was too far from the previous.
[email protected]89264042013-08-21 07:35:24488 QUIC_INVALID_HEADER_ID = 22,
[email protected]899951652013-05-16 12:52:39489 // Negotiable parameter received during handshake had invalid value.
[email protected]89264042013-08-21 07:35:24490 QUIC_INVALID_NEGOTIATED_VALUE = 23,
[email protected]899951652013-05-16 12:52:39491 // There was an error decompressing data.
[email protected]89264042013-08-21 07:35:24492 QUIC_DECOMPRESSION_FAILURE = 24,
[email protected]8b37a092012-10-18 21:53:49493 // We hit our prenegotiated (or default) timeout
[email protected]89264042013-08-21 07:35:24494 QUIC_CONNECTION_TIMED_OUT = 25,
rtenneti31e9fd62014-09-16 05:22:15495 // We hit our overall connection timeout
496 QUIC_CONNECTION_OVERALL_TIMED_OUT = 67,
[email protected]899951652013-05-16 12:52:39497 // There was an error encountered migrating addresses
[email protected]89264042013-08-21 07:35:24498 QUIC_ERROR_MIGRATING_ADDRESS = 26,
[email protected]1505a512013-09-04 22:59:35499 // There was an error while writing to the socket.
[email protected]89264042013-08-21 07:35:24500 QUIC_PACKET_WRITE_ERROR = 27,
[email protected]1505a512013-09-04 22:59:35501 // There was an error while reading from the socket.
502 QUIC_PACKET_READ_ERROR = 51,
[email protected]24e5bc52013-09-18 15:36:58503 // We received a STREAM_FRAME with no data and no fin flag set.
504 QUIC_INVALID_STREAM_FRAME = 50,
[email protected]4d640792013-12-18 22:21:08505 // We received invalid data on the headers stream.
506 QUIC_INVALID_HEADERS_STREAM_DATA = 56,
[email protected]730b35d72014-06-05 03:23:22507 // The peer received too much data, violating flow control.
508 QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA = 59,
509 // The peer sent too much data, violating flow control.
510 QUIC_FLOW_CONTROL_SENT_TOO_MUCH_DATA = 63,
511 // The peer received an invalid flow control window.
512 QUIC_FLOW_CONTROL_INVALID_WINDOW = 64,
[email protected]71c84e592014-05-28 23:39:29513 // The connection has been IP pooled into an existing connection.
514 QUIC_CONNECTION_IP_POOLED = 62,
rtenneti23186682014-10-30 01:49:33515 // The connection has too many outstanding sent packets.
516 QUIC_TOO_MANY_OUTSTANDING_SENT_PACKETS = 68,
517 // The connection has too many outstanding received packets.
518 QUIC_TOO_MANY_OUTSTANDING_RECEIVED_PACKETS = 69,
[email protected]8b37a092012-10-18 21:53:49519
520 // Crypto errors.
521
[email protected]1354bf62013-05-23 23:17:18522 // Hanshake failed.
[email protected]89264042013-08-21 07:35:24523 QUIC_HANDSHAKE_FAILED = 28,
[email protected]8b37a092012-10-18 21:53:49524 // Handshake message contained out of order tags.
[email protected]89264042013-08-21 07:35:24525 QUIC_CRYPTO_TAGS_OUT_OF_ORDER = 29,
[email protected]701bc892013-01-17 04:51:54526 // Handshake message contained too many entries.
[email protected]89264042013-08-21 07:35:24527 QUIC_CRYPTO_TOO_MANY_ENTRIES = 30,
[email protected]8b37a092012-10-18 21:53:49528 // Handshake message contained an invalid value length.
[email protected]89264042013-08-21 07:35:24529 QUIC_CRYPTO_INVALID_VALUE_LENGTH = 31,
[email protected]8b37a092012-10-18 21:53:49530 // A crypto message was received after the handshake was complete.
[email protected]89264042013-08-21 07:35:24531 QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE = 32,
[email protected]d3d15bf2013-01-30 02:51:54532 // A crypto message was received with an illegal message tag.
[email protected]89264042013-08-21 07:35:24533 QUIC_INVALID_CRYPTO_MESSAGE_TYPE = 33,
[email protected]d3d15bf2013-01-30 02:51:54534 // A crypto message was received with an illegal parameter.
[email protected]89264042013-08-21 07:35:24535 QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER = 34,
[email protected]752fbe52013-10-14 08:35:32536 // An invalid channel id signature was supplied.
537 QUIC_INVALID_CHANNEL_ID_SIGNATURE = 52,
[email protected]d3d15bf2013-01-30 02:51:54538 // A crypto message was received with a mandatory parameter missing.
[email protected]89264042013-08-21 07:35:24539 QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND = 35,
[email protected]d3d15bf2013-01-30 02:51:54540 // A crypto message was received with a parameter that has no overlap
541 // with the local parameter.
[email protected]89264042013-08-21 07:35:24542 QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP = 36,
[email protected]ed3fc15d2013-03-08 18:37:44543 // A crypto message was received that contained a parameter with too few
544 // values.
[email protected]89264042013-08-21 07:35:24545 QUIC_CRYPTO_MESSAGE_INDEX_NOT_FOUND = 37,
[email protected]ccc66e8a2013-03-26 08:26:14546 // An internal error occured in crypto processing.
[email protected]89264042013-08-21 07:35:24547 QUIC_CRYPTO_INTERNAL_ERROR = 38,
[email protected]ccc66e8a2013-03-26 08:26:14548 // A crypto handshake message specified an unsupported version.
[email protected]89264042013-08-21 07:35:24549 QUIC_CRYPTO_VERSION_NOT_SUPPORTED = 39,
[email protected]ccc66e8a2013-03-26 08:26:14550 // There was no intersection between the crypto primitives supported by the
551 // peer and ourselves.
[email protected]89264042013-08-21 07:35:24552 QUIC_CRYPTO_NO_SUPPORT = 40,
[email protected]ef95114d2013-04-17 17:57:01553 // The server rejected our client hello messages too many times.
[email protected]89264042013-08-21 07:35:24554 QUIC_CRYPTO_TOO_MANY_REJECTS = 41,
[email protected]a57e0272013-04-26 07:31:47555 // The client rejected the server's certificate chain or signature.
[email protected]89264042013-08-21 07:35:24556 QUIC_PROOF_INVALID = 42,
[email protected]8ba81212013-05-03 13:11:48557 // A crypto message was received with a duplicate tag.
[email protected]89264042013-08-21 07:35:24558 QUIC_CRYPTO_DUPLICATE_TAG = 43,
[email protected]2532de12013-05-09 12:29:33559 // A crypto message was received with the wrong encryption level (i.e. it
560 // should have been encrypted but was not.)
[email protected]89264042013-08-21 07:35:24561 QUIC_CRYPTO_ENCRYPTION_LEVEL_INCORRECT = 44,
[email protected]2532de12013-05-09 12:29:33562 // The server config for a server has expired.
[email protected]89264042013-08-21 07:35:24563 QUIC_CRYPTO_SERVER_CONFIG_EXPIRED = 45,
[email protected]752fbe52013-10-14 08:35:32564 // We failed to setup the symmetric keys for a connection.
565 QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED = 53,
[email protected]691f45a982013-11-19 10:52:04566 // A handshake message arrived, but we are still validating the
567 // previous handshake message.
568 QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO = 54,
[email protected]ccb34212014-07-18 09:27:50569 // A server config update arrived before the handshake is complete.
570 QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE = 65,
[email protected]d89f1862013-11-26 21:21:27571 // This connection involved a version negotiation which appears to have been
572 // tampered with.
573 QUIC_VERSION_NEGOTIATION_MISMATCH = 55,
[email protected]ccc66e8a2013-03-26 08:26:14574
[email protected]74bda142013-03-31 02:49:11575 // No error. Used as bound while iterating.
rtenneti23186682014-10-30 01:49:33576 QUIC_LAST_ERROR = 70,
[email protected]8b37a092012-10-18 21:53:49577};
578
[email protected]c995c572013-01-18 05:43:20579struct NET_EXPORT_PRIVATE QuicPacketPublicHeader {
[email protected]14e8106c2013-03-14 16:25:33580 QuicPacketPublicHeader();
581 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other);
582 ~QuicPacketPublicHeader();
583
[email protected]3aa9ca72014-02-27 19:39:43584 // Universal header. All QuicPacket headers will have a connection_id and
585 // public flags.
586 QuicConnectionId connection_id;
587 QuicConnectionIdLength connection_id_length;
[email protected]9db443912013-02-25 05:27:03588 bool reset_flag;
589 bool version_flag;
[email protected]25c31dc2013-06-05 17:56:04590 QuicSequenceNumberLength sequence_number_length;
[email protected]48878092013-07-26 14:51:56591 QuicVersionVector versions;
[email protected]c995c572013-01-18 05:43:20592};
593
594// Header for Data or FEC packets.
[email protected]74bda142013-03-31 02:49:11595struct NET_EXPORT_PRIVATE QuicPacketHeader {
596 QuicPacketHeader();
597 explicit QuicPacketHeader(const QuicPacketPublicHeader& header);
[email protected]9db443912013-02-25 05:27:03598
599 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
600 std::ostream& os, const QuicPacketHeader& s);
601
[email protected]c995c572013-01-18 05:43:20602 QuicPacketPublicHeader public_header;
[email protected]9db443912013-02-25 05:27:03603 bool fec_flag;
[email protected]9db443912013-02-25 05:27:03604 bool entropy_flag;
605 QuicPacketEntropyHash entropy_hash;
[email protected]8b37a092012-10-18 21:53:49606 QuicPacketSequenceNumber packet_sequence_number;
[email protected]b064310782013-05-30 21:12:17607 InFecGroup is_in_fec_group;
[email protected]8b37a092012-10-18 21:53:49608 QuicFecGroupNumber fec_group;
609};
610
[email protected]74bda142013-03-31 02:49:11611struct NET_EXPORT_PRIVATE QuicPublicResetPacket {
[email protected]6ae6e342014-02-06 02:21:42612 QuicPublicResetPacket();
613 explicit QuicPublicResetPacket(const QuicPacketPublicHeader& header);
614
[email protected]86a318d2013-01-23 21:16:04615 QuicPacketPublicHeader public_header;
[email protected]86a318d2013-01-23 21:16:04616 QuicPublicResetNonceProof nonce_proof;
[email protected]300ccd52014-01-25 08:00:19617 QuicPacketSequenceNumber rejected_sequence_number;
[email protected]79d13dcb2014-02-05 07:23:13618 IPEndPoint client_address;
[email protected]86a318d2013-01-23 21:16:04619};
620
[email protected]14e8106c2013-03-14 16:25:33621enum QuicVersionNegotiationState {
622 START_NEGOTIATION = 0,
[email protected]ec640112013-08-09 03:56:18623 // Server-side this implies we've sent a version negotiation packet and are
624 // waiting on the client to select a compatible version. Client-side this
625 // implies we've gotten a version negotiation packet, are retransmitting the
626 // initial packets with a supported version and are waiting for our first
627 // packet from the server.
628 NEGOTIATION_IN_PROGRESS,
629 // This indicates this endpoint has received a packet from the peer with a
630 // version this endpoint supports. Version negotiation is complete, and the
631 // version number will no longer be sent with future packets.
[email protected]14e8106c2013-03-14 16:25:33632 NEGOTIATED_VERSION
633};
634
635typedef QuicPacketPublicHeader QuicVersionNegotiationPacket;
636
[email protected]c995c572013-01-18 05:43:20637// A padding frame contains no payload.
638struct NET_EXPORT_PRIVATE QuicPaddingFrame {
639};
640
[email protected]d8c522112014-04-23 09:23:25641// A ping frame contains no payload, though it is retransmittable,
642// and ACK'd just like other normal frames.
643struct NET_EXPORT_PRIVATE QuicPingFrame {
644};
645
[email protected]be24ab22012-10-22 03:01:52646struct NET_EXPORT_PRIVATE QuicStreamFrame {
647 QuicStreamFrame();
[email protected]5dafdb62013-11-14 01:24:26648 QuicStreamFrame(const QuicStreamFrame& frame);
[email protected]be24ab22012-10-22 03:01:52649 QuicStreamFrame(QuicStreamId stream_id,
[email protected]a5061242012-10-23 23:29:37650 bool fin,
[email protected]701bc892013-01-17 04:51:54651 QuicStreamOffset offset,
[email protected]5dafdb62013-11-14 01:24:26652 IOVector data);
653
[email protected]c5e1aca2014-01-30 04:03:04654 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
655 std::ostream& os, const QuicStreamFrame& s);
656
[email protected]5dafdb62013-11-14 01:24:26657 // Returns a copy of the IOVector |data| as a heap-allocated string.
658 // Caller must take ownership of the returned string.
659 std::string* GetDataAsString() const;
[email protected]8b37a092012-10-18 21:53:49660
661 QuicStreamId stream_id;
662 bool fin;
[email protected]701bc892013-01-17 04:51:54663 QuicStreamOffset offset; // Location of this data in the stream.
[email protected]5dafdb62013-11-14 01:24:26664 IOVector data;
[email protected]97cf3022013-09-05 14:30:16665
666 // If this is set, then when this packet is ACKed the AckNotifier will be
667 // informed.
668 QuicAckNotifier* notifier;
[email protected]8b37a092012-10-18 21:53:49669};
670
[email protected]e537f742012-12-07 15:33:53671// TODO(ianswett): Re-evaluate the trade-offs of hash_set vs set when framing
672// is finalized.
[email protected]9db443912013-02-25 05:27:03673typedef std::set<QuicPacketSequenceNumber> SequenceNumberSet;
rtennetidd4bf8f2014-09-03 00:45:16674typedef std::list<QuicPacketSequenceNumber> SequenceNumberList;
rtenneti4b06ae72014-08-26 03:43:43675
mostynbdc40b80612014-09-10 03:45:42676typedef std::list<
677 std::pair<QuicPacketSequenceNumber, QuicTime> > PacketTimeList;
[email protected]044ac2b2012-11-13 21:41:06678
[email protected]310d37b2014-08-02 06:15:37679struct NET_EXPORT_PRIVATE QuicStopWaitingFrame {
680 QuicStopWaitingFrame();
681 ~QuicStopWaitingFrame();
[email protected]6ae6e342014-02-06 02:21:42682
[email protected]26f3f8e2012-12-13 21:07:19683 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
[email protected]310d37b2014-08-02 06:15:37684 std::ostream& os, const QuicStopWaitingFrame& s);
685 // Entropy hash of all packets up to, but not including, the least unacked
686 // packet.
687 QuicPacketEntropyHash entropy_hash;
688 // The lowest packet we've sent which is unacked, and we expect an ack for.
689 QuicPacketSequenceNumber least_unacked;
690};
691
692struct NET_EXPORT_PRIVATE QuicAckFrame {
693 QuicAckFrame();
694 ~QuicAckFrame();
695
696 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
697 std::ostream& os, const QuicAckFrame& s);
[email protected]a674b4c2012-12-05 03:44:30698
[email protected]9db443912013-02-25 05:27:03699 // Entropy hash of all packets up to largest observed not including missing
700 // packets.
701 QuicPacketEntropyHash entropy_hash;
[email protected]e537f742012-12-07 15:33:53702
[email protected]48697d8a2013-01-15 19:42:24703 // The highest packet sequence number we've observed from the peer.
704 //
705 // In general, this should be the largest packet number we've received. In
706 // the case of truncated acks, we may have to advertise a lower "upper bound"
707 // than largest received, to avoid implicitly acking missing packets that
708 // don't fit in the missing packet list due to size limitations. In this
709 // case, largest_observed may be a packet which is also in the missing packets
710 // list.
711 QuicPacketSequenceNumber largest_observed;
[email protected]a674b4c2012-12-05 03:44:30712
[email protected]14e8106c2013-03-14 16:25:33713 // Time elapsed since largest_observed was received until this Ack frame was
714 // sent.
715 QuicTime::Delta delta_time_largest_observed;
716
[email protected]9db443912013-02-25 05:27:03717 // TODO(satyamshekhar): Can be optimized using an interval set like data
718 // structure.
[email protected]e537f742012-12-07 15:33:53719 // The set of packets which we're expecting and have not received.
[email protected]9db443912013-02-25 05:27:03720 SequenceNumberSet missing_packets;
[email protected]8e01c062013-10-31 07:35:31721
722 // Whether the ack had to be truncated when sent.
723 bool is_truncated;
[email protected]bdf2d432014-02-09 10:45:41724
725 // Packets which have been revived via FEC.
726 // All of these must also be in missing_packets.
727 SequenceNumberSet revived_packets;
rtenneti4b06ae72014-08-26 03:43:43728
729 // List of <sequence_number, time> for when packets arrived.
730 PacketTimeList received_packet_times;
[email protected]8b37a092012-10-18 21:53:49731};
732
[email protected]9db443912013-02-25 05:27:03733// True if the sequence number is greater than largest_observed or is listed
734// as missing.
735// Always returns false for sequence numbers less than least_unacked.
736bool NET_EXPORT_PRIVATE IsAwaitingPacket(
[email protected]310d37b2014-08-02 06:15:37737 const QuicAckFrame& ack_frame,
[email protected]9db443912013-02-25 05:27:03738 QuicPacketSequenceNumber sequence_number);
739
740// Inserts missing packets between [lower, higher).
741void NET_EXPORT_PRIVATE InsertMissingPacketsBetween(
[email protected]310d37b2014-08-02 06:15:37742 QuicAckFrame* ack_frame,
[email protected]9db443912013-02-25 05:27:03743 QuicPacketSequenceNumber lower,
744 QuicPacketSequenceNumber higher);
745
[email protected]8b37a092012-10-18 21:53:49746// Defines for all types of congestion feedback that will be negotiated in QUIC,
[email protected]f62262b2013-07-05 20:57:30747// kTCP MUST be supported by all QUIC implementations to guarantee 100%
[email protected]8b37a092012-10-18 21:53:49748// compatibility.
rtenneti4b06ae72014-08-26 03:43:43749// TODO(cyr): Remove this when removing QUIC_VERSION_22.
[email protected]8b37a092012-10-18 21:53:49750enum CongestionFeedbackType {
[email protected]8b37a092012-10-18 21:53:49751 kTCP, // Used to mimic TCP.
[email protected]a692ad9d2014-07-18 21:35:24752};
753
754// Defines for all types of congestion control algorithms that can be used in
755// QUIC. Note that this is separate from the congestion feedback type -
756// some congestion control algorithms may use the same feedback type
757// (Reno and Cubic are the classic example for that).
758enum CongestionControlType {
759 kCubic,
760 kReno,
[email protected]a692ad9d2014-07-18 21:35:24761 kBBR,
[email protected]8b37a092012-10-18 21:53:49762};
763
[email protected]c5cc9bd2014-03-31 23:17:14764enum LossDetectionType {
765 kNack, // Used to mimic TCP's loss detection.
766 kTime, // Time based loss detection.
767};
768
rtenneti4b06ae72014-08-26 03:43:43769// TODO(cyr): Remove this when removing QUIC_VERSION_22.
[email protected]8b37a092012-10-18 21:53:49770struct NET_EXPORT_PRIVATE CongestionFeedbackMessageTCP {
[email protected]6ae6e342014-02-06 02:21:42771 CongestionFeedbackMessageTCP();
772
[email protected]fee17f72013-02-03 07:47:41773 QuicByteCount receive_window;
[email protected]8b37a092012-10-18 21:53:49774};
775
rtenneti4b06ae72014-08-26 03:43:43776// TODO(cyr): Remove this when removing QUIC_VERSION_22.
[email protected]26f3f8e2012-12-13 21:07:19777struct NET_EXPORT_PRIVATE QuicCongestionFeedbackFrame {
[email protected]7884ecad2012-12-14 22:55:15778 QuicCongestionFeedbackFrame();
779 ~QuicCongestionFeedbackFrame();
780
[email protected]26f3f8e2012-12-13 21:07:19781 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
782 std::ostream& os, const QuicCongestionFeedbackFrame& c);
783
[email protected]7884ecad2012-12-14 22:55:15784 CongestionFeedbackType type;
[email protected]a97b3182014-08-08 08:10:18785 // This should really be a union, but since the timestamp struct
[email protected]7884ecad2012-12-14 22:55:15786 // is non-trivial, C++ prohibits it.
787 CongestionFeedbackMessageTCP tcp;
[email protected]8b37a092012-10-18 21:53:49788};
789
[email protected]be24ab22012-10-22 03:01:52790struct NET_EXPORT_PRIVATE QuicRstStreamFrame {
[email protected]6ae6e342014-02-06 02:21:42791 QuicRstStreamFrame();
792 QuicRstStreamFrame(QuicStreamId stream_id,
793 QuicRstStreamErrorCode error_code,
794 QuicStreamOffset bytes_written);
[email protected]8b37a092012-10-18 21:53:49795
[email protected]c5e1aca2014-01-30 04:03:04796 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
797 std::ostream& os, const QuicRstStreamFrame& r);
798
[email protected]8b37a092012-10-18 21:53:49799 QuicStreamId stream_id;
[email protected]74bda142013-03-31 02:49:11800 QuicRstStreamErrorCode error_code;
[email protected]431bb4fd2012-10-19 17:46:09801 std::string error_details;
[email protected]6ae6e342014-02-06 02:21:42802
803 // Used to update flow control windows. On termination of a stream, both
804 // endpoints must inform the peer of the number of bytes they have sent on
805 // that stream. This can be done through normal termination (data packet with
806 // FIN) or through a RST.
807 QuicStreamOffset byte_offset;
[email protected]8b37a092012-10-18 21:53:49808};
809
[email protected]be24ab22012-10-22 03:01:52810struct NET_EXPORT_PRIVATE QuicConnectionCloseFrame {
[email protected]6ae6e342014-02-06 02:21:42811 QuicConnectionCloseFrame();
812
[email protected]c5e1aca2014-01-30 04:03:04813 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
814 std::ostream& os, const QuicConnectionCloseFrame& c);
815
[email protected]431bb4fd2012-10-19 17:46:09816 QuicErrorCode error_code;
[email protected]431bb4fd2012-10-19 17:46:09817 std::string error_details;
[email protected]8b37a092012-10-18 21:53:49818};
819
[email protected]9db443912013-02-25 05:27:03820struct NET_EXPORT_PRIVATE QuicGoAwayFrame {
[email protected]6ae6e342014-02-06 02:21:42821 QuicGoAwayFrame();
[email protected]9db443912013-02-25 05:27:03822 QuicGoAwayFrame(QuicErrorCode error_code,
823 QuicStreamId last_good_stream_id,
824 const std::string& reason);
825
[email protected]c5e1aca2014-01-30 04:03:04826 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
827 std::ostream& os, const QuicGoAwayFrame& g);
828
[email protected]9db443912013-02-25 05:27:03829 QuicErrorCode error_code;
830 QuicStreamId last_good_stream_id;
831 std::string reason_phrase;
832};
833
[email protected]6ae6e342014-02-06 02:21:42834// Flow control updates per-stream and at the connection levoel.
835// Based on SPDY's WINDOW_UPDATE frame, but uses an absolute byte offset rather
836// than a window delta.
837// TODO(rjshade): A possible future optimization is to make stream_id and
838// byte_offset variable length, similar to stream frames.
839struct NET_EXPORT_PRIVATE QuicWindowUpdateFrame {
840 QuicWindowUpdateFrame() {}
841 QuicWindowUpdateFrame(QuicStreamId stream_id, QuicStreamOffset byte_offset);
842
843 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
844 std::ostream& os, const QuicWindowUpdateFrame& w);
845
846 // The stream this frame applies to. 0 is a special case meaning the overall
847 // connection rather than a specific stream.
848 QuicStreamId stream_id;
849
850 // Byte offset in the stream or connection. The receiver of this frame must
851 // not send data which would result in this offset being exceeded.
852 QuicStreamOffset byte_offset;
853};
854
855// The BLOCKED frame is used to indicate to the remote endpoint that this
856// endpoint believes itself to be flow-control blocked but otherwise ready to
857// send data. The BLOCKED frame is purely advisory and optional.
858// Based on SPDY's BLOCKED frame (undocumented as of 2014-01-28).
859struct NET_EXPORT_PRIVATE QuicBlockedFrame {
860 QuicBlockedFrame() {}
861 explicit QuicBlockedFrame(QuicStreamId stream_id);
862
863 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
864 std::ostream& os, const QuicBlockedFrame& b);
865
866 // The stream this frame applies to. 0 is a special case meaning the overall
867 // connection rather than a specific stream.
868 QuicStreamId stream_id;
869};
870
[email protected]8ba81212013-05-03 13:11:48871// EncryptionLevel enumerates the stages of encryption that a QUIC connection
872// progresses through. When retransmitting a packet, the encryption level needs
873// to be specified so that it is retransmitted at a level which the peer can
874// understand.
875enum EncryptionLevel {
876 ENCRYPTION_NONE = 0,
877 ENCRYPTION_INITIAL = 1,
878 ENCRYPTION_FORWARD_SECURE = 2,
879
880 NUM_ENCRYPTION_LEVELS,
881};
882
[email protected]be24ab22012-10-22 03:01:52883struct NET_EXPORT_PRIVATE QuicFrame {
[email protected]6ae6e342014-02-06 02:21:42884 QuicFrame();
885 explicit QuicFrame(QuicPaddingFrame* padding_frame);
886 explicit QuicFrame(QuicStreamFrame* stream_frame);
887 explicit QuicFrame(QuicAckFrame* frame);
rtenneti4b06ae72014-08-26 03:43:43888
889 // TODO(cyr): Remove this when removing QUIC_VERSION_22.
[email protected]6ae6e342014-02-06 02:21:42890 explicit QuicFrame(QuicCongestionFeedbackFrame* frame);
rtenneti4b06ae72014-08-26 03:43:43891
[email protected]6ae6e342014-02-06 02:21:42892 explicit QuicFrame(QuicRstStreamFrame* frame);
893 explicit QuicFrame(QuicConnectionCloseFrame* frame);
[email protected]93dd91f2014-02-27 00:09:03894 explicit QuicFrame(QuicStopWaitingFrame* frame);
[email protected]d8c522112014-04-23 09:23:25895 explicit QuicFrame(QuicPingFrame* frame);
[email protected]6ae6e342014-02-06 02:21:42896 explicit QuicFrame(QuicGoAwayFrame* frame);
897 explicit QuicFrame(QuicWindowUpdateFrame* frame);
898 explicit QuicFrame(QuicBlockedFrame* frame);
[email protected]8b37a092012-10-18 21:53:49899
[email protected]c5e1aca2014-01-30 04:03:04900 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
901 std::ostream& os, const QuicFrame& frame);
902
[email protected]be24ab22012-10-22 03:01:52903 QuicFrameType type;
[email protected]8b37a092012-10-18 21:53:49904 union {
[email protected]c995c572013-01-18 05:43:20905 QuicPaddingFrame* padding_frame;
[email protected]be24ab22012-10-22 03:01:52906 QuicStreamFrame* stream_frame;
907 QuicAckFrame* ack_frame;
rtenneti4b06ae72014-08-26 03:43:43908
909 // TODO(cyr): Remove this when removing QUIC_VERSION_22.
[email protected]26f3f8e2012-12-13 21:07:19910 QuicCongestionFeedbackFrame* congestion_feedback_frame;
[email protected]93dd91f2014-02-27 00:09:03911 QuicStopWaitingFrame* stop_waiting_frame;
rtenneti4b06ae72014-08-26 03:43:43912
[email protected]d8c522112014-04-23 09:23:25913 QuicPingFrame* ping_frame;
[email protected]be24ab22012-10-22 03:01:52914 QuicRstStreamFrame* rst_stream_frame;
915 QuicConnectionCloseFrame* connection_close_frame;
[email protected]9db443912013-02-25 05:27:03916 QuicGoAwayFrame* goaway_frame;
[email protected]6ae6e342014-02-06 02:21:42917 QuicWindowUpdateFrame* window_update_frame;
918 QuicBlockedFrame* blocked_frame;
[email protected]8b37a092012-10-18 21:53:49919 };
920};
921
[email protected]be24ab22012-10-22 03:01:52922typedef std::vector<QuicFrame> QuicFrames;
[email protected]8b37a092012-10-18 21:53:49923
924struct NET_EXPORT_PRIVATE QuicFecData {
925 QuicFecData();
[email protected]a5061242012-10-23 23:29:37926
[email protected]c995c572013-01-18 05:43:20927 // The FEC group number is also the sequence number of the first
928 // FEC protected packet. The last protected packet's sequence number will
929 // be one less than the sequence number of the FEC packet.
[email protected]8b37a092012-10-18 21:53:49930 QuicFecGroupNumber fec_group;
[email protected]8b37a092012-10-18 21:53:49931 base::StringPiece redundancy;
[email protected]8b37a092012-10-18 21:53:49932};
933
[email protected]8b37a092012-10-18 21:53:49934class NET_EXPORT_PRIVATE QuicData {
935 public:
[email protected]6ae6e342014-02-06 02:21:42936 QuicData(const char* buffer, size_t length);
937 QuicData(char* buffer, size_t length, bool owns_buffer);
[email protected]8b37a092012-10-18 21:53:49938 virtual ~QuicData();
939
940 base::StringPiece AsStringPiece() const {
941 return base::StringPiece(data(), length());
942 }
943
944 const char* data() const { return buffer_; }
945 size_t length() const { return length_; }
946
947 private:
948 const char* buffer_;
949 size_t length_;
950 bool owns_buffer_;
951
952 DISALLOW_COPY_AND_ASSIGN(QuicData);
953};
954
955class NET_EXPORT_PRIVATE QuicPacket : public QuicData {
956 public:
[email protected]25c31dc2013-06-05 17:56:04957 static QuicPacket* NewDataPacket(
958 char* buffer,
959 size_t length,
960 bool owns_buffer,
[email protected]3aa9ca72014-02-27 19:39:43961 QuicConnectionIdLength connection_id_length,
[email protected]25c31dc2013-06-05 17:56:04962 bool includes_version,
963 QuicSequenceNumberLength sequence_number_length) {
[email protected]3aa9ca72014-02-27 19:39:43964 return new QuicPacket(buffer, length, owns_buffer, connection_id_length,
[email protected]25c31dc2013-06-05 17:56:04965 includes_version, sequence_number_length, false);
[email protected]c995c572013-01-18 05:43:20966 }
967
[email protected]25c31dc2013-06-05 17:56:04968 static QuicPacket* NewFecPacket(
969 char* buffer,
970 size_t length,
971 bool owns_buffer,
[email protected]3aa9ca72014-02-27 19:39:43972 QuicConnectionIdLength connection_id_length,
[email protected]25c31dc2013-06-05 17:56:04973 bool includes_version,
974 QuicSequenceNumberLength sequence_number_length) {
[email protected]3aa9ca72014-02-27 19:39:43975 return new QuicPacket(buffer, length, owns_buffer, connection_id_length,
[email protected]25c31dc2013-06-05 17:56:04976 includes_version, sequence_number_length, true);
[email protected]c995c572013-01-18 05:43:20977 }
[email protected]8b37a092012-10-18 21:53:49978
[email protected]5351cc4b2013-03-03 07:22:41979 base::StringPiece FecProtectedData() const;
980 base::StringPiece AssociatedData() const;
981 base::StringPiece BeforePlaintext() const;
982 base::StringPiece Plaintext() const;
[email protected]082b65b2012-11-10 19:11:31983
[email protected]c995c572013-01-18 05:43:20984 bool is_fec_packet() const { return is_fec_packet_; }
[email protected]082b65b2012-11-10 19:11:31985
[email protected]8b37a092012-10-18 21:53:49986 char* mutable_data() { return buffer_; }
987
988 private:
[email protected]5351cc4b2013-03-03 07:22:41989 QuicPacket(char* buffer,
990 size_t length,
991 bool owns_buffer,
[email protected]3aa9ca72014-02-27 19:39:43992 QuicConnectionIdLength connection_id_length,
[email protected]5351cc4b2013-03-03 07:22:41993 bool includes_version,
[email protected]25c31dc2013-06-05 17:56:04994 QuicSequenceNumberLength sequence_number_length,
[email protected]6ae6e342014-02-06 02:21:42995 bool is_fec_packet);
[email protected]c995c572013-01-18 05:43:20996
[email protected]8b37a092012-10-18 21:53:49997 char* buffer_;
[email protected]c995c572013-01-18 05:43:20998 const bool is_fec_packet_;
[email protected]3aa9ca72014-02-27 19:39:43999 const QuicConnectionIdLength connection_id_length_;
[email protected]5351cc4b2013-03-03 07:22:411000 const bool includes_version_;
[email protected]25c31dc2013-06-05 17:56:041001 const QuicSequenceNumberLength sequence_number_length_;
[email protected]8b37a092012-10-18 21:53:491002
[email protected]2e740db2012-10-20 19:35:191003 DISALLOW_COPY_AND_ASSIGN(QuicPacket);
[email protected]8b37a092012-10-18 21:53:491004};
1005
1006class NET_EXPORT_PRIVATE QuicEncryptedPacket : public QuicData {
1007 public:
[email protected]6ae6e342014-02-06 02:21:421008 QuicEncryptedPacket(const char* buffer, size_t length);
1009 QuicEncryptedPacket(char* buffer, size_t length, bool owns_buffer);
[email protected]8b37a092012-10-18 21:53:491010
[email protected]ec86d5462013-11-17 16:04:491011 // Clones the packet into a new packet which owns the buffer.
1012 QuicEncryptedPacket* Clone() const;
1013
[email protected]c1b32c62013-01-20 02:49:101014 // By default, gtest prints the raw bytes of an object. The bool data
1015 // member (in the base class QuicData) causes this object to have padding
1016 // bytes, which causes the default gtest object printer to read
1017 // uninitialize memory. So we need to teach gtest how to print this object.
1018 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
1019 std::ostream& os, const QuicEncryptedPacket& s);
1020
[email protected]2e740db2012-10-20 19:35:191021 private:
1022 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket);
[email protected]8b37a092012-10-18 21:53:491023};
1024
[email protected]9db443912013-02-25 05:27:031025class NET_EXPORT_PRIVATE RetransmittableFrames {
1026 public:
1027 RetransmittableFrames();
1028 ~RetransmittableFrames();
1029
1030 // Allocates a local copy of the referenced StringPiece has QuicStreamFrame
1031 // use it.
1032 // Takes ownership of |stream_frame|.
1033 const QuicFrame& AddStreamFrame(QuicStreamFrame* stream_frame);
1034 // Takes ownership of the frame inside |frame|.
1035 const QuicFrame& AddNonStreamFrame(const QuicFrame& frame);
1036 const QuicFrames& frames() const { return frames_; }
1037
[email protected]672631c2014-08-16 06:11:451038 IsHandshake HasCryptoHandshake() const {
1039 return has_crypto_handshake_;
1040 }
[email protected]2115d33ba2014-01-02 21:53:521041
[email protected]8ba81212013-05-03 13:11:481042 void set_encryption_level(EncryptionLevel level);
1043 EncryptionLevel encryption_level() const {
1044 return encryption_level_;
1045 }
1046
[email protected]9db443912013-02-25 05:27:031047 private:
1048 QuicFrames frames_;
[email protected]8ba81212013-05-03 13:11:481049 EncryptionLevel encryption_level_;
[email protected]672631c2014-08-16 06:11:451050 IsHandshake has_crypto_handshake_;
[email protected]9db443912013-02-25 05:27:031051 // Data referenced by the StringPiece of a QuicStreamFrame.
1052 std::vector<std::string*> stream_data_;
1053
1054 DISALLOW_COPY_AND_ASSIGN(RetransmittableFrames);
1055};
1056
1057struct NET_EXPORT_PRIVATE SerializedPacket {
1058 SerializedPacket(QuicPacketSequenceNumber sequence_number,
[email protected]ea825e02013-08-21 18:12:451059 QuicSequenceNumberLength sequence_number_length,
[email protected]9db443912013-02-25 05:27:031060 QuicPacket* packet,
1061 QuicPacketEntropyHash entropy_hash,
[email protected]97cf3022013-09-05 14:30:161062 RetransmittableFrames* retransmittable_frames);
1063 ~SerializedPacket();
[email protected]9db443912013-02-25 05:27:031064
1065 QuicPacketSequenceNumber sequence_number;
[email protected]ea825e02013-08-21 18:12:451066 QuicSequenceNumberLength sequence_number_length;
[email protected]9db443912013-02-25 05:27:031067 QuicPacket* packet;
1068 QuicPacketEntropyHash entropy_hash;
1069 RetransmittableFrames* retransmittable_frames;
[email protected]97cf3022013-09-05 14:30:161070
1071 // If set, these will be called when this packet is ACKed by the peer.
1072 std::set<QuicAckNotifier*> notifiers;
[email protected]9db443912013-02-25 05:27:031073};
1074
[email protected]77b5d50b2014-05-07 22:48:481075struct NET_EXPORT_PRIVATE TransmissionInfo {
1076 // Used by STL when assigning into a map.
1077 TransmissionInfo();
1078
1079 // Constructs a Transmission with a new all_tranmissions set
1080 // containing |sequence_number|.
1081 TransmissionInfo(RetransmittableFrames* retransmittable_frames,
[email protected]77b5d50b2014-05-07 22:48:481082 QuicSequenceNumberLength sequence_number_length,
[email protected]730b35d72014-06-05 03:23:221083 TransmissionType transmission_type,
rtenneti08b014382014-10-29 14:03:191084 QuicTime sent_time);
[email protected]77b5d50b2014-05-07 22:48:481085
1086 RetransmittableFrames* retransmittable_frames;
1087 QuicSequenceNumberLength sequence_number_length;
1088 // Zero when the packet is serialized, non-zero once it's sent.
1089 QuicTime sent_time;
1090 // Zero when the packet is serialized, non-zero once it's sent.
1091 QuicByteCount bytes_sent;
1092 size_t nack_count;
[email protected]730b35d72014-06-05 03:23:221093 // Reason why this packet was transmitted.
1094 TransmissionType transmission_type;
[email protected]77b5d50b2014-05-07 22:48:481095 // Stores the sequence numbers of all transmissions of this packet.
rtennetibe635732014-10-02 22:51:421096 // Must always be nullptr or have multiple elements.
rtennetidd4bf8f2014-09-03 00:45:161097 SequenceNumberList* all_transmissions;
[email protected]aa7e4ef2014-05-28 03:53:151098 // In flight packets have not been abandoned or lost.
1099 bool in_flight;
rtenneti31e9fd62014-09-16 05:22:151100 // True if the packet can never be acked, so it can be removed.
1101 bool is_unackable;
rtenneti85d89712014-11-20 03:32:241102 // True if the packet is an FEC packet.
1103 bool is_fec_packet;
[email protected]77b5d50b2014-05-07 22:48:481104};
1105
[email protected]8b37a092012-10-18 21:53:491106} // namespace net
1107
1108#endif // NET_QUIC_QUIC_PROTOCOL_H_