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/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "net/base/host_port_pair.h" | 12 #include "net/base/host_port_pair.h" |
13 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
14 #include "net/http/http_pipelined_host_capability.h" | 14 #include "net/http/http_pipelined_host_capability.h" |
15 #include "net/socket/next_proto.h" | 15 #include "net/socket/next_proto.h" |
16 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this. | 16 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this. |
17 | 17 |
18 namespace net { | 18 namespace net { |
19 | 19 |
20 enum AlternateProtocol { | 20 enum AlternateProtocol { |
21 NPN_SPDY_1 = 0, | 21 NPN_SPDY_2 = 0, |
22 NPN_SPDY_MINIMUM_VERSION = NPN_SPDY_1, | 22 ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION = NPN_SPDY_2, |
23 NPN_SPDY_2, | 23 NPN_SPDY_MINIMUM_VERSION = NPN_SPDY_2, |
24 NPN_SPDY_3, | 24 NPN_SPDY_3, |
25 NPN_SPDY_3_1, | 25 NPN_SPDY_3_1, |
26 NPN_SPDY_4A2, | 26 NPN_SPDY_4A2, |
27 // We lump in HTTP/2 with the SPDY protocols for now. | 27 // We lump in HTTP/2 with the SPDY protocols for now. |
28 NPN_HTTP2_DRAFT_04, | 28 NPN_HTTP2_DRAFT_04, |
29 NPN_SPDY_MAXIMUM_VERSION = NPN_HTTP2_DRAFT_04, | 29 NPN_SPDY_MAXIMUM_VERSION = NPN_HTTP2_DRAFT_04, |
30 QUIC, | 30 QUIC, |
31 NUM_ALTERNATE_PROTOCOLS, | 31 ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION = QUIC, |
32 ALTERNATE_PROTOCOL_BROKEN, // The alternate protocol is known to be broken. | 32 ALTERNATE_PROTOCOL_BROKEN, // The alternate protocol is known to be broken. |
33 UNINITIALIZED_ALTERNATE_PROTOCOL, | 33 UNINITIALIZED_ALTERNATE_PROTOCOL, |
34 }; | 34 }; |
35 | 35 |
| 36 // Simply returns whether |protocol| is between |
| 37 // ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION and |
| 38 // ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION (inclusive). |
| 39 NET_EXPORT bool IsAlternateProtocolValid(AlternateProtocol protocol); |
| 40 |
| 41 enum AlternateProtocolSize { |
| 42 NUM_VALID_ALTERNATE_PROTOCOLS = |
| 43 ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION - |
| 44 ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION + 1, |
| 45 }; |
| 46 |
36 NET_EXPORT const char* AlternateProtocolToString(AlternateProtocol protocol); | 47 NET_EXPORT const char* AlternateProtocolToString(AlternateProtocol protocol); |
37 NET_EXPORT AlternateProtocol AlternateProtocolFromString( | 48 NET_EXPORT AlternateProtocol AlternateProtocolFromString( |
38 const std::string& protocol); | 49 const std::string& str); |
39 NET_EXPORT_PRIVATE AlternateProtocol AlternateProtocolFromNextProto( | 50 NET_EXPORT_PRIVATE AlternateProtocol AlternateProtocolFromNextProto( |
40 NextProto next_proto); | 51 NextProto next_proto); |
41 | 52 |
42 struct NET_EXPORT PortAlternateProtocolPair { | 53 struct NET_EXPORT PortAlternateProtocolPair { |
43 bool Equals(const PortAlternateProtocolPair& other) const { | 54 bool Equals(const PortAlternateProtocolPair& other) const { |
44 return port == other.port && protocol == other.protocol; | 55 return port == other.port && protocol == other.protocol; |
45 } | 56 } |
46 | 57 |
47 std::string ToString() const; | 58 std::string ToString() const; |
48 | 59 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 143 |
133 virtual PipelineCapabilityMap GetPipelineCapabilityMap() const = 0; | 144 virtual PipelineCapabilityMap GetPipelineCapabilityMap() const = 0; |
134 | 145 |
135 private: | 146 private: |
136 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 147 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
137 }; | 148 }; |
138 | 149 |
139 } // namespace net | 150 } // namespace net |
140 | 151 |
141 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 152 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
OLD | NEW |