Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: net/quic/quic_protocol.h

Issue 559373003: Landing Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compiler errors Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_packet_generator_test.cc ('k') | net/quic/quic_protocol.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_QUIC_QUIC_PROTOCOL_H_ 5 #ifndef NET_QUIC_QUIC_PROTOCOL_H_
6 #define NET_QUIC_QUIC_PROTOCOL_H_ 6 #define NET_QUIC_QUIC_PROTOCOL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <limits> 9 #include <limits>
10 #include <list> 10 #include <list>
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 // Reserved ID for the crypto stream. 102 // Reserved ID for the crypto stream.
103 const QuicStreamId kCryptoStreamId = 1; 103 const QuicStreamId kCryptoStreamId = 1;
104 104
105 // Reserved ID for the headers stream. 105 // Reserved ID for the headers stream.
106 const QuicStreamId kHeadersStreamId = 3; 106 const QuicStreamId kHeadersStreamId = 3;
107 107
108 // Maximum delayed ack time, in ms. 108 // Maximum delayed ack time, in ms.
109 const int kMaxDelayedAckTimeMs = 25; 109 const int kMaxDelayedAckTimeMs = 25;
110 110
111 // This is the default network timeout a for connection till the crypto 111 // The default idle timeout before the crypto handshake succeeds.
112 // handshake succeeds and the negotiated timeout from the handshake is received.
113 const int64 kDefaultInitialTimeoutSecs = 120; // 2 mins. 112 const int64 kDefaultInitialTimeoutSecs = 120; // 2 mins.
114 const int64 kDefaultTimeoutSecs = 60 * 10; // 10 minutes. 113 // The maximum idle timeout that can be negotiated.
115 const int64 kDefaultMaxTimeForCryptoHandshakeSecs = 5; // 5 secs. 114 const int64 kMaximumIdleTimeoutSecs = 60 * 10; // 10 minutes.
115 // The default timeout for a connection until the crypto handshake succeeds.
116 const int64 kDefaultMaxTimeForCryptoHandshakeSecs = 10; // 10 secs.
116 117
117 // Default ping timeout. 118 // Default ping timeout.
118 const int64 kPingTimeoutSecs = 15; // 15 secs. 119 const int64 kPingTimeoutSecs = 15; // 15 secs.
119 120
120 // Minimum number of RTTs between Server Config Updates (SCUP) sent to client. 121 // Minimum number of RTTs between Server Config Updates (SCUP) sent to client.
121 const int kMinIntervalBetweenServerConfigUpdatesRTTs = 10; 122 const int kMinIntervalBetweenServerConfigUpdatesRTTs = 10;
122 123
123 // Minimum time between Server Config Updates (SCUP) sent to client. 124 // Minimum time between Server Config Updates (SCUP) sent to client.
124 const int kMinIntervalBetweenServerConfigUpdatesMs = 1000; 125 const int kMinIntervalBetweenServerConfigUpdatesMs = 1000;
125 126
127 // Multiplier that allows server to accept slightly more streams than
128 // negotiated in handshake.
129 const float kMaxStreamsMultiplier = 1.1f;
130
126 // We define an unsigned 16-bit floating point value, inspired by IEEE floats 131 // We define an unsigned 16-bit floating point value, inspired by IEEE floats
127 // (http://en.wikipedia.org/wiki/Half_precision_floating-point_format), 132 // (http://en.wikipedia.org/wiki/Half_precision_floating-point_format),
128 // with 5-bit exponent (bias 1), 11-bit mantissa (effective 12 with hidden 133 // with 5-bit exponent (bias 1), 11-bit mantissa (effective 12 with hidden
129 // bit) and denormals, but without signs, transfinites or fractions. Wire format 134 // bit) and denormals, but without signs, transfinites or fractions. Wire format
130 // 16 bits (little-endian byte order) are split into exponent (high 5) and 135 // 16 bits (little-endian byte order) are split into exponent (high 5) and
131 // mantissa (low 11) and decoded as: 136 // mantissa (low 11) and decoded as:
132 // uint64 value; 137 // uint64 value;
133 // if (exponent == 0) value = mantissa; 138 // if (exponent == 0) value = mantissa;
134 // else value = (mantissa | 1 << 11) << (exponent - 1) 139 // else value = (mantissa | 1 << 11) << (exponent - 1)
135 const int kUFloat16ExponentBits = 5; 140 const int kUFloat16ExponentBits = 5;
136 const int kUFloat16MaxExponent = (1 << kUFloat16ExponentBits) - 2; // 30 141 const int kUFloat16MaxExponent = (1 << kUFloat16ExponentBits) - 2; // 30
137 const int kUFloat16MantissaBits = 16 - kUFloat16ExponentBits; // 11 142 const int kUFloat16MantissaBits = 16 - kUFloat16ExponentBits; // 11
138 const int kUFloat16MantissaEffectiveBits = kUFloat16MantissaBits + 1; // 12 143 const int kUFloat16MantissaEffectiveBits = kUFloat16MantissaBits + 1; // 12
139 const uint64 kUFloat16MaxValue = // 0x3FFC0000000 144 const uint64 kUFloat16MaxValue = // 0x3FFC0000000
140 ((GG_UINT64_C(1) << kUFloat16MantissaEffectiveBits) - 1) << 145 ((GG_UINT64_C(1) << kUFloat16MantissaEffectiveBits) - 1) <<
141 kUFloat16MaxExponent; 146 kUFloat16MaxExponent;
142 147
143 enum TransmissionType { 148 enum TransmissionType {
144 NOT_RETRANSMISSION, 149 NOT_RETRANSMISSION,
145 FIRST_TRANSMISSION_TYPE = NOT_RETRANSMISSION, 150 FIRST_TRANSMISSION_TYPE = NOT_RETRANSMISSION,
146 HANDSHAKE_RETRANSMISSION, // Retransmits due to handshake timeouts. 151 HANDSHAKE_RETRANSMISSION, // Retransmits due to handshake timeouts.
147 ALL_UNACKED_RETRANSMISSION, // Retransmits of all unacked packets. 152 ALL_UNACKED_RETRANSMISSION, // Retransmits all unacked packets.
153 ALL_INITIAL_RETRANSMISSION, // Retransmits all initially encrypted packets.
148 LOSS_RETRANSMISSION, // Retransmits due to loss detection. 154 LOSS_RETRANSMISSION, // Retransmits due to loss detection.
149 RTO_RETRANSMISSION, // Retransmits due to retransmit time out. 155 RTO_RETRANSMISSION, // Retransmits due to retransmit time out.
150 TLP_RETRANSMISSION, // Tail loss probes. 156 TLP_RETRANSMISSION, // Tail loss probes.
151 LAST_TRANSMISSION_TYPE = TLP_RETRANSMISSION, 157 LAST_TRANSMISSION_TYPE = TLP_RETRANSMISSION,
152 }; 158 };
153 159
154 enum RetransmissionType {
155 INITIAL_ENCRYPTION_ONLY,
156 ALL_PACKETS
157 };
158
159 enum HasRetransmittableData { 160 enum HasRetransmittableData {
160 NO_RETRANSMITTABLE_DATA, 161 NO_RETRANSMITTABLE_DATA,
161 HAS_RETRANSMITTABLE_DATA, 162 HAS_RETRANSMITTABLE_DATA,
162 }; 163 };
163 164
164 enum IsHandshake { 165 enum IsHandshake {
165 NOT_HANDSHAKE, 166 NOT_HANDSHAKE,
166 IS_HANDSHAKE 167 IS_HANDSHAKE
167 }; 168 };
168 169
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 // deprecated: QUIC_STREAM_RST_BEFORE_HEADERS_DECOMPRESSED = 21 466 // deprecated: QUIC_STREAM_RST_BEFORE_HEADERS_DECOMPRESSED = 21
466 467
467 // The Header ID for a stream was too far from the previous. 468 // The Header ID for a stream was too far from the previous.
468 QUIC_INVALID_HEADER_ID = 22, 469 QUIC_INVALID_HEADER_ID = 22,
469 // Negotiable parameter received during handshake had invalid value. 470 // Negotiable parameter received during handshake had invalid value.
470 QUIC_INVALID_NEGOTIATED_VALUE = 23, 471 QUIC_INVALID_NEGOTIATED_VALUE = 23,
471 // There was an error decompressing data. 472 // There was an error decompressing data.
472 QUIC_DECOMPRESSION_FAILURE = 24, 473 QUIC_DECOMPRESSION_FAILURE = 24,
473 // We hit our prenegotiated (or default) timeout 474 // We hit our prenegotiated (or default) timeout
474 QUIC_CONNECTION_TIMED_OUT = 25, 475 QUIC_CONNECTION_TIMED_OUT = 25,
476 // We hit our overall connection timeout
477 QUIC_CONNECTION_OVERALL_TIMED_OUT = 67,
475 // There was an error encountered migrating addresses 478 // There was an error encountered migrating addresses
476 QUIC_ERROR_MIGRATING_ADDRESS = 26, 479 QUIC_ERROR_MIGRATING_ADDRESS = 26,
477 // There was an error while writing to the socket. 480 // There was an error while writing to the socket.
478 QUIC_PACKET_WRITE_ERROR = 27, 481 QUIC_PACKET_WRITE_ERROR = 27,
479 // There was an error while reading from the socket. 482 // There was an error while reading from the socket.
480 QUIC_PACKET_READ_ERROR = 51, 483 QUIC_PACKET_READ_ERROR = 51,
481 // We received a STREAM_FRAME with no data and no fin flag set. 484 // We received a STREAM_FRAME with no data and no fin flag set.
482 QUIC_INVALID_STREAM_FRAME = 50, 485 QUIC_INVALID_STREAM_FRAME = 50,
483 // We received invalid data on the headers stream. 486 // We received invalid data on the headers stream.
484 QUIC_INVALID_HEADERS_STREAM_DATA = 56, 487 QUIC_INVALID_HEADERS_STREAM_DATA = 56,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 // A handshake message arrived, but we are still validating the 543 // A handshake message arrived, but we are still validating the
541 // previous handshake message. 544 // previous handshake message.
542 QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO = 54, 545 QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO = 54,
543 // A server config update arrived before the handshake is complete. 546 // A server config update arrived before the handshake is complete.
544 QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE = 65, 547 QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE = 65,
545 // This connection involved a version negotiation which appears to have been 548 // This connection involved a version negotiation which appears to have been
546 // tampered with. 549 // tampered with.
547 QUIC_VERSION_NEGOTIATION_MISMATCH = 55, 550 QUIC_VERSION_NEGOTIATION_MISMATCH = 55,
548 551
549 // No error. Used as bound while iterating. 552 // No error. Used as bound while iterating.
550 QUIC_LAST_ERROR = 67, 553 QUIC_LAST_ERROR = 68,
551 }; 554 };
552 555
553 struct NET_EXPORT_PRIVATE QuicPacketPublicHeader { 556 struct NET_EXPORT_PRIVATE QuicPacketPublicHeader {
554 QuicPacketPublicHeader(); 557 QuicPacketPublicHeader();
555 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other); 558 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other);
556 ~QuicPacketPublicHeader(); 559 ~QuicPacketPublicHeader();
557 560
558 // Universal header. All QuicPacket headers will have a connection_id and 561 // Universal header. All QuicPacket headers will have a connection_id and
559 // public flags. 562 // public flags.
560 QuicConnectionId connection_id; 563 QuicConnectionId connection_id;
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 // Zero when the packet is serialized, non-zero once it's sent. 1072 // Zero when the packet is serialized, non-zero once it's sent.
1070 QuicByteCount bytes_sent; 1073 QuicByteCount bytes_sent;
1071 size_t nack_count; 1074 size_t nack_count;
1072 // Reason why this packet was transmitted. 1075 // Reason why this packet was transmitted.
1073 TransmissionType transmission_type; 1076 TransmissionType transmission_type;
1074 // Stores the sequence numbers of all transmissions of this packet. 1077 // Stores the sequence numbers of all transmissions of this packet.
1075 // Must always be NULL or have multiple elements. 1078 // Must always be NULL or have multiple elements.
1076 SequenceNumberList* all_transmissions; 1079 SequenceNumberList* all_transmissions;
1077 // In flight packets have not been abandoned or lost. 1080 // In flight packets have not been abandoned or lost.
1078 bool in_flight; 1081 bool in_flight;
1082 // True if the packet can never be acked, so it can be removed.
1083 bool is_unackable;
1079 }; 1084 };
1080 1085
1081 } // namespace net 1086 } // namespace net
1082 1087
1083 #endif // NET_QUIC_QUIC_PROTOCOL_H_ 1088 #endif // NET_QUIC_QUIC_PROTOCOL_H_
OLDNEW
« no previous file with comments | « net/quic/quic_packet_generator_test.cc ('k') | net/quic/quic_protocol.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698