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

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

Issue 47283002: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compilation error Created 7 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 | Annotate | Revision Log
« 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 <map> 10 #include <map>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // Reserved ID for the crypto stream. 76 // Reserved ID for the crypto stream.
77 // TODO(rch): ensure that this is not usable by any other streams. 77 // TODO(rch): ensure that this is not usable by any other streams.
78 const QuicStreamId kCryptoStreamId = 1; 78 const QuicStreamId kCryptoStreamId = 1;
79 79
80 // This is the default network timeout a for connection till the crypto 80 // This is the default network timeout a for connection till the crypto
81 // handshake succeeds and the negotiated timeout from the handshake is received. 81 // handshake succeeds and the negotiated timeout from the handshake is received.
82 const int64 kDefaultInitialTimeoutSecs = 120; // 2 mins. 82 const int64 kDefaultInitialTimeoutSecs = 120; // 2 mins.
83 const int64 kDefaultTimeoutSecs = 60 * 10; // 10 minutes. 83 const int64 kDefaultTimeoutSecs = 60 * 10; // 10 minutes.
84 const int64 kDefaultMaxTimeForCryptoHandshakeSecs = 5; // 5 secs. 84 const int64 kDefaultMaxTimeForCryptoHandshakeSecs = 5; // 5 secs.
85 85
86 // We define an unsigned 16-bit floating point value, inspired by IEEE floats
87 // (http://en.wikipedia.org/wiki/Half_precision_floating-point_format),
88 // with 5-bit exponent (bias 1), 11-bit mantissa (effective 12 with hidden
89 // bit) and denormals, but without signs, transfinites or fractions. Wire format
90 // 16 bits (little-endian byte order) are split into exponent (high 5) and
91 // mantissa (low 11) and decoded as:
92 // uint64 value;
93 // if (exponent == 0) value = mantissa;
94 // else value = (mantissa | 1 << 11) << (exponent - 1)
95 const int kUFloat16ExponentBits = 5;
96 const int kUFloat16MaxExponent = (1 << kUFloat16ExponentBits) - 2; // 30
97 const int kUFloat16MantissaBits = 16 - kUFloat16ExponentBits; // 11
98 const int kUFloat16MantissaEffectiveBits = kUFloat16MantissaBits + 1; // 12
99 const uint64 kUFloat16MaxValue = // 0x3FFC0000000
100 ((GG_UINT64_C(1) << kUFloat16MantissaEffectiveBits) - 1) <<
101 kUFloat16MaxExponent;
102
86 enum TransmissionType { 103 enum TransmissionType {
87 NOT_RETRANSMISSION, 104 NOT_RETRANSMISSION,
88 NACK_RETRANSMISSION, 105 NACK_RETRANSMISSION,
89 RTO_RETRANSMISSION, 106 RTO_RETRANSMISSION,
90 }; 107 };
91 108
92 enum HasRetransmittableData { 109 enum HasRetransmittableData {
93 NO_RETRANSMITTABLE_DATA, 110 NO_RETRANSMITTABLE_DATA,
94 HAS_RETRANSMITTABLE_DATA, 111 HAS_RETRANSMITTABLE_DATA,
95 }; 112 };
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 213
197 // This vector contains QUIC versions which we currently support. 214 // This vector contains QUIC versions which we currently support.
198 // This should be ordered such that the highest supported version is the first 215 // This should be ordered such that the highest supported version is the first
199 // element, with subsequent elements in descending order (versions can be 216 // element, with subsequent elements in descending order (versions can be
200 // skipped as necessary). 217 // skipped as necessary).
201 static const QuicVersion kSupportedQuicVersions[] = 218 static const QuicVersion kSupportedQuicVersions[] =
202 {QUIC_VERSION_10}; 219 {QUIC_VERSION_10};
203 220
204 typedef std::vector<QuicVersion> QuicVersionVector; 221 typedef std::vector<QuicVersion> QuicVersionVector;
205 222
206 // Upper limit on versions we support. 223 // Returns a vector of QUIC versions in kSupportedQuicVersions.
207 NET_EXPORT_PRIVATE QuicVersion QuicVersionMax(); 224 NET_EXPORT_PRIVATE QuicVersionVector QuicSupportedVersions();
208
209 // Lower limit on versions we support.
210 NET_EXPORT_PRIVATE QuicVersion QuicVersionMin();
211 225
212 // QuicTag is written to and read from the wire, but we prefer to use 226 // QuicTag is written to and read from the wire, but we prefer to use
213 // the more readable QuicVersion at other levels. 227 // the more readable QuicVersion at other levels.
214 // Helper function which translates from a QuicVersion to a QuicTag. Returns 0 228 // Helper function which translates from a QuicVersion to a QuicTag. Returns 0
215 // if QuicVersion is unsupported. 229 // if QuicVersion is unsupported.
216 NET_EXPORT_PRIVATE QuicTag QuicVersionToQuicTag(const QuicVersion version); 230 NET_EXPORT_PRIVATE QuicTag QuicVersionToQuicTag(const QuicVersion version);
217 231
218 // Returns appropriate QuicVersion from a QuicTag. 232 // Returns appropriate QuicVersion from a QuicTag.
219 // Returns QUIC_VERSION_UNSUPPORTED if version_tag cannot be understood. 233 // Returns QUIC_VERSION_UNSUPPORTED if version_tag cannot be understood.
220 NET_EXPORT_PRIVATE QuicVersion QuicTagToQuicVersion(const QuicTag version_tag); 234 NET_EXPORT_PRIVATE QuicVersion QuicTagToQuicVersion(const QuicTag version_tag);
221 235
222 // Helper function which translates from a QuicVersion to a string. 236 // Helper function which translates from a QuicVersion to a string.
223 // Returns strings corresponding to enum names (e.g. QUIC_VERSION_6). 237 // Returns strings corresponding to enum names (e.g. QUIC_VERSION_6).
224 NET_EXPORT_PRIVATE std::string QuicVersionToString(const QuicVersion version); 238 NET_EXPORT_PRIVATE std::string QuicVersionToString(const QuicVersion version);
225 239
226 // Returns comma separated list of string representations of QuicVersion enum 240 // Returns comma separated list of string representations of QuicVersion enum
227 // values in the supplied QuicVersionArray. 241 // values in the supplied |versions| vector.
228 NET_EXPORT_PRIVATE std::string QuicVersionArrayToString( 242 NET_EXPORT_PRIVATE std::string QuicVersionVectorToString(
229 const QuicVersion versions[], int num_versions); 243 const QuicVersionVector& versions);
230 244
231 // Version and Crypto tags are written to the wire with a big-endian 245 // Version and Crypto tags are written to the wire with a big-endian
232 // representation of the name of the tag. For example 246 // representation of the name of the tag. For example
233 // the client hello tag (CHLO) will be written as the 247 // the client hello tag (CHLO) will be written as the
234 // following 4 bytes: 'C' 'H' 'L' 'O'. Since it is 248 // following 4 bytes: 'C' 'H' 'L' 'O'. Since it is
235 // stored in memory as a little endian uint32, we need 249 // stored in memory as a little endian uint32, we need
236 // to reverse the order of the bytes. 250 // to reverse the order of the bytes.
237 251
238 // MakeQuicTag returns a value given the four bytes. For example: 252 // MakeQuicTag returns a value given the four bytes. For example:
239 // MakeQuicTag('C', 'H', 'L', 'O'); 253 // MakeQuicTag('C', 'H', 'L', 'O');
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 WriteStatus status; 900 WriteStatus status;
887 union { 901 union {
888 int bytes_written; // only valid when status is OK 902 int bytes_written; // only valid when status is OK
889 int error_code; // only valid when status is ERROR 903 int error_code; // only valid when status is ERROR
890 }; 904 };
891 }; 905 };
892 906
893 } // namespace net 907 } // namespace net
894 908
895 #endif // NET_QUIC_QUIC_PROTOCOL_H_ 909 #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