Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: net/quic/core/quic_framer.cc

Issue 2533303004: Add ENDPOINT macro to QuicFramer (and include in existing LOG statement output). (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_framer.h" 5 #include "net/quic/core/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 17 matching lines...) Expand all
28 using base::StringPiece; 28 using base::StringPiece;
29 using std::max; 29 using std::max;
30 using std::min; 30 using std::min;
31 using std::string; 31 using std::string;
32 #define PREDICT_FALSE(x) (x) 32 #define PREDICT_FALSE(x) (x)
33 33
34 namespace net { 34 namespace net {
35 35
36 namespace { 36 namespace {
37 37
38 #define ENDPOINT \
39 (perspective_ == Perspective::IS_SERVER ? "Server: " : "Client: ")
40
38 // Mask to select the lowest 48 bits of a packet number. 41 // Mask to select the lowest 48 bits of a packet number.
39 const QuicPacketNumber k6ByteSequenceNumberMask = UINT64_C(0x0000FFFFFFFFFFFF); 42 const QuicPacketNumber k6ByteSequenceNumberMask = UINT64_C(0x0000FFFFFFFFFFFF);
40 const QuicPacketNumber k4ByteSequenceNumberMask = UINT64_C(0x00000000FFFFFFFF); 43 const QuicPacketNumber k4ByteSequenceNumberMask = UINT64_C(0x00000000FFFFFFFF);
41 const QuicPacketNumber k2ByteSequenceNumberMask = UINT64_C(0x000000000000FFFF); 44 const QuicPacketNumber k2ByteSequenceNumberMask = UINT64_C(0x000000000000FFFF);
42 const QuicPacketNumber k1ByteSequenceNumberMask = UINT64_C(0x00000000000000FF); 45 const QuicPacketNumber k1ByteSequenceNumberMask = UINT64_C(0x00000000000000FF);
43 46
44 // Number of bits the packet number length bits are shifted from the right 47 // Number of bits the packet number length bits are shifted from the right
45 // edge of the public header. 48 // edge of the public header.
46 const uint8_t kPublicHeaderSequenceNumberShift = 4; 49 const uint8_t kPublicHeaderSequenceNumberShift = 4;
47 50
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 if (!first_frame) { 301 if (!first_frame) {
299 return 0; 302 return 0;
300 } 303 }
301 bool can_truncate = 304 bool can_truncate =
302 frame.type == ACK_FRAME && 305 frame.type == ACK_FRAME &&
303 free_bytes >= 306 free_bytes >=
304 GetMinAckFrameSize(quic_version_, PACKET_6BYTE_PACKET_NUMBER); 307 GetMinAckFrameSize(quic_version_, PACKET_6BYTE_PACKET_NUMBER);
305 if (can_truncate) { 308 if (can_truncate) {
306 // Truncate the frame so the packet will not exceed kMaxPacketSize. 309 // Truncate the frame so the packet will not exceed kMaxPacketSize.
307 // Note that we may not use every byte of the writer in this case. 310 // Note that we may not use every byte of the writer in this case.
308 DVLOG(1) << "Truncating large frame, free bytes: " << free_bytes; 311 DVLOG(1) << ENDPOINT
312 << "Truncating large frame, free bytes: " << free_bytes;
309 return free_bytes; 313 return free_bytes;
310 } 314 }
311 return 0; 315 return 0;
312 } 316 }
313 317
314 QuicFramer::NewAckFrameInfo::NewAckFrameInfo() 318 QuicFramer::NewAckFrameInfo::NewAckFrameInfo()
315 : max_block_length(0), first_block_length(0), num_ack_blocks(0) {} 319 : max_block_length(0), first_block_length(0), num_ack_blocks(0) {}
316 320
317 QuicFramer::NewAckFrameInfo::NewAckFrameInfo(const NewAckFrameInfo& other) = 321 QuicFramer::NewAckFrameInfo::NewAckFrameInfo(const NewAckFrameInfo& other) =
318 default; 322 default;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 } 499 }
496 500
497 bool QuicFramer::ProcessPacket(const QuicEncryptedPacket& packet) { 501 bool QuicFramer::ProcessPacket(const QuicEncryptedPacket& packet) {
498 QuicDataReader reader(packet.data(), packet.length()); 502 QuicDataReader reader(packet.data(), packet.length());
499 503
500 visitor_->OnPacket(); 504 visitor_->OnPacket();
501 505
502 // First parse the public header. 506 // First parse the public header.
503 QuicPacketPublicHeader public_header; 507 QuicPacketPublicHeader public_header;
504 if (!ProcessPublicHeader(&reader, &public_header)) { 508 if (!ProcessPublicHeader(&reader, &public_header)) {
505 DVLOG(1) << "Unable to process public header."; 509 DVLOG(1) << ENDPOINT << "Unable to process public header.";
506 DCHECK_NE("", detailed_error_); 510 DCHECK_NE("", detailed_error_);
507 return RaiseError(QUIC_INVALID_PACKET_HEADER); 511 return RaiseError(QUIC_INVALID_PACKET_HEADER);
508 } 512 }
509 513
510 if (!visitor_->OnUnauthenticatedPublicHeader(public_header)) { 514 if (!visitor_->OnUnauthenticatedPublicHeader(public_header)) {
511 // The visitor suppresses further processing of the packet. 515 // The visitor suppresses further processing of the packet.
512 return true; 516 return true;
513 } 517 }
514 518
515 if (perspective_ == Perspective::IS_SERVER && public_header.version_flag && 519 if (perspective_ == Perspective::IS_SERVER && public_header.version_flag &&
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 return true; 566 return true;
563 } 567 }
564 568
565 bool QuicFramer::ProcessDataPacket(QuicDataReader* encrypted_reader, 569 bool QuicFramer::ProcessDataPacket(QuicDataReader* encrypted_reader,
566 const QuicPacketPublicHeader& public_header, 570 const QuicPacketPublicHeader& public_header,
567 const QuicEncryptedPacket& packet, 571 const QuicEncryptedPacket& packet,
568 char* decrypted_buffer, 572 char* decrypted_buffer,
569 size_t buffer_length) { 573 size_t buffer_length) {
570 QuicPacketHeader header(public_header); 574 QuicPacketHeader header(public_header);
571 if (!ProcessUnauthenticatedHeader(encrypted_reader, &header)) { 575 if (!ProcessUnauthenticatedHeader(encrypted_reader, &header)) {
572 DVLOG(1) << "Unable to process packet header. Stopping parsing."; 576 DVLOG(1) << ENDPOINT
577 << "Unable to process packet header. Stopping parsing.";
573 return false; 578 return false;
574 } 579 }
575 580
576 size_t decrypted_length = 0; 581 size_t decrypted_length = 0;
577 if (!DecryptPayload(encrypted_reader, header, packet, decrypted_buffer, 582 if (!DecryptPayload(encrypted_reader, header, packet, decrypted_buffer,
578 buffer_length, &decrypted_length)) { 583 buffer_length, &decrypted_length)) {
579 set_detailed_error("Unable to decrypt payload."); 584 set_detailed_error("Unable to decrypt payload.");
580 return RaiseError(QUIC_DECRYPTION_FAILURE); 585 return RaiseError(QUIC_DECRYPTION_FAILURE);
581 } 586 }
582 587
(...skipping 10 matching lines...) Expand all
593 598
594 if (packet.length() > kMaxPacketSize) { 599 if (packet.length() > kMaxPacketSize) {
595 // If the packet has gotten this far, it should not be too large. 600 // If the packet has gotten this far, it should not be too large.
596 QUIC_BUG << "Packet too large:" << packet.length(); 601 QUIC_BUG << "Packet too large:" << packet.length();
597 return RaiseError(QUIC_PACKET_TOO_LARGE); 602 return RaiseError(QUIC_PACKET_TOO_LARGE);
598 } 603 }
599 604
600 // Handle the payload. 605 // Handle the payload.
601 if (!ProcessFrameData(&reader, header)) { 606 if (!ProcessFrameData(&reader, header)) {
602 DCHECK_NE(QUIC_NO_ERROR, error_); // ProcessFrameData sets the error. 607 DCHECK_NE(QUIC_NO_ERROR, error_); // ProcessFrameData sets the error.
603 DLOG(WARNING) << "Unable to process frame data."; 608 DLOG(WARNING) << ENDPOINT << "Unable to process frame data.";
604 return false; 609 return false;
605 } 610 }
606 611
607 visitor_->OnPacketComplete(); 612 visitor_->OnPacketComplete();
608 return true; 613 return true;
609 } 614 }
610 615
611 bool QuicFramer::ProcessPublicResetPacket( 616 bool QuicFramer::ProcessPublicResetPacket(
612 QuicDataReader* reader, 617 QuicDataReader* reader,
613 const QuicPacketPublicHeader& public_header) { 618 const QuicPacketPublicHeader& public_header) {
(...skipping 24 matching lines...) Expand all
638 QuicSocketAddress(address_coder.ip(), address_coder.port()); 643 QuicSocketAddress(address_coder.ip(), address_coder.port());
639 } 644 }
640 } 645 }
641 646
642 visitor_->OnPublicResetPacket(packet); 647 visitor_->OnPublicResetPacket(packet);
643 return true; 648 return true;
644 } 649 }
645 650
646 bool QuicFramer::AppendPacketHeader(const QuicPacketHeader& header, 651 bool QuicFramer::AppendPacketHeader(const QuicPacketHeader& header,
647 QuicDataWriter* writer) { 652 QuicDataWriter* writer) {
648 DVLOG(1) << "Appending header: " << header; 653 DVLOG(1) << ENDPOINT << "Appending header: " << header;
649 uint8_t public_flags = 0; 654 uint8_t public_flags = 0;
650 if (header.public_header.reset_flag) { 655 if (header.public_header.reset_flag) {
651 public_flags |= PACKET_PUBLIC_FLAGS_RST; 656 public_flags |= PACKET_PUBLIC_FLAGS_RST;
652 } 657 }
653 if (header.public_header.version_flag) { 658 if (header.public_header.version_flag) {
654 public_flags |= PACKET_PUBLIC_FLAGS_VERSION; 659 public_flags |= PACKET_PUBLIC_FLAGS_VERSION;
655 } 660 }
656 if (header.public_header.multipath_flag) { 661 if (header.public_header.multipath_flag) {
657 public_flags |= PACKET_PUBLIC_FLAGS_MULTIPATH; 662 public_flags |= PACKET_PUBLIC_FLAGS_MULTIPATH;
658 } 663 }
(...skipping 25 matching lines...) Expand all
684 return false; 689 return false;
685 } 690 }
686 break; 691 break;
687 } 692 }
688 last_serialized_connection_id_ = header.public_header.connection_id; 693 last_serialized_connection_id_ = header.public_header.connection_id;
689 694
690 if (header.public_header.version_flag) { 695 if (header.public_header.version_flag) {
691 DCHECK_EQ(Perspective::IS_CLIENT, perspective_); 696 DCHECK_EQ(Perspective::IS_CLIENT, perspective_);
692 QuicTag tag = QuicVersionToQuicTag(quic_version_); 697 QuicTag tag = QuicVersionToQuicTag(quic_version_);
693 writer->WriteUInt32(tag); 698 writer->WriteUInt32(tag);
694 DVLOG(1) << "version = " << quic_version_ << ", tag = '" 699 DVLOG(1) << ENDPOINT << "version = " << quic_version_ << ", tag = '"
695 << QuicTagToString(tag) << "'"; 700 << QuicTagToString(tag) << "'";
696 } 701 }
697 702
698 if (header.public_header.multipath_flag && 703 if (header.public_header.multipath_flag &&
699 !writer->WriteUInt8(header.path_id)) { 704 !writer->WriteUInt8(header.path_id)) {
700 return false; 705 return false;
701 } 706 }
702 707
703 if (header.public_header.nonce != nullptr && 708 if (header.public_header.nonce != nullptr &&
704 !writer->WriteBytes(header.public_header.nonce, 709 !writer->WriteBytes(header.public_header.nonce,
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 } 1025 }
1021 1026
1022 if (frame_type & kQuicFrameTypeSpecialMask) { 1027 if (frame_type & kQuicFrameTypeSpecialMask) {
1023 // Stream Frame 1028 // Stream Frame
1024 if (frame_type & kQuicFrameTypeStreamMask) { 1029 if (frame_type & kQuicFrameTypeStreamMask) {
1025 QuicStreamFrame frame; 1030 QuicStreamFrame frame;
1026 if (!ProcessStreamFrame(reader, frame_type, &frame)) { 1031 if (!ProcessStreamFrame(reader, frame_type, &frame)) {
1027 return RaiseError(QUIC_INVALID_STREAM_DATA); 1032 return RaiseError(QUIC_INVALID_STREAM_DATA);
1028 } 1033 }
1029 if (!visitor_->OnStreamFrame(frame)) { 1034 if (!visitor_->OnStreamFrame(frame)) {
1030 DVLOG(1) << "Visitor asked to stop further processing."; 1035 DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
1031 // Returning true since there was no parsing error. 1036 // Returning true since there was no parsing error.
1032 return true; 1037 return true;
1033 } 1038 }
1034 continue; 1039 continue;
1035 } 1040 }
1036 1041
1037 // Ack Frame 1042 // Ack Frame
1038 if (frame_type & kQuicFrameTypeAckMask) { 1043 if (frame_type & kQuicFrameTypeAckMask) {
1039 QuicAckFrame frame; 1044 QuicAckFrame frame;
1040 if (!ProcessNewAckFrame(reader, frame_type, &frame)) { 1045 if (!ProcessNewAckFrame(reader, frame_type, &frame)) {
1041 return RaiseError(QUIC_INVALID_ACK_DATA); 1046 return RaiseError(QUIC_INVALID_ACK_DATA);
1042 } 1047 }
1043 if (!visitor_->OnAckFrame(frame)) { 1048 if (!visitor_->OnAckFrame(frame)) {
1044 DVLOG(1) << "Visitor asked to stop further processing."; 1049 DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
1045 // Returning true since there was no parsing error. 1050 // Returning true since there was no parsing error.
1046 return true; 1051 return true;
1047 } 1052 }
1048 continue; 1053 continue;
1049 } 1054 }
1050 1055
1051 // This was a special frame type that did not match any 1056 // This was a special frame type that did not match any
1052 // of the known ones. Error. 1057 // of the known ones. Error.
1053 set_detailed_error("Illegal frame type."); 1058 set_detailed_error("Illegal frame type.");
1054 DLOG(WARNING) << "Illegal frame type: " << static_cast<int>(frame_type); 1059 DLOG(WARNING) << ENDPOINT
1060 << "Illegal frame type: " << static_cast<int>(frame_type);
1055 return RaiseError(QUIC_INVALID_FRAME_DATA); 1061 return RaiseError(QUIC_INVALID_FRAME_DATA);
1056 } 1062 }
1057 1063
1058 switch (frame_type) { 1064 switch (frame_type) {
1059 case PADDING_FRAME: { 1065 case PADDING_FRAME: {
1060 QuicPaddingFrame frame(reader->BytesRemaining()); 1066 QuicPaddingFrame frame(reader->BytesRemaining());
1061 if (!visitor_->OnPaddingFrame(frame)) { 1067 if (!visitor_->OnPaddingFrame(frame)) {
1062 DVLOG(1) << "Visitor asked to stop further processing."; 1068 DVLOG(1) << "Visitor asked to stop further processing.";
1063 } 1069 }
1064 // We're done with the packet. 1070 // We're done with the packet.
(...skipping 13 matching lines...) Expand all
1078 continue; 1084 continue;
1079 } 1085 }
1080 1086
1081 case CONNECTION_CLOSE_FRAME: { 1087 case CONNECTION_CLOSE_FRAME: {
1082 QuicConnectionCloseFrame frame; 1088 QuicConnectionCloseFrame frame;
1083 if (!ProcessConnectionCloseFrame(reader, &frame)) { 1089 if (!ProcessConnectionCloseFrame(reader, &frame)) {
1084 return RaiseError(QUIC_INVALID_CONNECTION_CLOSE_DATA); 1090 return RaiseError(QUIC_INVALID_CONNECTION_CLOSE_DATA);
1085 } 1091 }
1086 1092
1087 if (!visitor_->OnConnectionCloseFrame(frame)) { 1093 if (!visitor_->OnConnectionCloseFrame(frame)) {
1088 DVLOG(1) << "Visitor asked to stop further processing."; 1094 DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
1089 // Returning true since there was no parsing error. 1095 // Returning true since there was no parsing error.
1090 return true; 1096 return true;
1091 } 1097 }
1092 continue; 1098 continue;
1093 } 1099 }
1094 1100
1095 case GOAWAY_FRAME: { 1101 case GOAWAY_FRAME: {
1096 QuicGoAwayFrame goaway_frame; 1102 QuicGoAwayFrame goaway_frame;
1097 if (!ProcessGoAwayFrame(reader, &goaway_frame)) { 1103 if (!ProcessGoAwayFrame(reader, &goaway_frame)) {
1098 return RaiseError(QUIC_INVALID_GOAWAY_DATA); 1104 return RaiseError(QUIC_INVALID_GOAWAY_DATA);
1099 } 1105 }
1100 if (!visitor_->OnGoAwayFrame(goaway_frame)) { 1106 if (!visitor_->OnGoAwayFrame(goaway_frame)) {
1101 DVLOG(1) << "Visitor asked to stop further processing."; 1107 DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
1102 // Returning true since there was no parsing error. 1108 // Returning true since there was no parsing error.
1103 return true; 1109 return true;
1104 } 1110 }
1105 continue; 1111 continue;
1106 } 1112 }
1107 1113
1108 case WINDOW_UPDATE_FRAME: { 1114 case WINDOW_UPDATE_FRAME: {
1109 QuicWindowUpdateFrame window_update_frame; 1115 QuicWindowUpdateFrame window_update_frame;
1110 if (!ProcessWindowUpdateFrame(reader, &window_update_frame)) { 1116 if (!ProcessWindowUpdateFrame(reader, &window_update_frame)) {
1111 return RaiseError(QUIC_INVALID_WINDOW_UPDATE_DATA); 1117 return RaiseError(QUIC_INVALID_WINDOW_UPDATE_DATA);
1112 } 1118 }
1113 if (!visitor_->OnWindowUpdateFrame(window_update_frame)) { 1119 if (!visitor_->OnWindowUpdateFrame(window_update_frame)) {
1114 DVLOG(1) << "Visitor asked to stop further processing."; 1120 DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
1115 // Returning true since there was no parsing error. 1121 // Returning true since there was no parsing error.
1116 return true; 1122 return true;
1117 } 1123 }
1118 continue; 1124 continue;
1119 } 1125 }
1120 1126
1121 case BLOCKED_FRAME: { 1127 case BLOCKED_FRAME: {
1122 QuicBlockedFrame blocked_frame; 1128 QuicBlockedFrame blocked_frame;
1123 if (!ProcessBlockedFrame(reader, &blocked_frame)) { 1129 if (!ProcessBlockedFrame(reader, &blocked_frame)) {
1124 return RaiseError(QUIC_INVALID_BLOCKED_DATA); 1130 return RaiseError(QUIC_INVALID_BLOCKED_DATA);
1125 } 1131 }
1126 if (!visitor_->OnBlockedFrame(blocked_frame)) { 1132 if (!visitor_->OnBlockedFrame(blocked_frame)) {
1127 DVLOG(1) << "Visitor asked to stop further processing."; 1133 DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
1128 // Returning true since there was no parsing error. 1134 // Returning true since there was no parsing error.
1129 return true; 1135 return true;
1130 } 1136 }
1131 continue; 1137 continue;
1132 } 1138 }
1133 1139
1134 case STOP_WAITING_FRAME: { 1140 case STOP_WAITING_FRAME: {
1135 QuicStopWaitingFrame stop_waiting_frame; 1141 QuicStopWaitingFrame stop_waiting_frame;
1136 if (!ProcessStopWaitingFrame(reader, header, &stop_waiting_frame)) { 1142 if (!ProcessStopWaitingFrame(reader, header, &stop_waiting_frame)) {
1137 return RaiseError(QUIC_INVALID_STOP_WAITING_DATA); 1143 return RaiseError(QUIC_INVALID_STOP_WAITING_DATA);
1138 } 1144 }
1139 if (!visitor_->OnStopWaitingFrame(stop_waiting_frame)) { 1145 if (!visitor_->OnStopWaitingFrame(stop_waiting_frame)) {
1140 DVLOG(1) << "Visitor asked to stop further processing."; 1146 DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
1141 // Returning true since there was no parsing error. 1147 // Returning true since there was no parsing error.
1142 return true; 1148 return true;
1143 } 1149 }
1144 continue; 1150 continue;
1145 } 1151 }
1146 case PING_FRAME: { 1152 case PING_FRAME: {
1147 // Ping has no payload. 1153 // Ping has no payload.
1148 QuicPingFrame ping_frame; 1154 QuicPingFrame ping_frame;
1149 if (!visitor_->OnPingFrame(ping_frame)) { 1155 if (!visitor_->OnPingFrame(ping_frame)) {
1150 DVLOG(1) << "Visitor asked to stop further processing."; 1156 DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
1151 // Returning true since there was no parsing error. 1157 // Returning true since there was no parsing error.
1152 return true; 1158 return true;
1153 } 1159 }
1154 continue; 1160 continue;
1155 } 1161 }
1156 case PATH_CLOSE_FRAME: { 1162 case PATH_CLOSE_FRAME: {
1157 QuicPathCloseFrame path_close_frame; 1163 QuicPathCloseFrame path_close_frame;
1158 if (!ProcessPathCloseFrame(reader, &path_close_frame)) { 1164 if (!ProcessPathCloseFrame(reader, &path_close_frame)) {
1159 return RaiseError(QUIC_INVALID_PATH_CLOSE_DATA); 1165 return RaiseError(QUIC_INVALID_PATH_CLOSE_DATA);
1160 } 1166 }
1161 if (!visitor_->OnPathCloseFrame(path_close_frame)) { 1167 if (!visitor_->OnPathCloseFrame(path_close_frame)) {
1162 DVLOG(1) << "Visitor asked to stop further processing."; 1168 DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
1163 // Returning true since there was no parsing error. 1169 // Returning true since there was no parsing error.
1164 return true; 1170 return true;
1165 } 1171 }
1166 continue; 1172 continue;
1167 } 1173 }
1168 1174
1169 default: 1175 default:
1170 set_detailed_error("Illegal frame type."); 1176 set_detailed_error("Illegal frame type.");
1171 DLOG(WARNING) << "Illegal frame type: " << static_cast<int>(frame_type); 1177 DLOG(WARNING) << ENDPOINT
1178 << "Illegal frame type: " << static_cast<int>(frame_type);
1172 return RaiseError(QUIC_INVALID_FRAME_DATA); 1179 return RaiseError(QUIC_INVALID_FRAME_DATA);
1173 } 1180 }
1174 } 1181 }
1175 1182
1176 return true; 1183 return true;
1177 } 1184 }
1178 1185
1179 bool QuicFramer::ProcessStreamFrame(QuicDataReader* reader, 1186 bool QuicFramer::ProcessStreamFrame(QuicDataReader* reader,
1180 uint8_t frame_type, 1187 uint8_t frame_type,
1181 QuicStreamFrame* frame) { 1188 QuicStreamFrame* frame) {
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 // Switch the alternative decrypter so that we use it first next time. 1668 // Switch the alternative decrypter so that we use it first next time.
1662 decrypter_.swap(alternative_decrypter_); 1669 decrypter_.swap(alternative_decrypter_);
1663 EncryptionLevel level = alternative_decrypter_level_; 1670 EncryptionLevel level = alternative_decrypter_level_;
1664 alternative_decrypter_level_ = decrypter_level_; 1671 alternative_decrypter_level_ = decrypter_level_;
1665 decrypter_level_ = level; 1672 decrypter_level_ = level;
1666 } 1673 }
1667 } 1674 }
1668 } 1675 }
1669 1676
1670 if (!success) { 1677 if (!success) {
1671 DVLOG(1) << "DecryptPacket failed for packet_number:" 1678 DVLOG(1) << ENDPOINT << "DecryptPacket failed for packet_number:"
1672 << header.packet_number; 1679 << header.packet_number;
1673 return false; 1680 return false;
1674 } 1681 }
1675 1682
1676 return true; 1683 return true;
1677 } 1684 }
1678 1685
1679 size_t QuicFramer::GetAckFrameTimeStampSize(const QuicAckFrame& ack) { 1686 size_t QuicFramer::GetAckFrameTimeStampSize(const QuicAckFrame& ack) {
1680 if (ack.received_packet_times.empty()) { 1687 if (ack.received_packet_times.empty()) {
1681 return 0; 1688 return 0;
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
2178 bool QuicFramer::AppendPathCloseFrame(const QuicPathCloseFrame& frame, 2185 bool QuicFramer::AppendPathCloseFrame(const QuicPathCloseFrame& frame,
2179 QuicDataWriter* writer) { 2186 QuicDataWriter* writer) {
2180 uint8_t path_id = static_cast<uint8_t>(frame.path_id); 2187 uint8_t path_id = static_cast<uint8_t>(frame.path_id);
2181 if (!writer->WriteUInt8(path_id)) { 2188 if (!writer->WriteUInt8(path_id)) {
2182 return false; 2189 return false;
2183 } 2190 }
2184 return true; 2191 return true;
2185 } 2192 }
2186 2193
2187 bool QuicFramer::RaiseError(QuicErrorCode error) { 2194 bool QuicFramer::RaiseError(QuicErrorCode error) {
2188 DVLOG(1) << "Error: " << QuicErrorCodeToString(error) 2195 DVLOG(1) << ENDPOINT << "Error: " << QuicErrorCodeToString(error)
2189 << " detail: " << detailed_error_; 2196 << " detail: " << detailed_error_;
2190 set_error(error); 2197 set_error(error);
2191 visitor_->OnError(this); 2198 visitor_->OnError(this);
2192 return false; 2199 return false;
2193 } 2200 }
2194 2201
2195 } // namespace net 2202 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698