Allow QUIC server to replace connection IDs
This CL changes the QuicDispatcher to have it replace the connection ID provided by the client if its length differs from what the dispatcher was configured with. It also changes QuicConnection on the client side to accept connection ID changes coming from the server, and replace its own connection ID to match what the server expects on outgoing packets. This checks VariableLengthConnectionIdAllowedForVersion() so it only impacts v99.
gfe-relnote: v99-only change, not flag protected
PiperOrigin-RevId: 239328650
Change-Id: I21ee0c0ca74c7624823c38a72f323ae6491e21e6
diff --git a/quic/core/quic_utils.h b/quic/core/quic_utils.h
index 9a052bd..709ea64 100644
--- a/quic/core/quic_utils.h
+++ b/quic/core/quic_utils.h
@@ -154,6 +154,15 @@
// Generates a random 64bit connection ID using the provided QuicRandom.
static QuicConnectionId CreateRandomConnectionId(QuicRandom* random);
+ // Generates a random connection ID of the given length.
+ static QuicConnectionId CreateRandomConnectionId(
+ uint8_t connection_id_length);
+
+ // Generates a random connection ID of the given length using the provided
+ // QuicRandom.
+ static QuicConnectionId CreateRandomConnectionId(uint8_t connection_id_length,
+ QuicRandom* random);
+
// Returns true if the QUIC version allows variable length connection IDs.
static bool VariableLengthConnectionIdAllowedForVersion(
QuicTransportVersion version);