Chromium Code Reviews
[email protected] (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Unified Diff: net/quic/quic_crypto_server_stream.h

Issue 1413613016: Factoring a QuicCryptoServerStreamBase API out of QuicCryptoServerStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@106845547
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_crypto_client_stream_test.cc ('k') | net/quic/quic_crypto_server_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..be70a62932e80d49c9dfbc856b499908221e65cf 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,75 @@ 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 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(
« no previous file with comments | « net/quic/quic_crypto_client_stream_test.cc ('k') | net/quic/quic_crypto_server_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698