| 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_framer.h" | 5 #include "net/quic/quic_framer.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 if (public_header->version_flag && perspective_ == Perspective::IS_SERVER) { | 968 if (public_header->version_flag && perspective_ == Perspective::IS_SERVER) { |
| 969 QuicTag version_tag; | 969 QuicTag version_tag; |
| 970 if (!reader->ReadUInt32(&version_tag)) { | 970 if (!reader->ReadUInt32(&version_tag)) { |
| 971 set_detailed_error("Unable to read protocol version."); | 971 set_detailed_error("Unable to read protocol version."); |
| 972 return false; | 972 return false; |
| 973 } | 973 } |
| 974 | 974 |
| 975 // If the version from the new packet is the same as the version of this | 975 // If the version from the new packet is the same as the version of this |
| 976 // framer, then the public flags should be set to something we understand. | 976 // framer, then the public flags should be set to something we understand. |
| 977 // If not, this raises an error. | 977 // If not, this raises an error. |
| 978 last_version_tag_ = version_tag; |
| 978 QuicVersion version = QuicTagToQuicVersion(version_tag); | 979 QuicVersion version = QuicTagToQuicVersion(version_tag); |
| 979 if (version == quic_version_ && public_flags > PACKET_PUBLIC_FLAGS_MAX) { | 980 if (version == quic_version_ && public_flags > PACKET_PUBLIC_FLAGS_MAX) { |
| 980 set_detailed_error("Illegal public flags value."); | 981 set_detailed_error("Illegal public flags value."); |
| 981 return false; | 982 return false; |
| 982 } | 983 } |
| 983 public_header->versions.push_back(version); | 984 public_header->versions.push_back(version); |
| 984 } | 985 } |
| 985 return true; | 986 return true; |
| 986 } | 987 } |
| 987 | 988 |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 if (ack_frame->is_truncated) { | 1481 if (ack_frame->is_truncated) { |
| 1481 return true; | 1482 return true; |
| 1482 } | 1483 } |
| 1483 uint8_t num_received_packets; | 1484 uint8_t num_received_packets; |
| 1484 if (!reader->ReadBytes(&num_received_packets, 1)) { | 1485 if (!reader->ReadBytes(&num_received_packets, 1)) { |
| 1485 set_detailed_error("Unable to read num received packets."); | 1486 set_detailed_error("Unable to read num received packets."); |
| 1486 return false; | 1487 return false; |
| 1487 } | 1488 } |
| 1488 | 1489 |
| 1489 if (num_received_packets > 0) { | 1490 if (num_received_packets > 0) { |
| 1491 ack_frame->received_packet_times.reserve(num_received_packets); |
| 1490 uint8_t delta_from_largest_observed; | 1492 uint8_t delta_from_largest_observed; |
| 1491 if (!reader->ReadBytes(&delta_from_largest_observed, | 1493 if (!reader->ReadBytes(&delta_from_largest_observed, |
| 1492 PACKET_1BYTE_PACKET_NUMBER)) { | 1494 PACKET_1BYTE_PACKET_NUMBER)) { |
| 1493 set_detailed_error("Unable to read sequence delta in received packets."); | 1495 set_detailed_error("Unable to read sequence delta in received packets."); |
| 1494 return false; | 1496 return false; |
| 1495 } | 1497 } |
| 1496 QuicPacketNumber seq_num = | 1498 QuicPacketNumber seq_num = |
| 1497 ack_frame->largest_observed - delta_from_largest_observed; | 1499 ack_frame->largest_observed - delta_from_largest_observed; |
| 1498 | 1500 |
| 1499 // Time delta from the framer creation. | 1501 // Time delta from the framer creation. |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2306 | 2308 |
| 2307 bool QuicFramer::RaiseError(QuicErrorCode error) { | 2309 bool QuicFramer::RaiseError(QuicErrorCode error) { |
| 2308 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error) | 2310 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error) |
| 2309 << " detail: " << detailed_error_; | 2311 << " detail: " << detailed_error_; |
| 2310 set_error(error); | 2312 set_error(error); |
| 2311 visitor_->OnError(this); | 2313 visitor_->OnError(this); |
| 2312 return false; | 2314 return false; |
| 2313 } | 2315 } |
| 2314 | 2316 |
| 2315 } // namespace net | 2317 } // namespace net |
| OLD | NEW |