| 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/crypto/source_address_token.h" | 5 #include "net/quic/crypto/source_address_token.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
| 9 | 9 |
| 10 using std::string; | 10 using std::string; |
| 11 | 11 |
| 12 namespace net { | 12 namespace net { |
| 13 | 13 |
| 14 CachedNetworkParameters::CachedNetworkParameters() | |
| 15 : bandwidth_estimate_bytes_per_second_(0), | |
| 16 max_bandwidth_estimate_bytes_per_second_(0), | |
| 17 max_bandwidth_timestamp_seconds_(0), | |
| 18 min_rtt_ms_(0), | |
| 19 previous_connection_state_(0), | |
| 20 timestamp_(0) { | |
| 21 } | |
| 22 | |
| 23 CachedNetworkParameters::~CachedNetworkParameters() { | |
| 24 } | |
| 25 | |
| 26 bool CachedNetworkParameters::operator==( | |
| 27 const CachedNetworkParameters& other) const { | |
| 28 return serving_region_ == other.serving_region_ && | |
| 29 bandwidth_estimate_bytes_per_second_ == | |
| 30 other.bandwidth_estimate_bytes_per_second_ && | |
| 31 max_bandwidth_estimate_bytes_per_second_ == | |
| 32 other.max_bandwidth_estimate_bytes_per_second_ && | |
| 33 max_bandwidth_timestamp_seconds_ == | |
| 34 other.max_bandwidth_timestamp_seconds_ && | |
| 35 min_rtt_ms_ == other.min_rtt_ms_ && | |
| 36 previous_connection_state_ == other.previous_connection_state_ && | |
| 37 timestamp_ == other.timestamp_; | |
| 38 } | |
| 39 | |
| 40 bool CachedNetworkParameters::operator!=( | |
| 41 const CachedNetworkParameters& other) const { | |
| 42 return !(*this == other); | |
| 43 } | |
| 44 | |
| 45 SourceAddressToken::SourceAddressToken() | 14 SourceAddressToken::SourceAddressToken() |
| 46 : has_cached_network_parameters_(false) { | 15 : has_cached_network_parameters_(false) { |
| 47 } | 16 } |
| 48 | 17 |
| 49 SourceAddressToken::~SourceAddressToken() { | 18 SourceAddressToken::~SourceAddressToken() { |
| 50 } | 19 } |
| 51 | 20 |
| 52 string SourceAddressToken::SerializeAsString() const { | 21 string SourceAddressToken::SerializeAsString() const { |
| 53 string out; | 22 string out; |
| 54 out.push_back(ip_.size()); | 23 out.push_back(ip_.size()); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 83 | 52 |
| 84 ip_.assign(&plaintext[1], ip_len); | 53 ip_.assign(&plaintext[1], ip_len); |
| 85 timestamp_ = timestamp; | 54 timestamp_ = timestamp; |
| 86 | 55 |
| 87 // TODO(rtenneti): Implement parsing of optional CachedNetworkParameters when | 56 // TODO(rtenneti): Implement parsing of optional CachedNetworkParameters when |
| 88 // they are used. | 57 // they are used. |
| 89 return true; | 58 return true; |
| 90 } | 59 } |
| 91 | 60 |
| 92 } // namespace net | 61 } // namespace net |
| OLD | NEW |