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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 min_rtt_ms_ = min_rtt_ms; | 67 min_rtt_ms_ = min_rtt_ms; |
68 } | 68 } |
69 | 69 |
70 int32 previous_connection_state() const { | 70 int32 previous_connection_state() const { |
71 return previous_connection_state_; | 71 return previous_connection_state_; |
72 } | 72 } |
73 void set_previous_connection_state(int32 previous_connection_state) { | 73 void set_previous_connection_state(int32 previous_connection_state) { |
74 previous_connection_state_ = previous_connection_state; | 74 previous_connection_state_ = previous_connection_state; |
75 } | 75 } |
76 | 76 |
| 77 int64 timestamp() const { return timestamp_; } |
| 78 void set_timestamp(int64 timestamp) { timestamp_ = timestamp; } |
| 79 |
77 private: | 80 private: |
78 // serving_region_ is used to decide whether or not the bandwidth estimate and | 81 // serving_region_ is used to decide whether or not the bandwidth estimate and |
79 // min RTT are reasonable and if they should be used. | 82 // min RTT are reasonable and if they should be used. |
80 // For example a group of geographically close servers may share the same | 83 // For example a group of geographically close servers may share the same |
81 // serving_region_ string if they are expected to have similar network | 84 // serving_region_ string if they are expected to have similar network |
82 // performance. | 85 // performance. |
83 std::string serving_region_; | 86 std::string serving_region_; |
84 // The server can supply a bandwidth estimate (in bytes/s) which it may re-use | 87 // The server can supply a bandwidth estimate (in bytes/s) which it may re-use |
85 // on receipt of a source-address token with this field set. | 88 // on receipt of a source-address token with this field set. |
86 int32 bandwidth_estimate_bytes_per_second_; | 89 int32 bandwidth_estimate_bytes_per_second_; |
87 // The maximum bandwidth seen by the client, not necessarily the latest. | 90 // The maximum bandwidth seen by the client, not necessarily the latest. |
88 int32 max_bandwidth_estimate_bytes_per_second_; | 91 int32 max_bandwidth_estimate_bytes_per_second_; |
89 // Timestamp (seconds since UNIX epoch) that indicates when the max bandwidth | 92 // Timestamp (seconds since UNIX epoch) that indicates when the max bandwidth |
90 // was seen by the server. | 93 // was seen by the server. |
91 int64 max_bandwidth_timestamp_seconds_; | 94 int64 max_bandwidth_timestamp_seconds_; |
92 // The min RTT seen on a previous connection can be used by the server to | 95 // The min RTT seen on a previous connection can be used by the server to |
93 // inform initial connection parameters for new connections. | 96 // inform initial connection parameters for new connections. |
94 int32 min_rtt_ms_; | 97 int32 min_rtt_ms_; |
95 // Encodes the PreviousConnectionState enum. | 98 // Encodes the PreviousConnectionState enum. |
96 int32 previous_connection_state_; | 99 int32 previous_connection_state_; |
| 100 // UNIX timestamp when this bandwidth estimate was created. |
| 101 int64 timestamp_; |
97 }; | 102 }; |
98 | 103 |
99 // TODO(rtenneti): sync with server more rationally. | 104 // TODO(rtenneti): sync with server more rationally. |
100 // A SourceAddressToken is serialised, encrypted and sent to clients so that | 105 // A SourceAddressToken is serialised, encrypted and sent to clients so that |
101 // they can prove ownership of an IP address. | 106 // they can prove ownership of an IP address. |
102 class NET_EXPORT_PRIVATE SourceAddressToken { | 107 class NET_EXPORT_PRIVATE SourceAddressToken { |
103 public: | 108 public: |
104 SourceAddressToken(); | 109 SourceAddressToken(); |
105 ~SourceAddressToken(); | 110 ~SourceAddressToken(); |
106 | 111 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // The server can provide estimated network parameters to be used for | 146 // The server can provide estimated network parameters to be used for |
142 // initial parameter selection in future connections. | 147 // initial parameter selection in future connections. |
143 CachedNetworkParameters cached_network_parameters_; | 148 CachedNetworkParameters cached_network_parameters_; |
144 | 149 |
145 DISALLOW_COPY_AND_ASSIGN(SourceAddressToken); | 150 DISALLOW_COPY_AND_ASSIGN(SourceAddressToken); |
146 }; | 151 }; |
147 | 152 |
148 } // namespace net | 153 } // namespace net |
149 | 154 |
150 #endif // NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_ | 155 #endif // NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_ |
OLD | NEW |