blob: cd27811e15651e7b6f0880f77285746e2519f1a3 [file] [log] [blame]
// Copyright (c) 2022 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.
// A Connection ID generator that generates deterministic connection IDs for
// QUIC servers.
#include "quiche/quic/core/connection_id_generator.h"
namespace quic {
// Generates connection IDs deterministically from the provided original
// connection ID.
class QUIC_EXPORT_PRIVATE DeterministicConnectionIdGenerator
: public ConnectionIdGeneratorInterface {
DeterministicConnectionIdGenerator(uint8_t expected_connection_id_length);
// Hashes |original| to create a new connection ID.
absl::optional<QuicConnectionId> GenerateNextConnectionId(
const QuicConnectionId& original) override;
// Replace the connection ID if and only if |original| is not of the expected
// length.
absl::optional<QuicConnectionId> MaybeReplaceConnectionId(
const QuicConnectionId& original,
const ParsedQuicVersion& version) override;
const uint8_t expected_connection_id_length_;
} // namespace quic