summaryrefslogtreecommitdiffstats
path: root/net/socket
diff options
context:
space:
mode:
Diffstat (limited to 'net/socket')
-rw-r--r--net/socket/next_proto.cc52
-rw-r--r--net/socket/next_proto.h17
2 files changed, 69 insertions, 0 deletions
diff --git a/net/socket/next_proto.cc b/net/socket/next_proto.cc
new file mode 100644
index 0000000..bf9b86e
--- /dev/null
+++ b/net/socket/next_proto.cc
@@ -0,0 +1,52 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "next_proto.h"
+
+namespace net {
+
+NextProtoVector NextProtosHttpOnly() {
+ NextProtoVector next_protos;
+ next_protos.push_back(kProtoHTTP11);
+ return next_protos;
+}
+
+NextProtoVector NextProtosSpdy3() {
+ NextProtoVector next_protos;
+ next_protos.push_back(kProtoHTTP11);
+ next_protos.push_back(kProtoQUIC1SPDY3);
+ next_protos.push_back(kProtoSPDY3);
+ return next_protos;
+}
+
+NextProtoVector NextProtosSpdy31() {
+ NextProtoVector next_protos;
+ next_protos.push_back(kProtoHTTP11);
+ next_protos.push_back(kProtoQUIC1SPDY3);
+ next_protos.push_back(kProtoSPDY3);
+ next_protos.push_back(kProtoSPDY31);
+ return next_protos;
+}
+
+NextProtoVector NextProtosSpdy31WithSpdy2() {
+ NextProtoVector next_protos;
+ next_protos.push_back(kProtoHTTP11);
+ next_protos.push_back(kProtoQUIC1SPDY3);
+ next_protos.push_back(kProtoDeprecatedSPDY2);
+ next_protos.push_back(kProtoSPDY3);
+ next_protos.push_back(kProtoSPDY31);
+ return next_protos;
+}
+
+NextProtoVector NextProtosSpdy4Http2() {
+ NextProtoVector next_protos;
+ next_protos.push_back(kProtoHTTP11);
+ next_protos.push_back(kProtoQUIC1SPDY3);
+ next_protos.push_back(kProtoSPDY3);
+ next_protos.push_back(kProtoSPDY31);
+ next_protos.push_back(kProtoSPDY4);
+ return next_protos;
+}
+
+} // namespace net
diff --git a/net/socket/next_proto.h b/net/socket/next_proto.h
index ab28a35..797c6ae 100644
--- a/net/socket/next_proto.h
+++ b/net/socket/next_proto.h
@@ -5,6 +5,10 @@
#ifndef NET_SOCKET_NEXT_PROTO_H_
#define NET_SOCKET_NEXT_PROTO_H_
+#include <vector>
+
+#include "net/base/net_export.h"
+
namespace net {
// Next Protocol Negotiation (NPN), if successful, results in agreement on an
@@ -28,6 +32,19 @@ enum NextProto {
kProtoMaximumVersion = kProtoQUIC1SPDY3,
};
+// List of protocols to use for NPN, used for configuring HttpNetworkSessions.
+typedef std::vector<NextProto> NextProtoVector;
+
+// Convenience functions to create NextProtoVector.
+
+NET_EXPORT NextProtoVector NextProtosHttpOnly();
+
+// All of these also enable QUIC.
+NET_EXPORT NextProtoVector NextProtosSpdy3();
+NET_EXPORT NextProtoVector NextProtosSpdy31();
+NET_EXPORT NextProtoVector NextProtosSpdy31WithSpdy2();
+NET_EXPORT NextProtoVector NextProtosSpdy4Http2();
+
} // namespace net
#endif // NET_SOCKET_NEXT_PROTO_H_