Add varz for QUIC 0-RTT acceptance/rejection reasons PiperOrigin-RevId: 332327315 Change-Id: Id6f5304135042ccbe28c55c2317d68efc299dfcf
diff --git a/quic/core/crypto/crypto_utils.cc b/quic/core/crypto/crypto_utils.cc index fe1a5ee..365fb12 100644 --- a/quic/core/crypto/crypto_utils.cc +++ b/quic/core/crypto/crypto_utils.cc
@@ -691,6 +691,30 @@ } // static +const char* CryptoUtils::EarlyDataReasonToString( + ssl_early_data_reason_t reason) { + switch (reason) { + RETURN_STRING_LITERAL(ssl_early_data_unknown); + RETURN_STRING_LITERAL(ssl_early_data_disabled); + RETURN_STRING_LITERAL(ssl_early_data_accepted); + RETURN_STRING_LITERAL(ssl_early_data_protocol_version); + RETURN_STRING_LITERAL(ssl_early_data_peer_declined); + RETURN_STRING_LITERAL(ssl_early_data_no_session_offered); + RETURN_STRING_LITERAL(ssl_early_data_session_not_resumed); + RETURN_STRING_LITERAL(ssl_early_data_unsupported_for_session); + RETURN_STRING_LITERAL(ssl_early_data_hello_retry_request); + RETURN_STRING_LITERAL(ssl_early_data_alpn_mismatch); + RETURN_STRING_LITERAL(ssl_early_data_channel_id); + RETURN_STRING_LITERAL(ssl_early_data_token_binding); + RETURN_STRING_LITERAL(ssl_early_data_ticket_age_skew); + RETURN_STRING_LITERAL(ssl_early_data_quic_parameter_mismatch); + } + QUIC_BUG_IF(reason < 0 || reason > ssl_early_data_reason_max_value) + << "Unknown ssl_early_data_reason_t " << reason; + return "unknown ssl_early_data_reason_t"; +} + +// static std::string CryptoUtils::HashHandshakeMessage( const CryptoHandshakeMessage& message, Perspective /*perspective*/) {
diff --git a/quic/core/crypto/crypto_utils.h b/quic/core/crypto/crypto_utils.h index 6c167f8..964f81f 100644 --- a/quic/core/crypto/crypto_utils.h +++ b/quic/core/crypto/crypto_utils.h
@@ -12,6 +12,7 @@ #include <string> #include "third_party/boringssl/src/include/openssl/evp.h" +#include "third_party/boringssl/src/include/openssl/ssl.h" #include "net/third_party/quiche/src/quic/core/crypto/crypto_handshake.h" #include "net/third_party/quiche/src/quic/core/crypto/crypto_handshake_message.h" #include "net/third_party/quiche/src/quic/core/crypto/crypto_protocol.h" @@ -211,6 +212,9 @@ static const char* HandshakeFailureReasonToString( HandshakeFailureReason reason); + // Returns the name of an ssl_early_data_reason_t as a char* + static const char* EarlyDataReasonToString(ssl_early_data_reason_t reason); + // Returns a hash of the serialized |message|. static std::string HashHandshakeMessage(const CryptoHandshakeMessage& message, Perspective perspective);