| 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_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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // a layering violation to some extent. The Expect-CT header only applies to | 122 // a layering violation to some extent. The Expect-CT header only applies to |
| 123 // HTTP connections, while this class can be used for non-HTTP applications. | 123 // HTTP connections, while this class can be used for non-HTTP applications. |
| 124 // However, it is exposed here because that is the only place where the | 124 // However, it is exposed here because that is the only place where the |
| 125 // configuration for the certificate used in the connection is accessible. | 125 // configuration for the certificate used in the connection is accessible. |
| 126 bool ShouldSendExpectCTHeader() const { | 126 bool ShouldSendExpectCTHeader() const { |
| 127 return signed_config_->proof.send_expect_ct_header; | 127 return signed_config_->proof.send_expect_ct_header; |
| 128 } | 128 } |
| 129 | 129 |
| 130 protected: | 130 protected: |
| 131 virtual void ProcessClientHello( | 131 virtual void ProcessClientHello( |
| 132 scoped_refptr<ValidateClientHelloResultCallback::Result> result, | 132 QuicReferenceCountedPointer<ValidateClientHelloResultCallback::Result> |
| 133 result, |
| 133 std::unique_ptr<ProofSource::Details> proof_source_details, | 134 std::unique_ptr<ProofSource::Details> proof_source_details, |
| 134 std::unique_ptr<ProcessClientHelloResultCallback> done_cb); | 135 std::unique_ptr<ProcessClientHelloResultCallback> done_cb); |
| 135 | 136 |
| 136 // Hook that allows the server to set QuicConfig defaults just | 137 // Hook that allows the server to set QuicConfig defaults just |
| 137 // before going through the parameter negotiation step. | 138 // before going through the parameter negotiation step. |
| 138 virtual void OverrideQuicConfigDefaults(QuicConfig* config); | 139 virtual void OverrideQuicConfigDefaults(QuicConfig* config); |
| 139 | 140 |
| 140 private: | 141 private: |
| 141 friend class test::CryptoTestUtils; | 142 friend class test::CryptoTestUtils; |
| 142 friend class test::QuicCryptoServerStreamPeer; | 143 friend class test::QuicCryptoServerStreamPeer; |
| 143 | 144 |
| 144 class ValidateCallback : public ValidateClientHelloResultCallback { | 145 class ValidateCallback : public ValidateClientHelloResultCallback { |
| 145 public: | 146 public: |
| 146 explicit ValidateCallback(QuicCryptoServerStream* parent); | 147 explicit ValidateCallback(QuicCryptoServerStream* parent); |
| 147 // To allow the parent to detach itself from the callback before deletion. | 148 // To allow the parent to detach itself from the callback before deletion. |
| 148 void Cancel(); | 149 void Cancel(); |
| 149 | 150 |
| 150 // From ValidateClientHelloResultCallback | 151 // From ValidateClientHelloResultCallback |
| 151 void Run(scoped_refptr<Result> result, | 152 void Run(QuicReferenceCountedPointer<Result> result, |
| 152 std::unique_ptr<ProofSource::Details> details) override; | 153 std::unique_ptr<ProofSource::Details> details) override; |
| 153 | 154 |
| 154 private: | 155 private: |
| 155 QuicCryptoServerStream* parent_; | 156 QuicCryptoServerStream* parent_; |
| 156 | 157 |
| 157 DISALLOW_COPY_AND_ASSIGN(ValidateCallback); | 158 DISALLOW_COPY_AND_ASSIGN(ValidateCallback); |
| 158 }; | 159 }; |
| 159 | 160 |
| 160 class SendServerConfigUpdateCallback | 161 class SendServerConfigUpdateCallback |
| 161 : public BuildServerConfigUpdateMessageResultCallback { | 162 : public BuildServerConfigUpdateMessageResultCallback { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 172 void Run(bool ok, const CryptoHandshakeMessage& message) override; | 173 void Run(bool ok, const CryptoHandshakeMessage& message) override; |
| 173 | 174 |
| 174 private: | 175 private: |
| 175 QuicCryptoServerStream* parent_; | 176 QuicCryptoServerStream* parent_; |
| 176 }; | 177 }; |
| 177 | 178 |
| 178 // Invoked by ValidateCallback::RunImpl once initial validation of | 179 // Invoked by ValidateCallback::RunImpl once initial validation of |
| 179 // the client hello is complete. Finishes processing of the client | 180 // the client hello is complete. Finishes processing of the client |
| 180 // hello message and handles handshake success/failure. | 181 // hello message and handles handshake success/failure. |
| 181 void FinishProcessingHandshakeMessage( | 182 void FinishProcessingHandshakeMessage( |
| 182 scoped_refptr<ValidateClientHelloResultCallback::Result> result, | 183 QuicReferenceCountedPointer<ValidateClientHelloResultCallback::Result> |
| 184 result, |
| 183 std::unique_ptr<ProofSource::Details> details); | 185 std::unique_ptr<ProofSource::Details> details); |
| 184 | 186 |
| 185 class ProcessClientHelloCallback; | 187 class ProcessClientHelloCallback; |
| 186 friend class ProcessClientHelloCallback; | 188 friend class ProcessClientHelloCallback; |
| 187 | 189 |
| 188 // Portion of FinishProcessingHandshakeMessage which executes after | 190 // Portion of FinishProcessingHandshakeMessage which executes after |
| 189 // ProcessClientHello has been called. | 191 // ProcessClientHello has been called. |
| 190 void FinishProcessingHandshakeMessageAfterProcessClientHello( | 192 void FinishProcessingHandshakeMessageAfterProcessClientHello( |
| 191 const ValidateClientHelloResultCallback::Result& result, | 193 const ValidateClientHelloResultCallback::Result& result, |
| 192 QuicErrorCode error, | 194 QuicErrorCode error, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 208 | 210 |
| 209 // crypto_config_ contains crypto parameters for the handshake. | 211 // crypto_config_ contains crypto parameters for the handshake. |
| 210 const QuicCryptoServerConfig* crypto_config_; | 212 const QuicCryptoServerConfig* crypto_config_; |
| 211 | 213 |
| 212 // compressed_certs_cache_ contains a set of most recently compressed certs. | 214 // compressed_certs_cache_ contains a set of most recently compressed certs. |
| 213 // Owned by QuicDispatcher. | 215 // Owned by QuicDispatcher. |
| 214 QuicCompressedCertsCache* compressed_certs_cache_; | 216 QuicCompressedCertsCache* compressed_certs_cache_; |
| 215 | 217 |
| 216 // Server's certificate chain and signature of the server config, as provided | 218 // Server's certificate chain and signature of the server config, as provided |
| 217 // by ProofSource::GetProof. | 219 // by ProofSource::GetProof. |
| 218 scoped_refptr<QuicSignedServerConfig> signed_config_; | 220 QuicReferenceCountedPointer<QuicSignedServerConfig> signed_config_; |
| 219 | 221 |
| 220 // Hash of the last received CHLO message which can be used for generating | 222 // Hash of the last received CHLO message which can be used for generating |
| 221 // server config update messages. | 223 // server config update messages. |
| 222 std::string chlo_hash_; | 224 std::string chlo_hash_; |
| 223 | 225 |
| 224 // Pointer to the active callback that will receive the result of | 226 // Pointer to the active callback that will receive the result of |
| 225 // the client hello validation request and forward it to | 227 // the client hello validation request and forward it to |
| 226 // FinishProcessingHandshakeMessage for processing. nullptr if no | 228 // FinishProcessingHandshakeMessage for processing. nullptr if no |
| 227 // handshake message is being validated. | 229 // handshake message is being validated. |
| 228 ValidateCallback* validate_client_hello_cb_; | 230 ValidateCallback* validate_client_hello_cb_; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 // ProcessClientHello and forward it to | 275 // ProcessClientHello and forward it to |
| 274 // FinishProcessingHandshakeMessageAfterProcessClientHello. | 276 // FinishProcessingHandshakeMessageAfterProcessClientHello. |
| 275 ProcessClientHelloCallback* process_client_hello_cb_; | 277 ProcessClientHelloCallback* process_client_hello_cb_; |
| 276 | 278 |
| 277 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream); | 279 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream); |
| 278 }; | 280 }; |
| 279 | 281 |
| 280 } // namespace net | 282 } // namespace net |
| 281 | 283 |
| 282 #endif // NET_QUIC_CORE_QUIC_CRYPTO_SERVER_STREAM_H_ | 284 #endif // NET_QUIC_CORE_QUIC_CRYPTO_SERVER_STREAM_H_ |
| OLD | NEW |