blob: 19b4928efb8054fe560b1f34ded1295e074e6413 [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// 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
11namespace quic {
12
13// Used to generate filtered supported versions based on flags.
14class 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:
zhongyif1e3e4a2019-09-27 16:02:03 -070030 // 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 teama6ef0a62019-03-07 20:34:33 -050033 void MaybeRefilterSupportedVersions();
34
35 // Refilters filtered_supported_versions_.
36 virtual void RefilterSupportedVersions();
37
rchd17a7402019-08-22 15:08:04 -070038 const QuicTransportVersionVector& filtered_transport_versions() const {
QUICHE teama6ef0a62019-03-07 20:34:33 -050039 return filtered_transport_versions_;
40 }
41
42 private:
zhongyif1e3e4a2019-09-27 16:02:03 -070043 // Cached value of reloadable flags.
dschinazi76881f02019-12-09 14:56:14 -080044 // quic_enable_version_t099 flag
45 bool enable_version_t099_;
dschinazi40f0b3d2020-02-19 17:54:05 -080046 // quic_enable_version_draft_25 flag
47 bool enable_version_draft_25_;
dschinazi76881f02019-12-09 14:56:14 -080048 // 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_;
zhongyif1e3e4a2019-09-27 16:02:03 -070060
QUICHE teama6ef0a62019-03-07 20:34:33 -050061 // 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_