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 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 2906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2917 header.public_header.reset_flag = false; | 2917 header.public_header.reset_flag = false; |
2918 header.public_header.version_flag = false; | 2918 header.public_header.version_flag = false; |
2919 header.fec_flag = false; | 2919 header.fec_flag = false; |
2920 header.entropy_flag = false; | 2920 header.entropy_flag = false; |
2921 header.packet_packet_number = UINT64_C(0x123456789ABC); | 2921 header.packet_packet_number = UINT64_C(0x123456789ABC); |
2922 header.fec_group = 0; | 2922 header.fec_group = 0; |
2923 | 2923 |
2924 QuicPaddingFrame padding_frame; | 2924 QuicPaddingFrame padding_frame; |
2925 | 2925 |
2926 QuicFrames frames; | 2926 QuicFrames frames; |
2927 frames.push_back(QuicFrame(&padding_frame)); | 2927 frames.push_back(QuicFrame(padding_frame)); |
2928 | 2928 |
2929 // clang-format off | 2929 // clang-format off |
2930 unsigned char packet[kMaxPacketSize] = { | 2930 unsigned char packet[kMaxPacketSize] = { |
2931 // public flags (8 byte connection_id) | 2931 // public flags (8 byte connection_id) |
2932 0x3C, | 2932 0x3C, |
2933 // connection_id | 2933 // connection_id |
2934 0x10, 0x32, 0x54, 0x76, | 2934 0x10, 0x32, 0x54, 0x76, |
2935 0x98, 0xBA, 0xDC, 0xFE, | 2935 0x98, 0xBA, 0xDC, 0xFE, |
2936 // packet number | 2936 // packet number |
2937 0xBC, 0x9A, 0x78, 0x56, | 2937 0xBC, 0x9A, 0x78, 0x56, |
(...skipping 28 matching lines...) Expand all Loading... |
2966 header.public_header.version_flag = false; | 2966 header.public_header.version_flag = false; |
2967 header.fec_flag = false; | 2967 header.fec_flag = false; |
2968 header.entropy_flag = false; | 2968 header.entropy_flag = false; |
2969 header.public_header.packet_number_length = PACKET_4BYTE_PACKET_NUMBER; | 2969 header.public_header.packet_number_length = PACKET_4BYTE_PACKET_NUMBER; |
2970 header.packet_packet_number = UINT64_C(0x123456789ABC); | 2970 header.packet_packet_number = UINT64_C(0x123456789ABC); |
2971 header.fec_group = 0; | 2971 header.fec_group = 0; |
2972 | 2972 |
2973 QuicPaddingFrame padding_frame; | 2973 QuicPaddingFrame padding_frame; |
2974 | 2974 |
2975 QuicFrames frames; | 2975 QuicFrames frames; |
2976 frames.push_back(QuicFrame(&padding_frame)); | 2976 frames.push_back(QuicFrame(padding_frame)); |
2977 | 2977 |
2978 // clang-format off | 2978 // clang-format off |
2979 unsigned char packet[kMaxPacketSize] = { | 2979 unsigned char packet[kMaxPacketSize] = { |
2980 // public flags (8 byte connection_id and 4 byte packet number) | 2980 // public flags (8 byte connection_id and 4 byte packet number) |
2981 0x2C, | 2981 0x2C, |
2982 // connection_id | 2982 // connection_id |
2983 0x10, 0x32, 0x54, 0x76, | 2983 0x10, 0x32, 0x54, 0x76, |
2984 0x98, 0xBA, 0xDC, 0xFE, | 2984 0x98, 0xBA, 0xDC, 0xFE, |
2985 // packet number | 2985 // packet number |
2986 0xBC, 0x9A, 0x78, 0x56, | 2986 0xBC, 0x9A, 0x78, 0x56, |
(...skipping 27 matching lines...) Expand all Loading... |
3014 header.public_header.version_flag = false; | 3014 header.public_header.version_flag = false; |
3015 header.fec_flag = false; | 3015 header.fec_flag = false; |
3016 header.entropy_flag = false; | 3016 header.entropy_flag = false; |
3017 header.public_header.packet_number_length = PACKET_2BYTE_PACKET_NUMBER; | 3017 header.public_header.packet_number_length = PACKET_2BYTE_PACKET_NUMBER; |
3018 header.packet_packet_number = UINT64_C(0x123456789ABC); | 3018 header.packet_packet_number = UINT64_C(0x123456789ABC); |
3019 header.fec_group = 0; | 3019 header.fec_group = 0; |
3020 | 3020 |
3021 QuicPaddingFrame padding_frame; | 3021 QuicPaddingFrame padding_frame; |
3022 | 3022 |
3023 QuicFrames frames; | 3023 QuicFrames frames; |
3024 frames.push_back(QuicFrame(&padding_frame)); | 3024 frames.push_back(QuicFrame(padding_frame)); |
3025 | 3025 |
3026 // clang-format off | 3026 // clang-format off |
3027 unsigned char packet[kMaxPacketSize] = { | 3027 unsigned char packet[kMaxPacketSize] = { |
3028 // public flags (8 byte connection_id and 2 byte packet number) | 3028 // public flags (8 byte connection_id and 2 byte packet number) |
3029 0x1C, | 3029 0x1C, |
3030 // connection_id | 3030 // connection_id |
3031 0x10, 0x32, 0x54, 0x76, | 3031 0x10, 0x32, 0x54, 0x76, |
3032 0x98, 0xBA, 0xDC, 0xFE, | 3032 0x98, 0xBA, 0xDC, 0xFE, |
3033 // packet number | 3033 // packet number |
3034 0xBC, 0x9A, | 3034 0xBC, 0x9A, |
(...skipping 27 matching lines...) Expand all Loading... |
3062 header.public_header.version_flag = false; | 3062 header.public_header.version_flag = false; |
3063 header.fec_flag = false; | 3063 header.fec_flag = false; |
3064 header.entropy_flag = false; | 3064 header.entropy_flag = false; |
3065 header.public_header.packet_number_length = PACKET_1BYTE_PACKET_NUMBER; | 3065 header.public_header.packet_number_length = PACKET_1BYTE_PACKET_NUMBER; |
3066 header.packet_packet_number = UINT64_C(0x123456789ABC); | 3066 header.packet_packet_number = UINT64_C(0x123456789ABC); |
3067 header.fec_group = 0; | 3067 header.fec_group = 0; |
3068 | 3068 |
3069 QuicPaddingFrame padding_frame; | 3069 QuicPaddingFrame padding_frame; |
3070 | 3070 |
3071 QuicFrames frames; | 3071 QuicFrames frames; |
3072 frames.push_back(QuicFrame(&padding_frame)); | 3072 frames.push_back(QuicFrame(padding_frame)); |
3073 | 3073 |
3074 // clang-format off | 3074 // clang-format off |
3075 unsigned char packet[kMaxPacketSize] = { | 3075 unsigned char packet[kMaxPacketSize] = { |
3076 // public flags (8 byte connection_id and 1 byte packet number) | 3076 // public flags (8 byte connection_id and 1 byte packet number) |
3077 0x0C, | 3077 0x0C, |
3078 // connection_id | 3078 // connection_id |
3079 0x10, 0x32, 0x54, 0x76, | 3079 0x10, 0x32, 0x54, 0x76, |
3080 0x98, 0xBA, 0xDC, 0xFE, | 3080 0x98, 0xBA, 0xDC, 0xFE, |
3081 // packet number | 3081 // packet number |
3082 0xBC, | 3082 0xBC, |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3894 header.public_header.version_flag = false; | 3894 header.public_header.version_flag = false; |
3895 header.fec_flag = false; | 3895 header.fec_flag = false; |
3896 header.entropy_flag = true; | 3896 header.entropy_flag = true; |
3897 header.packet_packet_number = UINT64_C(0x123456789ABC); | 3897 header.packet_packet_number = UINT64_C(0x123456789ABC); |
3898 header.fec_group = 0; | 3898 header.fec_group = 0; |
3899 | 3899 |
3900 QuicBlockedFrame blocked_frame; | 3900 QuicBlockedFrame blocked_frame; |
3901 blocked_frame.stream_id = 0x01020304; | 3901 blocked_frame.stream_id = 0x01020304; |
3902 | 3902 |
3903 QuicFrames frames; | 3903 QuicFrames frames; |
3904 frames.push_back(QuicFrame(&blocked_frame)); | 3904 frames.push_back(QuicFrame(blocked_frame)); |
3905 | 3905 |
3906 // clang-format off | 3906 // clang-format off |
3907 unsigned char packet[] = { | 3907 unsigned char packet[] = { |
3908 // public flags (8 byte connection_id) | 3908 // public flags (8 byte connection_id) |
3909 0x3C, | 3909 0x3C, |
3910 // connection_id | 3910 // connection_id |
3911 0x10, 0x32, 0x54, 0x76, | 3911 0x10, 0x32, 0x54, 0x76, |
3912 0x98, 0xBA, 0xDC, 0xFE, | 3912 0x98, 0xBA, 0xDC, 0xFE, |
3913 // packet number | 3913 // packet number |
3914 0xBC, 0x9A, 0x78, 0x56, | 3914 0xBC, 0x9A, 0x78, 0x56, |
(...skipping 22 matching lines...) Expand all Loading... |
3937 header.public_header.reset_flag = false; | 3937 header.public_header.reset_flag = false; |
3938 header.public_header.version_flag = false; | 3938 header.public_header.version_flag = false; |
3939 header.fec_flag = false; | 3939 header.fec_flag = false; |
3940 header.entropy_flag = true; | 3940 header.entropy_flag = true; |
3941 header.packet_packet_number = UINT64_C(0x123456789ABC); | 3941 header.packet_packet_number = UINT64_C(0x123456789ABC); |
3942 header.fec_group = 0; | 3942 header.fec_group = 0; |
3943 | 3943 |
3944 QuicPingFrame ping_frame; | 3944 QuicPingFrame ping_frame; |
3945 | 3945 |
3946 QuicFrames frames; | 3946 QuicFrames frames; |
3947 frames.push_back(QuicFrame(&ping_frame)); | 3947 frames.push_back(QuicFrame(ping_frame)); |
3948 | 3948 |
3949 // clang-format off | 3949 // clang-format off |
3950 unsigned char packet[] = { | 3950 unsigned char packet[] = { |
3951 // public flags (8 byte connection_id) | 3951 // public flags (8 byte connection_id) |
3952 0x3C, | 3952 0x3C, |
3953 // connection_id | 3953 // connection_id |
3954 0x10, 0x32, 0x54, 0x76, | 3954 0x10, 0x32, 0x54, 0x76, |
3955 0x98, 0xBA, 0xDC, 0xFE, | 3955 0x98, 0xBA, 0xDC, 0xFE, |
3956 // packet number | 3956 // packet number |
3957 0xBC, 0x9A, 0x78, 0x56, | 3957 0xBC, 0x9A, 0x78, 0x56, |
(...skipping 21 matching lines...) Expand all Loading... |
3979 header.public_header.reset_flag = false; | 3979 header.public_header.reset_flag = false; |
3980 header.public_header.version_flag = false; | 3980 header.public_header.version_flag = false; |
3981 header.fec_flag = false; | 3981 header.fec_flag = false; |
3982 header.entropy_flag = true; | 3982 header.entropy_flag = true; |
3983 header.packet_packet_number = UINT64_C(0x123456789ABC); | 3983 header.packet_packet_number = UINT64_C(0x123456789ABC); |
3984 header.fec_group = 0; | 3984 header.fec_group = 0; |
3985 | 3985 |
3986 QuicMtuDiscoveryFrame mtu_discovery_frame; | 3986 QuicMtuDiscoveryFrame mtu_discovery_frame; |
3987 | 3987 |
3988 QuicFrames frames; | 3988 QuicFrames frames; |
3989 frames.push_back(QuicFrame(&mtu_discovery_frame)); | 3989 frames.push_back(QuicFrame(mtu_discovery_frame)); |
3990 | 3990 |
3991 // clang-format off | 3991 // clang-format off |
3992 unsigned char packet[] = { | 3992 unsigned char packet[] = { |
3993 // public flags (8 byte connection_id) | 3993 // public flags (8 byte connection_id) |
3994 0x3C, | 3994 0x3C, |
3995 // connection_id | 3995 // connection_id |
3996 0x10, 0x32, 0x54, 0x76, | 3996 0x10, 0x32, 0x54, 0x76, |
3997 0x98, 0xBA, 0xDC, 0xFE, | 3997 0x98, 0xBA, 0xDC, 0xFE, |
3998 // packet number | 3998 // packet number |
3999 0xBC, 0x9A, 0x78, 0x56, | 3999 0xBC, 0x9A, 0x78, 0x56, |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4560 EXPECT_CALL(visitor, OnStreamFrame(_)).Times(0); | 4560 EXPECT_CALL(visitor, OnStreamFrame(_)).Times(0); |
4561 EXPECT_CALL(visitor, OnAckFrame(_)).Times(0); | 4561 EXPECT_CALL(visitor, OnAckFrame(_)).Times(0); |
4562 EXPECT_CALL(visitor, OnPacketComplete()).Times(0); | 4562 EXPECT_CALL(visitor, OnPacketComplete()).Times(0); |
4563 | 4563 |
4564 EXPECT_FALSE(framer_.ProcessPacket(*packet)); | 4564 EXPECT_FALSE(framer_.ProcessPacket(*packet)); |
4565 EXPECT_EQ(QUIC_INVALID_PACKET_HEADER, framer_.error()); | 4565 EXPECT_EQ(QUIC_INVALID_PACKET_HEADER, framer_.error()); |
4566 } | 4566 } |
4567 | 4567 |
4568 } // namespace test | 4568 } // namespace test |
4569 } // namespace net | 4569 } // namespace net |
OLD | NEW |