Index: net/quic/quic_protocol.h |
diff --git a/net/quic/quic_protocol.h b/net/quic/quic_protocol.h |
index f6dc181fc6e5287a933406e4d083d8c8e2f1d397..a981d7d360c31161d6c920aca30481c8e50d5c2c 100644 |
--- a/net/quic/quic_protocol.h |
+++ b/net/quic/quic_protocol.h |
@@ -103,8 +103,8 @@ const QuicStreamId kHeadersStreamId = 3; |
// This is the default network timeout a for connection till the crypto |
// handshake succeeds and the negotiated timeout from the handshake is received. |
-const int64 kDefaultInitialTimeoutSecs = 120; // 2 mins. |
-const int64 kDefaultTimeoutSecs = 60 * 10; // 10 minutes. |
+const int64 kDefaultInitialTimeoutSecs = 120; // 2 mins. |
+const int64 kDefaultTimeoutSecs = 60 * 10; // 10 minutes. |
const int64 kDefaultMaxTimeForCryptoHandshakeSecs = 5; // 5 secs. |
// Default ping timeout. |
@@ -120,38 +120,32 @@ const int64 kPingTimeoutSecs = 15; // 15 secs. |
// if (exponent == 0) value = mantissa; |
// else value = (mantissa | 1 << 11) << (exponent - 1) |
const int kUFloat16ExponentBits = 5; |
-const int kUFloat16MaxExponent = (1 << kUFloat16ExponentBits) - 2; // 30 |
-const int kUFloat16MantissaBits = 16 - kUFloat16ExponentBits; // 11 |
+const int kUFloat16MaxExponent = (1 << kUFloat16ExponentBits) - 2; // 30 |
+const int kUFloat16MantissaBits = 16 - kUFloat16ExponentBits; // 11 |
const int kUFloat16MantissaEffectiveBits = kUFloat16MantissaBits + 1; // 12 |
const uint64 kUFloat16MaxValue = // 0x3FFC0000000 |
- ((GG_UINT64_C(1) << kUFloat16MantissaEffectiveBits) - 1) << |
- kUFloat16MaxExponent; |
+ ((GG_UINT64_C(1) << kUFloat16MantissaEffectiveBits) - 1) |
+ << kUFloat16MaxExponent; |
enum TransmissionType { |
NOT_RETRANSMISSION, |
FIRST_TRANSMISSION_TYPE = NOT_RETRANSMISSION, |
- HANDSHAKE_RETRANSMISSION, // Retransmits due to handshake timeouts. |
+ HANDSHAKE_RETRANSMISSION, // Retransmits due to handshake timeouts. |
ALL_UNACKED_RETRANSMISSION, // Retransmits of all unacked packets. |
- LOSS_RETRANSMISSION, // Retransmits due to loss detection. |
- RTO_RETRANSMISSION, // Retransmits due to retransmit time out. |
- TLP_RETRANSMISSION, // Tail loss probes. |
+ LOSS_RETRANSMISSION, // Retransmits due to loss detection. |
+ RTO_RETRANSMISSION, // Retransmits due to retransmit time out. |
+ TLP_RETRANSMISSION, // Tail loss probes. |
LAST_TRANSMISSION_TYPE = TLP_RETRANSMISSION, |
}; |
-enum RetransmissionType { |
- INITIAL_ENCRYPTION_ONLY, |
- ALL_PACKETS |
-}; |
+enum RetransmissionType { INITIAL_ENCRYPTION_ONLY, ALL_PACKETS }; |
enum HasRetransmittableData { |
NO_RETRANSMITTABLE_DATA, |
HAS_RETRANSMITTABLE_DATA, |
}; |
-enum IsHandshake { |
- NOT_HANDSHAKE, |
- IS_HANDSHAKE |
-}; |
+enum IsHandshake { NOT_HANDSHAKE, IS_HANDSHAKE }; |
enum QuicFrameType { |
// Regular frame types. The values set here cannot change without the |
@@ -194,9 +188,9 @@ enum QuicSequenceNumberLength { |
// Used to indicate a QuicSequenceNumberLength using two flag bits. |
enum QuicSequenceNumberLengthFlags { |
- PACKET_FLAGS_1BYTE_SEQUENCE = 0, // 00 |
- PACKET_FLAGS_2BYTE_SEQUENCE = 1, // 01 |
- PACKET_FLAGS_4BYTE_SEQUENCE = 1 << 1, // 10 |
+ PACKET_FLAGS_1BYTE_SEQUENCE = 0, // 00 |
+ PACKET_FLAGS_2BYTE_SEQUENCE = 1, // 01 |
+ PACKET_FLAGS_4BYTE_SEQUENCE = 1 << 1, // 10 |
PACKET_FLAGS_6BYTE_SEQUENCE = 1 << 1 | 1, // 11 |
}; |
@@ -260,7 +254,6 @@ enum QuicPacketPrivateFlags { |
enum QuicVersion { |
// Special case to indicate unknown/unsupported QUIC version. |
QUIC_VERSION_UNSUPPORTED = 0, |
- |
QUIC_VERSION_15 = 15, |
QUIC_VERSION_16 = 16, |
QUIC_VERSION_17 = 17, |
@@ -274,10 +267,8 @@ enum QuicVersion { |
// |
// IMPORTANT: if you are addding to this list, follow the instructions at |
// http://sites/quic/adding-and-removing-versions |
-static const QuicVersion kSupportedQuicVersions[] = {QUIC_VERSION_18, |
- QUIC_VERSION_17, |
- QUIC_VERSION_16, |
- QUIC_VERSION_15}; |
+static const QuicVersion kSupportedQuicVersions[] = { |
+ QUIC_VERSION_18, QUIC_VERSION_17, QUIC_VERSION_16, QUIC_VERSION_15}; |
typedef std::vector<QuicVersion> QuicVersionVector; |
@@ -317,22 +308,22 @@ NET_EXPORT_PRIVATE QuicTag MakeQuicTag(char a, char b, char c, char d); |
// Size in bytes of the data or fec packet header. |
NET_EXPORT_PRIVATE size_t GetPacketHeaderSize(const QuicPacketHeader& header); |
-NET_EXPORT_PRIVATE size_t GetPacketHeaderSize( |
- QuicConnectionIdLength connection_id_length, |
- bool include_version, |
- QuicSequenceNumberLength sequence_number_length, |
- InFecGroup is_in_fec_group); |
+NET_EXPORT_PRIVATE size_t |
+ GetPacketHeaderSize(QuicConnectionIdLength connection_id_length, |
+ bool include_version, |
+ QuicSequenceNumberLength sequence_number_length, |
+ InFecGroup is_in_fec_group); |
// Index of the first byte in a QUIC packet of FEC protected data. |
-NET_EXPORT_PRIVATE size_t GetStartOfFecProtectedData( |
- QuicConnectionIdLength connection_id_length, |
- bool include_version, |
- QuicSequenceNumberLength sequence_number_length); |
+NET_EXPORT_PRIVATE size_t |
+ GetStartOfFecProtectedData(QuicConnectionIdLength connection_id_length, |
+ bool include_version, |
+ QuicSequenceNumberLength sequence_number_length); |
// Index of the first byte in a QUIC packet of encrypted data. |
-NET_EXPORT_PRIVATE size_t GetStartOfEncryptedData( |
- QuicConnectionIdLength connection_id_length, |
- bool include_version, |
- QuicSequenceNumberLength sequence_number_length); |
+NET_EXPORT_PRIVATE size_t |
+ GetStartOfEncryptedData(QuicConnectionIdLength connection_id_length, |
+ bool include_version, |
+ QuicSequenceNumberLength sequence_number_length); |
enum QuicRstStreamErrorCode { |
QUIC_STREAM_NO_ERROR = 0, |
@@ -360,9 +351,9 @@ enum QuicRstStreamErrorCode { |
// Because receiving an unknown QuicRstStreamErrorCode results in connection |
// teardown, we use this to make sure any errors predating a given version are |
// downgraded to the most appropriate existing error. |
-NET_EXPORT_PRIVATE QuicRstStreamErrorCode AdjustErrorForVersion( |
- QuicRstStreamErrorCode error_code, |
- QuicVersion version); |
+NET_EXPORT_PRIVATE QuicRstStreamErrorCode |
+ AdjustErrorForVersion(QuicRstStreamErrorCode error_code, |
+ QuicVersion version); |
// These values must remain stable as they are uploaded to UMA histograms. |
// To add a new error code, use the current value of QUIC_LAST_ERROR and |
@@ -527,8 +518,8 @@ struct NET_EXPORT_PRIVATE QuicPacketHeader { |
QuicPacketHeader(); |
explicit QuicPacketHeader(const QuicPacketPublicHeader& header); |
- NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
- std::ostream& os, const QuicPacketHeader& s); |
+ NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, |
+ const QuicPacketHeader& s); |
QuicPacketPublicHeader public_header; |
bool fec_flag; |
@@ -566,13 +557,11 @@ enum QuicVersionNegotiationState { |
typedef QuicPacketPublicHeader QuicVersionNegotiationPacket; |
// A padding frame contains no payload. |
-struct NET_EXPORT_PRIVATE QuicPaddingFrame { |
-}; |
+struct NET_EXPORT_PRIVATE QuicPaddingFrame {}; |
// A ping frame contains no payload, though it is retransmittable, |
// and ACK'd just like other normal frames. |
-struct NET_EXPORT_PRIVATE QuicPingFrame { |
-}; |
+struct NET_EXPORT_PRIVATE QuicPingFrame {}; |
struct NET_EXPORT_PRIVATE QuicStreamFrame { |
QuicStreamFrame(); |
@@ -582,8 +571,8 @@ struct NET_EXPORT_PRIVATE QuicStreamFrame { |
QuicStreamOffset offset, |
IOVector data); |
- NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
- std::ostream& os, const QuicStreamFrame& s); |
+ NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, |
+ const QuicStreamFrame& s); |
// Returns a copy of the IOVector |data| as a heap-allocated string. |
// Caller must take ownership of the returned string. |
@@ -610,7 +599,8 @@ struct NET_EXPORT_PRIVATE ReceivedPacketInfo { |
~ReceivedPacketInfo(); |
NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
- std::ostream& os, const ReceivedPacketInfo& s); |
+ std::ostream& os, |
+ const ReceivedPacketInfo& s); |
// Entropy hash of all packets up to largest observed not including missing |
// packets. |
@@ -646,22 +636,23 @@ struct NET_EXPORT_PRIVATE ReceivedPacketInfo { |
// True if the sequence number is greater than largest_observed or is listed |
// as missing. |
// Always returns false for sequence numbers less than least_unacked. |
-bool NET_EXPORT_PRIVATE IsAwaitingPacket( |
- const ReceivedPacketInfo& received_info, |
- QuicPacketSequenceNumber sequence_number); |
+bool NET_EXPORT_PRIVATE |
+ IsAwaitingPacket(const ReceivedPacketInfo& received_info, |
+ QuicPacketSequenceNumber sequence_number); |
// Inserts missing packets between [lower, higher). |
-void NET_EXPORT_PRIVATE InsertMissingPacketsBetween( |
- ReceivedPacketInfo* received_info, |
- QuicPacketSequenceNumber lower, |
- QuicPacketSequenceNumber higher); |
+void NET_EXPORT_PRIVATE |
+ InsertMissingPacketsBetween(ReceivedPacketInfo* received_info, |
+ QuicPacketSequenceNumber lower, |
+ QuicPacketSequenceNumber higher); |
struct NET_EXPORT_PRIVATE QuicStopWaitingFrame { |
QuicStopWaitingFrame(); |
~QuicStopWaitingFrame(); |
NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
- std::ostream& os, const QuicStopWaitingFrame& s); |
+ std::ostream& os, |
+ const QuicStopWaitingFrame& s); |
// Entropy hash of all packets up to, but not including, the least unacked |
// packet. |
@@ -673,8 +664,8 @@ struct NET_EXPORT_PRIVATE QuicStopWaitingFrame { |
struct NET_EXPORT_PRIVATE QuicAckFrame { |
QuicAckFrame(); |
- NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
- std::ostream& os, const QuicAckFrame& s); |
+ NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, |
+ const QuicAckFrame& s); |
QuicStopWaitingFrame sent_info; |
ReceivedPacketInfo received_info; |
@@ -684,9 +675,9 @@ struct NET_EXPORT_PRIVATE QuicAckFrame { |
// kTCP MUST be supported by all QUIC implementations to guarantee 100% |
// compatibility. |
enum CongestionFeedbackType { |
- kTCP, // Used to mimic TCP. |
+ kTCP, // Used to mimic TCP. |
kInterArrival, // Use additional inter arrival information. |
- kFixRate, // Provided for testing. |
+ kFixRate, // Provided for testing. |
}; |
enum LossDetectionType { |
@@ -719,7 +710,8 @@ struct NET_EXPORT_PRIVATE QuicCongestionFeedbackFrame { |
~QuicCongestionFeedbackFrame(); |
NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
- std::ostream& os, const QuicCongestionFeedbackFrame& c); |
+ std::ostream& os, |
+ const QuicCongestionFeedbackFrame& c); |
CongestionFeedbackType type; |
// This should really be a union, but since the inter arrival struct |
@@ -736,7 +728,8 @@ struct NET_EXPORT_PRIVATE QuicRstStreamFrame { |
QuicStreamOffset bytes_written); |
NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
- std::ostream& os, const QuicRstStreamFrame& r); |
+ std::ostream& os, |
+ const QuicRstStreamFrame& r); |
QuicStreamId stream_id; |
QuicRstStreamErrorCode error_code; |
@@ -753,7 +746,8 @@ struct NET_EXPORT_PRIVATE QuicConnectionCloseFrame { |
QuicConnectionCloseFrame(); |
NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
- std::ostream& os, const QuicConnectionCloseFrame& c); |
+ std::ostream& os, |
+ const QuicConnectionCloseFrame& c); |
QuicErrorCode error_code; |
std::string error_details; |
@@ -765,8 +759,8 @@ struct NET_EXPORT_PRIVATE QuicGoAwayFrame { |
QuicStreamId last_good_stream_id, |
const std::string& reason); |
- NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
- std::ostream& os, const QuicGoAwayFrame& g); |
+ NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, |
+ const QuicGoAwayFrame& g); |
QuicErrorCode error_code; |
QuicStreamId last_good_stream_id; |
@@ -783,7 +777,8 @@ struct NET_EXPORT_PRIVATE QuicWindowUpdateFrame { |
QuicWindowUpdateFrame(QuicStreamId stream_id, QuicStreamOffset byte_offset); |
NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
- std::ostream& os, const QuicWindowUpdateFrame& w); |
+ std::ostream& os, |
+ const QuicWindowUpdateFrame& w); |
// The stream this frame applies to. 0 is a special case meaning the overall |
// connection rather than a specific stream. |
@@ -802,8 +797,8 @@ struct NET_EXPORT_PRIVATE QuicBlockedFrame { |
QuicBlockedFrame() {} |
explicit QuicBlockedFrame(QuicStreamId stream_id); |
- NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
- std::ostream& os, const QuicBlockedFrame& b); |
+ NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, |
+ const QuicBlockedFrame& b); |
// The stream this frame applies to. 0 is a special case meaning the overall |
// connection rather than a specific stream. |
@@ -818,7 +813,6 @@ enum EncryptionLevel { |
ENCRYPTION_NONE = 0, |
ENCRYPTION_INITIAL = 1, |
ENCRYPTION_FORWARD_SECURE = 2, |
- |
NUM_ENCRYPTION_LEVELS, |
}; |
@@ -836,8 +830,8 @@ struct NET_EXPORT_PRIVATE QuicFrame { |
explicit QuicFrame(QuicWindowUpdateFrame* frame); |
explicit QuicFrame(QuicBlockedFrame* frame); |
- NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
- std::ostream& os, const QuicFrame& frame); |
+ NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, |
+ const QuicFrame& frame); |
QuicFrameType type; |
union { |
@@ -897,8 +891,13 @@ class NET_EXPORT_PRIVATE QuicPacket : public QuicData { |
QuicConnectionIdLength connection_id_length, |
bool includes_version, |
QuicSequenceNumberLength sequence_number_length) { |
- return new QuicPacket(buffer, length, owns_buffer, connection_id_length, |
- includes_version, sequence_number_length, false); |
+ return new QuicPacket(buffer, |
+ length, |
+ owns_buffer, |
+ connection_id_length, |
+ includes_version, |
+ sequence_number_length, |
+ false); |
} |
static QuicPacket* NewFecPacket( |
@@ -908,8 +907,13 @@ class NET_EXPORT_PRIVATE QuicPacket : public QuicData { |
QuicConnectionIdLength connection_id_length, |
bool includes_version, |
QuicSequenceNumberLength sequence_number_length) { |
- return new QuicPacket(buffer, length, owns_buffer, connection_id_length, |
- includes_version, sequence_number_length, true); |
+ return new QuicPacket(buffer, |
+ length, |
+ owns_buffer, |
+ connection_id_length, |
+ includes_version, |
+ sequence_number_length, |
+ true); |
} |
base::StringPiece FecProtectedData() const; |
@@ -952,7 +956,8 @@ class NET_EXPORT_PRIVATE QuicEncryptedPacket : public QuicData { |
// bytes, which causes the default gtest object printer to read |
// uninitialize memory. So we need to teach gtest how to print this object. |
NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
- std::ostream& os, const QuicEncryptedPacket& s); |
+ std::ostream& os, |
+ const QuicEncryptedPacket& s); |
private: |
DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket); |
@@ -974,9 +979,7 @@ class NET_EXPORT_PRIVATE RetransmittableFrames { |
IsHandshake HasCryptoHandshake() const; |
void set_encryption_level(EncryptionLevel level); |
- EncryptionLevel encryption_level() const { |
- return encryption_level_; |
- } |
+ EncryptionLevel encryption_level() const { return encryption_level_; } |
private: |
QuicFrames frames_; |
@@ -1013,8 +1016,8 @@ struct NET_EXPORT_PRIVATE QuicConsumedData { |
// member causes this object to have padding bytes, which causes the |
// default gtest object printer to read uninitialize memory. So we need |
// to teach gtest how to print this object. |
- NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
- std::ostream& os, const QuicConsumedData& s); |
+ NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, |
+ const QuicConsumedData& s); |
// How many bytes were consumed. |
size_t bytes_consumed; |
@@ -1038,7 +1041,7 @@ struct NET_EXPORT_PRIVATE WriteResult { |
WriteStatus status; |
union { |
int bytes_written; // only valid when status is OK |
- int error_code; // only valid when status is ERROR |
+ int error_code; // only valid when status is ERROR |
}; |
}; |