OLD | NEW |
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 Loading... |
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 // The default idle timeout before the crypto handshake succeeds. | 111 // The timeout before the handshake succeeds. |
112 const int64 kDefaultInitialTimeoutSecs = 120; // 2 mins. | 112 const int64 kInitialIdleTimeoutSecs = 5; |
| 113 // The default idle timeout. |
| 114 const int64 kDefaultIdleTimeoutSecs = 30; |
113 // The maximum idle timeout that can be negotiated. | 115 // The maximum idle timeout that can be negotiated. |
114 const int64 kMaximumIdleTimeoutSecs = 60 * 10; // 10 minutes. | 116 const int64 kMaximumIdleTimeoutSecs = 60 * 10; // 10 minutes. |
115 // The default timeout for a connection until the crypto handshake succeeds. | 117 // The default timeout for a connection until the crypto handshake succeeds. |
116 const int64 kDefaultMaxTimeForCryptoHandshakeSecs = 10; // 10 secs. | 118 const int64 kMaxTimeForCryptoHandshakeSecs = 10; // 10 secs. |
117 | 119 |
118 // Default ping timeout. | 120 // Default ping timeout. |
119 const int64 kPingTimeoutSecs = 15; // 15 secs. | 121 const int64 kPingTimeoutSecs = 15; // 15 secs. |
120 | 122 |
121 // Minimum number of RTTs between Server Config Updates (SCUP) sent to client. | 123 // Minimum number of RTTs between Server Config Updates (SCUP) sent to client. |
122 const int kMinIntervalBetweenServerConfigUpdatesRTTs = 10; | 124 const int kMinIntervalBetweenServerConfigUpdatesRTTs = 10; |
123 | 125 |
124 // Minimum time between Server Config Updates (SCUP) sent to client. | 126 // Minimum time between Server Config Updates (SCUP) sent to client. |
125 const int kMinIntervalBetweenServerConfigUpdatesMs = 1000; | 127 const int kMinIntervalBetweenServerConfigUpdatesMs = 1000; |
126 | 128 |
127 // Multiplier that allows server to accept slightly more streams than | 129 // The number of open streams that a server will accept is set to be slightly |
128 // negotiated in handshake. | 130 // larger than the negotiated limit. Immediately closing the connection if the |
| 131 // client opens slightly too many streams is not ideal: the client may have sent |
| 132 // a FIN that was lost, and simultaneously opened a new stream. The number of |
| 133 // streams a server accepts is a fixed increment over the negotiated limit, or a |
| 134 // percentage increase, whichever is larger. |
129 const float kMaxStreamsMultiplier = 1.1f; | 135 const float kMaxStreamsMultiplier = 1.1f; |
| 136 const int kMaxStreamsMinimumIncrement = 10; |
130 | 137 |
131 // We define an unsigned 16-bit floating point value, inspired by IEEE floats | 138 // We define an unsigned 16-bit floating point value, inspired by IEEE floats |
132 // (http://en.wikipedia.org/wiki/Half_precision_floating-point_format), | 139 // (http://en.wikipedia.org/wiki/Half_precision_floating-point_format), |
133 // with 5-bit exponent (bias 1), 11-bit mantissa (effective 12 with hidden | 140 // with 5-bit exponent (bias 1), 11-bit mantissa (effective 12 with hidden |
134 // bit) and denormals, but without signs, transfinites or fractions. Wire format | 141 // bit) and denormals, but without signs, transfinites or fractions. Wire format |
135 // 16 bits (little-endian byte order) are split into exponent (high 5) and | 142 // 16 bits (little-endian byte order) are split into exponent (high 5) and |
136 // mantissa (low 11) and decoded as: | 143 // mantissa (low 11) and decoded as: |
137 // uint64 value; | 144 // uint64 value; |
138 // if (exponent == 0) value = mantissa; | 145 // if (exponent == 0) value = mantissa; |
139 // else value = (mantissa | 1 << 11) << (exponent - 1) | 146 // else value = (mantissa | 1 << 11) << (exponent - 1) |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // The available versions of QUIC. Guaranteed that the integer value of the enum | 287 // The available versions of QUIC. Guaranteed that the integer value of the enum |
281 // will match the version number. | 288 // will match the version number. |
282 // When adding a new version to this enum you should add it to | 289 // When adding a new version to this enum you should add it to |
283 // kSupportedQuicVersions (if appropriate), and also add a new case to the | 290 // kSupportedQuicVersions (if appropriate), and also add a new case to the |
284 // helper methods QuicVersionToQuicTag, QuicTagToQuicVersion, and | 291 // helper methods QuicVersionToQuicTag, QuicTagToQuicVersion, and |
285 // QuicVersionToString. | 292 // QuicVersionToString. |
286 enum QuicVersion { | 293 enum QuicVersion { |
287 // Special case to indicate unknown/unsupported QUIC version. | 294 // Special case to indicate unknown/unsupported QUIC version. |
288 QUIC_VERSION_UNSUPPORTED = 0, | 295 QUIC_VERSION_UNSUPPORTED = 0, |
289 | 296 |
290 QUIC_VERSION_16 = 16, // STOP_WAITING frame. | |
291 QUIC_VERSION_18 = 18, // PING frame. | 297 QUIC_VERSION_18 = 18, // PING frame. |
292 QUIC_VERSION_19 = 19, // Connection level flow control. | 298 QUIC_VERSION_19 = 19, // Connection level flow control. |
293 QUIC_VERSION_21 = 21, // Headers/crypto streams are flow controlled. | 299 QUIC_VERSION_21 = 21, // Headers/crypto streams are flow controlled. |
294 QUIC_VERSION_22 = 22, // Send Server Config Update messages on crypto stream. | 300 QUIC_VERSION_22 = 22, // Send Server Config Update messages on crypto stream. |
295 QUIC_VERSION_23 = 23, // Timestamp in the ack frame. | 301 QUIC_VERSION_23 = 23, // Timestamp in the ack frame. |
296 }; | 302 }; |
297 | 303 |
298 // This vector contains QUIC versions which we currently support. | 304 // This vector contains QUIC versions which we currently support. |
299 // This should be ordered such that the highest supported version is the first | 305 // This should be ordered such that the highest supported version is the first |
300 // element, with subsequent elements in descending order (versions can be | 306 // element, with subsequent elements in descending order (versions can be |
301 // skipped as necessary). | 307 // skipped as necessary). |
302 // | 308 // |
303 // IMPORTANT: if you are adding to this list, follow the instructions at | 309 // IMPORTANT: if you are adding to this list, follow the instructions at |
304 // http://sites/quic/adding-and-removing-versions | 310 // http://sites/quic/adding-and-removing-versions |
305 static const QuicVersion kSupportedQuicVersions[] = {QUIC_VERSION_23, | 311 static const QuicVersion kSupportedQuicVersions[] = {QUIC_VERSION_23, |
306 QUIC_VERSION_22, | 312 QUIC_VERSION_22, |
307 QUIC_VERSION_21, | 313 QUIC_VERSION_21, |
308 QUIC_VERSION_19, | 314 QUIC_VERSION_19, |
309 QUIC_VERSION_18, | 315 QUIC_VERSION_18}; |
310 QUIC_VERSION_16}; | |
311 | 316 |
312 typedef std::vector<QuicVersion> QuicVersionVector; | 317 typedef std::vector<QuicVersion> QuicVersionVector; |
313 | 318 |
314 // Returns a vector of QUIC versions in kSupportedQuicVersions. | 319 // Returns a vector of QUIC versions in kSupportedQuicVersions. |
315 NET_EXPORT_PRIVATE QuicVersionVector QuicSupportedVersions(); | 320 NET_EXPORT_PRIVATE QuicVersionVector QuicSupportedVersions(); |
316 | 321 |
317 // QuicTag is written to and read from the wire, but we prefer to use | 322 // QuicTag is written to and read from the wire, but we prefer to use |
318 // the more readable QuicVersion at other levels. | 323 // the more readable QuicVersion at other levels. |
319 // Helper function which translates from a QuicVersion to a QuicTag. Returns 0 | 324 // Helper function which translates from a QuicVersion to a QuicTag. Returns 0 |
320 // if QuicVersion is unsupported. | 325 // if QuicVersion is unsupported. |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 SequenceNumberList* all_transmissions; | 1084 SequenceNumberList* all_transmissions; |
1080 // In flight packets have not been abandoned or lost. | 1085 // In flight packets have not been abandoned or lost. |
1081 bool in_flight; | 1086 bool in_flight; |
1082 // True if the packet can never be acked, so it can be removed. | 1087 // True if the packet can never be acked, so it can be removed. |
1083 bool is_unackable; | 1088 bool is_unackable; |
1084 }; | 1089 }; |
1085 | 1090 |
1086 } // namespace net | 1091 } // namespace net |
1087 | 1092 |
1088 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 1093 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |