Rename QuicCryptoServerHandshaker to QuicCryptoServerStream gfe-relnote: rename class. No behavior change. PiperOrigin-RevId: 297908757 Change-Id: I13c1d61d9289b9026ea3094333de69a327459e73
diff --git a/quic/core/http/quic_server_session_base_test.cc b/quic/core/http/quic_server_session_base_test.cc index e2f2898..ee5e8dc 100644 --- a/quic/core/http/quic_server_session_base_test.cc +++ b/quic/core/http/quic_server_session_base_test.cc
@@ -13,7 +13,7 @@ #include "net/third_party/quiche/src/quic/core/crypto/quic_random.h" #include "net/third_party/quiche/src/quic/core/proto/cached_network_parameters_proto.h" #include "net/third_party/quiche/src/quic/core/quic_connection.h" -#include "net/third_party/quiche/src/quic/core/quic_crypto_server_handshaker.h" +#include "net/third_party/quiche/src/quic/core/quic_crypto_server_stream.h" #include "net/third_party/quiche/src/quic/core/quic_crypto_server_stream_base.h" #include "net/third_party/quiche/src/quic/core/quic_utils.h" #include "net/third_party/quiche/src/quic/core/tls_server_handshaker.h" @@ -457,22 +457,21 @@ "ShouldCreateIncomingStream called when disconnected"); } -class MockQuicCryptoServerHandshaker : public QuicCryptoServerHandshaker { +class MockQuicCryptoServerStream : public QuicCryptoServerStream { public: - explicit MockQuicCryptoServerHandshaker( + explicit MockQuicCryptoServerStream( const QuicCryptoServerConfig* crypto_config, QuicCompressedCertsCache* compressed_certs_cache, QuicServerSessionBase* session, QuicCryptoServerStreamBase::Helper* helper) - : QuicCryptoServerHandshaker(crypto_config, - compressed_certs_cache, - session, - helper) {} - MockQuicCryptoServerHandshaker(const MockQuicCryptoServerHandshaker&) = + : QuicCryptoServerStream(crypto_config, + compressed_certs_cache, + session, + helper) {} + MockQuicCryptoServerStream(const MockQuicCryptoServerStream&) = delete; + MockQuicCryptoServerStream& operator=(const MockQuicCryptoServerStream&) = delete; - MockQuicCryptoServerHandshaker& operator=( - const MockQuicCryptoServerHandshaker&) = delete; - ~MockQuicCryptoServerHandshaker() override {} + ~MockQuicCryptoServerStream() override {} MOCK_METHOD1(SendServerConfigUpdate, void(const CachedNetworkParameters* cached_network_parameters)); @@ -518,11 +517,11 @@ /*is_static=*/true); } QuicServerSessionBasePeer::SetCryptoStream(session_.get(), nullptr); - MockQuicCryptoServerHandshaker* quic_crypto_stream = nullptr; + MockQuicCryptoServerStream* quic_crypto_stream = nullptr; MockTlsServerHandshaker* tls_server_stream = nullptr; if (session_->connection()->version().handshake_protocol == PROTOCOL_QUIC_CRYPTO) { - quic_crypto_stream = new MockQuicCryptoServerHandshaker( + quic_crypto_stream = new MockQuicCryptoServerStream( &crypto_config_, &compressed_certs_cache_, session_.get(), &stream_helper_); QuicServerSessionBasePeer::SetCryptoStream(session_.get(),
diff --git a/quic/core/quic_crypto_server_handshaker.cc b/quic/core/quic_crypto_server_stream.cc similarity index 84% rename from quic/core/quic_crypto_server_handshaker.cc rename to quic/core/quic_crypto_server_stream.cc index ba25c21..84fd42f 100644 --- a/quic/core/quic_crypto_server_handshaker.cc +++ b/quic/core/quic_crypto_server_stream.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "net/third_party/quiche/src/quic/core/quic_crypto_server_handshaker.h" +#include "net/third_party/quiche/src/quic/core/quic_crypto_server_stream.h" #include <memory> #include <string> @@ -14,11 +14,11 @@ namespace quic { -class QuicCryptoServerHandshaker::ProcessClientHelloCallback +class QuicCryptoServerStream::ProcessClientHelloCallback : public ProcessClientHelloResultCallback { public: ProcessClientHelloCallback( - QuicCryptoServerHandshaker* parent, + QuicCryptoServerStream* parent, const QuicReferenceCountedPointer< ValidateClientHelloResultCallback::Result>& result) : parent_(parent), result_(result) {} @@ -41,12 +41,12 @@ void Cancel() { parent_ = nullptr; } private: - QuicCryptoServerHandshaker* parent_; + QuicCryptoServerStream* parent_; QuicReferenceCountedPointer<ValidateClientHelloResultCallback::Result> result_; }; -QuicCryptoServerHandshaker::QuicCryptoServerHandshaker( +QuicCryptoServerStream::QuicCryptoServerStream( const QuicCryptoServerConfig* crypto_config, QuicCompressedCertsCache* compressed_certs_cache, QuicSession* session, @@ -72,11 +72,11 @@ one_rtt_packet_decrypted_(false), crypto_negotiated_params_(new QuicCryptoNegotiatedParameters) {} -QuicCryptoServerHandshaker::~QuicCryptoServerHandshaker() { +QuicCryptoServerStream::~QuicCryptoServerStream() { CancelOutstandingCallbacks(); } -void QuicCryptoServerHandshaker::CancelOutstandingCallbacks() { +void QuicCryptoServerStream::CancelOutstandingCallbacks() { // Detach from the validation callback. Calling this multiple times is safe. if (validate_client_hello_cb_ != nullptr) { validate_client_hello_cb_->Cancel(); @@ -92,7 +92,7 @@ } } -void QuicCryptoServerHandshaker::OnHandshakeMessage( +void QuicCryptoServerStream::OnHandshakeMessage( const CryptoHandshakeMessage& message) { QuicCryptoHandshaker::OnHandshakeMessage(message); ++num_handshake_messages_; @@ -134,7 +134,7 @@ session()->connection()->clock(), signed_config_, std::move(cb)); } -void QuicCryptoServerHandshaker::FinishProcessingHandshakeMessage( +void QuicCryptoServerStream::FinishProcessingHandshakeMessage( QuicReferenceCountedPointer<ValidateClientHelloResultCallback::Result> result, std::unique_ptr<ProofSource::Details> details) { @@ -149,7 +149,7 @@ ProcessClientHello(result, std::move(details), std::move(cb)); } -void QuicCryptoServerHandshaker:: +void QuicCryptoServerStream:: FinishProcessingHandshakeMessageAfterProcessClientHello( const ValidateClientHelloResultCallback::Result& result, QuicErrorCode error, @@ -226,7 +226,7 @@ delegate_->DiscardOldEncryptionKey(ENCRYPTION_INITIAL); } -void QuicCryptoServerHandshaker::SendServerConfigUpdate( +void QuicCryptoServerStream::SendServerConfigUpdate( const CachedNetworkParameters* cached_network_params) { if (!one_rtt_keys_available_) { return; @@ -250,16 +250,16 @@ *crypto_negotiated_params_, cached_network_params, std::move(cb)); } -QuicCryptoServerHandshaker::SendServerConfigUpdateCallback:: - SendServerConfigUpdateCallback(QuicCryptoServerHandshaker* parent) +QuicCryptoServerStream::SendServerConfigUpdateCallback:: + SendServerConfigUpdateCallback(QuicCryptoServerStream* parent) : parent_(parent) {} -void QuicCryptoServerHandshaker::SendServerConfigUpdateCallback::Cancel() { +void QuicCryptoServerStream::SendServerConfigUpdateCallback::Cancel() { parent_ = nullptr; } // From BuildServerConfigUpdateMessageResultCallback -void QuicCryptoServerHandshaker::SendServerConfigUpdateCallback::Run( +void QuicCryptoServerStream::SendServerConfigUpdateCallback::Run( bool ok, const CryptoHandshakeMessage& message) { if (parent_ == nullptr) { @@ -268,7 +268,7 @@ parent_->FinishSendServerConfigUpdate(ok, message); } -void QuicCryptoServerHandshaker::FinishSendServerConfigUpdate( +void QuicCryptoServerStream::FinishSendServerConfigUpdate( bool ok, const CryptoHandshakeMessage& message) { // Clear the callback that got us here. @@ -293,50 +293,49 @@ ++num_server_config_update_messages_sent_; } -uint8_t QuicCryptoServerHandshaker::NumHandshakeMessages() const { +uint8_t QuicCryptoServerStream::NumHandshakeMessages() const { return num_handshake_messages_; } -uint8_t QuicCryptoServerHandshaker::NumHandshakeMessagesWithServerNonces() - const { +uint8_t QuicCryptoServerStream::NumHandshakeMessagesWithServerNonces() const { return num_handshake_messages_with_server_nonces_; } -int QuicCryptoServerHandshaker::NumServerConfigUpdateMessagesSent() const { +int QuicCryptoServerStream::NumServerConfigUpdateMessagesSent() const { return num_server_config_update_messages_sent_; } const CachedNetworkParameters* -QuicCryptoServerHandshaker::PreviousCachedNetworkParams() const { +QuicCryptoServerStream::PreviousCachedNetworkParams() const { return previous_cached_network_params_.get(); } -bool QuicCryptoServerHandshaker::ZeroRttAttempted() const { +bool QuicCryptoServerStream::ZeroRttAttempted() const { return zero_rtt_attempted_; } -void QuicCryptoServerHandshaker::SetPreviousCachedNetworkParams( +void QuicCryptoServerStream::SetPreviousCachedNetworkParams( CachedNetworkParameters cached_network_params) { previous_cached_network_params_.reset( new CachedNetworkParameters(cached_network_params)); } -void QuicCryptoServerHandshaker::OnPacketDecrypted(EncryptionLevel level) { +void QuicCryptoServerStream::OnPacketDecrypted(EncryptionLevel level) { if (level == ENCRYPTION_FORWARD_SECURE) { one_rtt_packet_decrypted_ = true; delegate_->NeuterHandshakeData(); } } -void QuicCryptoServerHandshaker::OnHandshakeDoneReceived() { +void QuicCryptoServerStream::OnHandshakeDoneReceived() { DCHECK(false); } -bool QuicCryptoServerHandshaker::ShouldSendExpectCTHeader() const { +bool QuicCryptoServerStream::ShouldSendExpectCTHeader() const { return signed_config_->proof.send_expect_ct_header; } -bool QuicCryptoServerHandshaker::GetBase64SHA256ClientChannelID( +bool QuicCryptoServerStream::GetBase64SHA256ClientChannelID( std::string* output) const { if (!encryption_established() || crypto_negotiated_params_->channel_id.empty()) { @@ -353,33 +352,33 @@ return true; } -bool QuicCryptoServerHandshaker::encryption_established() const { +bool QuicCryptoServerStream::encryption_established() const { return encryption_established_; } -bool QuicCryptoServerHandshaker::one_rtt_keys_available() const { +bool QuicCryptoServerStream::one_rtt_keys_available() const { return one_rtt_keys_available_; } const QuicCryptoNegotiatedParameters& -QuicCryptoServerHandshaker::crypto_negotiated_params() const { +QuicCryptoServerStream::crypto_negotiated_params() const { return *crypto_negotiated_params_; } -CryptoMessageParser* QuicCryptoServerHandshaker::crypto_message_parser() { +CryptoMessageParser* QuicCryptoServerStream::crypto_message_parser() { return QuicCryptoHandshaker::crypto_message_parser(); } -HandshakeState QuicCryptoServerHandshaker::GetHandshakeState() const { +HandshakeState QuicCryptoServerStream::GetHandshakeState() const { return one_rtt_packet_decrypted_ ? HANDSHAKE_COMPLETE : HANDSHAKE_START; } -size_t QuicCryptoServerHandshaker::BufferSizeLimitForLevel( +size_t QuicCryptoServerStream::BufferSizeLimitForLevel( EncryptionLevel level) const { return QuicCryptoHandshaker::BufferSizeLimitForLevel(level); } -void QuicCryptoServerHandshaker::ProcessClientHello( +void QuicCryptoServerStream::ProcessClientHello( QuicReferenceCountedPointer<ValidateClientHelloResultCallback::Result> result, std::unique_ptr<ProofSource::Details> /*proof_source_details*/, @@ -422,18 +421,18 @@ chlo_packet_size_, std::move(done_cb)); } -void QuicCryptoServerHandshaker::OverrideQuicConfigDefaults( +void QuicCryptoServerStream::OverrideQuicConfigDefaults( QuicConfig* /*config*/) {} -QuicCryptoServerHandshaker::ValidateCallback::ValidateCallback( - QuicCryptoServerHandshaker* parent) +QuicCryptoServerStream::ValidateCallback::ValidateCallback( + QuicCryptoServerStream* parent) : parent_(parent) {} -void QuicCryptoServerHandshaker::ValidateCallback::Cancel() { +void QuicCryptoServerStream::ValidateCallback::Cancel() { parent_ = nullptr; } -void QuicCryptoServerHandshaker::ValidateCallback::Run( +void QuicCryptoServerStream::ValidateCallback::Run( QuicReferenceCountedPointer<Result> result, std::unique_ptr<ProofSource::Details> details) { if (parent_ != nullptr) { @@ -442,7 +441,7 @@ } } -const QuicSocketAddress QuicCryptoServerHandshaker::GetClientAddress() { +const QuicSocketAddress QuicCryptoServerStream::GetClientAddress() { return session()->connection()->peer_address(); }
diff --git a/quic/core/quic_crypto_server_handshaker.h b/quic/core/quic_crypto_server_stream.h similarity index 89% rename from quic/core/quic_crypto_server_handshaker.h rename to quic/core/quic_crypto_server_stream.h index 2b85a9f..2dc04a4 100644 --- a/quic/core/quic_crypto_server_handshaker.h +++ b/quic/core/quic_crypto_server_stream.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef QUICHE_QUIC_CORE_QUIC_CRYPTO_SERVER_HANDSHAKER_H_ -#define QUICHE_QUIC_CORE_QUIC_CRYPTO_SERVER_HANDSHAKER_H_ +#ifndef QUICHE_QUIC_CORE_QUIC_CRYPTO_SERVER_STREAM_H_ +#define QUICHE_QUIC_CORE_QUIC_CRYPTO_SERVER_STREAM_H_ #include <string> @@ -20,16 +20,14 @@ class QuicCryptoServerStreamPeer; } // namespace test -// TODO(nharper): Rename this class to QuicCryptoServerStream. -class QUIC_EXPORT_PRIVATE QuicCryptoServerHandshaker +class QUIC_EXPORT_PRIVATE QuicCryptoServerStream : public QuicCryptoServerStreamBase, public QuicCryptoHandshaker { public: - QuicCryptoServerHandshaker(const QuicCryptoServerHandshaker&) = delete; - QuicCryptoServerHandshaker& operator=(const QuicCryptoServerHandshaker&) = - delete; + QuicCryptoServerStream(const QuicCryptoServerStream&) = delete; + QuicCryptoServerStream& operator=(const QuicCryptoServerStream&) = delete; - ~QuicCryptoServerHandshaker() override; + ~QuicCryptoServerStream() override; // From HandshakerInterface void CancelOutstandingCallbacks() override; @@ -70,10 +68,10 @@ // |crypto_config| must outlive the stream. // |session| must outlive the stream. // |helper| must outlive the stream. - QuicCryptoServerHandshaker(const QuicCryptoServerConfig* crypto_config, - QuicCompressedCertsCache* compressed_certs_cache, - QuicSession* session, - QuicCryptoServerStreamBase::Helper* helper); + QuicCryptoServerStream(const QuicCryptoServerConfig* crypto_config, + QuicCompressedCertsCache* compressed_certs_cache, + QuicSession* session, + QuicCryptoServerStreamBase::Helper* helper); virtual void ProcessClientHello( QuicReferenceCountedPointer<ValidateClientHelloResultCallback::Result> @@ -105,7 +103,7 @@ class QUIC_EXPORT_PRIVATE ValidateCallback : public ValidateClientHelloResultCallback { public: - explicit ValidateCallback(QuicCryptoServerHandshaker* parent); + explicit ValidateCallback(QuicCryptoServerStream* parent); ValidateCallback(const ValidateCallback&) = delete; ValidateCallback& operator=(const ValidateCallback&) = delete; // To allow the parent to detach itself from the callback before deletion. @@ -116,13 +114,13 @@ std::unique_ptr<ProofSource::Details> details) override; private: - QuicCryptoServerHandshaker* parent_; + QuicCryptoServerStream* parent_; }; class SendServerConfigUpdateCallback : public BuildServerConfigUpdateMessageResultCallback { public: - explicit SendServerConfigUpdateCallback(QuicCryptoServerHandshaker* parent); + explicit SendServerConfigUpdateCallback(QuicCryptoServerStream* parent); SendServerConfigUpdateCallback(const SendServerConfigUpdateCallback&) = delete; void operator=(const SendServerConfigUpdateCallback&) = delete; @@ -134,7 +132,7 @@ void Run(bool ok, const CryptoHandshakeMessage& message) override; private: - QuicCryptoServerHandshaker* parent_; + QuicCryptoServerStream* parent_; }; // Invoked by ValidateCallback::RunImpl once initial validation of @@ -243,4 +241,4 @@ } // namespace quic -#endif // QUICHE_QUIC_CORE_QUIC_CRYPTO_SERVER_HANDSHAKER_H_ +#endif // QUICHE_QUIC_CORE_QUIC_CRYPTO_SERVER_STREAM_H_
diff --git a/quic/core/quic_crypto_server_stream_base.cc b/quic/core/quic_crypto_server_stream_base.cc index b931783..0a77ca7 100644 --- a/quic/core/quic_crypto_server_stream_base.cc +++ b/quic/core/quic_crypto_server_stream_base.cc
@@ -14,7 +14,7 @@ #include "net/third_party/quiche/src/quic/core/crypto/quic_random.h" #include "net/third_party/quiche/src/quic/core/proto/cached_network_parameters_proto.h" #include "net/third_party/quiche/src/quic/core/quic_config.h" -#include "net/third_party/quiche/src/quic/core/quic_crypto_server_handshaker.h" +#include "net/third_party/quiche/src/quic/core/quic_crypto_server_stream.h" #include "net/third_party/quiche/src/quic/core/quic_packets.h" #include "net/third_party/quiche/src/quic/core/quic_session.h" #include "net/third_party/quiche/src/quic/core/tls_server_handshaker.h" @@ -34,9 +34,8 @@ QuicCryptoServerStreamBase::Helper* helper) { switch (session->connection()->version().handshake_protocol) { case PROTOCOL_QUIC_CRYPTO: - return std::unique_ptr<QuicCryptoServerHandshaker>( - new QuicCryptoServerHandshaker(crypto_config, compressed_certs_cache, - session, helper)); + return std::unique_ptr<QuicCryptoServerStream>(new QuicCryptoServerStream( + crypto_config, compressed_certs_cache, session, helper)); case PROTOCOL_TLS1_3: return std::unique_ptr<TlsServerHandshaker>(new TlsServerHandshaker( session, crypto_config->ssl_ctx(), crypto_config->proof_source()));
diff --git a/quic/tools/quic_simple_server_session_test.cc b/quic/tools/quic_simple_server_session_test.cc index 0315c86..8265dde 100644 --- a/quic/tools/quic_simple_server_session_test.cc +++ b/quic/tools/quic_simple_server_session_test.cc
@@ -13,7 +13,7 @@ #include "net/third_party/quiche/src/quic/core/http/http_encoder.h" #include "net/third_party/quiche/src/quic/core/proto/cached_network_parameters_proto.h" #include "net/third_party/quiche/src/quic/core/quic_connection.h" -#include "net/third_party/quiche/src/quic/core/quic_crypto_server_handshaker.h" +#include "net/third_party/quiche/src/quic/core/quic_crypto_server_stream.h" #include "net/third_party/quiche/src/quic/core/quic_utils.h" #include "net/third_party/quiche/src/quic/core/quic_versions.h" #include "net/third_party/quiche/src/quic/core/tls_server_handshaker.h" @@ -79,22 +79,21 @@ const size_t kMaxStreamsForTest = 10; -class MockQuicCryptoServerHandshaker : public QuicCryptoServerHandshaker { +class MockQuicCryptoServerStream : public QuicCryptoServerStream { public: - explicit MockQuicCryptoServerHandshaker( + explicit MockQuicCryptoServerStream( const QuicCryptoServerConfig* crypto_config, QuicCompressedCertsCache* compressed_certs_cache, QuicSession* session, QuicCryptoServerStreamBase::Helper* helper) - : QuicCryptoServerHandshaker(crypto_config, - compressed_certs_cache, - session, - helper) {} - MockQuicCryptoServerHandshaker(const MockQuicCryptoServerHandshaker&) = + : QuicCryptoServerStream(crypto_config, + compressed_certs_cache, + session, + helper) {} + MockQuicCryptoServerStream(const MockQuicCryptoServerStream&) = delete; + MockQuicCryptoServerStream& operator=(const MockQuicCryptoServerStream&) = delete; - MockQuicCryptoServerHandshaker& operator=( - const MockQuicCryptoServerHandshaker&) = delete; - ~MockQuicCryptoServerHandshaker() override {} + ~MockQuicCryptoServerStream() override {} MOCK_METHOD1(SendServerConfigUpdate, void(const CachedNetworkParameters* cached_network_parameters)); @@ -125,7 +124,7 @@ QuicCryptoServerStreamBase::Helper* helper) { switch (session->connection()->version().handshake_protocol) { case PROTOCOL_QUIC_CRYPTO: - return new MockQuicCryptoServerHandshaker( + return new MockQuicCryptoServerStream( crypto_config, compressed_certs_cache, session, helper); case PROTOCOL_TLS1_3: return new MockTlsServerHandshaker(session, crypto_config->ssl_ctx(),