OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_HTTP_HTTP_SERVER_PROPERTIES_H_ | 5 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/containers/mru_cache.h" | 11 #include "base/containers/mru_cache.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "net/base/host_port_pair.h" | 14 #include "net/base/host_port_pair.h" |
15 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
| 16 #include "net/base/net_util.h" |
16 #include "net/quic/quic_bandwidth.h" | 17 #include "net/quic/quic_bandwidth.h" |
17 #include "net/socket/next_proto.h" | 18 #include "net/socket/next_proto.h" |
18 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this. | 19 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this. |
19 #include "net/spdy/spdy_protocol.h" | 20 #include "net/spdy/spdy_protocol.h" |
20 | 21 |
21 namespace net { | 22 namespace net { |
22 | 23 |
23 struct SSLConfig; | 24 struct SSLConfig; |
24 | 25 |
25 enum AlternateProtocolUsage { | 26 enum AlternateProtocolUsage { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 struct NET_EXPORT ServerNetworkStats { | 141 struct NET_EXPORT ServerNetworkStats { |
141 ServerNetworkStats() : bandwidth_estimate(QuicBandwidth::Zero()) {} | 142 ServerNetworkStats() : bandwidth_estimate(QuicBandwidth::Zero()) {} |
142 | 143 |
143 base::TimeDelta srtt; | 144 base::TimeDelta srtt; |
144 QuicBandwidth bandwidth_estimate; | 145 QuicBandwidth bandwidth_estimate; |
145 }; | 146 }; |
146 | 147 |
147 typedef base::MRUCache< | 148 typedef base::MRUCache< |
148 HostPortPair, AlternateProtocolInfo> AlternateProtocolMap; | 149 HostPortPair, AlternateProtocolInfo> AlternateProtocolMap; |
149 typedef base::MRUCache<HostPortPair, SettingsMap> SpdySettingsMap; | 150 typedef base::MRUCache<HostPortPair, SettingsMap> SpdySettingsMap; |
150 typedef std::map<HostPortPair, SupportsQuic> SupportsQuicMap; | |
151 typedef base::MRUCache<HostPortPair, ServerNetworkStats> ServerNetworkStatsMap; | 151 typedef base::MRUCache<HostPortPair, ServerNetworkStats> ServerNetworkStatsMap; |
152 | 152 |
153 extern const char kAlternateProtocolHeader[]; | 153 extern const char kAlternateProtocolHeader[]; |
154 | 154 |
155 // The interface for setting/retrieving the HTTP server properties. | 155 // The interface for setting/retrieving the HTTP server properties. |
156 // Currently, this class manages servers': | 156 // Currently, this class manages servers': |
157 // * SPDY support (based on NPN results) | 157 // * SPDY support (based on NPN results) |
158 // * Alternate-Protocol support | 158 // * Alternate-Protocol support |
159 // * Spdy Settings (like CWND ID field) | 159 // * Spdy Settings (like CWND ID field) |
160 class NET_EXPORT HttpServerProperties { | 160 class NET_EXPORT HttpServerProperties { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 // Clears all SPDY settings for a host. | 241 // Clears all SPDY settings for a host. |
242 virtual void ClearSpdySettings(const HostPortPair& host_port_pair) = 0; | 242 virtual void ClearSpdySettings(const HostPortPair& host_port_pair) = 0; |
243 | 243 |
244 // Clears all SPDY settings for all hosts. | 244 // Clears all SPDY settings for all hosts. |
245 virtual void ClearAllSpdySettings() = 0; | 245 virtual void ClearAllSpdySettings() = 0; |
246 | 246 |
247 // Returns all persistent SPDY settings. | 247 // Returns all persistent SPDY settings. |
248 virtual const SpdySettingsMap& spdy_settings_map() const = 0; | 248 virtual const SpdySettingsMap& spdy_settings_map() const = 0; |
249 | 249 |
250 // TODO(rtenneti): Make SupportsQuic a global (instead of per host_port_pair). | 250 virtual bool GetSupportsQuic(IPAddressNumber* last_address) const = 0; |
251 virtual SupportsQuic GetSupportsQuic( | |
252 const HostPortPair& host_port_pair) const = 0; | |
253 | 251 |
254 virtual void SetSupportsQuic(const HostPortPair& host_port_pair, | 252 virtual void SetSupportsQuic(bool used_quic, |
255 bool used_quic, | 253 const IPAddressNumber& last_address) = 0; |
256 const std::string& address) = 0; | |
257 | |
258 virtual const SupportsQuicMap& supports_quic_map() const = 0; | |
259 | 254 |
260 virtual void SetServerNetworkStats(const HostPortPair& host_port_pair, | 255 virtual void SetServerNetworkStats(const HostPortPair& host_port_pair, |
261 ServerNetworkStats stats) = 0; | 256 ServerNetworkStats stats) = 0; |
262 | 257 |
263 virtual const ServerNetworkStats* GetServerNetworkStats( | 258 virtual const ServerNetworkStats* GetServerNetworkStats( |
264 const HostPortPair& host_port_pair) = 0; | 259 const HostPortPair& host_port_pair) = 0; |
265 | 260 |
266 virtual const ServerNetworkStatsMap& server_network_stats_map() const = 0; | 261 virtual const ServerNetworkStatsMap& server_network_stats_map() const = 0; |
267 | 262 |
268 private: | 263 private: |
269 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 264 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
270 }; | 265 }; |
271 | 266 |
272 } // namespace net | 267 } // namespace net |
273 | 268 |
274 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 269 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
OLD | NEW |