| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/base/host_port_pair.h" | 11 #include "net/base/host_port_pair.h" |
| 12 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
| 13 #include "net/http/http_pipelined_host_capability.h" | |
| 14 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this. | 13 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this. |
| 15 | 14 |
| 16 namespace net { | 15 namespace net { |
| 17 | 16 |
| 18 enum AlternateProtocol { | 17 enum AlternateProtocol { |
| 19 NPN_SPDY_1 = 0, | 18 NPN_SPDY_1 = 0, |
| 20 NPN_SPDY_2, | 19 NPN_SPDY_2, |
| 21 NUM_ALTERNATE_PROTOCOLS, | 20 NUM_ALTERNATE_PROTOCOLS, |
| 22 ALTERNATE_PROTOCOL_BROKEN, // The alternate protocol is known to be broken. | 21 ALTERNATE_PROTOCOL_BROKEN, // The alternate protocol is known to be broken. |
| 23 UNINITIALIZED_ALTERNATE_PROTOCOL, | 22 UNINITIALIZED_ALTERNATE_PROTOCOL, |
| 24 }; | 23 }; |
| 25 | 24 |
| 26 struct NET_EXPORT PortAlternateProtocolPair { | 25 struct NET_EXPORT PortAlternateProtocolPair { |
| 27 bool Equals(const PortAlternateProtocolPair& other) const { | 26 bool Equals(const PortAlternateProtocolPair& other) const { |
| 28 return port == other.port && protocol == other.protocol; | 27 return port == other.port && protocol == other.protocol; |
| 29 } | 28 } |
| 30 | 29 |
| 31 std::string ToString() const; | 30 std::string ToString() const; |
| 32 | 31 |
| 33 uint16 port; | 32 uint16 port; |
| 34 AlternateProtocol protocol; | 33 AlternateProtocol protocol; |
| 35 }; | 34 }; |
| 36 | 35 |
| 37 typedef std::map<HostPortPair, PortAlternateProtocolPair> AlternateProtocolMap; | 36 typedef std::map<HostPortPair, PortAlternateProtocolPair> AlternateProtocolMap; |
| 38 typedef std::map<HostPortPair, spdy::SpdySettings> SpdySettingsMap; | 37 typedef std::map<HostPortPair, spdy::SpdySettings> SpdySettingsMap; |
| 39 typedef std::map<HostPortPair, | |
| 40 HttpPipelinedHostCapability> PipelineCapabilityMap; | |
| 41 | 38 |
| 42 extern const char kAlternateProtocolHeader[]; | 39 extern const char kAlternateProtocolHeader[]; |
| 43 extern const char* const kAlternateProtocolStrings[NUM_ALTERNATE_PROTOCOLS]; | 40 extern const char* const kAlternateProtocolStrings[NUM_ALTERNATE_PROTOCOLS]; |
| 44 | 41 |
| 45 // The interface for setting/retrieving the HTTP server properties. | 42 // The interface for setting/retrieving the HTTP server properties. |
| 46 // Currently, this class manages servers': | 43 // Currently, this class manages servers': |
| 47 // * SPDY support (based on NPN results) | 44 // * SPDY support (based on NPN results) |
| 48 // * Alternate-Protocol support | 45 // * Alternate-Protocol support |
| 49 // * Spdy Settings (like CWND ID field) | 46 // * Spdy Settings (like CWND ID field) |
| 50 class NET_EXPORT HttpServerProperties { | 47 class NET_EXPORT HttpServerProperties { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // persisted. | 88 // persisted. |
| 92 virtual bool SetSpdySettings(const HostPortPair& host_port_pair, | 89 virtual bool SetSpdySettings(const HostPortPair& host_port_pair, |
| 93 const spdy::SpdySettings& settings) = 0; | 90 const spdy::SpdySettings& settings) = 0; |
| 94 | 91 |
| 95 // Clears all spdy_settings. | 92 // Clears all spdy_settings. |
| 96 virtual void ClearSpdySettings() = 0; | 93 virtual void ClearSpdySettings() = 0; |
| 97 | 94 |
| 98 // Returns all persistent SpdySettings. | 95 // Returns all persistent SpdySettings. |
| 99 virtual const SpdySettingsMap& spdy_settings_map() const = 0; | 96 virtual const SpdySettingsMap& spdy_settings_map() const = 0; |
| 100 | 97 |
| 101 virtual HttpPipelinedHostCapability GetPipelineCapability( | |
| 102 const HostPortPair& origin) = 0; | |
| 103 | |
| 104 virtual void SetPipelineCapability( | |
| 105 const HostPortPair& origin, | |
| 106 HttpPipelinedHostCapability capability) = 0; | |
| 107 | |
| 108 virtual void ClearPipelineCapabilities() = 0; | |
| 109 | |
| 110 virtual PipelineCapabilityMap GetPipelineCapabilityMap() const = 0; | |
| 111 | |
| 112 private: | 98 private: |
| 113 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 99 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
| 114 }; | 100 }; |
| 115 | 101 |
| 116 } // namespace net | 102 } // namespace net |
| 117 | 103 |
| 118 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 104 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
| OLD | NEW |