Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(454)

Unified Diff: net/quic/core/quic_versions.h

Issue 2516033003: Landing Recent QUIC changes until Mon Nov 14 04:43:50 2016 +0000 (Closed)
Patch Set: Remove unused UpdatePacketGapSentHistogram() function. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/quic_utils_test.cc ('k') | net/quic/core/quic_versions.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_versions.h
diff --git a/net/quic/core/quic_versions.h b/net/quic/core/quic_versions.h
new file mode 100644
index 0000000000000000000000000000000000000000..c51df819a964cba82b9827b98c7a232193cc70af
--- /dev/null
+++ b/net/quic/core/quic_versions.h
@@ -0,0 +1,85 @@
+// Copyright (c) 2012 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.
+
+#ifndef NET_QUIC_QUIC_VERSIONS_H_
+#define NET_QUIC_QUIC_VERSIONS_H_
+
+#include <string>
+#include <vector>
+
+#include "net/quic/core/quic_tag.h"
+#include "net/quic/core/quic_types.h"
+
+namespace net {
+
+// The available versions of QUIC. Guaranteed that the integer value of the enum
+// will match the version number.
+// When adding a new version to this enum you should add it to
+// kSupportedQuicVersions (if appropriate), and also add a new case to the
+// helper methods QuicVersionToQuicTag, QuicTagToQuicVersion, and
+// QuicVersionToString.
+enum QuicVersion {
+ // Special case to indicate unknown/unsupported QUIC version.
+ QUIC_VERSION_UNSUPPORTED = 0,
+
+ QUIC_VERSION_34 = 34, // Deprecates entropy, removes private flag from packet
+ // header, uses new ack and stop waiting wire format.
+ QUIC_VERSION_35 = 35, // Allows endpoints to independently set stream limit.
+ QUIC_VERSION_36 = 36, // Add support to force HOL blocking.
+
+ // IMPORTANT: if you are adding to this std::list, follow the instructions at
+ // http://sites/quic/adding-and-removing-versions
+};
+
+// This vector contains QUIC versions which we currently support.
+// This should be ordered such that the highest supported version is the first
+// element, with subsequent elements in descending order (versions can be
+// skipped as necessary).
+//
+// IMPORTANT: if you are adding to this list, follow the instructions at
+// http://sites/quic/adding-and-removing-versions
+static const QuicVersion kSupportedQuicVersions[] = {
+ QUIC_VERSION_36, QUIC_VERSION_35, QUIC_VERSION_34};
+
+typedef std::vector<QuicVersion> QuicVersionVector;
+
+// Returns a vector of QUIC versions in kSupportedQuicVersions.
+NET_EXPORT_PRIVATE QuicVersionVector AllSupportedVersions();
+
+// Returns a vector of QUIC versions from kSupportedQuicVersions which exclude
+// any versions which are disabled by flags.
+NET_EXPORT_PRIVATE QuicVersionVector CurrentSupportedVersions();
+
+// Returns a vector of QUIC versions from |versions| which exclude any versions
+// which are disabled by flags.
+NET_EXPORT_PRIVATE QuicVersionVector
+FilterSupportedVersions(QuicVersionVector versions);
+
+// Returns QUIC version of |index| in result of |versions|. Returns
+// QUIC_VERSION_UNSUPPORTED if |index| is out of bounds.
+NET_EXPORT_PRIVATE QuicVersionVector
+VersionOfIndex(const QuicVersionVector& versions, int index);
+
+// QuicTag is written to and read from the wire, but we prefer to use
+// the more readable QuicVersion at other levels.
+// Helper function which translates from a QuicVersion to a QuicTag. Returns 0
+// if QuicVersion is unsupported.
+NET_EXPORT_PRIVATE QuicTag QuicVersionToQuicTag(const QuicVersion version);
+
+// Returns appropriate QuicVersion from a QuicTag.
+// Returns QUIC_VERSION_UNSUPPORTED if version_tag cannot be understood.
+NET_EXPORT_PRIVATE QuicVersion QuicTagToQuicVersion(const QuicTag version_tag);
+
+// Helper function which translates from a QuicVersion to a string.
+// Returns strings corresponding to enum names (e.g. QUIC_VERSION_6).
+NET_EXPORT_PRIVATE std::string QuicVersionToString(const QuicVersion version);
+
+// Returns comma separated list of string representations of QuicVersion enum
+// values in the supplied |versions| vector.
+NET_EXPORT_PRIVATE std::string QuicVersionVectorToString(
+ const QuicVersionVector& versions);
+
+} // namespace net
+
+#endif // NET_QUIC_QUIC_VERSIONS_H_
« no previous file with comments | « net/quic/core/quic_utils_test.cc ('k') | net/quic/core/quic_versions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698