blob: ad920d0f21028ad3bfca01f9ac35665204d800af [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
62// Maximum size of the initial congestion window in packets.
rtenneti4a5df262014-11-07 00:43:5863const QuicPacketCount kDefaultInitialWindow = 10;
64const QuicPacketCount kMaxInitialWindow = 100;
[email protected]8e01c062013-10-31 07:35:3165
[email protected]7d561352014-06-20 09:09:2166// Default size of initial flow control window, for both stream and session.
[email protected]9bb57c72014-03-31 20:36:0467const uint32 kDefaultFlowControlSendWindow = 16 * 1024; // 16 KB
68
[email protected]0ac0c5b2013-11-20 05:55:5869// Maximum size of the congestion window, in packets, for TCP congestion control
70// algorithms.
71const size_t kMaxTcpCongestionWindow = 200;
72
rtenneti23186682014-10-30 01:49:3373// Default size of the socket receive buffer in bytes.
[email protected]648f81142014-08-15 21:38:4674const QuicByteCount kDefaultSocketReceiveBuffer = 256 * 1024;
rtenneti23186682014-10-30 01:49:3375// Minimum size of the socket receive buffer in bytes.
76// Smaller values are ignored.
77const QuicByteCount kMinSocketReceiveBuffer = 16 * 1024;
[email protected]a97b3182014-08-08 08:10:1878
rtennetifc97ab62014-11-11 22:17:4979// Don't allow a client to suggest an RTT shorter than 10ms.
80const uint32 kMinInitialRoundTripTimeUs = 10 * kNumMicrosPerMilli;
81
[email protected]8e01c062013-10-31 07:35:3182// Don't allow a client to suggest an RTT longer than 15 seconds.
[email protected]2d43c40122014-04-21 14:51:2783const uint32 kMaxInitialRoundTripTimeUs = 15 * kNumMicrosPerSecond;
[email protected]8b37a092012-10-18 21:53:4984
85// Maximum number of open streams per connection.
86const size_t kDefaultMaxStreamsPerConnection = 100;
87
[email protected]af806e62013-05-22 14:47:5088// Number of bytes reserved for public flags in the packet header.
89const size_t kPublicFlagsSize = 1;
[email protected]5351cc4b2013-03-03 07:22:4190// Number of bytes reserved for version number in the packet header.
91const size_t kQuicVersionSize = 4;
[email protected]c995c572013-01-18 05:43:2092// Number of bytes reserved for private flags in the packet header.
93const size_t kPrivateFlagsSize = 1;
94// Number of bytes reserved for FEC group in the packet header.
95const size_t kFecGroupSize = 1;
[email protected]5351cc4b2013-03-03 07:22:4196
97// Signifies that the QuicPacket will contain version of the protocol.
98const bool kIncludeVersion = true;
[email protected]c995c572013-01-18 05:43:2099
[email protected]5351cc4b2013-03-03 07:22:41100// Index of the first byte in a QUIC packet which is used in hash calculation.
101const size_t kStartOfHashData = 0;
[email protected]8b37a092012-10-18 21:53:49102
103// Limit on the delta between stream IDs.
[email protected]c5cc9bd2014-03-31 23:17:14104const QuicStreamId kMaxStreamIdDelta = 200;
[email protected]c244c5a12013-05-07 20:55:04105// Limit on the delta between header IDs.
[email protected]c5cc9bd2014-03-31 23:17:14106const QuicHeaderId kMaxHeaderIdDelta = 200;
[email protected]8b37a092012-10-18 21:53:49107
108// Reserved ID for the crypto stream.
[email protected]8b37a092012-10-18 21:53:49109const QuicStreamId kCryptoStreamId = 1;
110
[email protected]4d640792013-12-18 22:21:08111// Reserved ID for the headers stream.
112const QuicStreamId kHeadersStreamId = 3;
113
[email protected]648f81142014-08-15 21:38:46114// Maximum delayed ack time, in ms.
pkastingacec86f2014-10-14 23:08:55115const int64 kMaxDelayedAckTimeMs = 25;
[email protected]648f81142014-08-15 21:38:46116
rtennetib5512bb2014-09-29 19:17:15117// The timeout before the handshake succeeds.
118const int64 kInitialIdleTimeoutSecs = 5;
119// The default idle timeout.
120const int64 kDefaultIdleTimeoutSecs = 30;
rtenneti31e9fd62014-09-16 05:22:15121// The maximum idle timeout that can be negotiated.
122const int64 kMaximumIdleTimeoutSecs = 60 * 10; // 10 minutes.
123// The default timeout for a connection until the crypto handshake succeeds.
rtennetib5512bb2014-09-29 19:17:15124const int64 kMaxTimeForCryptoHandshakeSecs = 10; // 10 secs.
[email protected]8b37a092012-10-18 21:53:49125
rtenneti93bce7ece2014-10-13 22:38:41126// Default limit on the number of undecryptable packets the connection buffers
127// before the CHLO/SHLO arrive.
128const size_t kDefaultMaxUndecryptablePackets = 10;
129
[email protected]525948df2014-04-21 06:26:58130// Default ping timeout.
131const int64 kPingTimeoutSecs = 15; // 15 secs.
132
[email protected]ca4e0d92014-08-22 16:33:22133// Minimum number of RTTs between Server Config Updates (SCUP) sent to client.
134const int kMinIntervalBetweenServerConfigUpdatesRTTs = 10;
135
136// Minimum time between Server Config Updates (SCUP) sent to client.
137const int kMinIntervalBetweenServerConfigUpdatesMs = 1000;
138
rtenneti33da8ab2014-11-04 04:17:00139// Minimum number of packets between Server Config Updates (SCUP).
140const int kMinPacketsBetweenServerConfigUpdates = 100;
141
rtennetib5512bb2014-09-29 19:17:15142// The number of open streams that a server will accept is set to be slightly
143// larger than the negotiated limit. Immediately closing the connection if the
144// client opens slightly too many streams is not ideal: the client may have sent
145// a FIN that was lost, and simultaneously opened a new stream. The number of
146// streams a server accepts is a fixed increment over the negotiated limit, or a
147// percentage increase, whichever is larger.
rtenneti31e9fd62014-09-16 05:22:15148const float kMaxStreamsMultiplier = 1.1f;
rtennetib5512bb2014-09-29 19:17:15149const int kMaxStreamsMinimumIncrement = 10;
rtenneti31e9fd62014-09-16 05:22:15150
[email protected]b007e632013-10-28 08:39:25151// We define an unsigned 16-bit floating point value, inspired by IEEE floats
152// (http://en.wikipedia.org/wiki/Half_precision_floating-point_format),
153// with 5-bit exponent (bias 1), 11-bit mantissa (effective 12 with hidden
154// bit) and denormals, but without signs, transfinites or fractions. Wire format
155// 16 bits (little-endian byte order) are split into exponent (high 5) and
156// mantissa (low 11) and decoded as:
157// uint64 value;
158// if (exponent == 0) value = mantissa;
159// else value = (mantissa | 1 << 11) << (exponent - 1)
160const int kUFloat16ExponentBits = 5;
161const int kUFloat16MaxExponent = (1 << kUFloat16ExponentBits) - 2; // 30
162const int kUFloat16MantissaBits = 16 - kUFloat16ExponentBits; // 11
163const int kUFloat16MantissaEffectiveBits = kUFloat16MantissaBits + 1; // 12
164const uint64 kUFloat16MaxValue = // 0x3FFC0000000
165 ((GG_UINT64_C(1) << kUFloat16MantissaEffectiveBits) - 1) <<
166 kUFloat16MaxExponent;
167
[email protected]c67a82cb2013-09-24 02:53:21168enum TransmissionType {
[email protected]2532de12013-05-09 12:29:33169 NOT_RETRANSMISSION,
[email protected]b9475b582014-03-20 20:04:33170 FIRST_TRANSMISSION_TYPE = NOT_RETRANSMISSION,
171 HANDSHAKE_RETRANSMISSION, // Retransmits due to handshake timeouts.
rtenneti31e9fd62014-09-16 05:22:15172 ALL_UNACKED_RETRANSMISSION, // Retransmits all unacked packets.
173 ALL_INITIAL_RETRANSMISSION, // Retransmits all initially encrypted packets.
[email protected]b9475b582014-03-20 20:04:33174 LOSS_RETRANSMISSION, // Retransmits due to loss detection.
175 RTO_RETRANSMISSION, // Retransmits due to retransmit time out.
176 TLP_RETRANSMISSION, // Tail loss probes.
177 LAST_TRANSMISSION_TYPE = TLP_RETRANSMISSION,
[email protected]74bda142013-03-31 02:49:11178};
179
180enum HasRetransmittableData {
[email protected]2532de12013-05-09 12:29:33181 NO_RETRANSMITTABLE_DATA,
182 HAS_RETRANSMITTABLE_DATA,
[email protected]74bda142013-03-31 02:49:11183};
184
[email protected]575cce62013-08-03 02:06:43185enum IsHandshake {
186 NOT_HANDSHAKE,
187 IS_HANDSHAKE
188};
189
[email protected]bbb10072014-06-13 07:41:59190// Indicates FEC protection level for data being written.
191enum FecProtection {
192 MUST_FEC_PROTECT, // Callee must FEC protect this data.
[email protected]a5b98172014-06-18 07:01:59193 MAY_FEC_PROTECT // Callee does not have to but may FEC protect this data.
194};
195
[email protected]bc356fe2014-06-19 11:14:14196// Indicates FEC policy.
[email protected]a5b98172014-06-18 07:01:59197enum FecPolicy {
198 FEC_PROTECT_ALWAYS, // All data in the stream should be FEC protected.
199 FEC_PROTECT_OPTIONAL // Data in the stream does not need FEC protection.
[email protected]bbb10072014-06-13 07:41:59200};
201
[email protected]be24ab22012-10-22 03:01:52202enum QuicFrameType {
[email protected]6ae6e342014-02-06 02:21:42203 // Regular frame types. The values set here cannot change without the
204 // introduction of a new QUIC version.
[email protected]c995c572013-01-18 05:43:20205 PADDING_FRAME = 0,
[email protected]6ae6e342014-02-06 02:21:42206 RST_STREAM_FRAME = 1,
207 CONNECTION_CLOSE_FRAME = 2,
208 GOAWAY_FRAME = 3,
209 WINDOW_UPDATE_FRAME = 4,
210 BLOCKED_FRAME = 5,
[email protected]93dd91f2014-02-27 00:09:03211 STOP_WAITING_FRAME = 6,
[email protected]d8c522112014-04-23 09:23:25212 PING_FRAME = 7,
[email protected]6ae6e342014-02-06 02:21:42213
214 // STREAM, ACK, and CONGESTION_FEEDBACK frames are special frames. They are
215 // encoded differently on the wire and their values do not need to be stable.
[email protected]97cf3022013-09-05 14:30:16216 STREAM_FRAME,
217 ACK_FRAME,
218 CONGESTION_FEEDBACK_FRAME,
[email protected]be24ab22012-10-22 03:01:52219 NUM_FRAME_TYPES
[email protected]8b37a092012-10-18 21:53:49220};
221
[email protected]3aa9ca72014-02-27 19:39:43222enum QuicConnectionIdLength {
223 PACKET_0BYTE_CONNECTION_ID = 0,
224 PACKET_1BYTE_CONNECTION_ID = 1,
225 PACKET_4BYTE_CONNECTION_ID = 4,
226 PACKET_8BYTE_CONNECTION_ID = 8
[email protected]b064310782013-05-30 21:12:17227};
228
229enum InFecGroup {
230 NOT_IN_FEC_GROUP,
231 IN_FEC_GROUP,
232};
233
[email protected]25c31dc2013-06-05 17:56:04234enum QuicSequenceNumberLength {
235 PACKET_1BYTE_SEQUENCE_NUMBER = 1,
236 PACKET_2BYTE_SEQUENCE_NUMBER = 2,
237 PACKET_4BYTE_SEQUENCE_NUMBER = 4,
238 PACKET_6BYTE_SEQUENCE_NUMBER = 6
239};
240
[email protected]8e01c062013-10-31 07:35:31241// Used to indicate a QuicSequenceNumberLength using two flag bits.
242enum QuicSequenceNumberLengthFlags {
243 PACKET_FLAGS_1BYTE_SEQUENCE = 0, // 00
244 PACKET_FLAGS_2BYTE_SEQUENCE = 1, // 01
245 PACKET_FLAGS_4BYTE_SEQUENCE = 1 << 1, // 10
246 PACKET_FLAGS_6BYTE_SEQUENCE = 1 << 1 | 1, // 11
247};
248
[email protected]f62262b2013-07-05 20:57:30249// The public flags are specified in one byte.
[email protected]c995c572013-01-18 05:43:20250enum QuicPacketPublicFlags {
251 PACKET_PUBLIC_FLAGS_NONE = 0,
[email protected]f62262b2013-07-05 20:57:30252
253 // Bit 0: Does the packet header contains version info?
254 PACKET_PUBLIC_FLAGS_VERSION = 1 << 0,
255
256 // Bit 1: Is this packet a public reset packet?
257 PACKET_PUBLIC_FLAGS_RST = 1 << 1,
258
[email protected]3aa9ca72014-02-27 19:39:43259 // Bits 2 and 3 specify the length of the ConnectionId as follows:
[email protected]f62262b2013-07-05 20:57:30260 // ----00--: 0 bytes
261 // ----01--: 1 byte
262 // ----10--: 4 bytes
263 // ----11--: 8 bytes
[email protected]3aa9ca72014-02-27 19:39:43264 PACKET_PUBLIC_FLAGS_0BYTE_CONNECTION_ID = 0,
265 PACKET_PUBLIC_FLAGS_1BYTE_CONNECTION_ID = 1 << 2,
266 PACKET_PUBLIC_FLAGS_4BYTE_CONNECTION_ID = 1 << 3,
267 PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID = 1 << 3 | 1 << 2,
[email protected]f62262b2013-07-05 20:57:30268
269 // Bits 4 and 5 describe the packet sequence number length as follows:
270 // --00----: 1 byte
271 // --01----: 2 bytes
272 // --10----: 4 bytes
273 // --11----: 6 bytes
[email protected]8e01c062013-10-31 07:35:31274 PACKET_PUBLIC_FLAGS_1BYTE_SEQUENCE = PACKET_FLAGS_1BYTE_SEQUENCE << 4,
275 PACKET_PUBLIC_FLAGS_2BYTE_SEQUENCE = PACKET_FLAGS_2BYTE_SEQUENCE << 4,
276 PACKET_PUBLIC_FLAGS_4BYTE_SEQUENCE = PACKET_FLAGS_4BYTE_SEQUENCE << 4,
277 PACKET_PUBLIC_FLAGS_6BYTE_SEQUENCE = PACKET_FLAGS_6BYTE_SEQUENCE << 4,
[email protected]f62262b2013-07-05 20:57:30278
279 // All bits set (bits 6 and 7 are not currently used): 00111111
280 PACKET_PUBLIC_FLAGS_MAX = (1 << 6) - 1
[email protected]c995c572013-01-18 05:43:20281};
[email protected]8b37a092012-10-18 21:53:49282
[email protected]f62262b2013-07-05 20:57:30283// The private flags are specified in one byte.
[email protected]c995c572013-01-18 05:43:20284enum QuicPacketPrivateFlags {
285 PACKET_PRIVATE_FLAGS_NONE = 0,
[email protected]f62262b2013-07-05 20:57:30286
287 // Bit 0: Does this packet contain an entropy bit?
[email protected]b064310782013-05-30 21:12:17288 PACKET_PRIVATE_FLAGS_ENTROPY = 1 << 0,
[email protected]f62262b2013-07-05 20:57:30289
290 // Bit 1: Payload is part of an FEC group?
291 PACKET_PRIVATE_FLAGS_FEC_GROUP = 1 << 1,
292
293 // Bit 2: Payload is FEC as opposed to frames?
294 PACKET_PRIVATE_FLAGS_FEC = 1 << 2,
295
296 // All bits set (bits 3-7 are not currently used): 00000111
297 PACKET_PRIVATE_FLAGS_MAX = (1 << 3) - 1
[email protected]c995c572013-01-18 05:43:20298};
299
[email protected]48878092013-07-26 14:51:56300// The available versions of QUIC. Guaranteed that the integer value of the enum
301// will match the version number.
302// When adding a new version to this enum you should add it to
[email protected]8bbfaeb72013-08-09 06:38:26303// kSupportedQuicVersions (if appropriate), and also add a new case to the
304// helper methods QuicVersionToQuicTag, QuicTagToQuicVersion, and
305// QuicVersionToString.
[email protected]48878092013-07-26 14:51:56306enum QuicVersion {
307 // Special case to indicate unknown/unsupported QUIC version.
308 QUIC_VERSION_UNSUPPORTED = 0,
309
[email protected]7afc2ebe2014-07-18 16:06:23310 QUIC_VERSION_19 = 19, // Connection level flow control.
[email protected]0c6b10ad2014-07-02 19:47:00311 QUIC_VERSION_21 = 21, // Headers/crypto streams are flow controlled.
[email protected]9693157b2014-08-08 11:13:49312 QUIC_VERSION_22 = 22, // Send Server Config Update messages on crypto stream.
rtenneti4b06ae72014-08-26 03:43:43313 QUIC_VERSION_23 = 23, // Timestamp in the ack frame.
[email protected]48878092013-07-26 14:51:56314};
315
316// This vector contains QUIC versions which we currently support.
317// This should be ordered such that the highest supported version is the first
318// element, with subsequent elements in descending order (versions can be
319// skipped as necessary).
[email protected]31ae854842013-11-27 00:05:46320//
[email protected]310d37b2014-08-02 06:15:37321// IMPORTANT: if you are adding to this list, follow the instructions at
[email protected]31ae854842013-11-27 00:05:46322// http://sites/quic/adding-and-removing-versions
rtenneti4b06ae72014-08-26 03:43:43323static const QuicVersion kSupportedQuicVersions[] = {QUIC_VERSION_23,
324 QUIC_VERSION_22,
rtenneti6afc6f42014-10-21 02:15:15325 QUIC_VERSION_19};
[email protected]48878092013-07-26 14:51:56326
327typedef std::vector<QuicVersion> QuicVersionVector;
328
[email protected]b007e632013-10-28 08:39:25329// Returns a vector of QUIC versions in kSupportedQuicVersions.
330NET_EXPORT_PRIVATE QuicVersionVector QuicSupportedVersions();
[email protected]ea2ab47b2013-08-13 00:44:11331
[email protected]48878092013-07-26 14:51:56332// QuicTag is written to and read from the wire, but we prefer to use
333// the more readable QuicVersion at other levels.
334// Helper function which translates from a QuicVersion to a QuicTag. Returns 0
335// if QuicVersion is unsupported.
336NET_EXPORT_PRIVATE QuicTag QuicVersionToQuicTag(const QuicVersion version);
337
338// Returns appropriate QuicVersion from a QuicTag.
339// Returns QUIC_VERSION_UNSUPPORTED if version_tag cannot be understood.
340NET_EXPORT_PRIVATE QuicVersion QuicTagToQuicVersion(const QuicTag version_tag);
341
342// Helper function which translates from a QuicVersion to a string.
343// Returns strings corresponding to enum names (e.g. QUIC_VERSION_6).
344NET_EXPORT_PRIVATE std::string QuicVersionToString(const QuicVersion version);
345
346// Returns comma separated list of string representations of QuicVersion enum
[email protected]b007e632013-10-28 08:39:25347// values in the supplied |versions| vector.
348NET_EXPORT_PRIVATE std::string QuicVersionVectorToString(
349 const QuicVersionVector& versions);
[email protected]48878092013-07-26 14:51:56350
351// Version and Crypto tags are written to the wire with a big-endian
352// representation of the name of the tag. For example
353// the client hello tag (CHLO) will be written as the
354// following 4 bytes: 'C' 'H' 'L' 'O'. Since it is
355// stored in memory as a little endian uint32, we need
356// to reverse the order of the bytes.
357
358// MakeQuicTag returns a value given the four bytes. For example:
359// MakeQuicTag('C', 'H', 'L', 'O');
360NET_EXPORT_PRIVATE QuicTag MakeQuicTag(char a, char b, char c, char d);
361
[email protected]9cda5fd2014-06-03 10:20:28362// Returns true if the tag vector contains the specified tag.
[email protected]cc1aa272014-06-30 19:48:22363NET_EXPORT_PRIVATE bool ContainsQuicTag(const QuicTagVector& tag_vector,
364 QuicTag tag);
[email protected]9cda5fd2014-06-03 10:20:28365
[email protected]b064310782013-05-30 21:12:17366// Size in bytes of the data or fec packet header.
[email protected]79d13dcb2014-02-05 07:23:13367NET_EXPORT_PRIVATE size_t GetPacketHeaderSize(const QuicPacketHeader& header);
[email protected]b064310782013-05-30 21:12:17368
[email protected]25c31dc2013-06-05 17:56:04369NET_EXPORT_PRIVATE size_t GetPacketHeaderSize(
[email protected]3aa9ca72014-02-27 19:39:43370 QuicConnectionIdLength connection_id_length,
[email protected]25c31dc2013-06-05 17:56:04371 bool include_version,
372 QuicSequenceNumberLength sequence_number_length,
373 InFecGroup is_in_fec_group);
[email protected]b064310782013-05-30 21:12:17374
[email protected]b064310782013-05-30 21:12:17375// Index of the first byte in a QUIC packet of FEC protected data.
[email protected]25c31dc2013-06-05 17:56:04376NET_EXPORT_PRIVATE size_t GetStartOfFecProtectedData(
[email protected]3aa9ca72014-02-27 19:39:43377 QuicConnectionIdLength connection_id_length,
[email protected]25c31dc2013-06-05 17:56:04378 bool include_version,
379 QuicSequenceNumberLength sequence_number_length);
[email protected]b064310782013-05-30 21:12:17380// Index of the first byte in a QUIC packet of encrypted data.
[email protected]25c31dc2013-06-05 17:56:04381NET_EXPORT_PRIVATE size_t GetStartOfEncryptedData(
[email protected]3aa9ca72014-02-27 19:39:43382 QuicConnectionIdLength connection_id_length,
[email protected]25c31dc2013-06-05 17:56:04383 bool include_version,
384 QuicSequenceNumberLength sequence_number_length);
[email protected]b064310782013-05-30 21:12:17385
[email protected]74bda142013-03-31 02:49:11386enum QuicRstStreamErrorCode {
387 QUIC_STREAM_NO_ERROR = 0,
[email protected]8b37a092012-10-18 21:53:49388
[email protected]24e5bc52013-09-18 15:36:58389 // There was some error which halted stream processing.
390 QUIC_ERROR_PROCESSING_STREAM,
[email protected]8b37a092012-10-18 21:53:49391 // We got two fin or reset offsets which did not match.
392 QUIC_MULTIPLE_TERMINATION_OFFSETS,
393 // We got bad payload and can not respond to it at the protocol level.
394 QUIC_BAD_APPLICATION_PAYLOAD,
[email protected]74bda142013-03-31 02:49:11395 // Stream closed due to connection error. No reset frame is sent when this
396 // happens.
397 QUIC_STREAM_CONNECTION_ERROR,
398 // GoAway frame sent. No more stream can be created.
399 QUIC_STREAM_PEER_GOING_AWAY,
[email protected]06ff5152013-08-29 01:03:05400 // The stream has been cancelled.
401 QUIC_STREAM_CANCELLED,
rtenneti4a5df262014-11-07 00:43:58402 // Closing stream locally, sending a RST to allow for proper flow control
403 // accounting. Sent in response to a RST from the peer.
404 QUIC_RST_ACKNOWLEDGEMENT,
[email protected]8b37a092012-10-18 21:53:49405
[email protected]74bda142013-03-31 02:49:11406 // No error. Used as bound while iterating.
407 QUIC_STREAM_LAST_ERROR,
408};
[email protected]8b37a092012-10-18 21:53:49409
[email protected]51cc1342014-04-18 23:44:37410// Because receiving an unknown QuicRstStreamErrorCode results in connection
411// teardown, we use this to make sure any errors predating a given version are
412// downgraded to the most appropriate existing error.
413NET_EXPORT_PRIVATE QuicRstStreamErrorCode AdjustErrorForVersion(
414 QuicRstStreamErrorCode error_code,
415 QuicVersion version);
416
[email protected]89264042013-08-21 07:35:24417// These values must remain stable as they are uploaded to UMA histograms.
418// To add a new error code, use the current value of QUIC_LAST_ERROR and
419// increment QUIC_LAST_ERROR.
[email protected]74bda142013-03-31 02:49:11420enum QuicErrorCode {
421 QUIC_NO_ERROR = 0,
422
423 // Connection has reached an invalid state.
[email protected]89264042013-08-21 07:35:24424 QUIC_INTERNAL_ERROR = 1,
[email protected]74bda142013-03-31 02:49:11425 // There were data frames after the a fin or reset.
[email protected]89264042013-08-21 07:35:24426 QUIC_STREAM_DATA_AFTER_TERMINATION = 2,
[email protected]8b37a092012-10-18 21:53:49427 // Control frame is malformed.
[email protected]89264042013-08-21 07:35:24428 QUIC_INVALID_PACKET_HEADER = 3,
[email protected]be24ab22012-10-22 03:01:52429 // Frame data is malformed.
[email protected]89264042013-08-21 07:35:24430 QUIC_INVALID_FRAME_DATA = 4,
431 // The packet contained no payload.
432 QUIC_MISSING_PAYLOAD = 48,
[email protected]8b37a092012-10-18 21:53:49433 // FEC data is malformed.
[email protected]89264042013-08-21 07:35:24434 QUIC_INVALID_FEC_DATA = 5,
435 // STREAM frame data is malformed.
436 QUIC_INVALID_STREAM_DATA = 46,
[email protected]42a3eba2014-04-30 10:52:55437 // STREAM frame data is not encrypted.
438 QUIC_UNENCRYPTED_STREAM_DATA = 61,
[email protected]89264042013-08-21 07:35:24439 // RST_STREAM frame data is malformed.
440 QUIC_INVALID_RST_STREAM_DATA = 6,
441 // CONNECTION_CLOSE frame data is malformed.
442 QUIC_INVALID_CONNECTION_CLOSE_DATA = 7,
443 // GOAWAY frame data is malformed.
444 QUIC_INVALID_GOAWAY_DATA = 8,
[email protected]6ae6e342014-02-06 02:21:42445 // WINDOW_UPDATE frame data is malformed.
446 QUIC_INVALID_WINDOW_UPDATE_DATA = 57,
447 // BLOCKED frame data is malformed.
448 QUIC_INVALID_BLOCKED_DATA = 58,
[email protected]93dd91f2014-02-27 00:09:03449 // STOP_WAITING frame data is malformed.
450 QUIC_INVALID_STOP_WAITING_DATA = 60,
[email protected]89264042013-08-21 07:35:24451 // ACK frame data is malformed.
452 QUIC_INVALID_ACK_DATA = 9,
453 // CONGESTION_FEEDBACK frame data is malformed.
454 QUIC_INVALID_CONGESTION_FEEDBACK_DATA = 47,
[email protected]14e8106c2013-03-14 16:25:33455 // Version negotiation packet is malformed.
[email protected]89264042013-08-21 07:35:24456 QUIC_INVALID_VERSION_NEGOTIATION_PACKET = 10,
[email protected]899951652013-05-16 12:52:39457 // Public RST packet is malformed.
[email protected]89264042013-08-21 07:35:24458 QUIC_INVALID_PUBLIC_RST_PACKET = 11,
[email protected]8b37a092012-10-18 21:53:49459 // There was an error decrypting.
[email protected]89264042013-08-21 07:35:24460 QUIC_DECRYPTION_FAILURE = 12,
[email protected]8b37a092012-10-18 21:53:49461 // There was an error encrypting.
[email protected]89264042013-08-21 07:35:24462 QUIC_ENCRYPTION_FAILURE = 13,
[email protected]8b37a092012-10-18 21:53:49463 // The packet exceeded kMaxPacketSize.
[email protected]89264042013-08-21 07:35:24464 QUIC_PACKET_TOO_LARGE = 14,
[email protected]8b37a092012-10-18 21:53:49465 // Data was sent for a stream which did not exist.
[email protected]89264042013-08-21 07:35:24466 QUIC_PACKET_FOR_NONEXISTENT_STREAM = 15,
[email protected]9db443912013-02-25 05:27:03467 // The peer is going away. May be a client or server.
[email protected]89264042013-08-21 07:35:24468 QUIC_PEER_GOING_AWAY = 16,
[email protected]8b37a092012-10-18 21:53:49469 // A stream ID was invalid.
[email protected]89264042013-08-21 07:35:24470 QUIC_INVALID_STREAM_ID = 17,
[email protected]24e5bc52013-09-18 15:36:58471 // A priority was invalid.
472 QUIC_INVALID_PRIORITY = 49,
[email protected]8b37a092012-10-18 21:53:49473 // Too many streams already open.
[email protected]89264042013-08-21 07:35:24474 QUIC_TOO_MANY_OPEN_STREAMS = 18,
[email protected]9693157b2014-08-08 11:13:49475 // The peer must send a FIN/RST for each stream, and has not been doing so.
476 QUIC_TOO_MANY_UNFINISHED_STREAMS = 66,
[email protected]86a318d2013-01-23 21:16:04477 // Received public reset for this connection.
[email protected]89264042013-08-21 07:35:24478 QUIC_PUBLIC_RESET = 19,
[email protected]c244c5a12013-05-07 20:55:04479 // Invalid protocol version.
[email protected]89264042013-08-21 07:35:24480 QUIC_INVALID_VERSION = 20,
[email protected]92bf17c2014-03-03 21:14:03481
482 // deprecated: QUIC_STREAM_RST_BEFORE_HEADERS_DECOMPRESSED = 21
483
[email protected]c244c5a12013-05-07 20:55:04484 // The Header ID for a stream was too far from the previous.
[email protected]89264042013-08-21 07:35:24485 QUIC_INVALID_HEADER_ID = 22,
[email protected]899951652013-05-16 12:52:39486 // Negotiable parameter received during handshake had invalid value.
[email protected]89264042013-08-21 07:35:24487 QUIC_INVALID_NEGOTIATED_VALUE = 23,
[email protected]899951652013-05-16 12:52:39488 // There was an error decompressing data.
[email protected]89264042013-08-21 07:35:24489 QUIC_DECOMPRESSION_FAILURE = 24,
[email protected]8b37a092012-10-18 21:53:49490 // We hit our prenegotiated (or default) timeout
[email protected]89264042013-08-21 07:35:24491 QUIC_CONNECTION_TIMED_OUT = 25,
rtenneti31e9fd62014-09-16 05:22:15492 // We hit our overall connection timeout
493 QUIC_CONNECTION_OVERALL_TIMED_OUT = 67,
[email protected]899951652013-05-16 12:52:39494 // There was an error encountered migrating addresses
[email protected]89264042013-08-21 07:35:24495 QUIC_ERROR_MIGRATING_ADDRESS = 26,
[email protected]1505a512013-09-04 22:59:35496 // There was an error while writing to the socket.
[email protected]89264042013-08-21 07:35:24497 QUIC_PACKET_WRITE_ERROR = 27,
[email protected]1505a512013-09-04 22:59:35498 // There was an error while reading from the socket.
499 QUIC_PACKET_READ_ERROR = 51,
[email protected]24e5bc52013-09-18 15:36:58500 // We received a STREAM_FRAME with no data and no fin flag set.
501 QUIC_INVALID_STREAM_FRAME = 50,
[email protected]4d640792013-12-18 22:21:08502 // We received invalid data on the headers stream.
503 QUIC_INVALID_HEADERS_STREAM_DATA = 56,
[email protected]730b35d72014-06-05 03:23:22504 // The peer received too much data, violating flow control.
505 QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA = 59,
506 // The peer sent too much data, violating flow control.
507 QUIC_FLOW_CONTROL_SENT_TOO_MUCH_DATA = 63,
508 // The peer received an invalid flow control window.
509 QUIC_FLOW_CONTROL_INVALID_WINDOW = 64,
[email protected]71c84e592014-05-28 23:39:29510 // The connection has been IP pooled into an existing connection.
511 QUIC_CONNECTION_IP_POOLED = 62,
rtenneti23186682014-10-30 01:49:33512 // The connection has too many outstanding sent packets.
513 QUIC_TOO_MANY_OUTSTANDING_SENT_PACKETS = 68,
514 // The connection has too many outstanding received packets.
515 QUIC_TOO_MANY_OUTSTANDING_RECEIVED_PACKETS = 69,
[email protected]8b37a092012-10-18 21:53:49516
517 // Crypto errors.
518
[email protected]1354bf62013-05-23 23:17:18519 // Hanshake failed.
[email protected]89264042013-08-21 07:35:24520 QUIC_HANDSHAKE_FAILED = 28,
[email protected]8b37a092012-10-18 21:53:49521 // Handshake message contained out of order tags.
[email protected]89264042013-08-21 07:35:24522 QUIC_CRYPTO_TAGS_OUT_OF_ORDER = 29,
[email protected]701bc892013-01-17 04:51:54523 // Handshake message contained too many entries.
[email protected]89264042013-08-21 07:35:24524 QUIC_CRYPTO_TOO_MANY_ENTRIES = 30,
[email protected]8b37a092012-10-18 21:53:49525 // Handshake message contained an invalid value length.
[email protected]89264042013-08-21 07:35:24526 QUIC_CRYPTO_INVALID_VALUE_LENGTH = 31,
[email protected]8b37a092012-10-18 21:53:49527 // A crypto message was received after the handshake was complete.
[email protected]89264042013-08-21 07:35:24528 QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE = 32,
[email protected]d3d15bf2013-01-30 02:51:54529 // A crypto message was received with an illegal message tag.
[email protected]89264042013-08-21 07:35:24530 QUIC_INVALID_CRYPTO_MESSAGE_TYPE = 33,
[email protected]d3d15bf2013-01-30 02:51:54531 // A crypto message was received with an illegal parameter.
[email protected]89264042013-08-21 07:35:24532 QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER = 34,
[email protected]752fbe52013-10-14 08:35:32533 // An invalid channel id signature was supplied.
534 QUIC_INVALID_CHANNEL_ID_SIGNATURE = 52,
[email protected]d3d15bf2013-01-30 02:51:54535 // A crypto message was received with a mandatory parameter missing.
[email protected]89264042013-08-21 07:35:24536 QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND = 35,
[email protected]d3d15bf2013-01-30 02:51:54537 // A crypto message was received with a parameter that has no overlap
538 // with the local parameter.
[email protected]89264042013-08-21 07:35:24539 QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP = 36,
[email protected]ed3fc15d2013-03-08 18:37:44540 // A crypto message was received that contained a parameter with too few
541 // values.
[email protected]89264042013-08-21 07:35:24542 QUIC_CRYPTO_MESSAGE_INDEX_NOT_FOUND = 37,
[email protected]ccc66e8a2013-03-26 08:26:14543 // An internal error occured in crypto processing.
[email protected]89264042013-08-21 07:35:24544 QUIC_CRYPTO_INTERNAL_ERROR = 38,
[email protected]ccc66e8a2013-03-26 08:26:14545 // A crypto handshake message specified an unsupported version.
[email protected]89264042013-08-21 07:35:24546 QUIC_CRYPTO_VERSION_NOT_SUPPORTED = 39,
[email protected]ccc66e8a2013-03-26 08:26:14547 // There was no intersection between the crypto primitives supported by the
548 // peer and ourselves.
[email protected]89264042013-08-21 07:35:24549 QUIC_CRYPTO_NO_SUPPORT = 40,
[email protected]ef95114d2013-04-17 17:57:01550 // The server rejected our client hello messages too many times.
[email protected]89264042013-08-21 07:35:24551 QUIC_CRYPTO_TOO_MANY_REJECTS = 41,
[email protected]a57e0272013-04-26 07:31:47552 // The client rejected the server's certificate chain or signature.
[email protected]89264042013-08-21 07:35:24553 QUIC_PROOF_INVALID = 42,
[email protected]8ba81212013-05-03 13:11:48554 // A crypto message was received with a duplicate tag.
[email protected]89264042013-08-21 07:35:24555 QUIC_CRYPTO_DUPLICATE_TAG = 43,
[email protected]2532de12013-05-09 12:29:33556 // A crypto message was received with the wrong encryption level (i.e. it
557 // should have been encrypted but was not.)
[email protected]89264042013-08-21 07:35:24558 QUIC_CRYPTO_ENCRYPTION_LEVEL_INCORRECT = 44,
[email protected]2532de12013-05-09 12:29:33559 // The server config for a server has expired.
[email protected]89264042013-08-21 07:35:24560 QUIC_CRYPTO_SERVER_CONFIG_EXPIRED = 45,
[email protected]752fbe52013-10-14 08:35:32561 // We failed to setup the symmetric keys for a connection.
562 QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED = 53,
[email protected]691f45a982013-11-19 10:52:04563 // A handshake message arrived, but we are still validating the
564 // previous handshake message.
565 QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO = 54,
[email protected]ccb34212014-07-18 09:27:50566 // A server config update arrived before the handshake is complete.
567 QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE = 65,
[email protected]d89f1862013-11-26 21:21:27568 // This connection involved a version negotiation which appears to have been
569 // tampered with.
570 QUIC_VERSION_NEGOTIATION_MISMATCH = 55,
[email protected]ccc66e8a2013-03-26 08:26:14571
[email protected]74bda142013-03-31 02:49:11572 // No error. Used as bound while iterating.
rtenneti23186682014-10-30 01:49:33573 QUIC_LAST_ERROR = 70,
[email protected]8b37a092012-10-18 21:53:49574};
575
[email protected]c995c572013-01-18 05:43:20576struct NET_EXPORT_PRIVATE QuicPacketPublicHeader {
[email protected]14e8106c2013-03-14 16:25:33577 QuicPacketPublicHeader();
578 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other);
579 ~QuicPacketPublicHeader();
580
[email protected]3aa9ca72014-02-27 19:39:43581 // Universal header. All QuicPacket headers will have a connection_id and
582 // public flags.
583 QuicConnectionId connection_id;
584 QuicConnectionIdLength connection_id_length;
[email protected]9db443912013-02-25 05:27:03585 bool reset_flag;
586 bool version_flag;
[email protected]25c31dc2013-06-05 17:56:04587 QuicSequenceNumberLength sequence_number_length;
[email protected]48878092013-07-26 14:51:56588 QuicVersionVector versions;
[email protected]c995c572013-01-18 05:43:20589};
590
591// Header for Data or FEC packets.
[email protected]74bda142013-03-31 02:49:11592struct NET_EXPORT_PRIVATE QuicPacketHeader {
593 QuicPacketHeader();
594 explicit QuicPacketHeader(const QuicPacketPublicHeader& header);
[email protected]9db443912013-02-25 05:27:03595
596 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
597 std::ostream& os, const QuicPacketHeader& s);
598
[email protected]c995c572013-01-18 05:43:20599 QuicPacketPublicHeader public_header;
[email protected]9db443912013-02-25 05:27:03600 bool fec_flag;
[email protected]9db443912013-02-25 05:27:03601 bool entropy_flag;
602 QuicPacketEntropyHash entropy_hash;
[email protected]8b37a092012-10-18 21:53:49603 QuicPacketSequenceNumber packet_sequence_number;
[email protected]b064310782013-05-30 21:12:17604 InFecGroup is_in_fec_group;
[email protected]8b37a092012-10-18 21:53:49605 QuicFecGroupNumber fec_group;
606};
607
[email protected]74bda142013-03-31 02:49:11608struct NET_EXPORT_PRIVATE QuicPublicResetPacket {
[email protected]6ae6e342014-02-06 02:21:42609 QuicPublicResetPacket();
610 explicit QuicPublicResetPacket(const QuicPacketPublicHeader& header);
611
[email protected]86a318d2013-01-23 21:16:04612 QuicPacketPublicHeader public_header;
[email protected]86a318d2013-01-23 21:16:04613 QuicPublicResetNonceProof nonce_proof;
[email protected]300ccd52014-01-25 08:00:19614 QuicPacketSequenceNumber rejected_sequence_number;
[email protected]79d13dcb2014-02-05 07:23:13615 IPEndPoint client_address;
[email protected]86a318d2013-01-23 21:16:04616};
617
[email protected]14e8106c2013-03-14 16:25:33618enum QuicVersionNegotiationState {
619 START_NEGOTIATION = 0,
[email protected]ec640112013-08-09 03:56:18620 // Server-side this implies we've sent a version negotiation packet and are
621 // waiting on the client to select a compatible version. Client-side this
622 // implies we've gotten a version negotiation packet, are retransmitting the
623 // initial packets with a supported version and are waiting for our first
624 // packet from the server.
625 NEGOTIATION_IN_PROGRESS,
626 // This indicates this endpoint has received a packet from the peer with a
627 // version this endpoint supports. Version negotiation is complete, and the
628 // version number will no longer be sent with future packets.
[email protected]14e8106c2013-03-14 16:25:33629 NEGOTIATED_VERSION
630};
631
632typedef QuicPacketPublicHeader QuicVersionNegotiationPacket;
633
[email protected]c995c572013-01-18 05:43:20634// A padding frame contains no payload.
635struct NET_EXPORT_PRIVATE QuicPaddingFrame {
636};
637
[email protected]d8c522112014-04-23 09:23:25638// A ping frame contains no payload, though it is retransmittable,
639// and ACK'd just like other normal frames.
640struct NET_EXPORT_PRIVATE QuicPingFrame {
641};
642
[email protected]be24ab22012-10-22 03:01:52643struct NET_EXPORT_PRIVATE QuicStreamFrame {
644 QuicStreamFrame();
[email protected]5dafdb62013-11-14 01:24:26645 QuicStreamFrame(const QuicStreamFrame& frame);
[email protected]be24ab22012-10-22 03:01:52646 QuicStreamFrame(QuicStreamId stream_id,
[email protected]a5061242012-10-23 23:29:37647 bool fin,
[email protected]701bc892013-01-17 04:51:54648 QuicStreamOffset offset,
[email protected]5dafdb62013-11-14 01:24:26649 IOVector data);
650
[email protected]c5e1aca2014-01-30 04:03:04651 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
652 std::ostream& os, const QuicStreamFrame& s);
653
[email protected]5dafdb62013-11-14 01:24:26654 // Returns a copy of the IOVector |data| as a heap-allocated string.
655 // Caller must take ownership of the returned string.
656 std::string* GetDataAsString() const;
[email protected]8b37a092012-10-18 21:53:49657
658 QuicStreamId stream_id;
659 bool fin;
[email protected]701bc892013-01-17 04:51:54660 QuicStreamOffset offset; // Location of this data in the stream.
[email protected]5dafdb62013-11-14 01:24:26661 IOVector data;
[email protected]97cf3022013-09-05 14:30:16662
663 // If this is set, then when this packet is ACKed the AckNotifier will be
664 // informed.
665 QuicAckNotifier* notifier;
[email protected]8b37a092012-10-18 21:53:49666};
667
[email protected]e537f742012-12-07 15:33:53668// TODO(ianswett): Re-evaluate the trade-offs of hash_set vs set when framing
669// is finalized.
[email protected]9db443912013-02-25 05:27:03670typedef std::set<QuicPacketSequenceNumber> SequenceNumberSet;
rtennetidd4bf8f2014-09-03 00:45:16671typedef std::list<QuicPacketSequenceNumber> SequenceNumberList;
rtenneti4b06ae72014-08-26 03:43:43672
mostynbdc40b80612014-09-10 03:45:42673typedef std::list<
674 std::pair<QuicPacketSequenceNumber, QuicTime> > PacketTimeList;
[email protected]044ac2b2012-11-13 21:41:06675
[email protected]310d37b2014-08-02 06:15:37676struct NET_EXPORT_PRIVATE QuicStopWaitingFrame {
677 QuicStopWaitingFrame();
678 ~QuicStopWaitingFrame();
[email protected]6ae6e342014-02-06 02:21:42679
[email protected]26f3f8e2012-12-13 21:07:19680 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
[email protected]310d37b2014-08-02 06:15:37681 std::ostream& os, const QuicStopWaitingFrame& s);
682 // Entropy hash of all packets up to, but not including, the least unacked
683 // packet.
684 QuicPacketEntropyHash entropy_hash;
685 // The lowest packet we've sent which is unacked, and we expect an ack for.
686 QuicPacketSequenceNumber least_unacked;
687};
688
689struct NET_EXPORT_PRIVATE QuicAckFrame {
690 QuicAckFrame();
691 ~QuicAckFrame();
692
693 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
694 std::ostream& os, const QuicAckFrame& s);
[email protected]a674b4c2012-12-05 03:44:30695
[email protected]9db443912013-02-25 05:27:03696 // Entropy hash of all packets up to largest observed not including missing
697 // packets.
698 QuicPacketEntropyHash entropy_hash;
[email protected]e537f742012-12-07 15:33:53699
[email protected]48697d8a2013-01-15 19:42:24700 // The highest packet sequence number we've observed from the peer.
701 //
702 // In general, this should be the largest packet number we've received. In
703 // the case of truncated acks, we may have to advertise a lower "upper bound"
704 // than largest received, to avoid implicitly acking missing packets that
705 // don't fit in the missing packet list due to size limitations. In this
706 // case, largest_observed may be a packet which is also in the missing packets
707 // list.
708 QuicPacketSequenceNumber largest_observed;
[email protected]a674b4c2012-12-05 03:44:30709
[email protected]14e8106c2013-03-14 16:25:33710 // Time elapsed since largest_observed was received until this Ack frame was
711 // sent.
712 QuicTime::Delta delta_time_largest_observed;
713
[email protected]9db443912013-02-25 05:27:03714 // TODO(satyamshekhar): Can be optimized using an interval set like data
715 // structure.
[email protected]e537f742012-12-07 15:33:53716 // The set of packets which we're expecting and have not received.
[email protected]9db443912013-02-25 05:27:03717 SequenceNumberSet missing_packets;
[email protected]8e01c062013-10-31 07:35:31718
719 // Whether the ack had to be truncated when sent.
720 bool is_truncated;
[email protected]bdf2d432014-02-09 10:45:41721
722 // Packets which have been revived via FEC.
723 // All of these must also be in missing_packets.
724 SequenceNumberSet revived_packets;
rtenneti4b06ae72014-08-26 03:43:43725
726 // List of <sequence_number, time> for when packets arrived.
727 PacketTimeList received_packet_times;
[email protected]8b37a092012-10-18 21:53:49728};
729
[email protected]9db443912013-02-25 05:27:03730// True if the sequence number is greater than largest_observed or is listed
731// as missing.
732// Always returns false for sequence numbers less than least_unacked.
733bool NET_EXPORT_PRIVATE IsAwaitingPacket(
[email protected]310d37b2014-08-02 06:15:37734 const QuicAckFrame& ack_frame,
[email protected]9db443912013-02-25 05:27:03735 QuicPacketSequenceNumber sequence_number);
736
737// Inserts missing packets between [lower, higher).
738void NET_EXPORT_PRIVATE InsertMissingPacketsBetween(
[email protected]310d37b2014-08-02 06:15:37739 QuicAckFrame* ack_frame,
[email protected]9db443912013-02-25 05:27:03740 QuicPacketSequenceNumber lower,
741 QuicPacketSequenceNumber higher);
742
[email protected]8b37a092012-10-18 21:53:49743// Defines for all types of congestion feedback that will be negotiated in QUIC,
[email protected]f62262b2013-07-05 20:57:30744// kTCP MUST be supported by all QUIC implementations to guarantee 100%
[email protected]8b37a092012-10-18 21:53:49745// compatibility.
rtenneti4b06ae72014-08-26 03:43:43746// TODO(cyr): Remove this when removing QUIC_VERSION_22.
[email protected]8b37a092012-10-18 21:53:49747enum CongestionFeedbackType {
[email protected]8b37a092012-10-18 21:53:49748 kTCP, // Used to mimic TCP.
[email protected]a692ad9d2014-07-18 21:35:24749};
750
751// Defines for all types of congestion control algorithms that can be used in
752// QUIC. Note that this is separate from the congestion feedback type -
753// some congestion control algorithms may use the same feedback type
754// (Reno and Cubic are the classic example for that).
755enum CongestionControlType {
756 kCubic,
757 kReno,
[email protected]a692ad9d2014-07-18 21:35:24758 kBBR,
[email protected]8b37a092012-10-18 21:53:49759};
760
[email protected]c5cc9bd2014-03-31 23:17:14761enum LossDetectionType {
762 kNack, // Used to mimic TCP's loss detection.
763 kTime, // Time based loss detection.
764};
765
rtenneti4b06ae72014-08-26 03:43:43766// TODO(cyr): Remove this when removing QUIC_VERSION_22.
[email protected]8b37a092012-10-18 21:53:49767struct NET_EXPORT_PRIVATE CongestionFeedbackMessageTCP {
[email protected]6ae6e342014-02-06 02:21:42768 CongestionFeedbackMessageTCP();
769
[email protected]fee17f72013-02-03 07:47:41770 QuicByteCount receive_window;
[email protected]8b37a092012-10-18 21:53:49771};
772
rtenneti4b06ae72014-08-26 03:43:43773// TODO(cyr): Remove this when removing QUIC_VERSION_22.
[email protected]26f3f8e2012-12-13 21:07:19774struct NET_EXPORT_PRIVATE QuicCongestionFeedbackFrame {
[email protected]7884ecad2012-12-14 22:55:15775 QuicCongestionFeedbackFrame();
776 ~QuicCongestionFeedbackFrame();
777
[email protected]26f3f8e2012-12-13 21:07:19778 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
779 std::ostream& os, const QuicCongestionFeedbackFrame& c);
780
[email protected]7884ecad2012-12-14 22:55:15781 CongestionFeedbackType type;
[email protected]a97b3182014-08-08 08:10:18782 // This should really be a union, but since the timestamp struct
[email protected]7884ecad2012-12-14 22:55:15783 // is non-trivial, C++ prohibits it.
784 CongestionFeedbackMessageTCP tcp;
[email protected]8b37a092012-10-18 21:53:49785};
786
[email protected]be24ab22012-10-22 03:01:52787struct NET_EXPORT_PRIVATE QuicRstStreamFrame {
[email protected]6ae6e342014-02-06 02:21:42788 QuicRstStreamFrame();
789 QuicRstStreamFrame(QuicStreamId stream_id,
790 QuicRstStreamErrorCode error_code,
791 QuicStreamOffset bytes_written);
[email protected]8b37a092012-10-18 21:53:49792
[email protected]c5e1aca2014-01-30 04:03:04793 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
794 std::ostream& os, const QuicRstStreamFrame& r);
795
[email protected]8b37a092012-10-18 21:53:49796 QuicStreamId stream_id;
[email protected]74bda142013-03-31 02:49:11797 QuicRstStreamErrorCode error_code;
[email protected]431bb4fd2012-10-19 17:46:09798 std::string error_details;
[email protected]6ae6e342014-02-06 02:21:42799
800 // Used to update flow control windows. On termination of a stream, both
801 // endpoints must inform the peer of the number of bytes they have sent on
802 // that stream. This can be done through normal termination (data packet with
803 // FIN) or through a RST.
804 QuicStreamOffset byte_offset;
[email protected]8b37a092012-10-18 21:53:49805};
806
[email protected]be24ab22012-10-22 03:01:52807struct NET_EXPORT_PRIVATE QuicConnectionCloseFrame {
[email protected]6ae6e342014-02-06 02:21:42808 QuicConnectionCloseFrame();
809
[email protected]c5e1aca2014-01-30 04:03:04810 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
811 std::ostream& os, const QuicConnectionCloseFrame& c);
812
[email protected]431bb4fd2012-10-19 17:46:09813 QuicErrorCode error_code;
[email protected]431bb4fd2012-10-19 17:46:09814 std::string error_details;
[email protected]8b37a092012-10-18 21:53:49815};
816
[email protected]9db443912013-02-25 05:27:03817struct NET_EXPORT_PRIVATE QuicGoAwayFrame {
[email protected]6ae6e342014-02-06 02:21:42818 QuicGoAwayFrame();
[email protected]9db443912013-02-25 05:27:03819 QuicGoAwayFrame(QuicErrorCode error_code,
820 QuicStreamId last_good_stream_id,
821 const std::string& reason);
822
[email protected]c5e1aca2014-01-30 04:03:04823 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
824 std::ostream& os, const QuicGoAwayFrame& g);
825
[email protected]9db443912013-02-25 05:27:03826 QuicErrorCode error_code;
827 QuicStreamId last_good_stream_id;
828 std::string reason_phrase;
829};
830
[email protected]6ae6e342014-02-06 02:21:42831// Flow control updates per-stream and at the connection levoel.
832// Based on SPDY's WINDOW_UPDATE frame, but uses an absolute byte offset rather
833// than a window delta.
834// TODO(rjshade): A possible future optimization is to make stream_id and
835// byte_offset variable length, similar to stream frames.
836struct NET_EXPORT_PRIVATE QuicWindowUpdateFrame {
837 QuicWindowUpdateFrame() {}
838 QuicWindowUpdateFrame(QuicStreamId stream_id, QuicStreamOffset byte_offset);
839
840 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
841 std::ostream& os, const QuicWindowUpdateFrame& w);
842
843 // The stream this frame applies to. 0 is a special case meaning the overall
844 // connection rather than a specific stream.
845 QuicStreamId stream_id;
846
847 // Byte offset in the stream or connection. The receiver of this frame must
848 // not send data which would result in this offset being exceeded.
849 QuicStreamOffset byte_offset;
850};
851
852// The BLOCKED frame is used to indicate to the remote endpoint that this
853// endpoint believes itself to be flow-control blocked but otherwise ready to
854// send data. The BLOCKED frame is purely advisory and optional.
855// Based on SPDY's BLOCKED frame (undocumented as of 2014-01-28).
856struct NET_EXPORT_PRIVATE QuicBlockedFrame {
857 QuicBlockedFrame() {}
858 explicit QuicBlockedFrame(QuicStreamId stream_id);
859
860 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
861 std::ostream& os, const QuicBlockedFrame& b);
862
863 // The stream this frame applies to. 0 is a special case meaning the overall
864 // connection rather than a specific stream.
865 QuicStreamId stream_id;
866};
867
[email protected]8ba81212013-05-03 13:11:48868// EncryptionLevel enumerates the stages of encryption that a QUIC connection
869// progresses through. When retransmitting a packet, the encryption level needs
870// to be specified so that it is retransmitted at a level which the peer can
871// understand.
872enum EncryptionLevel {
873 ENCRYPTION_NONE = 0,
874 ENCRYPTION_INITIAL = 1,
875 ENCRYPTION_FORWARD_SECURE = 2,
876
877 NUM_ENCRYPTION_LEVELS,
878};
879
[email protected]be24ab22012-10-22 03:01:52880struct NET_EXPORT_PRIVATE QuicFrame {
[email protected]6ae6e342014-02-06 02:21:42881 QuicFrame();
882 explicit QuicFrame(QuicPaddingFrame* padding_frame);
883 explicit QuicFrame(QuicStreamFrame* stream_frame);
884 explicit QuicFrame(QuicAckFrame* frame);
rtenneti4b06ae72014-08-26 03:43:43885
886 // TODO(cyr): Remove this when removing QUIC_VERSION_22.
[email protected]6ae6e342014-02-06 02:21:42887 explicit QuicFrame(QuicCongestionFeedbackFrame* frame);
rtenneti4b06ae72014-08-26 03:43:43888
[email protected]6ae6e342014-02-06 02:21:42889 explicit QuicFrame(QuicRstStreamFrame* frame);
890 explicit QuicFrame(QuicConnectionCloseFrame* frame);
[email protected]93dd91f2014-02-27 00:09:03891 explicit QuicFrame(QuicStopWaitingFrame* frame);
[email protected]d8c522112014-04-23 09:23:25892 explicit QuicFrame(QuicPingFrame* frame);
[email protected]6ae6e342014-02-06 02:21:42893 explicit QuicFrame(QuicGoAwayFrame* frame);
894 explicit QuicFrame(QuicWindowUpdateFrame* frame);
895 explicit QuicFrame(QuicBlockedFrame* frame);
[email protected]8b37a092012-10-18 21:53:49896
[email protected]c5e1aca2014-01-30 04:03:04897 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
898 std::ostream& os, const QuicFrame& frame);
899
[email protected]be24ab22012-10-22 03:01:52900 QuicFrameType type;
[email protected]8b37a092012-10-18 21:53:49901 union {
[email protected]c995c572013-01-18 05:43:20902 QuicPaddingFrame* padding_frame;
[email protected]be24ab22012-10-22 03:01:52903 QuicStreamFrame* stream_frame;
904 QuicAckFrame* ack_frame;
rtenneti4b06ae72014-08-26 03:43:43905
906 // TODO(cyr): Remove this when removing QUIC_VERSION_22.
[email protected]26f3f8e2012-12-13 21:07:19907 QuicCongestionFeedbackFrame* congestion_feedback_frame;
[email protected]93dd91f2014-02-27 00:09:03908 QuicStopWaitingFrame* stop_waiting_frame;
rtenneti4b06ae72014-08-26 03:43:43909
[email protected]d8c522112014-04-23 09:23:25910 QuicPingFrame* ping_frame;
[email protected]be24ab22012-10-22 03:01:52911 QuicRstStreamFrame* rst_stream_frame;
912 QuicConnectionCloseFrame* connection_close_frame;
[email protected]9db443912013-02-25 05:27:03913 QuicGoAwayFrame* goaway_frame;
[email protected]6ae6e342014-02-06 02:21:42914 QuicWindowUpdateFrame* window_update_frame;
915 QuicBlockedFrame* blocked_frame;
[email protected]8b37a092012-10-18 21:53:49916 };
917};
918
[email protected]be24ab22012-10-22 03:01:52919typedef std::vector<QuicFrame> QuicFrames;
[email protected]8b37a092012-10-18 21:53:49920
921struct NET_EXPORT_PRIVATE QuicFecData {
922 QuicFecData();
[email protected]a5061242012-10-23 23:29:37923
[email protected]c995c572013-01-18 05:43:20924 // The FEC group number is also the sequence number of the first
925 // FEC protected packet. The last protected packet's sequence number will
926 // be one less than the sequence number of the FEC packet.
[email protected]8b37a092012-10-18 21:53:49927 QuicFecGroupNumber fec_group;
[email protected]8b37a092012-10-18 21:53:49928 base::StringPiece redundancy;
[email protected]8b37a092012-10-18 21:53:49929};
930
[email protected]8b37a092012-10-18 21:53:49931class NET_EXPORT_PRIVATE QuicData {
932 public:
[email protected]6ae6e342014-02-06 02:21:42933 QuicData(const char* buffer, size_t length);
934 QuicData(char* buffer, size_t length, bool owns_buffer);
[email protected]8b37a092012-10-18 21:53:49935 virtual ~QuicData();
936
937 base::StringPiece AsStringPiece() const {
938 return base::StringPiece(data(), length());
939 }
940
941 const char* data() const { return buffer_; }
942 size_t length() const { return length_; }
943
944 private:
945 const char* buffer_;
946 size_t length_;
947 bool owns_buffer_;
948
949 DISALLOW_COPY_AND_ASSIGN(QuicData);
950};
951
952class NET_EXPORT_PRIVATE QuicPacket : public QuicData {
953 public:
[email protected]25c31dc2013-06-05 17:56:04954 static QuicPacket* NewDataPacket(
955 char* buffer,
956 size_t length,
957 bool owns_buffer,
[email protected]3aa9ca72014-02-27 19:39:43958 QuicConnectionIdLength connection_id_length,
[email protected]25c31dc2013-06-05 17:56:04959 bool includes_version,
960 QuicSequenceNumberLength sequence_number_length) {
[email protected]3aa9ca72014-02-27 19:39:43961 return new QuicPacket(buffer, length, owns_buffer, connection_id_length,
[email protected]25c31dc2013-06-05 17:56:04962 includes_version, sequence_number_length, false);
[email protected]c995c572013-01-18 05:43:20963 }
964
[email protected]25c31dc2013-06-05 17:56:04965 static QuicPacket* NewFecPacket(
966 char* buffer,
967 size_t length,
968 bool owns_buffer,
[email protected]3aa9ca72014-02-27 19:39:43969 QuicConnectionIdLength connection_id_length,
[email protected]25c31dc2013-06-05 17:56:04970 bool includes_version,
971 QuicSequenceNumberLength sequence_number_length) {
[email protected]3aa9ca72014-02-27 19:39:43972 return new QuicPacket(buffer, length, owns_buffer, connection_id_length,
[email protected]25c31dc2013-06-05 17:56:04973 includes_version, sequence_number_length, true);
[email protected]c995c572013-01-18 05:43:20974 }
[email protected]8b37a092012-10-18 21:53:49975
[email protected]5351cc4b2013-03-03 07:22:41976 base::StringPiece FecProtectedData() const;
977 base::StringPiece AssociatedData() const;
978 base::StringPiece BeforePlaintext() const;
979 base::StringPiece Plaintext() const;
[email protected]082b65b2012-11-10 19:11:31980
[email protected]c995c572013-01-18 05:43:20981 bool is_fec_packet() const { return is_fec_packet_; }
[email protected]082b65b2012-11-10 19:11:31982
[email protected]8b37a092012-10-18 21:53:49983 char* mutable_data() { return buffer_; }
984
985 private:
[email protected]5351cc4b2013-03-03 07:22:41986 QuicPacket(char* buffer,
987 size_t length,
988 bool owns_buffer,
[email protected]3aa9ca72014-02-27 19:39:43989 QuicConnectionIdLength connection_id_length,
[email protected]5351cc4b2013-03-03 07:22:41990 bool includes_version,
[email protected]25c31dc2013-06-05 17:56:04991 QuicSequenceNumberLength sequence_number_length,
[email protected]6ae6e342014-02-06 02:21:42992 bool is_fec_packet);
[email protected]c995c572013-01-18 05:43:20993
[email protected]8b37a092012-10-18 21:53:49994 char* buffer_;
[email protected]c995c572013-01-18 05:43:20995 const bool is_fec_packet_;
[email protected]3aa9ca72014-02-27 19:39:43996 const QuicConnectionIdLength connection_id_length_;
[email protected]5351cc4b2013-03-03 07:22:41997 const bool includes_version_;
[email protected]25c31dc2013-06-05 17:56:04998 const QuicSequenceNumberLength sequence_number_length_;
[email protected]8b37a092012-10-18 21:53:49999
[email protected]2e740db2012-10-20 19:35:191000 DISALLOW_COPY_AND_ASSIGN(QuicPacket);
[email protected]8b37a092012-10-18 21:53:491001};
1002
1003class NET_EXPORT_PRIVATE QuicEncryptedPacket : public QuicData {
1004 public:
[email protected]6ae6e342014-02-06 02:21:421005 QuicEncryptedPacket(const char* buffer, size_t length);
1006 QuicEncryptedPacket(char* buffer, size_t length, bool owns_buffer);
[email protected]8b37a092012-10-18 21:53:491007
[email protected]ec86d5462013-11-17 16:04:491008 // Clones the packet into a new packet which owns the buffer.
1009 QuicEncryptedPacket* Clone() const;
1010
[email protected]c1b32c62013-01-20 02:49:101011 // By default, gtest prints the raw bytes of an object. The bool data
1012 // member (in the base class QuicData) causes this object to have padding
1013 // bytes, which causes the default gtest object printer to read
1014 // uninitialize memory. So we need to teach gtest how to print this object.
1015 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
1016 std::ostream& os, const QuicEncryptedPacket& s);
1017
[email protected]2e740db2012-10-20 19:35:191018 private:
1019 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket);
[email protected]8b37a092012-10-18 21:53:491020};
1021
[email protected]9db443912013-02-25 05:27:031022class NET_EXPORT_PRIVATE RetransmittableFrames {
1023 public:
1024 RetransmittableFrames();
1025 ~RetransmittableFrames();
1026
1027 // Allocates a local copy of the referenced StringPiece has QuicStreamFrame
1028 // use it.
1029 // Takes ownership of |stream_frame|.
1030 const QuicFrame& AddStreamFrame(QuicStreamFrame* stream_frame);
1031 // Takes ownership of the frame inside |frame|.
1032 const QuicFrame& AddNonStreamFrame(const QuicFrame& frame);
1033 const QuicFrames& frames() const { return frames_; }
1034
[email protected]672631c2014-08-16 06:11:451035 IsHandshake HasCryptoHandshake() const {
1036 return has_crypto_handshake_;
1037 }
[email protected]2115d33ba2014-01-02 21:53:521038
[email protected]8ba81212013-05-03 13:11:481039 void set_encryption_level(EncryptionLevel level);
1040 EncryptionLevel encryption_level() const {
1041 return encryption_level_;
1042 }
1043
[email protected]9db443912013-02-25 05:27:031044 private:
1045 QuicFrames frames_;
[email protected]8ba81212013-05-03 13:11:481046 EncryptionLevel encryption_level_;
[email protected]672631c2014-08-16 06:11:451047 IsHandshake has_crypto_handshake_;
[email protected]9db443912013-02-25 05:27:031048 // Data referenced by the StringPiece of a QuicStreamFrame.
1049 std::vector<std::string*> stream_data_;
1050
1051 DISALLOW_COPY_AND_ASSIGN(RetransmittableFrames);
1052};
1053
1054struct NET_EXPORT_PRIVATE SerializedPacket {
1055 SerializedPacket(QuicPacketSequenceNumber sequence_number,
[email protected]ea825e02013-08-21 18:12:451056 QuicSequenceNumberLength sequence_number_length,
[email protected]9db443912013-02-25 05:27:031057 QuicPacket* packet,
1058 QuicPacketEntropyHash entropy_hash,
[email protected]97cf3022013-09-05 14:30:161059 RetransmittableFrames* retransmittable_frames);
1060 ~SerializedPacket();
[email protected]9db443912013-02-25 05:27:031061
1062 QuicPacketSequenceNumber sequence_number;
[email protected]ea825e02013-08-21 18:12:451063 QuicSequenceNumberLength sequence_number_length;
[email protected]9db443912013-02-25 05:27:031064 QuicPacket* packet;
1065 QuicPacketEntropyHash entropy_hash;
1066 RetransmittableFrames* retransmittable_frames;
[email protected]97cf3022013-09-05 14:30:161067
1068 // If set, these will be called when this packet is ACKed by the peer.
1069 std::set<QuicAckNotifier*> notifiers;
[email protected]9db443912013-02-25 05:27:031070};
1071
[email protected]77b5d50b2014-05-07 22:48:481072struct NET_EXPORT_PRIVATE TransmissionInfo {
1073 // Used by STL when assigning into a map.
1074 TransmissionInfo();
1075
1076 // Constructs a Transmission with a new all_tranmissions set
1077 // containing |sequence_number|.
1078 TransmissionInfo(RetransmittableFrames* retransmittable_frames,
[email protected]77b5d50b2014-05-07 22:48:481079 QuicSequenceNumberLength sequence_number_length,
[email protected]730b35d72014-06-05 03:23:221080 TransmissionType transmission_type,
rtenneti08b014382014-10-29 14:03:191081 QuicTime sent_time);
[email protected]77b5d50b2014-05-07 22:48:481082
1083 RetransmittableFrames* retransmittable_frames;
1084 QuicSequenceNumberLength sequence_number_length;
1085 // Zero when the packet is serialized, non-zero once it's sent.
1086 QuicTime sent_time;
1087 // Zero when the packet is serialized, non-zero once it's sent.
1088 QuicByteCount bytes_sent;
1089 size_t nack_count;
[email protected]730b35d72014-06-05 03:23:221090 // Reason why this packet was transmitted.
1091 TransmissionType transmission_type;
[email protected]77b5d50b2014-05-07 22:48:481092 // Stores the sequence numbers of all transmissions of this packet.
rtennetibe635732014-10-02 22:51:421093 // Must always be nullptr or have multiple elements.
rtennetidd4bf8f2014-09-03 00:45:161094 SequenceNumberList* all_transmissions;
[email protected]aa7e4ef2014-05-28 03:53:151095 // In flight packets have not been abandoned or lost.
1096 bool in_flight;
rtenneti31e9fd62014-09-16 05:22:151097 // True if the packet can never be acked, so it can be removed.
1098 bool is_unackable;
[email protected]77b5d50b2014-05-07 22:48:481099};
1100
[email protected]8b37a092012-10-18 21:53:491101} // namespace net
1102
1103#endif // NET_QUIC_QUIC_PROTOCOL_H_