Roll src/third_party/WebKit a3b4a2e:7441784 (svn 202551:202552)
[chromium-blink-merge.git] / net / socket / next_proto.h
blob62cac9a86ab2c2117ed5557568f8bf84d5987aad
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
3 // found in the LICENSE file.
5 #ifndef NET_SOCKET_NEXT_PROTO_H_
6 #define NET_SOCKET_NEXT_PROTO_H_
8 #include <vector>
10 #include "net/base/net_export.h"
12 namespace net {
14 // Next Protocol Negotiation (NPN), if successful, results in agreement on an
15 // application-level string that specifies the application level protocol to
16 // use over the TLS connection. NextProto enumerates the application level
17 // protocols that we recognize. Do not change or reuse values, because they
18 // are used to collect statistics on UMA. Also, values must be in [0,499),
19 // because of the way TLS protocol negotiation extension information is added to
20 // UMA histogram.
21 enum NextProto {
22 kProtoUnknown = 0,
23 kProtoHTTP11 = 1,
24 kProtoMinimumVersion = kProtoHTTP11,
26 kProtoDeprecatedSPDY2 = 100,
27 kProtoSPDYMinimumVersion = kProtoDeprecatedSPDY2,
28 kProtoSPDYHistogramOffset = kProtoDeprecatedSPDY2,
29 kProtoSPDY3 = 101,
30 kProtoSPDY31 = 102,
31 // kProtoHTTP2_14 = 103, // HTTP/2 draft-14
32 // kProtoHTTP2_15 = 104, // HTTP/2 draft-15
33 // kProtoHTTP2_16 = 105, // HTTP/2 draft-16
34 // kProtoHTTP2_17 = 106, // HTTP/2 draft-17
35 kProtoHTTP2 = 107, // HTTP/2, see https://tools.ietf.org/html/rfc7540.
36 kProtoSPDYMaximumVersion = kProtoHTTP2,
38 kProtoQUIC1SPDY3 = 200,
40 kProtoMaximumVersion = kProtoQUIC1SPDY3,
43 // List of protocols to use for NPN, used for configuring HttpNetworkSessions.
44 typedef std::vector<NextProto> NextProtoVector;
46 // Convenience functions to create NextProtoVector.
48 // Default values, which are subject to change over time.
49 NET_EXPORT NextProtoVector NextProtosDefaults();
51 // Enable SPDY/3.1 and QUIC, but not HTTP/2.
52 NET_EXPORT NextProtoVector NextProtosSpdy31();
54 // Control SPDY/3.1 and HTTP/2 separately.
55 NET_EXPORT NextProtoVector NextProtosWithSpdyAndQuic(bool spdy_enabled,
56 bool quic_enabled);
58 // Returns true if |next_proto| is a version of SPDY or HTTP/2.
59 bool NextProtoIsSPDY(NextProto next_proto);
61 } // namespace net
63 #endif // NET_SOCKET_NEXT_PROTO_H_