| 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 <stdint.h> |
| 9 |
| 8 #include <string> | 10 #include <string> |
| 9 | 11 |
| 12 #include "base/macros.h" |
| 10 #include "net/quic/crypto/crypto_handshake.h" | 13 #include "net/quic/crypto/crypto_handshake.h" |
| 11 #include "net/quic/crypto/quic_crypto_server_config.h" | 14 #include "net/quic/crypto/quic_crypto_server_config.h" |
| 12 #include "net/quic/proto/source_address_token.pb.h" | 15 #include "net/quic/proto/source_address_token.pb.h" |
| 13 #include "net/quic/quic_config.h" | 16 #include "net/quic/quic_config.h" |
| 14 #include "net/quic/quic_crypto_stream.h" | 17 #include "net/quic/quic_crypto_stream.h" |
| 15 | 18 |
| 16 namespace net { | 19 namespace net { |
| 17 | 20 |
| 18 class CachedNetworkParameters; | 21 class CachedNetworkParameters; |
| 19 class CryptoHandshakeMessage; | 22 class CryptoHandshakeMessage; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 71 |
| 69 // Sends the latest server config and source-address token to the client. | 72 // Sends the latest server config and source-address token to the client. |
| 70 virtual void SendServerConfigUpdate( | 73 virtual void SendServerConfigUpdate( |
| 71 const CachedNetworkParameters* cached_network_params) = 0; | 74 const CachedNetworkParameters* cached_network_params) = 0; |
| 72 | 75 |
| 73 // Called by the ServerHello AckNotifier once the SHLO has been ACKed by the | 76 // Called by the ServerHello AckNotifier once the SHLO has been ACKed by the |
| 74 // client. | 77 // client. |
| 75 virtual void OnServerHelloAcked() = 0; | 78 virtual void OnServerHelloAcked() = 0; |
| 76 | 79 |
| 77 // These are all accessors and setters to their respective counters. | 80 // These are all accessors and setters to their respective counters. |
| 78 virtual uint8 NumHandshakeMessages() const = 0; | 81 virtual uint8_t NumHandshakeMessages() const = 0; |
| 79 virtual uint8 NumHandshakeMessagesWithServerNonces() const = 0; | 82 virtual uint8_t NumHandshakeMessagesWithServerNonces() const = 0; |
| 80 virtual bool UseStatelessRejectsIfPeerSupported() const = 0; | 83 virtual bool UseStatelessRejectsIfPeerSupported() const = 0; |
| 81 virtual bool PeerSupportsStatelessRejects() const = 0; | 84 virtual bool PeerSupportsStatelessRejects() const = 0; |
| 82 virtual void SetPeerSupportsStatelessRejects(bool set) = 0; | 85 virtual void SetPeerSupportsStatelessRejects(bool set) = 0; |
| 83 virtual const CachedNetworkParameters* PreviousCachedNetworkParams() | 86 virtual const CachedNetworkParameters* PreviousCachedNetworkParams() |
| 84 const = 0; | 87 const = 0; |
| 85 virtual void SetPreviousCachedNetworkParams( | 88 virtual void SetPreviousCachedNetworkParams( |
| 86 CachedNetworkParameters cached_network_params) = 0; | 89 CachedNetworkParameters cached_network_params) = 0; |
| 87 }; | 90 }; |
| 88 | 91 |
| 89 class NET_EXPORT_PRIVATE QuicCryptoServerStream | 92 class NET_EXPORT_PRIVATE QuicCryptoServerStream |
| 90 : public QuicCryptoServerStreamBase { | 93 : public QuicCryptoServerStreamBase { |
| 91 public: | 94 public: |
| 92 // |crypto_config| must outlive the stream. | 95 // |crypto_config| must outlive the stream. |
| 93 QuicCryptoServerStream(const QuicCryptoServerConfig* crypto_config, | 96 QuicCryptoServerStream(const QuicCryptoServerConfig* crypto_config, |
| 94 QuicSession* session); | 97 QuicSession* session); |
| 95 ~QuicCryptoServerStream() override; | 98 ~QuicCryptoServerStream() override; |
| 96 | 99 |
| 97 // From QuicCryptoServerStreamBase | 100 // From QuicCryptoServerStreamBase |
| 98 void CancelOutstandingCallbacks() override; | 101 void CancelOutstandingCallbacks() override; |
| 99 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override; | 102 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override; |
| 100 bool GetBase64SHA256ClientChannelID(std::string* output) const override; | 103 bool GetBase64SHA256ClientChannelID(std::string* output) const override; |
| 101 void SendServerConfigUpdate( | 104 void SendServerConfigUpdate( |
| 102 const CachedNetworkParameters* cached_network_params) override; | 105 const CachedNetworkParameters* cached_network_params) override; |
| 103 void OnServerHelloAcked() override; | 106 void OnServerHelloAcked() override; |
| 104 uint8 NumHandshakeMessages() const override; | 107 uint8_t NumHandshakeMessages() const override; |
| 105 uint8 NumHandshakeMessagesWithServerNonces() const override; | 108 uint8_t NumHandshakeMessagesWithServerNonces() const override; |
| 106 int NumServerConfigUpdateMessagesSent() const override; | 109 int NumServerConfigUpdateMessagesSent() const override; |
| 107 const CachedNetworkParameters* PreviousCachedNetworkParams() const override; | 110 const CachedNetworkParameters* PreviousCachedNetworkParams() const override; |
| 108 bool UseStatelessRejectsIfPeerSupported() const override; | 111 bool UseStatelessRejectsIfPeerSupported() const override; |
| 109 bool PeerSupportsStatelessRejects() const override; | 112 bool PeerSupportsStatelessRejects() const override; |
| 110 void SetPeerSupportsStatelessRejects( | 113 void SetPeerSupportsStatelessRejects( |
| 111 bool peer_supports_stateless_rejects) override; | 114 bool peer_supports_stateless_rejects) override; |
| 112 void SetPreviousCachedNetworkParams( | 115 void SetPreviousCachedNetworkParams( |
| 113 CachedNetworkParameters cached_network_params) override; | 116 CachedNetworkParameters cached_network_params) override; |
| 114 | 117 |
| 115 protected: | 118 protected: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 // by ProofSource::GetProof. | 170 // by ProofSource::GetProof. |
| 168 QuicCryptoProof crypto_proof_; | 171 QuicCryptoProof crypto_proof_; |
| 169 | 172 |
| 170 // Pointer to the active callback that will receive the result of | 173 // Pointer to the active callback that will receive the result of |
| 171 // the client hello validation request and forward it to | 174 // the client hello validation request and forward it to |
| 172 // FinishProcessingHandshakeMessage for processing. nullptr if no | 175 // FinishProcessingHandshakeMessage for processing. nullptr if no |
| 173 // handshake message is being validated. | 176 // handshake message is being validated. |
| 174 ValidateCallback* validate_client_hello_cb_; | 177 ValidateCallback* validate_client_hello_cb_; |
| 175 | 178 |
| 176 // Number of handshake messages received by this stream. | 179 // Number of handshake messages received by this stream. |
| 177 uint8 num_handshake_messages_; | 180 uint8_t num_handshake_messages_; |
| 178 | 181 |
| 179 // Number of handshake messages received by this stream that contain | 182 // Number of handshake messages received by this stream that contain |
| 180 // server nonces (indicating that this is a non-zero-RTT handshake | 183 // server nonces (indicating that this is a non-zero-RTT handshake |
| 181 // attempt). | 184 // attempt). |
| 182 uint8 num_handshake_messages_with_server_nonces_; | 185 uint8_t num_handshake_messages_with_server_nonces_; |
| 183 | 186 |
| 184 // Number of server config update (SCUP) messages sent by this stream. | 187 // Number of server config update (SCUP) messages sent by this stream. |
| 185 int num_server_config_update_messages_sent_; | 188 int num_server_config_update_messages_sent_; |
| 186 | 189 |
| 187 // If the client provides CachedNetworkParameters in the STK in the CHLO, then | 190 // If the client provides CachedNetworkParameters in the STK in the CHLO, then |
| 188 // store here, and send back in future STKs if we have no better bandwidth | 191 // store here, and send back in future STKs if we have no better bandwidth |
| 189 // estimate to send. | 192 // estimate to send. |
| 190 scoped_ptr<CachedNetworkParameters> previous_cached_network_params_; | 193 scoped_ptr<CachedNetworkParameters> previous_cached_network_params_; |
| 191 | 194 |
| 192 // Contains any source address tokens which were present in the CHLO. | 195 // Contains any source address tokens which were present in the CHLO. |
| 193 SourceAddressTokens previous_source_address_tokens_; | 196 SourceAddressTokens previous_source_address_tokens_; |
| 194 | 197 |
| 195 // If true, the server should use stateless rejects, so long as the | 198 // If true, the server should use stateless rejects, so long as the |
| 196 // client supports them, as indicated by | 199 // client supports them, as indicated by |
| 197 // peer_supports_stateless_rejects_. | 200 // peer_supports_stateless_rejects_. |
| 198 bool use_stateless_rejects_if_peer_supported_; | 201 bool use_stateless_rejects_if_peer_supported_; |
| 199 | 202 |
| 200 // Set to true, once the server has received information from the | 203 // Set to true, once the server has received information from the |
| 201 // client that it supports stateless reject. | 204 // client that it supports stateless reject. |
| 202 // TODO(jokulik): Remove once client stateless reject support | 205 // TODO(jokulik): Remove once client stateless reject support |
| 203 // becomes the default. | 206 // becomes the default. |
| 204 bool peer_supports_stateless_rejects_; | 207 bool peer_supports_stateless_rejects_; |
| 205 | 208 |
| 206 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream); | 209 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream); |
| 207 }; | 210 }; |
| 208 | 211 |
| 209 } // namespace net | 212 } // namespace net |
| 210 | 213 |
| 211 #endif // NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ | 214 #endif // NET_QUIC_QUIC_CRYPTO_SERVER_STREAM_H_ |
| OLD | NEW |