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

Side by Side Diff: net/quic/core/quic_constants.h

Issue 2516033003: Landing Recent QUIC changes until Mon Nov 14 04:43:50 2016 +0000 (Closed)
Patch Set: Remove unused UpdatePacketGapSentHistogram() function. Created 4 years, 1 month 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/core/quic_connection_test.cc ('k') | net/quic/core/quic_constants.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NET_QUIC_QUIC_CONSTANTS_H_
6 #define NET_QUIC_QUIC_CONSTANTS_H_
7
8 #include <stddef.h>
9 #include <cstdint>
10 #include <limits>
11
12 #include "base/macros.h"
13 #include "net/quic/core/quic_time.h"
14 #include "net/quic/core/quic_types.h"
15
16 // Definitions of constant values used throughout the QUIC code.
17
18 namespace net {
19
20 // Default initial maximum size in bytes of a QUIC packet.
21 const QuicByteCount kDefaultMaxPacketSize = 1350;
22 const QuicByteCount kDefaultServerMaxPacketSize = 1000;
23 // The maximum packet size of any QUIC packet, based on ethernet's max size,
24 // minus the IP and UDP headers. IPv6 has a 40 byte header, UDP adds an
25 // additional 8 bytes. This is a total overhead of 48 bytes. Ethernet's
26 // max packet size is 1500 bytes, 1500 - 48 = 1452.
27 const QuicByteCount kMaxPacketSize = 1452;
28 // Default maximum packet size used in the Linux TCP implementation.
29 // Used in QUIC for congestion window computations in bytes.
30 const QuicByteCount kDefaultTCPMSS = 1460;
31
32 // We match SPDY's use of 32 (since we'd compete with SPDY).
33 const QuicPacketCount kInitialCongestionWindow = 32;
34
35 // Minimum size of initial flow control window, for both stream and session.
36 const uint32_t kMinimumFlowControlSendWindow = 16 * 1024; // 16 KB
37
38 // Maximum flow control receive window limits for connection and stream.
39 const QuicByteCount kStreamReceiveWindowLimit = 16 * 1024 * 1024; // 16 MB
40 const QuicByteCount kSessionReceiveWindowLimit = 24 * 1024 * 1024; // 24 MB
41
42 // Default limit on the size of uncompressed headers.
43 const QuicByteCount kDefaultMaxUncompressedHeaderSize = 16 * 1024; // 16 KB
44
45 // Minimum size of the CWND, in packets, when doing bandwidth resumption.
46 const QuicPacketCount kMinCongestionWindowForBandwidthResumption = 10;
47
48 // Maximum number of tracked packets.
49 const QuicPacketCount kMaxTrackedPackets = 10000;
50
51 // Default size of the socket receive buffer in bytes.
52 const QuicByteCount kDefaultSocketReceiveBuffer = 1024 * 1024;
53
54 // Don't allow a client to suggest an RTT shorter than 10ms.
55 const uint32_t kMinInitialRoundTripTimeUs = 10 * kNumMicrosPerMilli;
56
57 // Don't allow a client to suggest an RTT longer than 15 seconds.
58 const uint32_t kMaxInitialRoundTripTimeUs = 15 * kNumMicrosPerSecond;
59
60 // Maximum number of open streams per connection.
61 const size_t kDefaultMaxStreamsPerConnection = 100;
62
63 // Number of bytes reserved for public flags in the packet header.
64 const size_t kPublicFlagsSize = 1;
65 // Number of bytes reserved for version number in the packet header.
66 const size_t kQuicVersionSize = 4;
67 // Number of bytes reserved for path id in the packet header.
68 const size_t kQuicPathIdSize = 1;
69 // Number of bytes reserved for private flags in the packet header.
70 const size_t kPrivateFlagsSize = 1;
71
72 // Signifies that the QuicPacket will contain version of the protocol.
73 const bool kIncludeVersion = true;
74 // Signifies that the QuicPacket will contain path id.
75 const bool kIncludePathId = true;
76 // Signifies that the QuicPacket will include a diversification nonce.
77 const bool kIncludeDiversificationNonce = true;
78
79 // Stream ID is reserved to denote an invalid ID.
80 const QuicStreamId kInvalidStreamId = 0;
81
82 // Reserved ID for the crypto stream.
83 const QuicStreamId kCryptoStreamId = 1;
84
85 // Reserved ID for the headers stream.
86 const QuicStreamId kHeadersStreamId = 3;
87
88 // Header key used to identify final offset on data stream when sending HTTP/2
89 // trailing headers over QUIC.
90 NET_EXPORT_PRIVATE extern const char* const kFinalOffsetHeaderKey;
91
92 // Maximum delayed ack time, in ms.
93 const int64_t kMaxDelayedAckTimeMs = 25;
94
95 // Minimum tail loss probe time in ms.
96 static const int64_t kMinTailLossProbeTimeoutMs = 10;
97
98 // The timeout before the handshake succeeds.
99 const int64_t kInitialIdleTimeoutSecs = 5;
100 // The default idle timeout.
101 const int64_t kDefaultIdleTimeoutSecs = 30;
102 // The maximum idle timeout that can be negotiated.
103 const int64_t kMaximumIdleTimeoutSecs = 60 * 10; // 10 minutes.
104 // The default timeout for a connection until the crypto handshake succeeds.
105 const int64_t kMaxTimeForCryptoHandshakeSecs = 10; // 10 secs.
106
107 // Default limit on the number of undecryptable packets the connection buffers
108 // before the CHLO/SHLO arrive.
109 const size_t kDefaultMaxUndecryptablePackets = 10;
110
111 // Default ping timeout.
112 const int64_t kPingTimeoutSecs = 15; // 15 secs.
113
114 // Minimum number of RTTs between Server Config Updates (SCUP) sent to client.
115 const int kMinIntervalBetweenServerConfigUpdatesRTTs = 10;
116
117 // Minimum time between Server Config Updates (SCUP) sent to client.
118 const int kMinIntervalBetweenServerConfigUpdatesMs = 1000;
119
120 // Minimum number of packets between Server Config Updates (SCUP).
121 const int kMinPacketsBetweenServerConfigUpdates = 100;
122
123 // The number of open streams that a server will accept is set to be slightly
124 // larger than the negotiated limit. Immediately closing the connection if the
125 // client opens slightly too many streams is not ideal: the client may have sent
126 // a FIN that was lost, and simultaneously opened a new stream. The number of
127 // streams a server accepts is a fixed increment over the negotiated limit, or a
128 // percentage increase, whichever is larger.
129 const float kMaxStreamsMultiplier = 1.1f;
130 const int kMaxStreamsMinimumIncrement = 10;
131
132 // Available streams are ones with IDs less than the highest stream that has
133 // been opened which have neither been opened or reset. The limit on the number
134 // of available streams is 10 times the limit on the number of open streams.
135 const int kMaxAvailableStreamsMultiplier = 10;
136
137 // Track the number of promises that are not yet claimed by a
138 // corresponding get. This must be smaller than
139 // kMaxAvailableStreamsMultiplier, because RST on a promised stream my
140 // create available streams entries.
141 const int kMaxPromisedStreamsMultiplier = kMaxAvailableStreamsMultiplier - 1;
142
143 // TCP RFC calls for 1 second RTO however Linux differs from this default and
144 // define the minimum RTO to 200ms, we will use the same until we have data to
145 // support a higher or lower value.
146 static const int64_t kMinRetransmissionTimeMs = 200;
147
148 // We define an unsigned 16-bit floating point value, inspired by IEEE floats
149 // (http://en.wikipedia.org/wiki/Half_precision_floating-point_format),
150 // with 5-bit exponent (bias 1), 11-bit mantissa (effective 12 with hidden
151 // bit) and denormals, but without signs, transfinites or fractions. Wire format
152 // 16 bits (little-endian byte order) are split into exponent (high 5) and
153 // mantissa (low 11) and decoded as:
154 // uint64_t value;
155 // if (exponent == 0) value = mantissa;
156 // else value = (mantissa | 1 << 11) << (exponent - 1)
157 const int kUFloat16ExponentBits = 5;
158 const int kUFloat16MaxExponent = (1 << kUFloat16ExponentBits) - 2; // 30
159 const int kUFloat16MantissaBits = 16 - kUFloat16ExponentBits; // 11
160 const int kUFloat16MantissaEffectiveBits = kUFloat16MantissaBits + 1; // 12
161 const uint64_t kUFloat16MaxValue = // 0x3FFC0000000
162 ((UINT64_C(1) << kUFloat16MantissaEffectiveBits) - 1)
163 << kUFloat16MaxExponent;
164
165 // Default path ID.
166 const QuicPathId kDefaultPathId = 0;
167 // Invalid path ID.
168 const QuicPathId kInvalidPathId = 0xff;
169
170 // kDiversificationNonceSize is the size, in bytes, of the nonce that a server
171 // may set in the packet header to ensure that its INITIAL keys are not
172 // duplicated.
173 const size_t kDiversificationNonceSize = 32;
174
175 // The largest gap in packets we'll accept without closing the connection.
176 // This will likely have to be tuned.
177 const QuicPacketNumber kMaxPacketGap = 5000;
178
179 } // namespace net
180
181 #endif // NET_QUIC_QUIC_CONSTANTS_H_
OLDNEW
« no previous file with comments | « net/quic/core/quic_connection_test.cc ('k') | net/quic/core/quic_constants.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698