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/quic_protocol.h" | 5 #include "net/quic/quic_protocol.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "net/quic/quic_utils.h" | 8 #include "net/quic/quic_utils.h" |
9 | 9 |
10 using base::StringPiece; | 10 using base::StringPiece; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 return data_string; | 137 return data_string; |
138 } | 138 } |
139 | 139 |
140 uint32 MakeQuicTag(char a, char b, char c, char d) { | 140 uint32 MakeQuicTag(char a, char b, char c, char d) { |
141 return static_cast<uint32>(a) | | 141 return static_cast<uint32>(a) | |
142 static_cast<uint32>(b) << 8 | | 142 static_cast<uint32>(b) << 8 | |
143 static_cast<uint32>(c) << 16 | | 143 static_cast<uint32>(c) << 16 | |
144 static_cast<uint32>(d) << 24; | 144 static_cast<uint32>(d) << 24; |
145 } | 145 } |
146 | 146 |
| 147 bool ContainsQuicTag(QuicTagVector tag_vector, QuicTag tag) { |
| 148 return std::find(tag_vector.begin(), tag_vector.end(), tag) |
| 149 != tag_vector.end(); |
| 150 } |
| 151 |
147 QuicVersionVector QuicSupportedVersions() { | 152 QuicVersionVector QuicSupportedVersions() { |
148 QuicVersionVector supported_versions; | 153 QuicVersionVector supported_versions; |
149 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { | 154 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { |
150 supported_versions.push_back(kSupportedQuicVersions[i]); | 155 supported_versions.push_back(kSupportedQuicVersions[i]); |
151 } | 156 } |
152 return supported_versions; | 157 return supported_versions; |
153 } | 158 } |
154 | 159 |
155 QuicTag QuicVersionToQuicTag(const QuicVersion version) { | 160 QuicTag QuicVersionToQuicTag(const QuicVersion version) { |
156 switch (version) { | 161 switch (version) { |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 bytes_written(0) { | 800 bytes_written(0) { |
796 } | 801 } |
797 | 802 |
798 WriteResult::WriteResult(WriteStatus status, | 803 WriteResult::WriteResult(WriteStatus status, |
799 int bytes_written_or_error_code) | 804 int bytes_written_or_error_code) |
800 : status(status), | 805 : status(status), |
801 bytes_written(bytes_written_or_error_code) { | 806 bytes_written(bytes_written_or_error_code) { |
802 } | 807 } |
803 | 808 |
804 } // namespace net | 809 } // namespace net |
OLD | NEW |