Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: net/quic/core/quic_crypto_server_stream.h

Issue 2875333002: Landing Recent QUIC changes until Mon May 8 21:42:46 2017 +0000 (Closed)
Patch Set: Created 3 years, 7 months 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 unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_connection_test.cc ('k') | net/quic/core/quic_crypto_server_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_QUIC_CORE_QUIC_CRYPTO_SERVER_STREAM_H_ 5 #ifndef NET_QUIC_CORE_QUIC_CRYPTO_SERVER_STREAM_H_
6 #define NET_QUIC_CORE_QUIC_CRYPTO_SERVER_STREAM_H_ 6 #define NET_QUIC_CORE_QUIC_CRYPTO_SERVER_STREAM_H_
7 7
8 #include <cstdint> 8 #include <cstdint>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 // Sends the latest server config and source-address token to the client. 51 // Sends the latest server config and source-address token to the client.
52 virtual void SendServerConfigUpdate( 52 virtual void SendServerConfigUpdate(
53 const CachedNetworkParameters* cached_network_params) = 0; 53 const CachedNetworkParameters* cached_network_params) = 0;
54 54
55 // These are all accessors and setters to their respective counters. 55 // These are all accessors and setters to their respective counters.
56 virtual uint8_t NumHandshakeMessages() const = 0; 56 virtual uint8_t NumHandshakeMessages() const = 0;
57 virtual uint8_t NumHandshakeMessagesWithServerNonces() const = 0; 57 virtual uint8_t NumHandshakeMessagesWithServerNonces() const = 0;
58 virtual bool UseStatelessRejectsIfPeerSupported() const = 0; 58 virtual bool UseStatelessRejectsIfPeerSupported() const = 0;
59 virtual bool PeerSupportsStatelessRejects() const = 0; 59 virtual bool PeerSupportsStatelessRejects() const = 0;
60 virtual bool ZeroRttAttempted() const = 0;
60 virtual void SetPeerSupportsStatelessRejects(bool set) = 0; 61 virtual void SetPeerSupportsStatelessRejects(bool set) = 0;
61 virtual const CachedNetworkParameters* PreviousCachedNetworkParams() 62 virtual const CachedNetworkParameters* PreviousCachedNetworkParams()
62 const = 0; 63 const = 0;
63 virtual void SetPreviousCachedNetworkParams( 64 virtual void SetPreviousCachedNetworkParams(
64 CachedNetworkParameters cached_network_params) = 0; 65 CachedNetworkParameters cached_network_params) = 0;
65 66
66 // Checks the options on the handshake-message to see whether the 67 // Checks the options on the handshake-message to see whether the
67 // peer supports stateless-rejects. 68 // peer supports stateless-rejects.
68 static bool DoesPeerSupportStatelessRejects( 69 static bool DoesPeerSupportStatelessRejects(
69 const CryptoHandshakeMessage& message); 70 const CryptoHandshakeMessage& message);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override; 106 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override;
106 bool GetBase64SHA256ClientChannelID(std::string* output) const override; 107 bool GetBase64SHA256ClientChannelID(std::string* output) const override;
107 void SendServerConfigUpdate( 108 void SendServerConfigUpdate(
108 const CachedNetworkParameters* cached_network_params) override; 109 const CachedNetworkParameters* cached_network_params) override;
109 uint8_t NumHandshakeMessages() const override; 110 uint8_t NumHandshakeMessages() const override;
110 uint8_t NumHandshakeMessagesWithServerNonces() const override; 111 uint8_t NumHandshakeMessagesWithServerNonces() const override;
111 int NumServerConfigUpdateMessagesSent() const override; 112 int NumServerConfigUpdateMessagesSent() const override;
112 const CachedNetworkParameters* PreviousCachedNetworkParams() const override; 113 const CachedNetworkParameters* PreviousCachedNetworkParams() const override;
113 bool UseStatelessRejectsIfPeerSupported() const override; 114 bool UseStatelessRejectsIfPeerSupported() const override;
114 bool PeerSupportsStatelessRejects() const override; 115 bool PeerSupportsStatelessRejects() const override;
116 bool ZeroRttAttempted() const override;
115 void SetPeerSupportsStatelessRejects( 117 void SetPeerSupportsStatelessRejects(
116 bool peer_supports_stateless_rejects) override; 118 bool peer_supports_stateless_rejects) override;
117 void SetPreviousCachedNetworkParams( 119 void SetPreviousCachedNetworkParams(
118 CachedNetworkParameters cached_network_params) override; 120 CachedNetworkParameters cached_network_params) override;
119 121
120 // NOTE: Indicating that the Expect-CT header should be sent here presents 122 // NOTE: Indicating that the Expect-CT header should be sent here presents
121 // a layering violation to some extent. The Expect-CT header only applies to 123 // a layering violation to some extent. The Expect-CT header only applies to
122 // HTTP connections, while this class can be used for non-HTTP applications. 124 // HTTP connections, while this class can be used for non-HTTP applications.
123 // However, it is exposed here because that is the only place where the 125 // However, it is exposed here because that is the only place where the
124 // configuration for the certificate used in the connection is accessible. 126 // configuration for the certificate used in the connection is accessible.
125 bool ShouldSendExpectCTHeader() const { 127 bool ShouldSendExpectCTHeader() const {
126 return signed_config_->proof.send_expect_ct_header; 128 return signed_config_->proof.send_expect_ct_header;
127 } 129 }
128 130
129 protected: 131 protected:
130 virtual void ProcessClientHello( 132 virtual void ProcessClientHello(
131 QuicReferenceCountedPointer<ValidateClientHelloResultCallback::Result> 133 QuicReferenceCountedPointer<ValidateClientHelloResultCallback::Result>
132 result, 134 result,
133 std::unique_ptr<ProofSource::Details> proof_source_details, 135 std::unique_ptr<ProofSource::Details> proof_source_details,
134 std::unique_ptr<ProcessClientHelloResultCallback> done_cb); 136 std::unique_ptr<ProcessClientHelloResultCallback> done_cb);
135 137
136 // Hook that allows the server to set QuicConfig defaults just 138 // Hook that allows the server to set QuicConfig defaults just
137 // before going through the parameter negotiation step. 139 // before going through the parameter negotiation step.
138 virtual void OverrideQuicConfigDefaults(QuicConfig* config); 140 virtual void OverrideQuicConfigDefaults(QuicConfig* config);
139 141
142 // Returns client address used to generate and validate source address token.
143 virtual const QuicSocketAddress GetClientAddress();
144
140 private: 145 private:
141 friend class test::QuicCryptoServerStreamPeer; 146 friend class test::QuicCryptoServerStreamPeer;
142 147
143 class ValidateCallback : public ValidateClientHelloResultCallback { 148 class ValidateCallback : public ValidateClientHelloResultCallback {
144 public: 149 public:
145 explicit ValidateCallback(QuicCryptoServerStream* parent); 150 explicit ValidateCallback(QuicCryptoServerStream* parent);
146 // To allow the parent to detach itself from the callback before deletion. 151 // To allow the parent to detach itself from the callback before deletion.
147 void Cancel(); 152 void Cancel();
148 153
149 // From ValidateClientHelloResultCallback 154 // From ValidateClientHelloResultCallback
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 // client supports them, as indicated by 258 // client supports them, as indicated by
254 // peer_supports_stateless_rejects_. 259 // peer_supports_stateless_rejects_.
255 bool use_stateless_rejects_if_peer_supported_; 260 bool use_stateless_rejects_if_peer_supported_;
256 261
257 // Set to true, once the server has received information from the 262 // Set to true, once the server has received information from the
258 // client that it supports stateless reject. 263 // client that it supports stateless reject.
259 // TODO(jokulik): Remove once client stateless reject support 264 // TODO(jokulik): Remove once client stateless reject support
260 // becomes the default. 265 // becomes the default.
261 bool peer_supports_stateless_rejects_; 266 bool peer_supports_stateless_rejects_;
262 267
268 // True if client attempts 0-rtt handshake (which can succeed or fail). If
269 // stateless rejects are used, this variable will be false for the stateless
270 // rejected connection and true for subsequent connections.
271 bool zero_rtt_attempted_;
272
263 // Size of the packet containing the most recently received CHLO. 273 // Size of the packet containing the most recently received CHLO.
264 QuicByteCount chlo_packet_size_; 274 QuicByteCount chlo_packet_size_;
265 275
266 // Pointer to the active callback that will receive the result of the client 276 // Pointer to the active callback that will receive the result of the client
267 // hello validation request and forward it to FinishProcessingHandshakeMessage 277 // hello validation request and forward it to FinishProcessingHandshakeMessage
268 // for processing. nullptr if no handshake message is being validated. Note 278 // for processing. nullptr if no handshake message is being validated. Note
269 // that this field is mutually exclusive with process_client_hello_cb_. 279 // that this field is mutually exclusive with process_client_hello_cb_.
270 ValidateCallback* validate_client_hello_cb_; 280 ValidateCallback* validate_client_hello_cb_;
271 281
272 // Pointer to the active callback which will receive the results of 282 // Pointer to the active callback which will receive the results of
273 // ProcessClientHello and forward it to 283 // ProcessClientHello and forward it to
274 // FinishProcessingHandshakeMessageAfterProcessClientHello. Note that this 284 // FinishProcessingHandshakeMessageAfterProcessClientHello. Note that this
275 // field is mutually exclusive with validate_client_hello_cb_. 285 // field is mutually exclusive with validate_client_hello_cb_.
276 ProcessClientHelloCallback* process_client_hello_cb_; 286 ProcessClientHelloCallback* process_client_hello_cb_;
277 287
278 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream); 288 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream);
279 }; 289 };
280 290
281 } // namespace net 291 } // namespace net
282 292
283 #endif // NET_QUIC_CORE_QUIC_CRYPTO_SERVER_STREAM_H_ 293 #endif // NET_QUIC_CORE_QUIC_CRYPTO_SERVER_STREAM_H_
OLDNEW
« no previous file with comments | « net/quic/core/quic_connection_test.cc ('k') | net/quic/core/quic_crypto_server_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698