Add client connection ID methods to quic_packets gfe-relnote: n/a, adds new currently unused methods PiperOrigin-RevId: 250704882 Change-Id: I0205e7638c229df39c1bb60661433c34adec5f84
diff --git a/quic/core/quic_packets.cc b/quic/core/quic_packets.cc index 57bda54..738cc6e 100644 --- a/quic/core/quic_packets.cc +++ b/quic/core/quic_packets.cc
@@ -27,6 +27,16 @@ return header.source_connection_id; } +QuicConnectionId GetClientConnectionIdAsRecipient( + const QuicPacketHeader& header, + Perspective perspective) { + DCHECK(GetQuicRestartFlag(quic_do_not_override_connection_id)); + if (perspective == Perspective::IS_CLIENT) { + return header.destination_connection_id; + } + return header.source_connection_id; +} + QuicConnectionId GetServerConnectionIdAsSender(const QuicPacketHeader& header, Perspective perspective) { if (perspective == Perspective::IS_CLIENT || @@ -48,6 +58,16 @@ return header.source_connection_id_included; } +QuicConnectionId GetClientConnectionIdAsSender(const QuicPacketHeader& header, + Perspective perspective) { + if (perspective == Perspective::IS_CLIENT || + !GetQuicRestartFlag(quic_do_not_override_connection_id)) { + return header.source_connection_id; + } + QUIC_RESTART_FLAG_COUNT_N(quic_do_not_override_connection_id, 3, 5); + return header.destination_connection_id; +} + QuicConnectionIdIncluded GetClientConnectionIdIncludedAsSender( const QuicPacketHeader& header, Perspective perspective) {