• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2012 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef NET_SOCKET_NEXT_PROTO_H_
6 #define NET_SOCKET_NEXT_PROTO_H_
7 
8 #include <stdint.h>
9 
10 #include <string_view>
11 #include <vector>
12 
13 #include "base/containers/enum_set.h"
14 #include "net/base/net_export.h"
15 
16 namespace net {
17 
18 // This enum is used in Net.SSLNegotiatedAlpnProtocol histogram.
19 // Do not change or re-use values.
20 enum NextProto : uint8_t {
21   kProtoUnknown = 0,
22   kProtoHTTP11 = 1,
23   kProtoHTTP2 = 2,
24   kProtoQUIC = 3,
25   kProtoLast = kProtoQUIC
26 };
27 
28 // List of protocols to use for ALPN, used for configuring HttpNetworkSessions.
29 typedef std::vector<NextProto> NextProtoVector;
30 
31 using NextProtoSet =
32     base::EnumSet<NextProto, NextProto::kProtoUnknown, NextProto::kProtoLast>;
33 
34 NET_EXPORT_PRIVATE NextProto NextProtoFromString(std::string_view proto_string);
35 
36 NET_EXPORT_PRIVATE const char* NextProtoToString(NextProto next_proto);
37 
38 }  // namespace net
39 
40 #endif  // NET_SOCKET_NEXT_PROTO_H_
41