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 <stdint.h> |
| 9 |
8 #include <map> | 10 #include <map> |
9 #include <string> | 11 #include <string> |
10 #include <tuple> | 12 #include <tuple> |
11 #include <vector> | 13 #include <vector> |
12 | 14 |
13 #include "base/basictypes.h" | |
14 #include "base/containers/mru_cache.h" | 15 #include "base/containers/mru_cache.h" |
| 16 #include "base/macros.h" |
15 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
16 #include "base/time/time.h" | 18 #include "base/time/time.h" |
17 #include "net/base/host_port_pair.h" | 19 #include "net/base/host_port_pair.h" |
18 #include "net/base/ip_address_number.h" | 20 #include "net/base/ip_address_number.h" |
19 #include "net/base/net_export.h" | 21 #include "net/base/net_export.h" |
20 #include "net/quic/quic_bandwidth.h" | 22 #include "net/quic/quic_bandwidth.h" |
21 #include "net/quic/quic_server_id.h" | 23 #include "net/quic/quic_server_id.h" |
22 #include "net/socket/next_proto.h" | 24 #include "net/socket/next_proto.h" |
23 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this. | 25 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this. |
24 #include "net/spdy/spdy_protocol.h" | 26 #include "net/spdy/spdy_protocol.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 NextProto next_proto); | 96 NextProto next_proto); |
95 | 97 |
96 // (protocol, host, port) triple as defined in | 98 // (protocol, host, port) triple as defined in |
97 // https://tools.ietf.org/id/draft-ietf-httpbis-alt-svc-06.html | 99 // https://tools.ietf.org/id/draft-ietf-httpbis-alt-svc-06.html |
98 struct NET_EXPORT AlternativeService { | 100 struct NET_EXPORT AlternativeService { |
99 AlternativeService() | 101 AlternativeService() |
100 : protocol(UNINITIALIZED_ALTERNATE_PROTOCOL), host(), port(0) {} | 102 : protocol(UNINITIALIZED_ALTERNATE_PROTOCOL), host(), port(0) {} |
101 | 103 |
102 AlternativeService(AlternateProtocol protocol, | 104 AlternativeService(AlternateProtocol protocol, |
103 const std::string& host, | 105 const std::string& host, |
104 uint16 port) | 106 uint16_t port) |
105 : protocol(protocol), host(host), port(port) {} | 107 : protocol(protocol), host(host), port(port) {} |
106 | 108 |
107 AlternativeService(AlternateProtocol protocol, | 109 AlternativeService(AlternateProtocol protocol, |
108 const HostPortPair& host_port_pair) | 110 const HostPortPair& host_port_pair) |
109 : protocol(protocol), | 111 : protocol(protocol), |
110 host(host_port_pair.host()), | 112 host(host_port_pair.host()), |
111 port(host_port_pair.port()) {} | 113 port(host_port_pair.port()) {} |
112 | 114 |
113 AlternativeService(const AlternativeService& alternative_service) = default; | 115 AlternativeService(const AlternativeService& alternative_service) = default; |
114 AlternativeService& operator=(const AlternativeService& alternative_service) = | 116 AlternativeService& operator=(const AlternativeService& alternative_service) = |
(...skipping 12 matching lines...) Expand all Loading... |
127 | 129 |
128 bool operator<(const AlternativeService& other) const { | 130 bool operator<(const AlternativeService& other) const { |
129 return std::tie(protocol, host, port) < | 131 return std::tie(protocol, host, port) < |
130 std::tie(other.protocol, other.host, other.port); | 132 std::tie(other.protocol, other.host, other.port); |
131 } | 133 } |
132 | 134 |
133 std::string ToString() const; | 135 std::string ToString() const; |
134 | 136 |
135 AlternateProtocol protocol; | 137 AlternateProtocol protocol; |
136 std::string host; | 138 std::string host; |
137 uint16 port; | 139 uint16_t port; |
138 }; | 140 }; |
139 | 141 |
140 struct NET_EXPORT AlternativeServiceInfo { | 142 struct NET_EXPORT AlternativeServiceInfo { |
141 AlternativeServiceInfo() : alternative_service(), probability(0.0) {} | 143 AlternativeServiceInfo() : alternative_service(), probability(0.0) {} |
142 | 144 |
143 AlternativeServiceInfo(const AlternativeService& alternative_service, | 145 AlternativeServiceInfo(const AlternativeService& alternative_service, |
144 double probability, | 146 double probability, |
145 base::Time expiration) | 147 base::Time expiration) |
146 : alternative_service(alternative_service), | 148 : alternative_service(alternative_service), |
147 probability(probability), | 149 probability(probability), |
148 expiration(expiration) {} | 150 expiration(expiration) {} |
149 | 151 |
150 AlternativeServiceInfo(AlternateProtocol protocol, | 152 AlternativeServiceInfo(AlternateProtocol protocol, |
151 const std::string& host, | 153 const std::string& host, |
152 uint16 port, | 154 uint16_t port, |
153 double probability, | 155 double probability, |
154 base::Time expiration) | 156 base::Time expiration) |
155 : alternative_service(protocol, host, port), | 157 : alternative_service(protocol, host, port), |
156 probability(probability), | 158 probability(probability), |
157 expiration(expiration) {} | 159 expiration(expiration) {} |
158 | 160 |
159 AlternativeServiceInfo( | 161 AlternativeServiceInfo( |
160 const AlternativeServiceInfo& alternative_service_info) = default; | 162 const AlternativeServiceInfo& alternative_service_info) = default; |
161 AlternativeServiceInfo& operator=( | 163 AlternativeServiceInfo& operator=( |
162 const AlternativeServiceInfo& alternative_service_info) = default; | 164 const AlternativeServiceInfo& alternative_service_info) = default; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 // Gets a reference to the SettingsMap stored for a host. | 337 // Gets a reference to the SettingsMap stored for a host. |
336 // If no settings are stored, returns an empty SettingsMap. | 338 // If no settings are stored, returns an empty SettingsMap. |
337 virtual const SettingsMap& GetSpdySettings( | 339 virtual const SettingsMap& GetSpdySettings( |
338 const HostPortPair& host_port_pair) = 0; | 340 const HostPortPair& host_port_pair) = 0; |
339 | 341 |
340 // Saves an individual SPDY setting for a host. Returns true if SPDY setting | 342 // Saves an individual SPDY setting for a host. Returns true if SPDY setting |
341 // is to be persisted. | 343 // is to be persisted. |
342 virtual bool SetSpdySetting(const HostPortPair& host_port_pair, | 344 virtual bool SetSpdySetting(const HostPortPair& host_port_pair, |
343 SpdySettingsIds id, | 345 SpdySettingsIds id, |
344 SpdySettingsFlags flags, | 346 SpdySettingsFlags flags, |
345 uint32 value) = 0; | 347 uint32_t value) = 0; |
346 | 348 |
347 // Clears all SPDY settings for a host. | 349 // Clears all SPDY settings for a host. |
348 virtual void ClearSpdySettings(const HostPortPair& host_port_pair) = 0; | 350 virtual void ClearSpdySettings(const HostPortPair& host_port_pair) = 0; |
349 | 351 |
350 // Clears all SPDY settings for all hosts. | 352 // Clears all SPDY settings for all hosts. |
351 virtual void ClearAllSpdySettings() = 0; | 353 virtual void ClearAllSpdySettings() = 0; |
352 | 354 |
353 // Returns all persistent SPDY settings. | 355 // Returns all persistent SPDY settings. |
354 virtual const SpdySettingsMap& spdy_settings_map() const = 0; | 356 virtual const SpdySettingsMap& spdy_settings_map() const = 0; |
355 | 357 |
(...skipping 23 matching lines...) Expand all Loading... |
379 // Returns all persistent QuicServerInfo objects. | 381 // Returns all persistent QuicServerInfo objects. |
380 virtual const QuicServerInfoMap& quic_server_info_map() const = 0; | 382 virtual const QuicServerInfoMap& quic_server_info_map() const = 0; |
381 | 383 |
382 private: | 384 private: |
383 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 385 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
384 }; | 386 }; |
385 | 387 |
386 } // namespace net | 388 } // namespace net |
387 | 389 |
388 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 390 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
OLD | NEW |