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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 QuicVersionVector QuicSupportedVersions() { | 152 QuicVersionVector QuicSupportedVersions() { |
153 QuicVersionVector supported_versions; | 153 QuicVersionVector supported_versions; |
154 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { | 154 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { |
155 supported_versions.push_back(kSupportedQuicVersions[i]); | 155 supported_versions.push_back(kSupportedQuicVersions[i]); |
156 } | 156 } |
157 return supported_versions; | 157 return supported_versions; |
158 } | 158 } |
159 | 159 |
160 QuicTag QuicVersionToQuicTag(const QuicVersion version) { | 160 QuicTag QuicVersionToQuicTag(const QuicVersion version) { |
161 switch (version) { | 161 switch (version) { |
162 case QUIC_VERSION_15: | |
163 return MakeQuicTag('Q', '0', '1', '5'); | |
164 case QUIC_VERSION_16: | 162 case QUIC_VERSION_16: |
165 return MakeQuicTag('Q', '0', '1', '6'); | 163 return MakeQuicTag('Q', '0', '1', '6'); |
166 case QUIC_VERSION_18: | 164 case QUIC_VERSION_18: |
167 return MakeQuicTag('Q', '0', '1', '8'); | 165 return MakeQuicTag('Q', '0', '1', '8'); |
168 case QUIC_VERSION_19: | 166 case QUIC_VERSION_19: |
169 return MakeQuicTag('Q', '0', '1', '9'); | 167 return MakeQuicTag('Q', '0', '1', '9'); |
170 case QUIC_VERSION_20: | 168 case QUIC_VERSION_20: |
171 return MakeQuicTag('Q', '0', '2', '0'); | 169 return MakeQuicTag('Q', '0', '2', '0'); |
172 case QUIC_VERSION_21: | 170 case QUIC_VERSION_21: |
173 return MakeQuicTag('Q', '0', '2', '1'); | 171 return MakeQuicTag('Q', '0', '2', '1'); |
(...skipping 16 matching lines...) Expand all Loading... |
190 << QuicUtils::TagToString(version_tag); | 188 << QuicUtils::TagToString(version_tag); |
191 return QUIC_VERSION_UNSUPPORTED; | 189 return QUIC_VERSION_UNSUPPORTED; |
192 } | 190 } |
193 | 191 |
194 #define RETURN_STRING_LITERAL(x) \ | 192 #define RETURN_STRING_LITERAL(x) \ |
195 case x: \ | 193 case x: \ |
196 return #x | 194 return #x |
197 | 195 |
198 string QuicVersionToString(const QuicVersion version) { | 196 string QuicVersionToString(const QuicVersion version) { |
199 switch (version) { | 197 switch (version) { |
200 RETURN_STRING_LITERAL(QUIC_VERSION_15); | |
201 RETURN_STRING_LITERAL(QUIC_VERSION_16); | 198 RETURN_STRING_LITERAL(QUIC_VERSION_16); |
202 RETURN_STRING_LITERAL(QUIC_VERSION_18); | 199 RETURN_STRING_LITERAL(QUIC_VERSION_18); |
203 RETURN_STRING_LITERAL(QUIC_VERSION_19); | 200 RETURN_STRING_LITERAL(QUIC_VERSION_19); |
204 RETURN_STRING_LITERAL(QUIC_VERSION_20); | 201 RETURN_STRING_LITERAL(QUIC_VERSION_20); |
205 RETURN_STRING_LITERAL(QUIC_VERSION_21); | 202 RETURN_STRING_LITERAL(QUIC_VERSION_21); |
206 default: | 203 default: |
207 return "QUIC_VERSION_UNSUPPORTED"; | 204 return "QUIC_VERSION_UNSUPPORTED"; |
208 } | 205 } |
209 } | 206 } |
210 | 207 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 os << "stream_id { " << stream_frame.stream_id << " } " | 492 os << "stream_id { " << stream_frame.stream_id << " } " |
496 << "fin { " << stream_frame.fin << " } " | 493 << "fin { " << stream_frame.fin << " } " |
497 << "offset { " << stream_frame.offset << " } " | 494 << "offset { " << stream_frame.offset << " } " |
498 << "data { " | 495 << "data { " |
499 << QuicUtils::StringToHexASCIIDump(*(stream_frame.GetDataAsString())) | 496 << QuicUtils::StringToHexASCIIDump(*(stream_frame.GetDataAsString())) |
500 << " }\n"; | 497 << " }\n"; |
501 return os; | 498 return os; |
502 } | 499 } |
503 | 500 |
504 ostream& operator<<(ostream& os, const QuicAckFrame& ack_frame) { | 501 ostream& operator<<(ostream& os, const QuicAckFrame& ack_frame) { |
505 os << "sent info { " << ack_frame.sent_info << " } " | 502 os << "received info { " << ack_frame.received_info << " }\n"; |
506 << "received info { " << ack_frame.received_info << " }\n"; | |
507 return os; | 503 return os; |
508 } | 504 } |
509 | 505 |
510 ostream& operator<<(ostream& os, | 506 ostream& operator<<(ostream& os, |
511 const QuicCongestionFeedbackFrame& congestion_frame) { | 507 const QuicCongestionFeedbackFrame& congestion_frame) { |
512 os << "type: " << congestion_frame.type; | 508 os << "type: " << congestion_frame.type; |
513 switch (congestion_frame.type) { | 509 switch (congestion_frame.type) { |
514 case kInterArrival: { | 510 case kInterArrival: { |
515 const CongestionFeedbackMessageInterArrival& inter_arrival = | 511 const CongestionFeedbackMessageInterArrival& inter_arrival = |
516 congestion_frame.inter_arrival; | 512 congestion_frame.inter_arrival; |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 sent_time(QuicTime::Zero()), | 776 sent_time(QuicTime::Zero()), |
781 bytes_sent(0), | 777 bytes_sent(0), |
782 nack_count(0), | 778 nack_count(0), |
783 transmission_type(transmission_type), | 779 transmission_type(transmission_type), |
784 all_transmissions(all_transmissions), | 780 all_transmissions(all_transmissions), |
785 in_flight(false) { | 781 in_flight(false) { |
786 all_transmissions->insert(sequence_number); | 782 all_transmissions->insert(sequence_number); |
787 } | 783 } |
788 | 784 |
789 } // namespace net | 785 } // namespace net |
OLD | NEW |