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