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, |
88 bool is_broken = false) | |
Ryan Hamilton
2014/11/05 17:05:19
Alas, using arguments with default values is prohi
Bence
2014/11/06 00:26:00
Done.
| |
89 : port(port), | 89 : port(port), |
90 protocol(protocol), | 90 protocol(protocol), |
91 probability(probability) {} | 91 probability(probability), |
92 is_broken(is_broken) {} | |
92 | 93 |
93 bool Equals(const AlternateProtocolInfo& other) const { | 94 bool Equals(const AlternateProtocolInfo& other) const { |
94 return port == other.port && | 95 return port == other.port && |
95 protocol == other.protocol && | 96 protocol == other.protocol && |
96 probability == other.probability; | 97 probability == other.probability; |
97 } | 98 } |
98 | 99 |
99 std::string ToString() const; | 100 std::string ToString() const; |
100 | 101 |
101 uint16 port; | 102 uint16 port; |
102 AlternateProtocol protocol; | 103 AlternateProtocol protocol; |
103 double probability; | 104 double probability; |
105 bool is_broken; | |
104 }; | 106 }; |
105 | 107 |
106 struct NET_EXPORT SupportsQuic { | 108 struct NET_EXPORT SupportsQuic { |
107 SupportsQuic() : used_quic(false) {} | 109 SupportsQuic() : used_quic(false) {} |
108 SupportsQuic(bool used_quic, const std::string& address) | 110 SupportsQuic(bool used_quic, const std::string& address) |
109 : used_quic(used_quic), | 111 : used_quic(used_quic), |
110 address(address) {} | 112 address(address) {} |
111 | 113 |
112 bool Equals(const SupportsQuic& other) const { | 114 bool Equals(const SupportsQuic& other) const { |
113 return used_quic == other.used_quic && address == other.address; | 115 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( | 230 virtual const NetworkStats* GetServerNetworkStats( |
229 const HostPortPair& host_port_pair) const = 0; | 231 const HostPortPair& host_port_pair) const = 0; |
230 | 232 |
231 private: | 233 private: |
232 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 234 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
233 }; | 235 }; |
234 | 236 |
235 } // namespace net | 237 } // namespace net |
236 | 238 |
237 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 239 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
OLD | NEW |