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" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 enum AlternateProtocol { | 54 enum AlternateProtocol { |
55 DEPRECATED_NPN_SPDY_2 = 0, | 55 DEPRECATED_NPN_SPDY_2 = 0, |
56 ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION = DEPRECATED_NPN_SPDY_2, | 56 ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION = DEPRECATED_NPN_SPDY_2, |
57 NPN_SPDY_MINIMUM_VERSION = DEPRECATED_NPN_SPDY_2, | 57 NPN_SPDY_MINIMUM_VERSION = DEPRECATED_NPN_SPDY_2, |
58 NPN_SPDY_3, | 58 NPN_SPDY_3, |
59 NPN_SPDY_3_1, | 59 NPN_SPDY_3_1, |
60 NPN_SPDY_4, // SPDY4 is HTTP/2. | 60 NPN_SPDY_4, // SPDY4 is HTTP/2. |
61 NPN_SPDY_MAXIMUM_VERSION = NPN_SPDY_4, | 61 NPN_SPDY_MAXIMUM_VERSION = NPN_SPDY_4, |
62 QUIC, | 62 QUIC, |
63 ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION = QUIC, | 63 ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION = QUIC, |
64 ALTERNATE_PROTOCOL_BROKEN, // The alternate protocol is known to be broken. | |
65 UNINITIALIZED_ALTERNATE_PROTOCOL, | 64 UNINITIALIZED_ALTERNATE_PROTOCOL, |
66 }; | 65 }; |
67 | 66 |
68 // Simply returns whether |protocol| is between | 67 // Simply returns whether |protocol| is between |
69 // ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION and | 68 // ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION and |
70 // ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION (inclusive). | 69 // ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION (inclusive). |
71 NET_EXPORT bool IsAlternateProtocolValid(AlternateProtocol protocol); | 70 NET_EXPORT bool IsAlternateProtocolValid(AlternateProtocol protocol); |
72 | 71 |
73 enum AlternateProtocolSize { | 72 enum AlternateProtocolSize { |
74 NUM_VALID_ALTERNATE_PROTOCOLS = | 73 NUM_VALID_ALTERNATE_PROTOCOLS = |
75 ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION - | 74 ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION - |
76 ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION + 1, | 75 ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION + 1, |
77 }; | 76 }; |
78 | 77 |
79 NET_EXPORT const char* AlternateProtocolToString(AlternateProtocol protocol); | 78 NET_EXPORT const char* AlternateProtocolToString(AlternateProtocol protocol); |
80 NET_EXPORT AlternateProtocol AlternateProtocolFromString( | 79 NET_EXPORT AlternateProtocol AlternateProtocolFromString( |
81 const std::string& str); | 80 const std::string& str); |
82 NET_EXPORT_PRIVATE AlternateProtocol AlternateProtocolFromNextProto( | 81 NET_EXPORT_PRIVATE AlternateProtocol AlternateProtocolFromNextProto( |
83 NextProto next_proto); | 82 NextProto next_proto); |
84 | 83 |
85 struct NET_EXPORT AlternateProtocolInfo { | 84 struct NET_EXPORT AlternateProtocolInfo { |
86 AlternateProtocolInfo(uint16 port, | 85 AlternateProtocolInfo(uint16 port, |
87 AlternateProtocol protocol, | 86 AlternateProtocol protocol, |
88 double probability) | 87 double probability) |
89 : port(port), | 88 : port(port), |
90 protocol(protocol), | 89 protocol(protocol), |
91 probability(probability) {} | 90 probability(probability), |
| 91 is_broken(false) {} |
| 92 |
| 93 AlternateProtocolInfo(uint16 port, |
| 94 AlternateProtocol protocol, |
| 95 double probability, |
| 96 bool is_broken) |
| 97 : port(port), |
| 98 protocol(protocol), |
| 99 probability(probability), |
| 100 is_broken(is_broken) {} |
92 | 101 |
93 bool Equals(const AlternateProtocolInfo& other) const { | 102 bool Equals(const AlternateProtocolInfo& other) const { |
94 return port == other.port && | 103 return port == other.port && |
95 protocol == other.protocol && | 104 protocol == other.protocol && |
96 probability == other.probability; | 105 probability == other.probability; |
97 } | 106 } |
98 | 107 |
99 std::string ToString() const; | 108 std::string ToString() const; |
100 | 109 |
101 uint16 port; | 110 uint16 port; |
102 AlternateProtocol protocol; | 111 AlternateProtocol protocol; |
103 double probability; | 112 double probability; |
| 113 bool is_broken; |
104 }; | 114 }; |
105 | 115 |
106 struct NET_EXPORT SupportsQuic { | 116 struct NET_EXPORT SupportsQuic { |
107 SupportsQuic() : used_quic(false) {} | 117 SupportsQuic() : used_quic(false) {} |
108 SupportsQuic(bool used_quic, const std::string& address) | 118 SupportsQuic(bool used_quic, const std::string& address) |
109 : used_quic(used_quic), | 119 : used_quic(used_quic), |
110 address(address) {} | 120 address(address) {} |
111 | 121 |
112 bool Equals(const SupportsQuic& other) const { | 122 bool Equals(const SupportsQuic& other) const { |
113 return used_quic == other.used_quic && address == other.address; | 123 return used_quic == other.used_quic && address == other.address; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 virtual const NetworkStats* GetServerNetworkStats( | 238 virtual const NetworkStats* GetServerNetworkStats( |
229 const HostPortPair& host_port_pair) const = 0; | 239 const HostPortPair& host_port_pair) const = 0; |
230 | 240 |
231 private: | 241 private: |
232 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 242 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
233 }; | 243 }; |
234 | 244 |
235 } // namespace net | 245 } // namespace net |
236 | 246 |
237 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 247 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
OLD | NEW |