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 <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // We match SPDY's use of 32 (since we'd compete with SPDY). | 68 // We match SPDY's use of 32 (since we'd compete with SPDY). |
69 const QuicPacketCount kInitialCongestionWindow = 32; | 69 const QuicPacketCount kInitialCongestionWindow = 32; |
70 | 70 |
71 // Minimum size of initial flow control window, for both stream and session. | 71 // Minimum size of initial flow control window, for both stream and session. |
72 const uint32_t kMinimumFlowControlSendWindow = 16 * 1024; // 16 KB | 72 const uint32_t kMinimumFlowControlSendWindow = 16 * 1024; // 16 KB |
73 | 73 |
74 // Maximum flow control receive window limits for connection and stream. | 74 // Maximum flow control receive window limits for connection and stream. |
75 const QuicByteCount kStreamReceiveWindowLimit = 16 * 1024 * 1024; // 16 MB | 75 const QuicByteCount kStreamReceiveWindowLimit = 16 * 1024 * 1024; // 16 MB |
76 const QuicByteCount kSessionReceiveWindowLimit = 24 * 1024 * 1024; // 24 MB | 76 const QuicByteCount kSessionReceiveWindowLimit = 24 * 1024 * 1024; // 24 MB |
77 | 77 |
| 78 // Default limit on the size of uncompressed headers. |
| 79 const QuicByteCount kDefaultMaxUncompressedHeaderSize = 16 * 1024; // 16 KB |
| 80 |
78 // Minimum size of the CWND, in packets, when doing bandwidth resumption. | 81 // Minimum size of the CWND, in packets, when doing bandwidth resumption. |
79 const QuicPacketCount kMinCongestionWindowForBandwidthResumption = 10; | 82 const QuicPacketCount kMinCongestionWindowForBandwidthResumption = 10; |
80 | 83 |
81 // Maximum number of tracked packets. | 84 // Maximum number of tracked packets. |
82 const QuicPacketCount kMaxTrackedPackets = 10000; | 85 const QuicPacketCount kMaxTrackedPackets = 10000; |
83 | 86 |
84 // Default size of the socket receive buffer in bytes. | 87 // Default size of the socket receive buffer in bytes. |
85 const QuicByteCount kDefaultSocketReceiveBuffer = 1024 * 1024; | 88 const QuicByteCount kDefaultSocketReceiveBuffer = 1024 * 1024; |
86 // Minimum size of the socket receive buffer in bytes. | |
87 // Smaller values are ignored. | |
88 const QuicByteCount kMinSocketReceiveBuffer = 16 * 1024; | |
89 | |
90 // Fraction of the receive buffer that can be used, based on conservative | |
91 // estimates and testing on Linux. | |
92 // An alternative to kUsableRecieveBufferFraction. | |
93 static const float kConservativeReceiveBufferFraction = 0.6f; | |
94 | 89 |
95 // Don't allow a client to suggest an RTT shorter than 10ms. | 90 // Don't allow a client to suggest an RTT shorter than 10ms. |
96 const uint32_t kMinInitialRoundTripTimeUs = 10 * kNumMicrosPerMilli; | 91 const uint32_t kMinInitialRoundTripTimeUs = 10 * kNumMicrosPerMilli; |
97 | 92 |
98 // Don't allow a client to suggest an RTT longer than 15 seconds. | 93 // Don't allow a client to suggest an RTT longer than 15 seconds. |
99 const uint32_t kMaxInitialRoundTripTimeUs = 15 * kNumMicrosPerSecond; | 94 const uint32_t kMaxInitialRoundTripTimeUs = 15 * kNumMicrosPerSecond; |
100 | 95 |
101 // Maximum number of open streams per connection. | 96 // Maximum number of open streams per connection. |
102 const size_t kDefaultMaxStreamsPerConnection = 100; | 97 const size_t kDefaultMaxStreamsPerConnection = 100; |
103 | 98 |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 // Server is not authoritative for this URL. | 480 // Server is not authoritative for this URL. |
486 QUIC_UNAUTHORIZED_PROMISE_URL, | 481 QUIC_UNAUTHORIZED_PROMISE_URL, |
487 // Can't have more than one active PUSH_PROMISE per URL. | 482 // Can't have more than one active PUSH_PROMISE per URL. |
488 QUIC_DUPLICATE_PROMISE_URL, | 483 QUIC_DUPLICATE_PROMISE_URL, |
489 // Vary check failed. | 484 // Vary check failed. |
490 QUIC_PROMISE_VARY_MISMATCH, | 485 QUIC_PROMISE_VARY_MISMATCH, |
491 // Only GET and HEAD methods allowed. | 486 // Only GET and HEAD methods allowed. |
492 QUIC_INVALID_PROMISE_METHOD, | 487 QUIC_INVALID_PROMISE_METHOD, |
493 // The push stream is unclaimed and timed out. | 488 // The push stream is unclaimed and timed out. |
494 QUIC_PUSH_STREAM_TIMED_OUT, | 489 QUIC_PUSH_STREAM_TIMED_OUT, |
| 490 // Received headers were too large. |
| 491 QUIC_HEADERS_TOO_LARGE, |
495 // No error. Used as bound while iterating. | 492 // No error. Used as bound while iterating. |
496 QUIC_STREAM_LAST_ERROR, | 493 QUIC_STREAM_LAST_ERROR, |
497 }; | 494 }; |
498 // QUIC error codes are encoded to a single octet on-the-wire. | 495 // QUIC error codes are encoded to a single octet on-the-wire. |
499 static_assert(static_cast<int>(QUIC_STREAM_LAST_ERROR) <= | 496 static_assert(static_cast<int>(QUIC_STREAM_LAST_ERROR) <= |
500 std::numeric_limits<uint8_t>::max(), | 497 std::numeric_limits<uint8_t>::max(), |
501 "QuicErrorCode exceeds single octet"); | 498 "QuicErrorCode exceeds single octet"); |
502 | 499 |
503 // Because receiving an unknown QuicRstStreamErrorCode results in connection | |
504 // teardown, we use this to make sure any errors predating a given version are | |
505 // downgraded to the most appropriate existing error. | |
506 NET_EXPORT_PRIVATE QuicRstStreamErrorCode | |
507 AdjustErrorForVersion(QuicRstStreamErrorCode error_code, QuicVersion version); | |
508 | |
509 // These values must remain stable as they are uploaded to UMA histograms. | 500 // These values must remain stable as they are uploaded to UMA histograms. |
510 // To add a new error code, use the current value of QUIC_LAST_ERROR and | 501 // To add a new error code, use the current value of QUIC_LAST_ERROR and |
511 // increment QUIC_LAST_ERROR. | 502 // increment QUIC_LAST_ERROR. |
512 enum QuicErrorCode { | 503 enum QuicErrorCode { |
513 QUIC_NO_ERROR = 0, | 504 QUIC_NO_ERROR = 0, |
514 | 505 |
515 // Connection has reached an invalid state. | 506 // Connection has reached an invalid state. |
516 QUIC_INTERNAL_ERROR = 1, | 507 QUIC_INTERNAL_ERROR = 1, |
517 // There were data frames after the a fin or reset. | 508 // There were data frames after the a fin or reset. |
518 QUIC_STREAM_DATA_AFTER_TERMINATION = 2, | 509 QUIC_STREAM_DATA_AFTER_TERMINATION = 2, |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 : iov(iov), iov_count(iov_count), total_length(total_length) {} | 1519 : iov(iov), iov_count(iov_count), total_length(total_length) {} |
1529 | 1520 |
1530 const struct iovec* iov; | 1521 const struct iovec* iov; |
1531 const int iov_count; | 1522 const int iov_count; |
1532 const size_t total_length; | 1523 const size_t total_length; |
1533 }; | 1524 }; |
1534 | 1525 |
1535 } // namespace net | 1526 } // namespace net |
1536 | 1527 |
1537 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 1528 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |