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 #ifndef NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_ | 5 #ifndef NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_ |
6 #define NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_ | 6 #define NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // Describes the state of the connection during which the supplied network | 21 // Describes the state of the connection during which the supplied network |
22 // parameters were calculated. | 22 // parameters were calculated. |
23 enum PreviousConnectionState { | 23 enum PreviousConnectionState { |
24 SLOW_START = 0, | 24 SLOW_START = 0, |
25 CONGESTION_AVOIDANCE = 1, | 25 CONGESTION_AVOIDANCE = 1, |
26 }; | 26 }; |
27 | 27 |
28 CachedNetworkParameters(); | 28 CachedNetworkParameters(); |
29 ~CachedNetworkParameters(); | 29 ~CachedNetworkParameters(); |
30 | 30 |
| 31 bool operator==(const CachedNetworkParameters& other) const; |
| 32 bool operator!=(const CachedNetworkParameters& other) const; |
| 33 |
31 std::string serving_region() const { | 34 std::string serving_region() const { |
32 return serving_region_; | 35 return serving_region_; |
33 } | 36 } |
34 void set_serving_region(base::StringPiece serving_region) { | 37 void set_serving_region(base::StringPiece serving_region) { |
35 serving_region_ = serving_region.as_string(); | 38 serving_region_ = serving_region.as_string(); |
36 } | 39 } |
37 | 40 |
38 int32 bandwidth_estimate_bytes_per_second() const { | 41 int32 bandwidth_estimate_bytes_per_second() const { |
39 return bandwidth_estimate_bytes_per_second_; | 42 return bandwidth_estimate_bytes_per_second_; |
40 } | 43 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 void set_timestamp(int64 timestamp) { | 129 void set_timestamp(int64 timestamp) { |
127 timestamp_ = timestamp; | 130 timestamp_ = timestamp; |
128 } | 131 } |
129 | 132 |
130 const CachedNetworkParameters& cached_network_parameters() const { | 133 const CachedNetworkParameters& cached_network_parameters() const { |
131 return cached_network_parameters_; | 134 return cached_network_parameters_; |
132 } | 135 } |
133 void set_cached_network_parameters( | 136 void set_cached_network_parameters( |
134 const CachedNetworkParameters& cached_network_parameters) { | 137 const CachedNetworkParameters& cached_network_parameters) { |
135 cached_network_parameters_ = cached_network_parameters; | 138 cached_network_parameters_ = cached_network_parameters; |
| 139 has_cached_network_parameters_ = true; |
| 140 } |
| 141 bool has_cached_network_parameters() const { |
| 142 return has_cached_network_parameters_; |
136 } | 143 } |
137 | 144 |
138 private: | 145 private: |
139 // ip_ contains either 4 (IPv4) or 16 (IPv6) bytes of IP address in network | 146 // ip_ contains either 4 (IPv4) or 16 (IPv6) bytes of IP address in network |
140 // byte order. | 147 // byte order. |
141 std::string ip_; | 148 std::string ip_; |
142 // timestamp_ contains a UNIX timestamp value of the time when the token was | 149 // timestamp_ contains a UNIX timestamp value of the time when the token was |
143 // created. | 150 // created. |
144 int64 timestamp_; | 151 int64 timestamp_; |
145 | 152 |
146 // The server can provide estimated network parameters to be used for | 153 // The server can provide estimated network parameters to be used for |
147 // initial parameter selection in future connections. | 154 // initial parameter selection in future connections. |
148 CachedNetworkParameters cached_network_parameters_; | 155 CachedNetworkParameters cached_network_parameters_; |
| 156 // TODO(rtenneti): Delete |has_cached_network_parameters_| after we convert |
| 157 // SourceAddressToken to protobuf. |
| 158 bool has_cached_network_parameters_; |
149 | 159 |
150 DISALLOW_COPY_AND_ASSIGN(SourceAddressToken); | 160 DISALLOW_COPY_AND_ASSIGN(SourceAddressToken); |
151 }; | 161 }; |
152 | 162 |
153 } // namespace net | 163 } // namespace net |
154 | 164 |
155 #endif // NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_ | 165 #endif // NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_ |
OLD | NEW |