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 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 | 36 |
37 int32 bandwidth_estimate_bytes_per_second() const { | 37 int32 bandwidth_estimate_bytes_per_second() const { |
38 return bandwidth_estimate_bytes_per_second_; | 38 return bandwidth_estimate_bytes_per_second_; |
39 } | 39 } |
40 void set_bandwidth_estimate_bytes_per_second( | 40 void set_bandwidth_estimate_bytes_per_second( |
41 int32 bandwidth_estimate_bytes_per_second) { | 41 int32 bandwidth_estimate_bytes_per_second) { |
42 bandwidth_estimate_bytes_per_second_ = bandwidth_estimate_bytes_per_second; | 42 bandwidth_estimate_bytes_per_second_ = bandwidth_estimate_bytes_per_second; |
43 } | 43 } |
44 | 44 |
| 45 int32 max_bandwidth_estimate_bytes_per_second() const { |
| 46 return max_bandwidth_estimate_bytes_per_second_; |
| 47 } |
| 48 void set_max_bandwidth_estimate_bytes_per_second( |
| 49 int32 max_bandwidth_estimate_bytes_per_second) { |
| 50 max_bandwidth_estimate_bytes_per_second_ = |
| 51 max_bandwidth_estimate_bytes_per_second; |
| 52 } |
| 53 |
| 54 int64 max_bandwidth_timestamp_seconds() const { |
| 55 return max_bandwidth_timestamp_seconds_; |
| 56 } |
| 57 void set_max_bandwidth_timestamp_seconds( |
| 58 int64 max_bandwidth_timestamp_seconds) { |
| 59 max_bandwidth_timestamp_seconds_ = max_bandwidth_timestamp_seconds; |
| 60 } |
| 61 |
45 int32 min_rtt_ms() const { | 62 int32 min_rtt_ms() const { |
46 return min_rtt_ms_; | 63 return min_rtt_ms_; |
47 } | 64 } |
48 void set_min_rtt_ms(int32 min_rtt_ms) { | 65 void set_min_rtt_ms(int32 min_rtt_ms) { |
49 min_rtt_ms_ = min_rtt_ms; | 66 min_rtt_ms_ = min_rtt_ms; |
50 } | 67 } |
51 | 68 |
52 int32 previous_connection_state() const { | 69 int32 previous_connection_state() const { |
53 return previous_connection_state_; | 70 return previous_connection_state_; |
54 } | 71 } |
55 void set_previous_connection_state(int32 previous_connection_state) { | 72 void set_previous_connection_state(int32 previous_connection_state) { |
56 previous_connection_state_ = previous_connection_state; | 73 previous_connection_state_ = previous_connection_state; |
57 } | 74 } |
58 | 75 |
59 private: | 76 private: |
60 // serving_region_ is used to decide whether or not the bandwidth estimate and | 77 // serving_region_ is used to decide whether or not the bandwidth estimate and |
61 // min RTT are reasonable and if they should be used. | 78 // min RTT are reasonable and if they should be used. |
62 // For example a group of geographically close servers may share the same | 79 // For example a group of geographically close servers may share the same |
63 // serving_region_ string if they are expected to have similar network | 80 // serving_region_ string if they are expected to have similar network |
64 // performance. | 81 // performance. |
65 std::string serving_region_; | 82 std::string serving_region_; |
66 // The server can supply a bandwidth estimate (in bytes/s) which it may re-use | 83 // The server can supply a bandwidth estimate (in bytes/s) which it may re-use |
67 // on receipt of a source-address token with this field set. | 84 // on receipt of a source-address token with this field set. |
68 int32 bandwidth_estimate_bytes_per_second_; | 85 int32 bandwidth_estimate_bytes_per_second_; |
| 86 // The maximum bandwidth seen by the client, not necessarily the latest. |
| 87 int32 max_bandwidth_estimate_bytes_per_second_; |
| 88 // Timestamp (seconds since UNIX epoch) that indicates when the max bandwidth |
| 89 // was seen by the server. |
| 90 int64 max_bandwidth_timestamp_seconds_; |
69 // The min RTT seen on a previous connection can be used by the server to | 91 // The min RTT seen on a previous connection can be used by the server to |
70 // inform initial connection parameters for new connections. | 92 // inform initial connection parameters for new connections. |
71 int32 min_rtt_ms_; | 93 int32 min_rtt_ms_; |
72 // Encodes the PreviousConnectionState enum. | 94 // Encodes the PreviousConnectionState enum. |
73 int32 previous_connection_state_; | 95 int32 previous_connection_state_; |
74 }; | 96 }; |
75 | 97 |
76 // TODO(rtenneti): sync with server more rationally. | 98 // TODO(rtenneti): sync with server more rationally. |
77 // A SourceAddressToken is serialised, encrypted and sent to clients so that | 99 // A SourceAddressToken is serialised, encrypted and sent to clients so that |
78 // they can prove ownership of an IP address. | 100 // they can prove ownership of an IP address. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // The server can provide estimated network parameters to be used for | 140 // The server can provide estimated network parameters to be used for |
119 // initial parameter selection in future connections. | 141 // initial parameter selection in future connections. |
120 CachedNetworkParameters cached_network_parameters_; | 142 CachedNetworkParameters cached_network_parameters_; |
121 | 143 |
122 DISALLOW_COPY_AND_ASSIGN(SourceAddressToken); | 144 DISALLOW_COPY_AND_ASSIGN(SourceAddressToken); |
123 }; | 145 }; |
124 | 146 |
125 } // namespace net | 147 } // namespace net |
126 | 148 |
127 #endif // NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_ | 149 #endif // NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_ |
OLD | NEW |