Add LengthPrefixedConnectionId support to QuicDataReader and Writer
This is currently only used in v99 NEW_CONNECTION_ID frames but will soon be used to parse the new connection ID invariants
gfe-relnote: n/a, protected by disabled v99 flag
PiperOrigin-RevId: 258684056
Change-Id: I666d150b9392e195a073272d2c5e79bd970d5862
diff --git a/quic/core/quic_data_writer.cc b/quic/core/quic_data_writer.cc
index 42f1e4e..e01eb6c 100644
--- a/quic/core/quic_data_writer.cc
+++ b/quic/core/quic_data_writer.cc
@@ -181,6 +181,11 @@
return WriteBytes(connection_id.data(), connection_id.length());
}
+bool QuicDataWriter::WriteLengthPrefixedConnectionId(
+ QuicConnectionId connection_id) {
+ return WriteUInt8(connection_id.length()) && WriteConnectionId(connection_id);
+}
+
bool QuicDataWriter::WriteTag(uint32_t tag) {
return WriteBytes(&tag, sizeof(tag));
}