| 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/core/quic_framer.h" | 5 #include "net/quic/core/quic_framer.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 4806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4817 QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset, | 4817 QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset, |
| 4818 StringPiece("hello world!")); | 4818 StringPiece("hello world!")); |
| 4819 | 4819 |
| 4820 QuicFrames frames; | 4820 QuicFrames frames; |
| 4821 frames.push_back(QuicFrame(&stream_frame)); | 4821 frames.push_back(QuicFrame(&stream_frame)); |
| 4822 | 4822 |
| 4823 // clang-format off | 4823 // clang-format off |
| 4824 unsigned char packet[] = { | 4824 unsigned char packet[] = { |
| 4825 // public flags (version, 8 byte connection_id) | 4825 // public flags (version, 8 byte connection_id) |
| 4826 static_cast<unsigned char>( | 4826 static_cast<unsigned char>( |
| 4827 framer_.version() > QUIC_VERSION_32 ? 0x3D : 0x3D), | 4827 (FLAGS_quic_remove_v33_hacks && |
| 4828 framer_.version() > QUIC_VERSION_32) ? 0x39 : 0x3D), |
| 4828 // connection_id | 4829 // connection_id |
| 4829 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE, | 4830 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE, |
| 4830 // version tag | 4831 // version tag |
| 4831 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(), | 4832 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(), |
| 4832 // packet number | 4833 // packet number |
| 4833 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, | 4834 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, |
| 4834 // private flags (entropy) | 4835 // private flags (entropy) |
| 4835 0x01, | 4836 0x01, |
| 4836 | 4837 |
| 4837 // frame type (stream frame with fin and no length) | 4838 // frame type (stream frame with fin and no length) |
| 4838 0xDF, | 4839 0xDF, |
| 4839 // stream id | 4840 // stream id |
| 4840 0x04, 0x03, 0x02, 0x01, | 4841 0x04, 0x03, 0x02, 0x01, |
| 4841 // offset | 4842 // offset |
| 4842 0x54, 0x76, 0x10, 0x32, 0xDC, 0xFE, 0x98, 0xBA, | 4843 0x54, 0x76, 0x10, 0x32, 0xDC, 0xFE, 0x98, 0xBA, |
| 4843 // data | 4844 // data |
| 4844 'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!', | 4845 'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!', |
| 4845 }; | 4846 }; |
| 4846 unsigned char packet_34[] = { | 4847 unsigned char packet_34[] = { |
| 4847 // public flags (version, 8 byte connection_id) | 4848 // public flags (version, 8 byte connection_id) |
| 4848 0x3D, | 4849 static_cast<unsigned char>( |
| 4850 FLAGS_quic_remove_v33_hacks ? 0x39 : 0x3D), |
| 4849 // connection_id | 4851 // connection_id |
| 4850 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE, | 4852 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE, |
| 4851 // version tag | 4853 // version tag |
| 4852 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(), | 4854 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(), |
| 4853 // packet number | 4855 // packet number |
| 4854 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, | 4856 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, |
| 4855 | 4857 |
| 4856 // frame type (stream frame with fin and no length) | 4858 // frame type (stream frame with fin and no length) |
| 4857 0xDF, | 4859 0xDF, |
| 4858 // stream id | 4860 // stream id |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4970 QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset, | 4972 QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset, |
| 4971 StringPiece("hello world!")); | 4973 StringPiece("hello world!")); |
| 4972 | 4974 |
| 4973 QuicFrames frames; | 4975 QuicFrames frames; |
| 4974 frames.push_back(QuicFrame(&stream_frame)); | 4976 frames.push_back(QuicFrame(&stream_frame)); |
| 4975 | 4977 |
| 4976 // clang-format off | 4978 // clang-format off |
| 4977 unsigned char packet[] = { | 4979 unsigned char packet[] = { |
| 4978 // public flags (8 byte connection_id) | 4980 // public flags (8 byte connection_id) |
| 4979 static_cast<unsigned char>( | 4981 static_cast<unsigned char>( |
| 4980 framer_.version() > QUIC_VERSION_32 ? 0x7D : 0x7D), | 4982 (FLAGS_quic_remove_v33_hacks && |
| 4983 framer_.version() > QUIC_VERSION_32) ? 0x79 : 0x7D), |
| 4981 // connection_id | 4984 // connection_id |
| 4982 0x10, 0x32, 0x54, 0x76, | 4985 0x10, 0x32, 0x54, 0x76, |
| 4983 0x98, 0xBA, 0xDC, 0xFE, | 4986 0x98, 0xBA, 0xDC, 0xFE, |
| 4984 // version tag | 4987 // version tag |
| 4985 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(), | 4988 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(), |
| 4986 // path_id | 4989 // path_id |
| 4987 0x42, | 4990 0x42, |
| 4988 // packet number | 4991 // packet number |
| 4989 0xBC, 0x9A, 0x78, 0x56, | 4992 0xBC, 0x9A, 0x78, 0x56, |
| 4990 0x34, 0x12, | 4993 0x34, 0x12, |
| 4991 // private flags (entropy) | 4994 // private flags (entropy) |
| 4992 0x01, | 4995 0x01, |
| 4993 | 4996 |
| 4994 // frame type (stream frame with fin and no length) | 4997 // frame type (stream frame with fin and no length) |
| 4995 0xDF, | 4998 0xDF, |
| 4996 // stream id | 4999 // stream id |
| 4997 0x04, 0x03, 0x02, 0x01, | 5000 0x04, 0x03, 0x02, 0x01, |
| 4998 // offset | 5001 // offset |
| 4999 0x54, 0x76, 0x10, 0x32, | 5002 0x54, 0x76, 0x10, 0x32, |
| 5000 0xDC, 0xFE, 0x98, 0xBA, | 5003 0xDC, 0xFE, 0x98, 0xBA, |
| 5001 // data | 5004 // data |
| 5002 'h', 'e', 'l', 'l', | 5005 'h', 'e', 'l', 'l', |
| 5003 'o', ' ', 'w', 'o', | 5006 'o', ' ', 'w', 'o', |
| 5004 'r', 'l', 'd', '!', | 5007 'r', 'l', 'd', '!', |
| 5005 }; | 5008 }; |
| 5006 unsigned char packet_34[] = { | 5009 unsigned char packet_34[] = { |
| 5007 // public flags (8 byte connection_id) | 5010 // public flags (8 byte connection_id) |
| 5008 0x7D, | 5011 static_cast<unsigned char>( |
| 5012 FLAGS_quic_remove_v33_hacks ? 0x79 : 0x7D), |
| 5009 // connection_id | 5013 // connection_id |
| 5010 0x10, 0x32, 0x54, 0x76, | 5014 0x10, 0x32, 0x54, 0x76, |
| 5011 0x98, 0xBA, 0xDC, 0xFE, | 5015 0x98, 0xBA, 0xDC, 0xFE, |
| 5012 // version tag | 5016 // version tag |
| 5013 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(), | 5017 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(), |
| 5014 // path_id | 5018 // path_id |
| 5015 0x42, | 5019 0x42, |
| 5016 // packet number | 5020 // packet number |
| 5017 0xBC, 0x9A, 0x78, 0x56, | 5021 0xBC, 0x9A, 0x78, 0x56, |
| 5018 0x34, 0x12, | 5022 0x34, 0x12, |
| (...skipping 2164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7183 'o', ' ', 'w', 'o', | 7187 'o', ' ', 'w', 'o', |
| 7184 'r', 'l', 'd', '!', | 7188 'r', 'l', 'd', '!', |
| 7185 }; | 7189 }; |
| 7186 // clang-format on | 7190 // clang-format on |
| 7187 | 7191 |
| 7188 QuicFramerFuzzFunc(packet, arraysize(packet)); | 7192 QuicFramerFuzzFunc(packet, arraysize(packet)); |
| 7189 } | 7193 } |
| 7190 | 7194 |
| 7191 } // namespace test | 7195 } // namespace test |
| 7192 } // namespace net | 7196 } // namespace net |
| OLD | NEW |