Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: net/quic/crypto/cached_network_parameters.h

Issue 734063004: Update from https://crrev.com/304418 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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_CACHED_NETWORK_PARAMETERS_H_
6 #define NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_ 6 #define NET_QUIC_CRYPTO_CACHED_NETWORK_PARAMETERS_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 #include "net/base/net_export.h"
13 13
14 namespace net { 14 namespace net {
15 15
16 // TODO(rtenneti): sync with server more rationally. 16 // TODO(rtenneti): sync with server more rationally.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 int64 max_bandwidth_timestamp_seconds_; 97 int64 max_bandwidth_timestamp_seconds_;
98 // The min RTT seen on a previous connection can be used by the server to 98 // The min RTT seen on a previous connection can be used by the server to
99 // inform initial connection parameters for new connections. 99 // inform initial connection parameters for new connections.
100 int32 min_rtt_ms_; 100 int32 min_rtt_ms_;
101 // Encodes the PreviousConnectionState enum. 101 // Encodes the PreviousConnectionState enum.
102 int32 previous_connection_state_; 102 int32 previous_connection_state_;
103 // UNIX timestamp when this bandwidth estimate was created. 103 // UNIX timestamp when this bandwidth estimate was created.
104 int64 timestamp_; 104 int64 timestamp_;
105 }; 105 };
106 106
107 // TODO(rtenneti): sync with server more rationally.
108 // A SourceAddressToken is serialised, encrypted and sent to clients so that
109 // they can prove ownership of an IP address.
110 class NET_EXPORT_PRIVATE SourceAddressToken {
111 public:
112 SourceAddressToken();
113 ~SourceAddressToken();
114
115 std::string SerializeAsString() const;
116
117 bool ParseFromArray(const char* plaintext, size_t plaintext_length);
118
119 std::string ip() const {
120 return ip_;
121 }
122 void set_ip(base::StringPiece ip) {
123 ip_ = ip.as_string();
124 }
125
126 int64 timestamp() const {
127 return timestamp_;
128 }
129 void set_timestamp(int64 timestamp) {
130 timestamp_ = timestamp;
131 }
132
133 const CachedNetworkParameters& cached_network_parameters() const {
134 return cached_network_parameters_;
135 }
136 void set_cached_network_parameters(
137 const CachedNetworkParameters& 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_;
143 }
144
145 private:
146 // ip_ contains either 4 (IPv4) or 16 (IPv6) bytes of IP address in network
147 // byte order.
148 std::string ip_;
149 // timestamp_ contains a UNIX timestamp value of the time when the token was
150 // created.
151 int64 timestamp_;
152
153 // The server can provide estimated network parameters to be used for
154 // initial parameter selection in future connections.
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_;
159
160 DISALLOW_COPY_AND_ASSIGN(SourceAddressToken);
161 };
162
163 } // namespace net 107 } // namespace net
164 108
165 #endif // NET_QUIC_CRYPTO_SOURCE_ADDRESS_TOKEN_H_ 109 #endif // NET_QUIC_CRYPTO_CACHED_NETWORK_PARAMETERS_H_
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender_test.cc ('k') | net/quic/crypto/cached_network_parameters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698