gfe-relnote: In QUIC, enable multiple packet number support in QuicFramer. Not used yet. Not protected.
PiperOrigin-RevId: 239686851
Change-Id: Ia2bb33e823fa4d80ad11366f8bc58079e39eeb47
diff --git a/quic/core/quic_utils.cc b/quic/core/quic_utils.cc
index d12ebeb..63b9b85 100644
--- a/quic/core/quic_utils.cc
+++ b/quic/core/quic_utils.cc
@@ -531,5 +531,23 @@
QuicEndian::NetToHost64(data_bytes[0]));
}
+// static
+PacketNumberSpace QuicUtils::GetPacketNumberSpace(
+ EncryptionLevel encryption_level) {
+ switch (encryption_level) {
+ case ENCRYPTION_INITIAL:
+ return INITIAL_DATA;
+ case ENCRYPTION_HANDSHAKE:
+ return HANDSHAKE_DATA;
+ case ENCRYPTION_ZERO_RTT:
+ case ENCRYPTION_FORWARD_SECURE:
+ return APPLICATION_DATA;
+ default:
+ QUIC_BUG << "Try to get packet number space of encryption level: "
+ << EncryptionLevelToString(encryption_level);
+ return NUM_PACKET_NUMBER_SPACES;
+ }
+}
+
#undef RETURN_STRING_LITERAL // undef for jumbo builds
} // namespace quic