Proposed interface for "Connection ID generators" that will allow different algorithms for different platforms that deploy QUICHE.

PiperOrigin-RevId: 465123243
diff --git a/build/source_list.bzl b/build/source_list.bzl
index cf43594..43d246d 100644
--- a/build/source_list.bzl
+++ b/build/source_list.bzl
@@ -133,6 +133,7 @@
     "quic/core/congestion_control/tcp_cubic_sender_bytes.h",
     "quic/core/congestion_control/uber_loss_algorithm.h",
     "quic/core/congestion_control/windowed_filter.h",
+    "quic/core/connection_id_generator.h",
     "quic/core/crypto/aead_base_decrypter.h",
     "quic/core/crypto/aead_base_encrypter.h",
     "quic/core/crypto/aes_128_gcm_12_decrypter.h",
diff --git a/build/source_list.gni b/build/source_list.gni
index 5845102..ba93bf9 100644
--- a/build/source_list.gni
+++ b/build/source_list.gni
@@ -133,6 +133,7 @@
     "src/quiche/quic/core/congestion_control/tcp_cubic_sender_bytes.h",
     "src/quiche/quic/core/congestion_control/uber_loss_algorithm.h",
     "src/quiche/quic/core/congestion_control/windowed_filter.h",
+    "src/quiche/quic/core/connection_id_generator.h",
     "src/quiche/quic/core/crypto/aead_base_decrypter.h",
     "src/quiche/quic/core/crypto/aead_base_encrypter.h",
     "src/quiche/quic/core/crypto/aes_128_gcm_12_decrypter.h",
diff --git a/build/source_list.json b/build/source_list.json
index f0ce0a7..e3b983c 100644
--- a/build/source_list.json
+++ b/build/source_list.json
@@ -132,6 +132,7 @@
     "quiche/quic/core/congestion_control/tcp_cubic_sender_bytes.h",
     "quiche/quic/core/congestion_control/uber_loss_algorithm.h",
     "quiche/quic/core/congestion_control/windowed_filter.h",
+    "quiche/quic/core/connection_id_generator.h",
     "quiche/quic/core/crypto/aead_base_decrypter.h",
     "quiche/quic/core/crypto/aead_base_encrypter.h",
     "quiche/quic/core/crypto/aes_128_gcm_12_decrypter.h",
diff --git a/quiche/quic/core/connection_id_generator.h b/quiche/quic/core/connection_id_generator.h
new file mode 100644
index 0000000..65284d8
--- /dev/null
+++ b/quiche/quic/core/connection_id_generator.h
@@ -0,0 +1,31 @@
+// 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.
+
+#ifndef QUICHE_QUIC_CORE_CONNECTION_ID_GENERATOR_H_
+#define QUICHE_QUIC_CORE_CONNECTION_ID_GENERATOR_H_
+
+#include "quiche/quic/core/quic_connection_id.h"
+#include "quiche/quic/core/quic_versions.h"
+
+namespace quic {
+
+class QUIC_EXPORT_PRIVATE ConnectionIdGeneratorInterface {
+  // Interface which is responsible for generating new connection IDs from an
+  // existing connection ID.
+ public:
+  // Generate a new connection ID for a given connection ID. Returns the new
+  // connection ID. If it cannot be generated for some reason, returns
+  // empty.
+  virtual absl::optional<QuicConnectionId> GenerateNextConnectionId(
+      const QuicConnectionId& original) = 0;
+  // Consider the client-generated server connection ID in the quic handshake
+  // and consider replacing it. Returns empty if not replaced.
+  virtual absl::optional<QuicConnectionId> MaybeReplaceConnectionId(
+      const QuicConnectionId& original, const ParsedQuicVersion& version) = 0;
+  virtual ~ConnectionIdGeneratorInterface() = default;
+};
+
+}  // namespace quic
+
+#endif  // QUICHE_QUIC_CORE_CONNECTION_ID_GENERATOR_H_