Move CongestionControlTypeToString() into quic_types.h header
It will be used for logging CC type in Chromium (<https://bugs.chromium.org/p/chromium/issues/detail?id=1291452>).
PiperOrigin-RevId: 454664733
diff --git a/quiche/quic/core/congestion_control/send_algorithm_test.cc b/quiche/quic/core/congestion_control/send_algorithm_test.cc
index 21af4f1..76e61a3 100644
--- a/quiche/quic/core/congestion_control/send_algorithm_test.cc
+++ b/quiche/quic/core/congestion_control/send_algorithm_test.cc
@@ -102,22 +102,6 @@
const QuicTime::Delta kTestLinkSmallRTTDelay =
QuicTime::Delta::FromMilliseconds(10);
-const char* CongestionControlTypeToString(CongestionControlType cc_type) {
- switch (cc_type) {
- case kCubicBytes:
- return "CUBIC_BYTES";
- case kRenoBytes:
- return "RENO_BYTES";
- case kBBR:
- return "BBR";
- case kPCC:
- return "PCC";
- default:
- QUIC_DLOG(FATAL) << "Unexpected CongestionControlType";
- return nullptr;
- }
-}
-
struct TestParams {
explicit TestParams(CongestionControlType congestion_control_type)
: congestion_control_type(congestion_control_type) {}
diff --git a/quiche/quic/core/quic_types.cc b/quiche/quic/core/quic_types.cc
index 62760c9..6e74dd7 100644
--- a/quiche/quic/core/quic_types.cc
+++ b/quiche/quic/core/quic_types.cc
@@ -307,6 +307,24 @@
return os;
}
+std::string CongestionControlTypeToString(CongestionControlType cc_type) {
+ switch (cc_type) {
+ case kCubicBytes:
+ return "CUBIC_BYTES";
+ case kRenoBytes:
+ return "RENO_BYTES";
+ case kBBR:
+ return "BBR";
+ case kBBRv2:
+ return "BBRv2";
+ case kPCC:
+ return "PCC";
+ case kGoogCC:
+ return "GoogCC";
+ }
+ return absl::StrCat("Unknown(", static_cast<int>(cc_type), ")");
+}
+
std::string EncryptionLevelToString(EncryptionLevel level) {
switch (level) {
RETURN_STRING_LITERAL(ENCRYPTION_INITIAL);
diff --git a/quiche/quic/core/quic_types.h b/quiche/quic/core/quic_types.h
index c79633c..b0992c8 100644
--- a/quiche/quic/core/quic_types.h
+++ b/quiche/quic/core/quic_types.h
@@ -452,6 +452,9 @@
kBBRv2,
};
+QUIC_EXPORT_PRIVATE std::string CongestionControlTypeToString(
+ CongestionControlType cc_type);
+
// EncryptionLevel enumerates the stages of encryption that a QUIC connection
// progresses through. When retransmitting a packet, the encryption level needs
// to be specified so that it is retransmitted at a level which the peer can