| 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 "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "net/quic/crypto/crypto_framer.h" | 9 #include "net/quic/crypto/crypto_framer.h" |
| 10 #include "net/quic/crypto/crypto_handshake_message.h" | 10 #include "net/quic/crypto/crypto_handshake_message.h" |
| (...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 public_header->connection_id_length = PACKET_8BYTE_CONNECTION_ID; | 876 public_header->connection_id_length = PACKET_8BYTE_CONNECTION_ID; |
| 877 break; | 877 break; |
| 878 case PACKET_PUBLIC_FLAGS_4BYTE_CONNECTION_ID: | 878 case PACKET_PUBLIC_FLAGS_4BYTE_CONNECTION_ID: |
| 879 // If the connection_id is truncated, expect to read the last serialized | 879 // If the connection_id is truncated, expect to read the last serialized |
| 880 // connection_id. | 880 // connection_id. |
| 881 if (!reader_->ReadBytes(&public_header->connection_id, | 881 if (!reader_->ReadBytes(&public_header->connection_id, |
| 882 PACKET_4BYTE_CONNECTION_ID)) { | 882 PACKET_4BYTE_CONNECTION_ID)) { |
| 883 set_detailed_error("Unable to read ConnectionId."); | 883 set_detailed_error("Unable to read ConnectionId."); |
| 884 return false; | 884 return false; |
| 885 } | 885 } |
| 886 if ((public_header->connection_id & k4ByteConnectionIdMask) != | 886 if (last_serialized_connection_id_ && |
| 887 (public_header->connection_id & k4ByteConnectionIdMask) != |
| 887 (last_serialized_connection_id_ & k4ByteConnectionIdMask)) { | 888 (last_serialized_connection_id_ & k4ByteConnectionIdMask)) { |
| 888 set_detailed_error("Truncated 4 byte ConnectionId does not match " | 889 set_detailed_error("Truncated 4 byte ConnectionId does not match " |
| 889 "previous connection_id."); | 890 "previous connection_id."); |
| 890 return false; | 891 return false; |
| 891 } | 892 } |
| 892 public_header->connection_id_length = PACKET_4BYTE_CONNECTION_ID; | 893 public_header->connection_id_length = PACKET_4BYTE_CONNECTION_ID; |
| 893 public_header->connection_id = last_serialized_connection_id_; | 894 public_header->connection_id = last_serialized_connection_id_; |
| 894 break; | 895 break; |
| 895 case PACKET_PUBLIC_FLAGS_1BYTE_CONNECTION_ID: | 896 case PACKET_PUBLIC_FLAGS_1BYTE_CONNECTION_ID: |
| 896 if (!reader_->ReadBytes(&public_header->connection_id, | 897 if (!reader_->ReadBytes(&public_header->connection_id, |
| 897 PACKET_1BYTE_CONNECTION_ID)) { | 898 PACKET_1BYTE_CONNECTION_ID)) { |
| 898 set_detailed_error("Unable to read ConnectionId."); | 899 set_detailed_error("Unable to read ConnectionId."); |
| 899 return false; | 900 return false; |
| 900 } | 901 } |
| 901 if ((public_header->connection_id & k1ByteConnectionIdMask) != | 902 if (last_serialized_connection_id_ && |
| 903 (public_header->connection_id & k1ByteConnectionIdMask) != |
| 902 (last_serialized_connection_id_ & k1ByteConnectionIdMask)) { | 904 (last_serialized_connection_id_ & k1ByteConnectionIdMask)) { |
| 903 set_detailed_error("Truncated 1 byte ConnectionId does not match " | 905 set_detailed_error("Truncated 1 byte ConnectionId does not match " |
| 904 "previous connection_id."); | 906 "previous connection_id."); |
| 905 return false; | 907 return false; |
| 906 } | 908 } |
| 907 public_header->connection_id_length = PACKET_1BYTE_CONNECTION_ID; | 909 public_header->connection_id_length = PACKET_1BYTE_CONNECTION_ID; |
| 908 public_header->connection_id = last_serialized_connection_id_; | 910 public_header->connection_id = last_serialized_connection_id_; |
| 909 break; | 911 break; |
| 910 case PACKET_PUBLIC_FLAGS_0BYTE_CONNECTION_ID: | 912 case PACKET_PUBLIC_FLAGS_0BYTE_CONNECTION_ID: |
| 911 public_header->connection_id_length = PACKET_0BYTE_CONNECTION_ID; | 913 public_header->connection_id_length = PACKET_0BYTE_CONNECTION_ID; |
| (...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2313 | 2315 |
| 2314 bool QuicFramer::RaiseError(QuicErrorCode error) { | 2316 bool QuicFramer::RaiseError(QuicErrorCode error) { |
| 2315 DVLOG(1) << "Error detail: " << detailed_error_; | 2317 DVLOG(1) << "Error detail: " << detailed_error_; |
| 2316 set_error(error); | 2318 set_error(error); |
| 2317 visitor_->OnError(this); | 2319 visitor_->OnError(this); |
| 2318 reader_.reset(nullptr); | 2320 reader_.reset(nullptr); |
| 2319 return false; | 2321 return false; |
| 2320 } | 2322 } |
| 2321 | 2323 |
| 2322 } // namespace net | 2324 } // namespace net |
| OLD | NEW |