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 #include "net/quic/core/quic_versions.h" | 5 #include "net/quic/core/quic_versions.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "net/quic/core/quic_flags.h" | 9 #include "net/quic/core/quic_flags.h" |
| 10 #include "net/quic/core/quic_tag.h" |
10 #include "net/quic/core/quic_types.h" | 11 #include "net/quic/core/quic_types.h" |
11 #include "net/quic/core/quic_utils.h" | 12 #include "net/quic/core/quic_utils.h" |
12 | 13 |
13 using base::StringPiece; | 14 using base::StringPiece; |
14 using std::map; | 15 using std::map; |
15 using std::numeric_limits; | 16 using std::numeric_limits; |
16 using std::ostream; | 17 using std::ostream; |
17 using std::string; | 18 using std::string; |
18 | 19 |
19 namespace net { | 20 namespace net { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 77 } |
77 } | 78 } |
78 | 79 |
79 QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) { | 80 QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) { |
80 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { | 81 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { |
81 if (version_tag == QuicVersionToQuicTag(kSupportedQuicVersions[i])) { | 82 if (version_tag == QuicVersionToQuicTag(kSupportedQuicVersions[i])) { |
82 return kSupportedQuicVersions[i]; | 83 return kSupportedQuicVersions[i]; |
83 } | 84 } |
84 } | 85 } |
85 // Reading from the client so this should not be considered an ERROR. | 86 // Reading from the client so this should not be considered an ERROR. |
86 DVLOG(1) << "Unsupported QuicTag version: " | 87 DVLOG(1) << "Unsupported QuicTag version: " << QuicTagToString(version_tag); |
87 << QuicUtils::TagToString(version_tag); | |
88 return QUIC_VERSION_UNSUPPORTED; | 88 return QUIC_VERSION_UNSUPPORTED; |
89 } | 89 } |
90 | 90 |
91 #define RETURN_STRING_LITERAL(x) \ | 91 #define RETURN_STRING_LITERAL(x) \ |
92 case x: \ | 92 case x: \ |
93 return #x | 93 return #x |
94 | 94 |
95 string QuicVersionToString(const QuicVersion version) { | 95 string QuicVersionToString(const QuicVersion version) { |
96 switch (version) { | 96 switch (version) { |
97 RETURN_STRING_LITERAL(QUIC_VERSION_34); | 97 RETURN_STRING_LITERAL(QUIC_VERSION_34); |
98 RETURN_STRING_LITERAL(QUIC_VERSION_35); | 98 RETURN_STRING_LITERAL(QUIC_VERSION_35); |
99 RETURN_STRING_LITERAL(QUIC_VERSION_36); | 99 RETURN_STRING_LITERAL(QUIC_VERSION_36); |
100 default: | 100 default: |
101 return "QUIC_VERSION_UNSUPPORTED"; | 101 return "QUIC_VERSION_UNSUPPORTED"; |
102 } | 102 } |
103 } | 103 } |
104 | 104 |
105 string QuicVersionVectorToString(const QuicVersionVector& versions) { | 105 string QuicVersionVectorToString(const QuicVersionVector& versions) { |
106 string result = ""; | 106 string result = ""; |
107 for (size_t i = 0; i < versions.size(); ++i) { | 107 for (size_t i = 0; i < versions.size(); ++i) { |
108 if (i != 0) { | 108 if (i != 0) { |
109 result.append(","); | 109 result.append(","); |
110 } | 110 } |
111 result.append(QuicVersionToString(versions[i])); | 111 result.append(QuicVersionToString(versions[i])); |
112 } | 112 } |
113 return result; | 113 return result; |
114 } | 114 } |
115 | 115 |
116 } // namespace net | 116 } // namespace net |
OLD | NEW |