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" |
11 #include "base/strings/string_piece.h" | 11 #include "base/strings/string_piece.h" |
| 12 #include "net/base/net_export.h" |
12 | 13 |
13 namespace net { | 14 namespace net { |
14 | 15 |
15 // TODO(rtenneti): sync with server more rationally. | 16 // TODO(rtenneti): sync with server more rationally. |
16 // CachedNetworkParameters contains data that can be used to choose appropriate | 17 // CachedNetworkParameters contains data that can be used to choose appropriate |
17 // connection parameters (initial RTT, initial CWND, etc.) in new connections. | 18 // connection parameters (initial RTT, initial CWND, etc.) in new connections. |
18 class CachedNetworkParameters { | 19 class NET_EXPORT_PRIVATE CachedNetworkParameters { |
19 public: | 20 public: |
20 // Describes the state of the connection during which the supplied network | 21 // Describes the state of the connection during which the supplied network |
21 // parameters were calculated. | 22 // parameters were calculated. |
22 enum PreviousConnectionState { | 23 enum PreviousConnectionState { |
23 SLOW_START = 0, | 24 SLOW_START = 0, |
24 CONGESTION_AVOIDANCE = 1, | 25 CONGESTION_AVOIDANCE = 1, |
25 }; | 26 }; |
26 | 27 |
27 CachedNetworkParameters(); | 28 CachedNetworkParameters(); |
28 ~CachedNetworkParameters(); | 29 ~CachedNetworkParameters(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // The min RTT seen on a previous connection can be used by the server to | 92 // The min RTT seen on a previous connection can be used by the server to |
92 // inform initial connection parameters for new connections. | 93 // inform initial connection parameters for new connections. |
93 int32 min_rtt_ms_; | 94 int32 min_rtt_ms_; |
94 // Encodes the PreviousConnectionState enum. | 95 // Encodes the PreviousConnectionState enum. |
95 int32 previous_connection_state_; | 96 int32 previous_connection_state_; |
96 }; | 97 }; |
97 | 98 |
98 // TODO(rtenneti): sync with server more rationally. | 99 // TODO(rtenneti): sync with server more rationally. |
99 // A SourceAddressToken is serialised, encrypted and sent to clients so that | 100 // A SourceAddressToken is serialised, encrypted and sent to clients so that |
100 // they can prove ownership of an IP address. | 101 // they can prove ownership of an IP address. |
101 class SourceAddressToken { | 102 class NET_EXPORT_PRIVATE SourceAddressToken { |
102 public: | 103 public: |
103 SourceAddressToken(); | 104 SourceAddressToken(); |
104 ~SourceAddressToken(); | 105 ~SourceAddressToken(); |
105 | 106 |
106 std::string SerializeAsString() const; | 107 std::string SerializeAsString() const; |
107 | 108 |
108 bool ParseFromArray(const char* plaintext, size_t plaintext_length); | 109 bool ParseFromArray(const char* plaintext, size_t plaintext_length); |
109 | 110 |
110 std::string ip() const { | 111 std::string ip() const { |
111 return ip_; | 112 return ip_; |
(...skipping 28 matching lines...) Expand all Loading... |
140 // The server can provide estimated network parameters to be used for | 141 // The server can provide estimated network parameters to be used for |
141 // initial parameter selection in future connections. | 142 // initial parameter selection in future connections. |
142 CachedNetworkParameters cached_network_parameters_; | 143 CachedNetworkParameters cached_network_parameters_; |
143 | 144 |
144 DISALLOW_COPY_AND_ASSIGN(SourceAddressToken); | 145 DISALLOW_COPY_AND_ASSIGN(SourceAddressToken); |
145 }; | 146 }; |
146 | 147 |
147 } // namespace net | 148 } // namespace net |
148 | 149 |
149 #endif // NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_ | 150 #endif // NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_ |
OLD | NEW |