| Index: net/quic/quic_crypto_server_stream.h
|
| diff --git a/net/quic/quic_crypto_server_stream.h b/net/quic/quic_crypto_server_stream.h
|
| index f3d9c928267ce449854d2ca2e7d4287b245689af..b07cef409b157c40aaab198ed65dace53795af68 100644
|
| --- a/net/quic/quic_crypto_server_stream.h
|
| +++ b/net/quic/quic_crypto_server_stream.h
|
| @@ -18,7 +18,7 @@ namespace net {
|
| class CachedNetworkParameters;
|
| class CryptoHandshakeMessage;
|
| class QuicCryptoServerConfig;
|
| -class QuicCryptoServerStream;
|
| +class QuicCryptoServerStreamBase;
|
| class QuicSession;
|
|
|
| namespace test {
|
| @@ -30,7 +30,7 @@ class QuicCryptoServerStreamPeer;
|
| // peer. At this point we disable HANDSHAKE_MODE in the sent packet manager.
|
| class NET_EXPORT_PRIVATE ServerHelloNotifier : public QuicAckListenerInterface {
|
| public:
|
| - explicit ServerHelloNotifier(QuicCryptoServerStream* stream)
|
| + explicit ServerHelloNotifier(QuicCryptoServerStreamBase* stream)
|
| : server_stream_(stream) {}
|
|
|
| void OnPacketAcked(int acked_bytes,
|
| @@ -41,65 +41,76 @@ class NET_EXPORT_PRIVATE ServerHelloNotifier : public QuicAckListenerInterface {
|
| private:
|
| ~ServerHelloNotifier() override {}
|
|
|
| - QuicCryptoServerStream* server_stream_;
|
| + QuicCryptoServerStreamBase* server_stream_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ServerHelloNotifier);
|
| };
|
|
|
| -class NET_EXPORT_PRIVATE QuicCryptoServerStream : public QuicCryptoStream {
|
| +// TODO(alyssar) see what can be moved out of QuicCryptoServerStream with
|
| +// various code and test refactoring.
|
| +class NET_EXPORT_PRIVATE QuicCryptoServerStreamBase : public QuicCryptoStream {
|
| public:
|
| // |crypto_config| must outlive the stream.
|
| - QuicCryptoServerStream(const QuicCryptoServerConfig* crypto_config,
|
| - QuicSession* session);
|
| - ~QuicCryptoServerStream() override;
|
| + explicit QuicCryptoServerStreamBase(QuicSession* session)
|
| + : QuicCryptoStream(session) {}
|
| + ~QuicCryptoServerStreamBase() override {}
|
|
|
| // Cancel any outstanding callbacks, such as asynchronous validation of client
|
| // hello.
|
| - void CancelOutstandingCallbacks();
|
| -
|
| - // CryptoFramerVisitorInterface implementation
|
| - void OnHandshakeMessage(const CryptoHandshakeMessage& message) override;
|
| + virtual void CancelOutstandingCallbacks() = 0;
|
|
|
| // GetBase64SHA256ClientChannelID sets |*output| to the base64 encoded,
|
| // SHA-256 hash of the client's ChannelID key and returns true, if the client
|
| // presented a ChannelID. Otherwise it returns false.
|
| - bool GetBase64SHA256ClientChannelID(std::string* output) const;
|
| + virtual bool GetBase64SHA256ClientChannelID(std::string* output) const = 0;
|
|
|
| - uint8 num_handshake_messages() const { return num_handshake_messages_; }
|
| -
|
| - uint8 num_handshake_messages_with_server_nonces() const {
|
| - return num_handshake_messages_with_server_nonces_;
|
| - }
|
| -
|
| - int num_server_config_update_messages_sent() const {
|
| - return num_server_config_update_messages_sent_;
|
| - }
|
| + virtual int NumServerConfigUpdateMessagesSent() const = 0;
|
|
|
| // Sends the latest server config and source-address token to the client.
|
| virtual void SendServerConfigUpdate(
|
| - const CachedNetworkParameters* cached_network_params);
|
| + const CachedNetworkParameters* cached_network_params) = 0;
|
|
|
| // Called by the ServerHello AckNotifier once the SHLO has been ACKed by the
|
| // client.
|
| - void OnServerHelloAcked();
|
| -
|
| - void set_previous_cached_network_params(
|
| - CachedNetworkParameters cached_network_params);
|
| -
|
| - const CachedNetworkParameters* previous_cached_network_params() const;
|
| -
|
| - bool use_stateless_rejects_if_peer_supported() const {
|
| - return use_stateless_rejects_if_peer_supported_;
|
| - }
|
| + virtual void OnServerHelloAcked() = 0;
|
| +
|
| + // These are all accessors and setters to their respective counters.
|
| + virtual uint8 NumHandshakeMessages() const = 0;
|
| + virtual uint8 NumHandshakeMessagesWithServerNonces() const = 0;
|
| + virtual bool UseStatelessRejectsIfPeerSupported() const = 0;
|
| + virtual bool PeerSupportsStatelessRejects() const = 0;
|
| + virtual void SetPeerSupportsStatelessRejects(bool set) = 0;
|
| + virtual const CachedNetworkParameters* PreviousCachedNetworkParams()
|
| + const = 0;
|
| + virtual void SetPreviousCachedNetworkParams(
|
| + CachedNetworkParameters cached_network_params) = 0;
|
| +};
|
|
|
| - bool peer_supports_stateless_rejects() const {
|
| - return peer_supports_stateless_rejects_;
|
| - }
|
| +class NET_EXPORT_PRIVATE QuicCryptoServerStream
|
| + : public QuicCryptoServerStreamBase {
|
| + public:
|
| + // |crypto_config| must outlive the stream.
|
| + QuicCryptoServerStream(const QuicCryptoServerConfig* crypto_config,
|
| + QuicSession* session);
|
| + ~QuicCryptoServerStream() override;
|
|
|
| - void set_peer_supports_stateless_rejects(
|
| - bool peer_supports_stateless_rejects) {
|
| - peer_supports_stateless_rejects_ = peer_supports_stateless_rejects;
|
| - }
|
| + // From QuicCryptoServerStreamBase
|
| + void CancelOutstandingCallbacks() override;
|
| + void OnHandshakeMessage(const CryptoHandshakeMessage& message) override;
|
| + bool GetBase64SHA256ClientChannelID(std::string* output) const override;
|
| + void SendServerConfigUpdate(
|
| + const CachedNetworkParameters* cached_network_params) override;
|
| + void OnServerHelloAcked() override;
|
| + uint8 NumHandshakeMessages() const override;
|
| + uint8 NumHandshakeMessagesWithServerNonces() const override;
|
| + int NumServerConfigUpdateMessagesSent() const override;
|
| + const CachedNetworkParameters* PreviousCachedNetworkParams() const override;
|
| + bool UseStatelessRejectsIfPeerSupported() const override;
|
| + bool PeerSupportsStatelessRejects() const override;
|
| + void SetPeerSupportsStatelessRejects(
|
| + bool peer_supports_stateless_rejects) override;
|
| + void SetPreviousCachedNetworkParams(
|
| + CachedNetworkParameters cached_network_params) override;
|
|
|
| protected:
|
| virtual QuicErrorCode ProcessClientHello(
|
|
|