| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 bool PeerSupportsStatelessRejects() const override; | 117 bool PeerSupportsStatelessRejects() const override; |
| 118 void SetPeerSupportsStatelessRejects( | 118 void SetPeerSupportsStatelessRejects( |
| 119 bool peer_supports_stateless_rejects) override; | 119 bool peer_supports_stateless_rejects) override; |
| 120 void SetPreviousCachedNetworkParams( | 120 void SetPreviousCachedNetworkParams( |
| 121 CachedNetworkParameters cached_network_params) override; | 121 CachedNetworkParameters cached_network_params) override; |
| 122 | 122 |
| 123 protected: | 123 protected: |
| 124 virtual QuicErrorCode ProcessClientHello( | 124 virtual QuicErrorCode ProcessClientHello( |
| 125 const CryptoHandshakeMessage& message, | 125 const CryptoHandshakeMessage& message, |
| 126 const ValidateClientHelloResultCallback::Result& result, | 126 const ValidateClientHelloResultCallback::Result& result, |
| 127 std::unique_ptr<ProofSource::Details> proof_source_details, |
| 127 CryptoHandshakeMessage* reply, | 128 CryptoHandshakeMessage* reply, |
| 128 DiversificationNonce* out_diversification_nonce, | 129 DiversificationNonce* out_diversification_nonce, |
| 129 std::string* error_details); | 130 std::string* error_details); |
| 130 | 131 |
| 131 // Hook that allows the server to set QuicConfig defaults just | 132 // Hook that allows the server to set QuicConfig defaults just |
| 132 // before going through the parameter negotiation step. | 133 // before going through the parameter negotiation step. |
| 133 virtual void OverrideQuicConfigDefaults(QuicConfig* config); | 134 virtual void OverrideQuicConfigDefaults(QuicConfig* config); |
| 134 | 135 |
| 135 // Given the current connection_id, generates a new ConnectionId to | 136 // Given the current connection_id, generates a new ConnectionId to |
| 136 // be returned with a stateless reject. | 137 // be returned with a stateless reject. |
| 137 virtual QuicConnectionId GenerateConnectionIdForReject( | 138 virtual QuicConnectionId GenerateConnectionIdForReject( |
| 138 QuicConnectionId connection_id); | 139 QuicConnectionId connection_id); |
| 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 RunImpl(const CryptoHandshakeMessage& client_hello, | 152 void RunImpl(const CryptoHandshakeMessage& client_hello, |
| 152 const Result& result) override; | 153 const Result& result, |
| 154 std::unique_ptr<ProofSource::Details> details) override; |
| 153 | 155 |
| 154 private: | 156 private: |
| 155 QuicCryptoServerStream* parent_; | 157 QuicCryptoServerStream* parent_; |
| 156 | 158 |
| 157 DISALLOW_COPY_AND_ASSIGN(ValidateCallback); | 159 DISALLOW_COPY_AND_ASSIGN(ValidateCallback); |
| 158 }; | 160 }; |
| 159 | 161 |
| 160 class SendServerConfigUpdateCallback | 162 class SendServerConfigUpdateCallback |
| 161 : public BuildServerConfigUpdateMessageResultCallback { | 163 : public BuildServerConfigUpdateMessageResultCallback { |
| 162 public: | 164 public: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 173 | 175 |
| 174 private: | 176 private: |
| 175 QuicCryptoServerStream* parent_; | 177 QuicCryptoServerStream* parent_; |
| 176 }; | 178 }; |
| 177 | 179 |
| 178 // Invoked by ValidateCallback::RunImpl once initial validation of | 180 // Invoked by ValidateCallback::RunImpl once initial validation of |
| 179 // the client hello is complete. Finishes processing of the client | 181 // the client hello is complete. Finishes processing of the client |
| 180 // hello message and handles handshake success/failure. | 182 // hello message and handles handshake success/failure. |
| 181 void FinishProcessingHandshakeMessage( | 183 void FinishProcessingHandshakeMessage( |
| 182 const CryptoHandshakeMessage& message, | 184 const CryptoHandshakeMessage& message, |
| 183 const ValidateClientHelloResultCallback::Result& result); | 185 const ValidateClientHelloResultCallback::Result& result, |
| 186 std::unique_ptr<ProofSource::Details> details); |
| 184 | 187 |
| 185 // Invoked by SendServerConfigUpdateCallback::RunImpl once the proof has been | 188 // Invoked by SendServerConfigUpdateCallback::RunImpl once the proof has been |
| 186 // received. |ok| indicates whether or not the proof was successfully | 189 // received. |ok| indicates whether or not the proof was successfully |
| 187 // acquired, and |message| holds the partially-constructed message from | 190 // acquired, and |message| holds the partially-constructed message from |
| 188 // SendServerConfigUpdate. | 191 // SendServerConfigUpdate. |
| 189 void FinishSendServerConfigUpdate(bool ok, | 192 void FinishSendServerConfigUpdate(bool ok, |
| 190 const CryptoHandshakeMessage& message); | 193 const CryptoHandshakeMessage& message); |
| 191 | 194 |
| 192 // crypto_config_ contains crypto parameters for the handshake. | 195 // crypto_config_ contains crypto parameters for the handshake. |
| 193 const QuicCryptoServerConfig* crypto_config_; | 196 const QuicCryptoServerConfig* crypto_config_; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 // TODO(jokulik): Remove once client stateless reject support | 248 // TODO(jokulik): Remove once client stateless reject support |
| 246 // becomes the default. | 249 // becomes the default. |
| 247 bool peer_supports_stateless_rejects_; | 250 bool peer_supports_stateless_rejects_; |
| 248 | 251 |
| 249 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream); | 252 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream); |
| 250 }; | 253 }; |
| 251 | 254 |
| 252 } // namespace net | 255 } // namespace net |
| 253 | 256 |
| 254 #endif // NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ | 257 #endif // NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ |
| OLD | NEW |