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/tls_client_handshaker.cc b/quic/core/tls_client_handshaker.cc
index d6fc038..735fd3b 100644
--- a/quic/core/tls_client_handshaker.cc
+++ b/quic/core/tls_client_handshaker.cc
@@ -120,7 +120,8 @@
   params.google_quic_params->SetStringPiece(kUAID, user_agent_id_);
 
   std::vector<uint8_t> param_bytes;
-  return SerializeTransportParameters(params, &param_bytes) &&
+  return SerializeTransportParameters(session()->connection()->version(),
+                                      params, &param_bytes) &&
          SSL_set_quic_transport_params(ssl(), param_bytes.data(),
                                        param_bytes.size()) == 1;
 }
@@ -132,8 +133,9 @@
   size_t param_bytes_len;
   SSL_get_peer_quic_transport_params(ssl(), &param_bytes, &param_bytes_len);
   if (param_bytes_len == 0 ||
-      !ParseTransportParameters(param_bytes, param_bytes_len,
-                                Perspective::IS_SERVER, &params)) {
+      !ParseTransportParameters(session()->connection()->version(),
+                                Perspective::IS_SERVER, param_bytes,
+                                param_bytes_len, &params)) {
     *error_details = "Unable to parse Transport Parameters";
     return false;
   }