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

Unified Diff: net/quic/quic_protocol.cc

Issue 19858003: * Removed QuicTag kQuicVersion1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comments from rch Created 7 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_protocol.h ('k') | net/quic/quic_protocol_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_protocol.cc
diff --git a/net/quic/quic_protocol.cc b/net/quic/quic_protocol.cc
index 051a6406589e9b7125e1d1e1d6db95eefda9b728..a3eb1b5d335248b309285b97316760842268448e 100644
--- a/net/quic/quic_protocol.cc
+++ b/net/quic/quic_protocol.cc
@@ -52,13 +52,6 @@ size_t GetStartOfEncryptedData(
kPrivateFlagsSize;
}
-uint32 MakeQuicTag(char a, char b, char c, char d) {
- return static_cast<uint32>(a) |
- static_cast<uint32>(b) << 8 |
- static_cast<uint32>(c) << 16 |
- static_cast<uint32>(d) << 24;
-}
-
QuicPacketPublicHeader::QuicPacketPublicHeader()
: guid(0),
guid_length(PACKET_8BYTE_GUID),
@@ -119,6 +112,65 @@ QuicStreamFrame::QuicStreamFrame(QuicStreamId stream_id,
data(data) {
}
+uint32 MakeQuicTag(char a, char b, char c, char d) {
+ return static_cast<uint32>(a) |
+ static_cast<uint32>(b) << 8 |
+ static_cast<uint32>(c) << 16 |
+ static_cast<uint32>(d) << 24;
+}
+
+QuicVersion QuicVersionMax() { return kSupportedQuicVersions[0]; }
+
+QuicTag QuicVersionToQuicTag(const QuicVersion version) {
+ switch (version) {
+ case QUIC_VERSION_6:
+ return MakeQuicTag('Q', '0', '0', '6');
+ // case QUIC_VERSION_7
+ // return MakeQuicTag('Q', '0', '0', '7');
+ default:
+ LOG(ERROR) << "Unsupported QUIC version: " << version;
+ return 0;
+ }
+}
+
+QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) {
+ const QuicTag quic_tag_v6 = MakeQuicTag('Q', '0', '0', '6');
+ // const QuicTag quic_tag_v7 = MakeQuicTag('Q', '0', '0', '7');
+
+ if (version_tag == quic_tag_v6) {
+ return QUIC_VERSION_6;
+ // } else if (version_tag == quic_tag_v7) {
+ // return QUIC_VERSION_7;
+ } else {
+ LOG(ERROR) << "Unsupported QUIC version: " << version_tag;
+ return QUIC_VERSION_UNSUPPORTED;
+ }
+}
+
+string QuicVersionToString(const QuicVersion version) {
+ // TODO(rjshade): Possibly start using RETURN_STRING_LITERAL here when we
+ // start supporting a lot of versions.
+ switch (version) {
+ case QUIC_VERSION_6:
+ return "QUIC_VERSION_6";
+ // case QUIC_VERSION_7:
+ // return "QUIC_VERSION_7";
+ default:
+ return "QUIC_VERSION_UNSUPPORTED";
+ }
+}
+
+string QuicVersionArrayToString(const QuicVersion versions[],
+ int num_versions) {
+ string result = "";
+ for (int i = 0; i < num_versions; ++i) {
+ const QuicVersion& version = versions[i];
+ result.append(QuicVersionToString(version));
+ result.append(",");
+ }
+ return result;
+}
+
ostream& operator<<(ostream& os, const QuicPacketHeader& header) {
os << "{ guid: " << header.public_header.guid
<< ", guid_length:" << header.public_header.guid_length
« no previous file with comments | « net/quic/quic_protocol.h ('k') | net/quic/quic_protocol_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698