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

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

Issue 23464033: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix valgrind error Created 7 years, 3 months 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_crypto_client_stream.cc ('k') | net/quic/quic_framer_test.cc » ('j') | 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/quic_framer.h" 5 #include "net/quic/quic_framer.h"
6 6
7 #include "base/containers/hash_tables.h" 7 #include "base/containers/hash_tables.h"
8 #include "net/quic/crypto/quic_decrypter.h" 8 #include "net/quic/crypto/quic_decrypter.h"
9 #include "net/quic/crypto/quic_encrypter.h" 9 #include "net/quic/crypto/quic_encrypter.h"
10 #include "net/quic/quic_data_reader.h" 10 #include "net/quic/quic_data_reader.h"
11 #include "net/quic/quic_data_writer.h" 11 #include "net/quic/quic_data_writer.h"
12 12
13 using base::StringPiece; 13 using base::StringPiece;
14 using std::make_pair; 14 using std::make_pair;
15 using std::map; 15 using std::map;
16 using std::numeric_limits; 16 using std::numeric_limits;
17 using std::string; 17 using std::string;
18 18
19 namespace net { 19 namespace net {
20 20
21 namespace { 21 namespace {
22 22
23 // TODO(jri): Remove uses of QuicFrameTypeOld when
24 // QUIC versions < 10 are no longer supported.
25 enum QuicFrameTypeOld {
26 PADDING_FRAME_OLD = 0,
27 STREAM_FRAME_OLD,
28 ACK_FRAME_OLD,
29 CONGESTION_FEEDBACK_FRAME_OLD,
30 RST_STREAM_FRAME_OLD,
31 CONNECTION_CLOSE_FRAME_OLD,
32 GOAWAY_FRAME_OLD,
33 NUM_FRAME_TYPES_OLD
34 };
35
23 // Mask to select the lowest 48 bits of a sequence number. 36 // Mask to select the lowest 48 bits of a sequence number.
24 const QuicPacketSequenceNumber k6ByteSequenceNumberMask = 37 const QuicPacketSequenceNumber k6ByteSequenceNumberMask =
25 GG_UINT64_C(0x0000FFFFFFFFFFFF); 38 GG_UINT64_C(0x0000FFFFFFFFFFFF);
26 const QuicPacketSequenceNumber k4ByteSequenceNumberMask = 39 const QuicPacketSequenceNumber k4ByteSequenceNumberMask =
27 GG_UINT64_C(0x00000000FFFFFFFF); 40 GG_UINT64_C(0x00000000FFFFFFFF);
28 const QuicPacketSequenceNumber k2ByteSequenceNumberMask = 41 const QuicPacketSequenceNumber k2ByteSequenceNumberMask =
29 GG_UINT64_C(0x000000000000FFFF); 42 GG_UINT64_C(0x000000000000FFFF);
30 const QuicPacketSequenceNumber k1ByteSequenceNumberMask = 43 const QuicPacketSequenceNumber k1ByteSequenceNumberMask =
31 GG_UINT64_C(0x00000000000000FF); 44 GG_UINT64_C(0x00000000000000FF);
32 45
33 const QuicGuid k1ByteGuidMask = GG_UINT64_C(0x00000000000000FF); 46 const QuicGuid k1ByteGuidMask = GG_UINT64_C(0x00000000000000FF);
34 const QuicGuid k4ByteGuidMask = GG_UINT64_C(0x00000000FFFFFFFF); 47 const QuicGuid k4ByteGuidMask = GG_UINT64_C(0x00000000FFFFFFFF);
35 48
49 // New Frame Types, QUIC v. >= 10:
50 // There are two interpretations for the Frame Type byte in the QUIC protocol,
51 // resulting in two Frame Types: Special Frame Types and Regular Frame Types.
52 //
53 // Regular Frame Types use the Frame Type byte simply. Currently defined
54 // Regular Frame Types are:
55 // Padding : 0b 00000000 (0x00)
56 // ResetStream : 0b 00000001 (0x01)
57 // ConnectionClose : 0b 00000010 (0x02)
58 // GoAway : 0b 00000011 (0x03)
59 //
60 // Special Frame Types encode both a Frame Type and corresponding flags
61 // all in the Frame Type byte. Currently defined Special Frame Types are:
62 // Stream : 0b 1xxxxxxx
63 // Ack : 0b 01xxxxxx
64 // CongestionFeedback : 0b 001xxxxx
65 //
66 // Semantics of the flag bits above (the x bits) depends on the frame type.
67
68 // Masks to determine if the frame type is a special use
69 // and for specific special frame types.
70 const uint8 kQuicFrameTypeSpecialMask = 0xE0; // 0b 11100000
71 const uint8 kQuicFrameTypeStreamMask = 0x80;
72 const uint8 kQuicFrameTypeAckMask = 0x40;
73 const uint8 kQuicFrameTypeCongestionFeedbackMask = 0x20;
74
36 // Mask to determine if it's a special frame type(Stream, Ack, or 75 // Mask to determine if it's a special frame type(Stream, Ack, or
37 // Congestion Control) by checking if the first bit is 0, then shifting right. 76 // Congestion Control) by checking if the first bit is 0, then shifting right.
77 // TODO(jri): Remove kQuicFrameType0BitMask constant from v. 10 onwards.
78 // Replaced by kQuicFrameTypeStream defined above.
38 const uint8 kQuicFrameType0BitMask = 0x01; 79 const uint8 kQuicFrameType0BitMask = 0x01;
39 80
40 // Default frame type shift and mask. 81 // Default frame type shift and mask.
41 const uint8 kQuicDefaultFrameTypeShift = 3; 82 const uint8 kQuicDefaultFrameTypeShift = 3;
42 const uint8 kQuicDefaultFrameTypeMask = 0x07; 83 const uint8 kQuicDefaultFrameTypeMask = 0x07;
43 84
44 // Stream frame relative shifts and masks for interpreting the stream flags. 85 // Stream frame relative shifts and masks for interpreting the stream flags.
45 // StreamID may be 1, 2, 3, or 4 bytes. 86 // StreamID may be 1, 2, 3, or 4 bytes.
46 const uint8 kQuicStreamIdShift = 2; 87 const uint8 kQuicStreamIdShift = 2;
47 const uint8 kQuicStreamIDLengthMask = 0x03; 88 const uint8 kQuicStreamIDLengthMask = 0x03;
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 set_detailed_error("Packet has no frames."); 925 set_detailed_error("Packet has no frames.");
885 return RaiseError(QUIC_MISSING_PAYLOAD); 926 return RaiseError(QUIC_MISSING_PAYLOAD);
886 } 927 }
887 while (!reader_->IsDoneReading()) { 928 while (!reader_->IsDoneReading()) {
888 uint8 frame_type; 929 uint8 frame_type;
889 if (!reader_->ReadBytes(&frame_type, 1)) { 930 if (!reader_->ReadBytes(&frame_type, 1)) {
890 set_detailed_error("Unable to read frame type."); 931 set_detailed_error("Unable to read frame type.");
891 return RaiseError(QUIC_INVALID_FRAME_DATA); 932 return RaiseError(QUIC_INVALID_FRAME_DATA);
892 } 933 }
893 934
894 if ((frame_type & kQuicFrameType0BitMask) == 0) { 935 // TODO(jri): Remove this entire if block when support for
895 QuicStreamFrame frame; 936 // QUIC version < 10 removed.
896 if (!ProcessStreamFrame(frame_type, &frame)) { 937 if (version() < QUIC_VERSION_10) {
897 return RaiseError(QUIC_INVALID_STREAM_DATA); 938 // Special frame type processing for QUIC version < 10.
898 } 939 if ((frame_type & kQuicFrameType0BitMask) == 0) {
899 if (!visitor_->OnStreamFrame(frame)) { 940 QuicStreamFrame frame;
900 DLOG(INFO) << "Visitor asked to stop further processing."; 941 if (!ProcessStreamFrame(frame_type, &frame)) {
901 // Returning true since there was no parsing error. 942 return RaiseError(QUIC_INVALID_STREAM_DATA);
902 return true;
903 }
904 continue;
905 }
906
907 frame_type >>= 1;
908 if ((frame_type & kQuicFrameType0BitMask) == 0) {
909 QuicAckFrame frame;
910 if (!ProcessAckFrame(&frame)) {
911 return RaiseError(QUIC_INVALID_ACK_DATA);
912 }
913 if (!visitor_->OnAckFrame(frame)) {
914 DLOG(INFO) << "Visitor asked to stop further processing.";
915 // Returning true since there was no parsing error.
916 return true;
917 }
918 continue;
919 }
920
921 frame_type >>= 1;
922 if ((frame_type & kQuicFrameType0BitMask) == 0) {
923 QuicCongestionFeedbackFrame frame;
924 if (!ProcessQuicCongestionFeedbackFrame(&frame)) {
925 return RaiseError(QUIC_INVALID_CONGESTION_FEEDBACK_DATA);
926 }
927 if (!visitor_->OnCongestionFeedbackFrame(frame)) {
928 DLOG(INFO) << "Visitor asked to stop further processing.";
929 // Returning true since there was no parsing error.
930 return true;
931 }
932 continue;
933 }
934
935 frame_type >>= 1;
936
937 switch (frame_type) {
938 // STREAM_FRAME, ACK_FRAME, and CONGESTION_FEEDBACK_FRAME are handled
939 // above.
940 case PADDING_FRAME:
941 // We're done with the packet
942 return true;
943
944 case RST_STREAM_FRAME: {
945 QuicRstStreamFrame frame;
946 if (!ProcessRstStreamFrame(&frame)) {
947 return RaiseError(QUIC_INVALID_RST_STREAM_DATA);
948 } 943 }
949 if (!visitor_->OnRstStreamFrame(frame)) { 944 if (!visitor_->OnStreamFrame(frame)) {
950 DLOG(INFO) << "Visitor asked to stop further processing."; 945 DLOG(INFO) << "Visitor asked to stop further processing.";
951 // Returning true since there was no parsing error. 946 // Returning true since there was no parsing error.
952 return true; 947 return true;
953 } 948 }
954 continue; 949 continue;
955 } 950 }
956 951
957 case CONNECTION_CLOSE_FRAME: { 952 frame_type >>= 1;
958 QuicConnectionCloseFrame frame; 953 if ((frame_type & kQuicFrameType0BitMask) == 0) {
959 if (!ProcessConnectionCloseFrame(&frame)) { 954 QuicAckFrame frame;
960 return RaiseError(QUIC_INVALID_CONNECTION_CLOSE_DATA); 955 if (!ProcessAckFrame(&frame)) {
956 return RaiseError(QUIC_INVALID_ACK_DATA);
961 } 957 }
962 958 if (!visitor_->OnAckFrame(frame)) {
963 if (!visitor_->OnAckFrame(frame.ack_frame)) {
964 DLOG(INFO) << "Visitor asked to stop further processing."; 959 DLOG(INFO) << "Visitor asked to stop further processing.";
965 // Returning true since there was no parsing error. 960 // Returning true since there was no parsing error.
966 return true; 961 return true;
967 } 962 }
963 continue;
964 }
968 965
969 if (!visitor_->OnConnectionCloseFrame(frame)) { 966 frame_type >>= 1;
967 if ((frame_type & kQuicFrameType0BitMask) == 0) {
968 QuicCongestionFeedbackFrame frame;
969 if (!ProcessQuicCongestionFeedbackFrame(&frame)) {
970 return RaiseError(QUIC_INVALID_CONGESTION_FEEDBACK_DATA);
971 }
972 if (!visitor_->OnCongestionFeedbackFrame(frame)) {
970 DLOG(INFO) << "Visitor asked to stop further processing."; 973 DLOG(INFO) << "Visitor asked to stop further processing.";
971 // Returning true since there was no parsing error. 974 // Returning true since there was no parsing error.
972 return true; 975 return true;
973 } 976 }
974 continue; 977 continue;
975 } 978 }
976 979
977 case GOAWAY_FRAME: { 980 frame_type >>= 1;
978 QuicGoAwayFrame goaway_frame; 981 switch (frame_type) {
979 if (!ProcessGoAwayFrame(&goaway_frame)) { 982 // STREAM_FRAME, ACK_FRAME, and CONGESTION_FEEDBACK_FRAME are handled
980 return RaiseError(QUIC_INVALID_GOAWAY_DATA); 983 // above.
984 case PADDING_FRAME_OLD:
985 // We're done with the packet.
986 return true;
987
988 case RST_STREAM_FRAME_OLD: {
989 QuicRstStreamFrame frame;
990 if (!ProcessRstStreamFrame(&frame)) {
991 return RaiseError(QUIC_INVALID_RST_STREAM_DATA);
992 }
993 if (!visitor_->OnRstStreamFrame(frame)) {
994 DLOG(INFO) << "Visitor asked to stop further processing.";
995 // Returning true since there was no parsing error.
996 return true;
997 }
998 continue;
981 } 999 }
982 if (!visitor_->OnGoAwayFrame(goaway_frame)) { 1000
983 DLOG(INFO) << "Visitor asked to stop further processing."; 1001 case CONNECTION_CLOSE_FRAME_OLD: {
984 // Returning true since there was no parsing error. 1002 QuicConnectionCloseFrame frame;
985 return true; 1003 if (!ProcessConnectionCloseFrame(&frame)) {
1004 return RaiseError(QUIC_INVALID_CONNECTION_CLOSE_DATA);
1005 }
1006
1007 if (!visitor_->OnAckFrame(frame.ack_frame)) {
1008 DLOG(INFO) << "Visitor asked to stop further processing.";
1009 // Returning true since there was no parsing error.
1010 return true;
1011 }
1012
1013 if (!visitor_->OnConnectionCloseFrame(frame)) {
1014 DLOG(INFO) << "Visitor asked to stop further processing.";
1015 // Returning true since there was no parsing error.
1016 return true;
1017 }
1018 continue;
986 } 1019 }
987 continue; 1020
1021 case GOAWAY_FRAME_OLD: {
1022 QuicGoAwayFrame goaway_frame;
1023 if (!ProcessGoAwayFrame(&goaway_frame)) {
1024 return RaiseError(QUIC_INVALID_GOAWAY_DATA);
1025 }
1026 if (!visitor_->OnGoAwayFrame(goaway_frame)) {
1027 DLOG(INFO) << "Visitor asked to stop further processing.";
1028 // Returning true since there was no parsing error.
1029 return true;
1030 }
1031 continue;
1032 }
1033
1034 set_detailed_error("Illegal frame type.");
1035 DLOG(WARNING) << "Illegal frame type: "
1036 << static_cast<int>(frame_type);
1037 return RaiseError(QUIC_INVALID_FRAME_DATA);
1038 }
1039 } else {
1040 // TODO(jri): Retain this else block when support for
1041 // QUIC version < 10 removed. Remove above if block.
1042
1043 // Special frame type processing for QUIC version >= 10
1044 if (frame_type & kQuicFrameTypeSpecialMask) {
1045 // Stream Frame
1046 if (frame_type & kQuicFrameTypeStreamMask) {
1047 QuicStreamFrame frame;
1048 if (!ProcessStreamFrame(frame_type, &frame)) {
1049 return RaiseError(QUIC_INVALID_STREAM_DATA);
1050 }
1051 if (!visitor_->OnStreamFrame(frame)) {
1052 DLOG(INFO) << "Visitor asked to stop further processing.";
1053 // Returning true since there was no parsing error.
1054 return true;
1055 }
1056 continue;
1057 }
1058
1059 // Ack Frame
1060 if (frame_type & kQuicFrameTypeAckMask) {
1061 QuicAckFrame frame;
1062 if (!ProcessAckFrame(&frame)) {
1063 return RaiseError(QUIC_INVALID_ACK_DATA);
1064 }
1065 if (!visitor_->OnAckFrame(frame)) {
1066 DLOG(INFO) << "Visitor asked to stop further processing.";
1067 // Returning true since there was no parsing error.
1068 return true;
1069 }
1070 continue;
1071 }
1072
1073 // Congestion Feedback Frame
1074 if (frame_type & kQuicFrameTypeCongestionFeedbackMask) {
1075 QuicCongestionFeedbackFrame frame;
1076 if (!ProcessQuicCongestionFeedbackFrame(&frame)) {
1077 return RaiseError(QUIC_INVALID_CONGESTION_FEEDBACK_DATA);
1078 }
1079 if (!visitor_->OnCongestionFeedbackFrame(frame)) {
1080 DLOG(INFO) << "Visitor asked to stop further processing.";
1081 // Returning true since there was no parsing error.
1082 return true;
1083 }
1084 continue;
1085 }
1086
1087 // This was a special frame type that did not match any
1088 // of the known ones. Error.
1089 set_detailed_error("Illegal frame type.");
1090 DLOG(WARNING) << "Illegal frame type: "
1091 << static_cast<int>(frame_type);
1092 return RaiseError(QUIC_INVALID_FRAME_DATA);
988 } 1093 }
989 1094
990 set_detailed_error("Illegal frame type."); 1095 switch (frame_type) {
991 DLOG(WARNING) << "Illegal frame type: " 1096 case PADDING_FRAME:
992 << static_cast<int>(frame_type); 1097 // We're done with the packet.
993 return RaiseError(QUIC_INVALID_FRAME_DATA); 1098 return true;
1099
1100 case RST_STREAM_FRAME: {
1101 QuicRstStreamFrame frame;
1102 if (!ProcessRstStreamFrame(&frame)) {
1103 return RaiseError(QUIC_INVALID_RST_STREAM_DATA);
1104 }
1105 if (!visitor_->OnRstStreamFrame(frame)) {
1106 DLOG(INFO) << "Visitor asked to stop further processing.";
1107 // Returning true since there was no parsing error.
1108 return true;
1109 }
1110 continue;
1111 }
1112
1113 case CONNECTION_CLOSE_FRAME: {
1114 QuicConnectionCloseFrame frame;
1115 if (!ProcessConnectionCloseFrame(&frame)) {
1116 return RaiseError(QUIC_INVALID_CONNECTION_CLOSE_DATA);
1117 }
1118
1119 if (!visitor_->OnAckFrame(frame.ack_frame)) {
1120 DLOG(INFO) << "Visitor asked to stop further processing.";
1121 // Returning true since there was no parsing error.
1122 return true;
1123 }
1124
1125 if (!visitor_->OnConnectionCloseFrame(frame)) {
1126 DLOG(INFO) << "Visitor asked to stop further processing.";
1127 // Returning true since there was no parsing error.
1128 return true;
1129 }
1130 continue;
1131 }
1132
1133 case GOAWAY_FRAME: {
1134 QuicGoAwayFrame goaway_frame;
1135 if (!ProcessGoAwayFrame(&goaway_frame)) {
1136 return RaiseError(QUIC_INVALID_GOAWAY_DATA);
1137 }
1138 if (!visitor_->OnGoAwayFrame(goaway_frame)) {
1139 DLOG(INFO) << "Visitor asked to stop further processing.";
1140 // Returning true since there was no parsing error.
1141 return true;
1142 }
1143 continue;
1144 }
1145
1146 default:
1147 set_detailed_error("Illegal frame type.");
1148 DLOG(WARNING) << "Illegal frame type: "
1149 << static_cast<int>(frame_type);
1150 return RaiseError(QUIC_INVALID_FRAME_DATA);
1151 }
994 } 1152 }
995 } 1153 }
996 1154
997 return true; 1155 return true;
998 } 1156 }
999 1157
1000 bool QuicFramer::ProcessStreamFrame(uint8 frame_type, 1158 bool QuicFramer::ProcessStreamFrame(uint8 frame_type,
1001 QuicStreamFrame* frame) { 1159 QuicStreamFrame* frame) {
1002 uint8 stream_flags = frame_type >> 1; 1160 uint8 stream_flags = frame_type;
1161
1162 // TODO(jri): Remove if block after support for ver. < 10 removed.
1163 if (version() < QUIC_VERSION_10) {
1164 stream_flags >>= 1;
1165 } else {
1166 stream_flags &= ~kQuicFrameTypeStreamMask;
1167 }
1168
1003 // Read from right to left: StreamID, Offset, Data Length, Fin. 1169 // Read from right to left: StreamID, Offset, Data Length, Fin.
1004 const uint8 stream_id_length = (stream_flags & kQuicStreamIDLengthMask) + 1; 1170 const uint8 stream_id_length = (stream_flags & kQuicStreamIDLengthMask) + 1;
1005 stream_flags >>= kQuicStreamIdShift; 1171 stream_flags >>= kQuicStreamIdShift;
1006 1172
1007 uint8 offset_length = (stream_flags & kQuicStreamOffsetMask); 1173 uint8 offset_length = (stream_flags & kQuicStreamOffsetMask);
1008 // There is no encoding for 1 byte, only 0 and 2 through 8. 1174 // There is no encoding for 1 byte, only 0 and 2 through 8.
1009 if (offset_length > 0) { 1175 if (offset_length > 0) {
1010 offset_length += 1; 1176 offset_length += 1;
1011 } 1177 }
1012 stream_flags >>= kQuicStreamOffsetShift; 1178 stream_flags >>= kQuicStreamOffsetShift;
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 type_byte <<= kQuicStreamOffsetShift; 1706 type_byte <<= kQuicStreamOffsetShift;
1541 const size_t offset_len = GetStreamOffsetSize(frame.stream_frame->offset); 1707 const size_t offset_len = GetStreamOffsetSize(frame.stream_frame->offset);
1542 if (offset_len > 0) { 1708 if (offset_len > 0) {
1543 type_byte |= offset_len - 1; 1709 type_byte |= offset_len - 1;
1544 } 1710 }
1545 1711
1546 // stream id 2 bits. 1712 // stream id 2 bits.
1547 type_byte <<= kQuicStreamIdShift; 1713 type_byte <<= kQuicStreamIdShift;
1548 type_byte |= GetStreamIdSize(frame.stream_frame->stream_id) - 1; 1714 type_byte |= GetStreamIdSize(frame.stream_frame->stream_id) - 1;
1549 1715
1550 type_byte <<= 1; // Leaves the last bit as a 0. 1716 // TODO(jri): Remove if block when support for QUIC ver. < 10 removed.
1717 if (version() < QUIC_VERSION_10) {
1718 type_byte <<= 1; // Leaves the last bit as a 0.
1719 } else {
1720 type_byte |= kQuicFrameTypeStreamMask; // Set Stream Frame Type to 1.
1721 }
1551 break; 1722 break;
1552 } 1723 }
1553 case ACK_FRAME: { 1724 case ACK_FRAME: {
1554 // TODO(ianswett): Use extra 5 bits in the ack framing. 1725 // TODO(ianswett): Use extra 5 bits in the ack framing.
1555 type_byte = 0x01; 1726 // TODO(jri): Remove if block when support for QUIC ver. < 10 removed.
1727 if (version() < QUIC_VERSION_10) {
1728 type_byte = 0x01;
1729 } else {
1730 type_byte = kQuicFrameTypeAckMask;
1731 }
1556 break; 1732 break;
1557 } 1733 }
1558 case CONGESTION_FEEDBACK_FRAME: { 1734 case CONGESTION_FEEDBACK_FRAME: {
1559 // TODO(ianswett): Use extra 5 bits in the congestion feedback framing. 1735 // TODO(ianswett): Use extra 5 bits in the congestion feedback framing.
1560 type_byte = 0x03; 1736 // TODO(jri): Remove if block when support for QUIC ver. < 10 removed.
1737 if (version() < QUIC_VERSION_10) {
1738 type_byte = 0x03;
1739 } else {
1740 type_byte = kQuicFrameTypeCongestionFeedbackMask;
1741 }
1561 break; 1742 break;
1562 } 1743 }
1563 default: 1744 default:
1564 type_byte = 1745 type_byte = frame.type;
1565 frame.type << kQuicDefaultFrameTypeShift | kQuicDefaultFrameTypeMask; 1746 // TODO(jri): Remove if block when support for QUIC ver. < 10 removed.
1747 if (version() < QUIC_VERSION_10) {
1748 if (type_byte > 0) {
1749 type_byte += 3;
1750 }
1751 type_byte = (type_byte << kQuicDefaultFrameTypeShift) |
1752 kQuicDefaultFrameTypeMask;
1753 }
1566 break; 1754 break;
1567 } 1755 }
1568 1756
1569 return writer->WriteUInt8(type_byte); 1757 return writer->WriteUInt8(type_byte);
1570 } 1758 }
1571 1759
1572 // static 1760 // static
1573 bool QuicFramer::AppendPacketSequenceNumber( 1761 bool QuicFramer::AppendPacketSequenceNumber(
1574 QuicSequenceNumberLength sequence_number_length, 1762 QuicSequenceNumberLength sequence_number_length,
1575 QuicPacketSequenceNumber packet_sequence_number, 1763 QuicPacketSequenceNumber packet_sequence_number,
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1854 2042
1855 bool QuicFramer::RaiseError(QuicErrorCode error) { 2043 bool QuicFramer::RaiseError(QuicErrorCode error) {
1856 DLOG(INFO) << detailed_error_; 2044 DLOG(INFO) << detailed_error_;
1857 set_error(error); 2045 set_error(error);
1858 visitor_->OnError(this); 2046 visitor_->OnError(this);
1859 reader_.reset(NULL); 2047 reader_.reset(NULL);
1860 return false; 2048 return false;
1861 } 2049 }
1862 2050
1863 } // namespace net 2051 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_crypto_client_stream.cc ('k') | net/quic/quic_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698