Add ShouldUpdateExpectedConnectionIdLength to QuicFramer

ShouldUpdateExpectedConnectionIdLength allows clients of QuicDispatcher like Quartc to have the QuicFramer owned by the QuicDispatcher dynamically change its expected connection ID length based on received long header packets. This will allow quartc to migrate to 0-length connection IDs.

gfe-relnote: refactor-only, no behavior change, not flag protected
PiperOrigin-RevId: 237882443
Change-Id: If7a49b092e1ff29fec740a18bbb7c5b78d749d62
diff --git a/quic/core/quic_framer.h b/quic/core/quic_framer.h
index d6916f6..c18e9db 100644
--- a/quic/core/quic_framer.h
+++ b/quic/core/quic_framer.h
@@ -565,6 +565,14 @@
     return first_sending_packet_number_;
   }
 
+  // If true, QuicFramer will change its expected connection ID length
+  // to the received destination connection ID length of all IETF long headers.
+  void SetShouldUpdateExpectedConnectionIdLength(
+      bool should_update_expected_connection_id_length) {
+    should_update_expected_connection_id_length_ =
+        should_update_expected_connection_id_length;
+  }
+
  private:
   friend class test::QuicFramerPeer;
 
@@ -921,7 +929,11 @@
   // encode its length. This variable contains the length we expect to read.
   // This is also used to validate the long header connection ID lengths in
   // older versions of QUIC.
-  const uint8_t expected_connection_id_length_;
+  uint8_t expected_connection_id_length_;
+
+  // When this is true, QuicFramer will change expected_connection_id_length_
+  // to the received destination connection ID length of all IETF long headers.
+  bool should_update_expected_connection_id_length_;
 };
 
 }  // namespace quic