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

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

Issue 2338013004: Simplify lifetime management of ValidateClientHelloResultCallback::Result objects (Closed)
Patch Set: Created 4 years, 3 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
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_QUIC_CRYPTO_SERVER_STREAM_H_ 5 #ifndef NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_
6 #define NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ 6 #define NET_QUIC_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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 const CachedNetworkParameters* PreviousCachedNetworkParams() const override; 118 const CachedNetworkParameters* PreviousCachedNetworkParams() const override;
119 bool UseStatelessRejectsIfPeerSupported() const override; 119 bool UseStatelessRejectsIfPeerSupported() const override;
120 bool PeerSupportsStatelessRejects() const override; 120 bool PeerSupportsStatelessRejects() const override;
121 void SetPeerSupportsStatelessRejects( 121 void SetPeerSupportsStatelessRejects(
122 bool peer_supports_stateless_rejects) override; 122 bool peer_supports_stateless_rejects) override;
123 void SetPreviousCachedNetworkParams( 123 void SetPreviousCachedNetworkParams(
124 CachedNetworkParameters cached_network_params) override; 124 CachedNetworkParameters cached_network_params) override;
125 125
126 protected: 126 protected:
127 virtual QuicErrorCode ProcessClientHello( 127 virtual QuicErrorCode ProcessClientHello(
128 const CryptoHandshakeMessage& message,
129 const ValidateClientHelloResultCallback::Result& result, 128 const ValidateClientHelloResultCallback::Result& result,
130 std::unique_ptr<ProofSource::Details> proof_source_details, 129 std::unique_ptr<ProofSource::Details> proof_source_details,
131 CryptoHandshakeMessage* reply, 130 CryptoHandshakeMessage* reply,
132 DiversificationNonce* out_diversification_nonce, 131 DiversificationNonce* out_diversification_nonce,
133 std::string* error_details); 132 std::string* error_details);
134 133
135 // Hook that allows the server to set QuicConfig defaults just 134 // Hook that allows the server to set QuicConfig defaults just
136 // before going through the parameter negotiation step. 135 // before going through the parameter negotiation step.
137 virtual void OverrideQuicConfigDefaults(QuicConfig* config); 136 virtual void OverrideQuicConfigDefaults(QuicConfig* config);
138 137
139 private: 138 private:
140 friend class test::CryptoTestUtils; 139 friend class test::CryptoTestUtils;
141 friend class test::QuicCryptoServerStreamPeer; 140 friend class test::QuicCryptoServerStreamPeer;
142 141
143 class ValidateCallback : public ValidateClientHelloResultCallback { 142 class ValidateCallback : public ValidateClientHelloResultCallback {
144 public: 143 public:
145 explicit ValidateCallback(QuicCryptoServerStream* parent); 144 explicit ValidateCallback(QuicCryptoServerStream* parent);
146 // To allow the parent to detach itself from the callback before deletion. 145 // To allow the parent to detach itself from the callback before deletion.
147 void Cancel(); 146 void Cancel();
148 147
149 // From ValidateClientHelloResultCallback 148 // From ValidateClientHelloResultCallback
150 void RunImpl(const CryptoHandshakeMessage& client_hello, 149 void RunImpl(std::unique_ptr<Result> result,
151 const Result& result,
152 std::unique_ptr<ProofSource::Details> details) override; 150 std::unique_ptr<ProofSource::Details> details) override;
153 151
154 private: 152 private:
155 QuicCryptoServerStream* parent_; 153 QuicCryptoServerStream* parent_;
156 154
157 DISALLOW_COPY_AND_ASSIGN(ValidateCallback); 155 DISALLOW_COPY_AND_ASSIGN(ValidateCallback);
158 }; 156 };
159 157
160 class SendServerConfigUpdateCallback 158 class SendServerConfigUpdateCallback
161 : public BuildServerConfigUpdateMessageResultCallback { 159 : public BuildServerConfigUpdateMessageResultCallback {
(...skipping 10 matching lines...) Expand all
172 void Run(bool ok, const CryptoHandshakeMessage& message) override; 170 void Run(bool ok, const CryptoHandshakeMessage& message) override;
173 171
174 private: 172 private:
175 QuicCryptoServerStream* parent_; 173 QuicCryptoServerStream* parent_;
176 }; 174 };
177 175
178 // Invoked by ValidateCallback::RunImpl once initial validation of 176 // Invoked by ValidateCallback::RunImpl once initial validation of
179 // the client hello is complete. Finishes processing of the client 177 // the client hello is complete. Finishes processing of the client
180 // hello message and handles handshake success/failure. 178 // hello message and handles handshake success/failure.
181 void FinishProcessingHandshakeMessage( 179 void FinishProcessingHandshakeMessage(
182 const CryptoHandshakeMessage& message,
183 const ValidateClientHelloResultCallback::Result& result, 180 const ValidateClientHelloResultCallback::Result& result,
184 std::unique_ptr<ProofSource::Details> details); 181 std::unique_ptr<ProofSource::Details> details);
185 182
186 // Invoked by SendServerConfigUpdateCallback::RunImpl once the proof has been 183 // Invoked by SendServerConfigUpdateCallback::RunImpl once the proof has been
187 // received. |ok| indicates whether or not the proof was successfully 184 // received. |ok| indicates whether or not the proof was successfully
188 // acquired, and |message| holds the partially-constructed message from 185 // acquired, and |message| holds the partially-constructed message from
189 // SendServerConfigUpdate. 186 // SendServerConfigUpdate.
190 void FinishSendServerConfigUpdate(bool ok, 187 void FinishSendServerConfigUpdate(bool ok,
191 const CryptoHandshakeMessage& message); 188 const CryptoHandshakeMessage& message);
192 189
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 253
257 // Size of the packet containing the most recently received CHLO. 254 // Size of the packet containing the most recently received CHLO.
258 QuicByteCount chlo_packet_size_; 255 QuicByteCount chlo_packet_size_;
259 256
260 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream); 257 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream);
261 }; 258 };
262 259
263 } // namespace net 260 } // namespace net
264 261
265 #endif // NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ 262 #endif // NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_
OLDNEW
« no previous file with comments | « net/quic/core/crypto/quic_crypto_server_config.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