| 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 <cstdint> | 7 #include <cstdint> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 if (private_flags > PACKET_PRIVATE_FLAGS_MAX) { | 1105 if (private_flags > PACKET_PRIVATE_FLAGS_MAX) { |
| 1106 set_detailed_error("Illegal private flags value."); | 1106 set_detailed_error("Illegal private flags value."); |
| 1107 return RaiseError(QUIC_INVALID_PACKET_HEADER); | 1107 return RaiseError(QUIC_INVALID_PACKET_HEADER); |
| 1108 } | 1108 } |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 header->entropy_flag = (private_flags & PACKET_PRIVATE_FLAGS_ENTROPY) != 0; | 1111 header->entropy_flag = (private_flags & PACKET_PRIVATE_FLAGS_ENTROPY) != 0; |
| 1112 header->fec_flag = (private_flags & PACKET_PRIVATE_FLAGS_FEC) != 0; | 1112 header->fec_flag = (private_flags & PACKET_PRIVATE_FLAGS_FEC) != 0; |
| 1113 | 1113 |
| 1114 if ((private_flags & PACKET_PRIVATE_FLAGS_FEC_GROUP) != 0) { | 1114 if ((private_flags & PACKET_PRIVATE_FLAGS_FEC_GROUP) != 0) { |
| 1115 header->is_in_fec_group = IN_FEC_GROUP; | |
| 1116 uint8_t first_fec_protected_packet_offset; | 1115 uint8_t first_fec_protected_packet_offset; |
| 1117 if (!reader->ReadBytes(&first_fec_protected_packet_offset, 1)) { | 1116 if (!reader->ReadBytes(&first_fec_protected_packet_offset, 1)) { |
| 1118 set_detailed_error("Unable to read first fec protected packet offset."); | 1117 set_detailed_error("Unable to read first fec protected packet offset."); |
| 1119 return RaiseError(QUIC_INVALID_PACKET_HEADER); | 1118 return RaiseError(QUIC_INVALID_PACKET_HEADER); |
| 1120 } | 1119 } |
| 1121 if (first_fec_protected_packet_offset >= header->packet_number) { | 1120 if (first_fec_protected_packet_offset >= header->packet_number) { |
| 1122 set_detailed_error( | 1121 set_detailed_error( |
| 1123 "First fec protected packet offset must be less " | 1122 "First fec protected packet offset must be less " |
| 1124 "than the packet number."); | 1123 "than the packet number."); |
| 1125 return RaiseError(QUIC_INVALID_PACKET_HEADER); | 1124 return RaiseError(QUIC_INVALID_PACKET_HEADER); |
| 1126 } | 1125 } |
| 1127 header->fec_group = | |
| 1128 header->packet_number - first_fec_protected_packet_offset; | |
| 1129 } | 1126 } |
| 1130 | 1127 |
| 1131 header->entropy_hash = GetPacketEntropyHash(*header); | 1128 header->entropy_hash = GetPacketEntropyHash(*header); |
| 1132 return true; | 1129 return true; |
| 1133 } | 1130 } |
| 1134 | 1131 |
| 1135 bool QuicFramer::ProcessPathId(QuicDataReader* reader, QuicPathId* path_id) { | 1132 bool QuicFramer::ProcessPathId(QuicDataReader* reader, QuicPathId* path_id) { |
| 1136 if (!reader->ReadBytes(path_id, 1)) { | 1133 if (!reader->ReadBytes(path_id, 1)) { |
| 1137 return false; | 1134 return false; |
| 1138 } | 1135 } |
| (...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2569 | 2566 |
| 2570 bool QuicFramer::RaiseError(QuicErrorCode error) { | 2567 bool QuicFramer::RaiseError(QuicErrorCode error) { |
| 2571 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error) | 2568 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error) |
| 2572 << " detail: " << detailed_error_; | 2569 << " detail: " << detailed_error_; |
| 2573 set_error(error); | 2570 set_error(error); |
| 2574 visitor_->OnError(this); | 2571 visitor_->OnError(this); |
| 2575 return false; | 2572 return false; |
| 2576 } | 2573 } |
| 2577 | 2574 |
| 2578 } // namespace net | 2575 } // namespace net |
| OLD | NEW |