OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef NET_QUIC_QUIC_VERSIONS_H_ |
| 6 #define NET_QUIC_QUIC_VERSIONS_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "net/quic/core/quic_types.h" |
| 12 |
| 13 namespace net { |
| 14 |
| 15 // The available versions of QUIC. Guaranteed that the integer value of the enum |
| 16 // will match the version number. |
| 17 // When adding a new version to this enum you should add it to |
| 18 // kSupportedQuicVersions (if appropriate), and also add a new case to the |
| 19 // helper methods QuicVersionToQuicTag, QuicTagToQuicVersion, and |
| 20 // QuicVersionToString. |
| 21 enum QuicVersion { |
| 22 // Special case to indicate unknown/unsupported QUIC version. |
| 23 QUIC_VERSION_UNSUPPORTED = 0, |
| 24 |
| 25 QUIC_VERSION_32 = 32, // FEC related fields are removed from wire format. |
| 26 QUIC_VERSION_33 = 33, // Adds diversification nonces. |
| 27 QUIC_VERSION_34 = 34, // Deprecates entropy, removes private flag from packet |
| 28 // header, uses new ack and stop waiting wire format. |
| 29 QUIC_VERSION_35 = 35, // Allows endpoints to independently set stream limit. |
| 30 QUIC_VERSION_36 = 36, // Add support to force HOL blocking. |
| 31 |
| 32 // IMPORTANT: if you are adding to this std::list, follow the instructions at |
| 33 // http://sites/quic/adding-and-removing-versions |
| 34 }; |
| 35 |
| 36 // This vector contains QUIC versions which we currently support. |
| 37 // This should be ordered such that the highest supported version is the first |
| 38 // element, with subsequent elements in descending order (versions can be |
| 39 // skipped as necessary). |
| 40 // |
| 41 // IMPORTANT: if you are adding to this list, follow the instructions at |
| 42 // http://sites/quic/adding-and-removing-versions |
| 43 static const QuicVersion kSupportedQuicVersions[] = { |
| 44 QUIC_VERSION_36, QUIC_VERSION_35, QUIC_VERSION_34, QUIC_VERSION_33, |
| 45 QUIC_VERSION_32}; |
| 46 |
| 47 typedef std::vector<QuicVersion> QuicVersionVector; |
| 48 |
| 49 // Returns a vector of QUIC versions in kSupportedQuicVersions. |
| 50 NET_EXPORT_PRIVATE QuicVersionVector AllSupportedVersions(); |
| 51 |
| 52 // Returns a vector of QUIC versions from kSupportedQuicVersions which exclude |
| 53 // any versions which are disabled by flags. |
| 54 NET_EXPORT_PRIVATE QuicVersionVector CurrentSupportedVersions(); |
| 55 |
| 56 // Returns a vector of QUIC versions from |versions| which exclude any versions |
| 57 // which are disabled by flags. |
| 58 NET_EXPORT_PRIVATE QuicVersionVector |
| 59 FilterSupportedVersions(QuicVersionVector versions); |
| 60 |
| 61 // Returns QUIC version of |index| in result of |versions|. Returns |
| 62 // QUIC_VERSION_UNSUPPORTED if |index| is out of bounds. |
| 63 NET_EXPORT_PRIVATE QuicVersionVector |
| 64 VersionOfIndex(const QuicVersionVector& versions, int index); |
| 65 |
| 66 // QuicTag is written to and read from the wire, but we prefer to use |
| 67 // the more readable QuicVersion at other levels. |
| 68 // Helper function which translates from a QuicVersion to a QuicTag. Returns 0 |
| 69 // if QuicVersion is unsupported. |
| 70 NET_EXPORT_PRIVATE QuicTag QuicVersionToQuicTag(const QuicVersion version); |
| 71 |
| 72 // Returns appropriate QuicVersion from a QuicTag. |
| 73 // Returns QUIC_VERSION_UNSUPPORTED if version_tag cannot be understood. |
| 74 NET_EXPORT_PRIVATE QuicVersion QuicTagToQuicVersion(const QuicTag version_tag); |
| 75 |
| 76 // Helper function which translates from a QuicVersion to a string. |
| 77 // Returns strings corresponding to enum names (e.g. QUIC_VERSION_6). |
| 78 NET_EXPORT_PRIVATE std::string QuicVersionToString(const QuicVersion version); |
| 79 |
| 80 // Returns comma separated list of string representations of QuicVersion enum |
| 81 // values in the supplied |versions| vector. |
| 82 NET_EXPORT_PRIVATE std::string QuicVersionVectorToString( |
| 83 const QuicVersionVector& versions); |
| 84 |
| 85 } // namespace net |
| 86 |
| 87 #endif // NET_QUIC_QUIC_VERSIONS_H_ |
OLD | NEW |