| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_config.h" | 5 #include "net/quic/core/quic_config.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "net/quic/core/crypto/crypto_handshake_message.h" | 9 #include "net/quic/core/crypto/crypto_handshake_message.h" |
| 10 #include "net/quic/core/crypto/crypto_protocol.h" | 10 #include "net/quic/core/crypto/crypto_protocol.h" |
| 11 #include "net/quic/core/quic_flags.h" | 11 #include "net/quic/core/quic_flags.h" |
| 12 #include "net/quic/core/quic_socket_address_coder.h" | 12 #include "net/quic/core/quic_socket_address_coder.h" |
| 13 #include "net/quic/core/quic_utils.h" | 13 #include "net/quic/core/quic_utils.h" |
| 14 #include "net/quic/platform/api/quic_bug_tracker.h" | 14 #include "net/quic/platform/api/quic_bug_tracker.h" |
| 15 #include "net/quic/platform/api/quic_logging.h" | 15 #include "net/quic/platform/api/quic_logging.h" |
| 16 #include "net/quic/platform/api/quic_string_piece.h" |
| 16 | 17 |
| 17 using std::string; | 18 using std::string; |
| 18 | 19 |
| 19 namespace net { | 20 namespace net { |
| 20 | 21 |
| 21 // Reads the value corresponding to |name_| from |msg| into |out|. If the | 22 // Reads the value corresponding to |name_| from |msg| into |out|. If the |
| 22 // |name_| is absent in |msg| and |presence| is set to OPTIONAL |out| is set | 23 // |name_| is absent in |msg| and |presence| is set to OPTIONAL |out| is set |
| 23 // to |default_value|. | 24 // to |default_value|. |
| 24 QuicErrorCode ReadUint32(const CryptoHandshakeMessage& msg, | 25 QuicErrorCode ReadUint32(const CryptoHandshakeMessage& msg, |
| 25 QuicTag tag, | 26 QuicTag tag, |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 if (has_send_value_) { | 299 if (has_send_value_) { |
| 299 QuicSocketAddressCoder address_coder(send_value_); | 300 QuicSocketAddressCoder address_coder(send_value_); |
| 300 out->SetStringPiece(tag_, address_coder.Encode()); | 301 out->SetStringPiece(tag_, address_coder.Encode()); |
| 301 } | 302 } |
| 302 } | 303 } |
| 303 | 304 |
| 304 QuicErrorCode QuicFixedSocketAddress::ProcessPeerHello( | 305 QuicErrorCode QuicFixedSocketAddress::ProcessPeerHello( |
| 305 const CryptoHandshakeMessage& peer_hello, | 306 const CryptoHandshakeMessage& peer_hello, |
| 306 HelloType hello_type, | 307 HelloType hello_type, |
| 307 string* error_details) { | 308 string* error_details) { |
| 308 base::StringPiece address; | 309 QuicStringPiece address; |
| 309 if (!peer_hello.GetStringPiece(tag_, &address)) { | 310 if (!peer_hello.GetStringPiece(tag_, &address)) { |
| 310 if (presence_ == PRESENCE_REQUIRED) { | 311 if (presence_ == PRESENCE_REQUIRED) { |
| 311 *error_details = "Missing " + QuicTagToString(tag_); | 312 *error_details = "Missing " + QuicTagToString(tag_); |
| 312 return QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND; | 313 return QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND; |
| 313 } | 314 } |
| 314 } else { | 315 } else { |
| 315 QuicSocketAddressCoder address_coder; | 316 QuicSocketAddressCoder address_coder; |
| 316 if (address_coder.Decode(address.data(), address.length())) { | 317 if (address_coder.Decode(address.data(), address.length())) { |
| 317 SetReceivedValue( | 318 SetReceivedValue( |
| 318 QuicSocketAddress(address_coder.ip(), address_coder.port())); | 319 QuicSocketAddress(address_coder.ip(), address_coder.port())); |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 error_details); | 709 error_details); |
| 709 } | 710 } |
| 710 if (error == QUIC_NO_ERROR) { | 711 if (error == QUIC_NO_ERROR) { |
| 711 error = support_max_header_list_size_.ProcessPeerHello( | 712 error = support_max_header_list_size_.ProcessPeerHello( |
| 712 peer_hello, hello_type, error_details); | 713 peer_hello, hello_type, error_details); |
| 713 } | 714 } |
| 714 return error; | 715 return error; |
| 715 } | 716 } |
| 716 | 717 |
| 717 } // namespace net | 718 } // namespace net |
| OLD | NEW |