QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 1 | // Copyright (c) 2016 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 QUICHE_QUIC_CORE_QUIC_VERSION_MANAGER_H_ |
| 6 | #define QUICHE_QUIC_CORE_QUIC_VERSION_MANAGER_H_ |
| 7 | |
| 8 | #include "net/third_party/quiche/src/quic/core/quic_versions.h" |
| 9 | #include "net/third_party/quiche/src/quic/platform/api/quic_export.h" |
| 10 | |
| 11 | namespace quic { |
| 12 | |
| 13 | // Used to generate filtered supported versions based on flags. |
| 14 | class QUIC_EXPORT_PRIVATE QuicVersionManager { |
| 15 | public: |
| 16 | // |supported_versions| should be sorted in the order of preference (typically |
| 17 | // highest supported version to the lowest supported version). |
| 18 | explicit QuicVersionManager(ParsedQuicVersionVector supported_versions); |
| 19 | virtual ~QuicVersionManager(); |
| 20 | |
| 21 | // Returns currently supported QUIC versions. |
| 22 | // TODO(nharper): Remove this method once it is unused. |
| 23 | const QuicTransportVersionVector& GetSupportedTransportVersions(); |
| 24 | |
| 25 | // Returns currently supported QUIC versions. This vector has the same order |
| 26 | // as the versions passed to the constructor. |
| 27 | const ParsedQuicVersionVector& GetSupportedVersions(); |
| 28 | |
| 29 | protected: |
zhongyi | f1e3e4a | 2019-09-27 16:02:03 -0700 | [diff] [blame] | 30 | // If the value of any reloadable flag is different from the cached value, |
| 31 | // re-filter |filtered_supported_versions_| and update the cached flag values. |
| 32 | // Otherwise, does nothing. |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 33 | void MaybeRefilterSupportedVersions(); |
| 34 | |
| 35 | // Refilters filtered_supported_versions_. |
| 36 | virtual void RefilterSupportedVersions(); |
| 37 | |
rch | d17a740 | 2019-08-22 15:08:04 -0700 | [diff] [blame] | 38 | const QuicTransportVersionVector& filtered_transport_versions() const { |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 39 | return filtered_transport_versions_; |
| 40 | } |
| 41 | |
| 42 | private: |
zhongyi | f1e3e4a | 2019-09-27 16:02:03 -0700 | [diff] [blame] | 43 | // Cached value of reloadable flags. |
dschinazi | 76881f0 | 2019-12-09 14:56:14 -0800 | [diff] [blame] | 44 | // quic_enable_version_t099 flag |
| 45 | bool enable_version_t099_; |
dschinazi | 40f0b3d | 2020-02-19 17:54:05 -0800 | [diff] [blame] | 46 | // quic_enable_version_draft_25 flag |
| 47 | bool enable_version_draft_25_; |
dschinazi | 76881f0 | 2019-12-09 14:56:14 -0800 | [diff] [blame] | 48 | // quic_disable_version_q050 flag |
| 49 | bool disable_version_q050_; |
| 50 | // quic_enable_version_t050 flag |
| 51 | bool enable_version_t050_; |
| 52 | // quic_disable_version_q049 flag |
| 53 | bool disable_version_q049_; |
| 54 | // quic_disable_version_q048 flag |
| 55 | bool disable_version_q048_; |
| 56 | // quic_disable_version_q046 flag |
| 57 | bool disable_version_q046_; |
| 58 | // quic_disable_version_q043 flag |
| 59 | bool disable_version_q043_; |
zhongyi | f1e3e4a | 2019-09-27 16:02:03 -0700 | [diff] [blame] | 60 | |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 61 | // The list of versions that may be supported. |
| 62 | ParsedQuicVersionVector allowed_supported_versions_; |
| 63 | // This vector contains QUIC versions which are currently supported based on |
| 64 | // flags. |
| 65 | ParsedQuicVersionVector filtered_supported_versions_; |
| 66 | // This vector contains the transport versions from |
| 67 | // |filtered_supported_versions_|. No guarantees are made that the same |
| 68 | // transport version isn't repeated. |
| 69 | QuicTransportVersionVector filtered_transport_versions_; |
| 70 | }; |
| 71 | |
| 72 | } // namespace quic |
| 73 | |
| 74 | #endif // QUICHE_QUIC_CORE_QUIC_VERSION_MANAGER_H_ |