OLD | NEW |
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 Loading... |
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 ValidateClientHelloResultCallback::Result& result, | 128 scoped_refptr<ValidateClientHelloResultCallback::Result> result, |
129 std::unique_ptr<ProofSource::Details> proof_source_details, | 129 std::unique_ptr<ProofSource::Details> proof_source_details, |
130 CryptoHandshakeMessage* reply, | 130 CryptoHandshakeMessage* reply, |
131 DiversificationNonce* out_diversification_nonce, | 131 DiversificationNonce* out_diversification_nonce, |
132 std::string* error_details); | 132 std::string* error_details); |
133 | 133 |
134 // Hook that allows the server to set QuicConfig defaults just | 134 // Hook that allows the server to set QuicConfig defaults just |
135 // before going through the parameter negotiation step. | 135 // before going through the parameter negotiation step. |
136 virtual void OverrideQuicConfigDefaults(QuicConfig* config); | 136 virtual void OverrideQuicConfigDefaults(QuicConfig* config); |
137 | 137 |
138 private: | 138 private: |
139 friend class test::CryptoTestUtils; | 139 friend class test::CryptoTestUtils; |
140 friend class test::QuicCryptoServerStreamPeer; | 140 friend class test::QuicCryptoServerStreamPeer; |
141 | 141 |
142 class ValidateCallback : public ValidateClientHelloResultCallback { | 142 class ValidateCallback : public ValidateClientHelloResultCallback { |
143 public: | 143 public: |
144 explicit ValidateCallback(QuicCryptoServerStream* parent); | 144 explicit ValidateCallback(QuicCryptoServerStream* parent); |
145 // 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. |
146 void Cancel(); | 146 void Cancel(); |
147 | 147 |
148 // From ValidateClientHelloResultCallback | 148 // From ValidateClientHelloResultCallback |
149 void Run(std::unique_ptr<Result> result, | 149 void Run(scoped_refptr<Result> result, |
150 std::unique_ptr<ProofSource::Details> details) override; | 150 std::unique_ptr<ProofSource::Details> details) override; |
151 | 151 |
152 private: | 152 private: |
153 QuicCryptoServerStream* parent_; | 153 QuicCryptoServerStream* parent_; |
154 | 154 |
155 DISALLOW_COPY_AND_ASSIGN(ValidateCallback); | 155 DISALLOW_COPY_AND_ASSIGN(ValidateCallback); |
156 }; | 156 }; |
157 | 157 |
158 class SendServerConfigUpdateCallback | 158 class SendServerConfigUpdateCallback |
159 : public BuildServerConfigUpdateMessageResultCallback { | 159 : public BuildServerConfigUpdateMessageResultCallback { |
(...skipping 10 matching lines...) Expand all Loading... |
170 void Run(bool ok, const CryptoHandshakeMessage& message) override; | 170 void Run(bool ok, const CryptoHandshakeMessage& message) override; |
171 | 171 |
172 private: | 172 private: |
173 QuicCryptoServerStream* parent_; | 173 QuicCryptoServerStream* parent_; |
174 }; | 174 }; |
175 | 175 |
176 // Invoked by ValidateCallback::RunImpl once initial validation of | 176 // Invoked by ValidateCallback::RunImpl once initial validation of |
177 // the client hello is complete. Finishes processing of the client | 177 // the client hello is complete. Finishes processing of the client |
178 // hello message and handles handshake success/failure. | 178 // hello message and handles handshake success/failure. |
179 void FinishProcessingHandshakeMessage( | 179 void FinishProcessingHandshakeMessage( |
180 const ValidateClientHelloResultCallback::Result& result, | 180 scoped_refptr<ValidateClientHelloResultCallback::Result> result, |
181 std::unique_ptr<ProofSource::Details> details); | 181 std::unique_ptr<ProofSource::Details> details); |
182 | 182 |
183 // Invoked by SendServerConfigUpdateCallback::RunImpl once the proof has been | 183 // Invoked by SendServerConfigUpdateCallback::RunImpl once the proof has been |
184 // received. |ok| indicates whether or not the proof was successfully | 184 // received. |ok| indicates whether or not the proof was successfully |
185 // acquired, and |message| holds the partially-constructed message from | 185 // acquired, and |message| holds the partially-constructed message from |
186 // SendServerConfigUpdate. | 186 // SendServerConfigUpdate. |
187 void FinishSendServerConfigUpdate(bool ok, | 187 void FinishSendServerConfigUpdate(bool ok, |
188 const CryptoHandshakeMessage& message); | 188 const CryptoHandshakeMessage& message); |
189 | 189 |
190 // Returns a new ConnectionId to be used for statelessly rejected connections | 190 // Returns a new ConnectionId to be used for statelessly rejected connections |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 253 |
254 // Size of the packet containing the most recently received CHLO. | 254 // Size of the packet containing the most recently received CHLO. |
255 QuicByteCount chlo_packet_size_; | 255 QuicByteCount chlo_packet_size_; |
256 | 256 |
257 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream); | 257 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream); |
258 }; | 258 }; |
259 | 259 |
260 } // namespace net | 260 } // namespace net |
261 | 261 |
262 #endif // NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ | 262 #endif // NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ |
OLD | NEW |