Introduce IsConnectionIdLengthValidForVersion
This CL is part of a larger change to allow the new connection ID invariants. It adds a new method QuicUtils::IsConnectionIdLengthValidForVersion() whose goal will be to replace uses of kQuicMaxConnectionIdLength in the codebase. This CL also plumbs the QUIC version to the TLS transport parameter parse/serialize code so it can call IsConnectionIdLengthValidForVersion. I suspect the transport parameter code will eventually need the version anyway as we create more QUIC versions that support TLS.
gfe-relnote: refactor, protected by disabled quic_enable_v47 flag.
PiperOrigin-RevId: 260938227
Change-Id: I590f7117de2b245044469e6dcdcca6f503c7a625
diff --git a/quic/core/crypto/transport_parameters.h b/quic/core/crypto/transport_parameters.h
index 368a7bf..95a01da 100644
--- a/quic/core/crypto/transport_parameters.h
+++ b/quic/core/crypto/transport_parameters.h
@@ -185,6 +185,7 @@
// TLS extension. The serialized bytes are written to |*out|. Returns if the
// parameters are valid and serialization succeeded.
QUIC_EXPORT_PRIVATE bool SerializeTransportParameters(
+ ParsedQuicVersion version,
const TransportParameters& in,
std::vector<uint8_t>* out);
@@ -193,9 +194,10 @@
// |perspective| indicates whether the input came from a client or a server.
// This method returns true if the input was successfully parsed.
// TODO(nharper): Write fuzz tests for this method.
-QUIC_EXPORT_PRIVATE bool ParseTransportParameters(const uint8_t* in,
- size_t in_len,
+QUIC_EXPORT_PRIVATE bool ParseTransportParameters(ParsedQuicVersion version,
Perspective perspective,
+ const uint8_t* in,
+ size_t in_len,
TransportParameters* out);
} // namespace quic