| 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_CLIENT_STREAM_H_ | 5 #ifndef NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ |
| 6 #define NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ | 6 #define NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "net/cert/cert_verify_result.h" | 10 #include "net/cert/cert_verify_result.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 virtual bool CryptoConnect(); | 41 virtual bool CryptoConnect(); |
| 42 | 42 |
| 43 // num_sent_client_hellos returns the number of client hello messages that | 43 // num_sent_client_hellos returns the number of client hello messages that |
| 44 // have been sent. If the handshake has completed then this is one greater | 44 // have been sent. If the handshake has completed then this is one greater |
| 45 // than the number of round-trips needed for the handshake. | 45 // than the number of round-trips needed for the handshake. |
| 46 int num_sent_client_hellos() const; | 46 int num_sent_client_hellos() const; |
| 47 | 47 |
| 48 // Gets the SSL connection information. | 48 // Gets the SSL connection information. |
| 49 virtual bool GetSSLInfo(SSLInfo* ssl_info); | 49 virtual bool GetSSLInfo(SSLInfo* ssl_info); |
| 50 | 50 |
| 51 void OnIOComplete(int result); |
| 52 |
| 51 private: | 53 private: |
| 52 // ProofVerifierCallbackImpl is passed as the callback method to VerifyProof. | 54 // ProofVerifierCallbackImpl is passed as the callback method to VerifyProof. |
| 53 // The ProofVerifier calls this class with the result of proof verification | 55 // The ProofVerifier calls this class with the result of proof verification |
| 54 // when verification is performed asynchronously. | 56 // when verification is performed asynchronously. |
| 55 class ProofVerifierCallbackImpl : public ProofVerifierCallback { | 57 class ProofVerifierCallbackImpl : public ProofVerifierCallback { |
| 56 public: | 58 public: |
| 57 explicit ProofVerifierCallbackImpl(QuicCryptoClientStream* stream); | 59 explicit ProofVerifierCallbackImpl(QuicCryptoClientStream* stream); |
| 58 virtual ~ProofVerifierCallbackImpl(); | 60 virtual ~ProofVerifierCallbackImpl(); |
| 59 | 61 |
| 60 // ProofVerifierCallback interface. | 62 // ProofVerifierCallback interface. |
| 61 virtual void Run(bool ok, | 63 virtual void Run(bool ok, |
| 62 const string& error_details, | 64 const string& error_details, |
| 63 scoped_ptr<ProofVerifyDetails>* details) OVERRIDE; | 65 scoped_ptr<ProofVerifyDetails>* details) OVERRIDE; |
| 64 | 66 |
| 65 // Cancel causes any future callbacks to be ignored. It must be called on | 67 // Cancel causes any future callbacks to be ignored. It must be called on |
| 66 // the same thread as the callback will be made on. | 68 // the same thread as the callback will be made on. |
| 67 void Cancel(); | 69 void Cancel(); |
| 68 | 70 |
| 69 private: | 71 private: |
| 70 QuicCryptoClientStream* stream_; | 72 QuicCryptoClientStream* stream_; |
| 71 }; | 73 }; |
| 72 | 74 |
| 73 friend class test::CryptoTestUtils; | 75 friend class test::CryptoTestUtils; |
| 74 friend class ProofVerifierCallbackImpl; | 76 friend class ProofVerifierCallbackImpl; |
| 75 | 77 |
| 76 enum State { | 78 enum State { |
| 77 STATE_IDLE, | 79 STATE_IDLE, |
| 80 STATE_LOAD_QUIC_SERVER_INFO, |
| 81 STATE_LOAD_QUIC_SERVER_INFO_COMPLETE, |
| 78 STATE_SEND_CHLO, | 82 STATE_SEND_CHLO, |
| 79 STATE_RECV_REJ, | 83 STATE_RECV_REJ, |
| 80 STATE_VERIFY_PROOF, | 84 STATE_VERIFY_PROOF, |
| 81 STATE_VERIFY_PROOF_COMPLETE, | 85 STATE_VERIFY_PROOF_COMPLETE, |
| 82 STATE_RECV_SHLO, | 86 STATE_RECV_SHLO, |
| 83 }; | 87 }; |
| 84 | 88 |
| 85 // DoHandshakeLoop performs a step of the handshake state machine. Note that | 89 // DoHandshakeLoop performs a step of the handshake state machine. Note that |
| 86 // |in| may be NULL if the call did not result from a received message | 90 // |in| may be NULL if the call did not result from a received message |
| 87 void DoHandshakeLoop(const CryptoHandshakeMessage* in); | 91 void DoHandshakeLoop(const CryptoHandshakeMessage* in); |
| 88 | 92 |
| 93 // TODO(rtenneti): convert the other states of the state machine into DoXXX |
| 94 // functions. |
| 95 |
| 96 // Call QuicServerInfo's WaitForDataReady to load the server information from |
| 97 // the disk cache. |
| 98 int DoLoadQuicServerInfo(QuicCryptoClientConfig::CachedState* cached); |
| 99 void DoLoadQuicServerInfoComplete( |
| 100 QuicCryptoClientConfig::CachedState* cached); |
| 101 |
| 89 State next_state_; | 102 State next_state_; |
| 90 // num_client_hellos_ contains the number of client hello messages that this | 103 // num_client_hellos_ contains the number of client hello messages that this |
| 91 // connection has sent. | 104 // connection has sent. |
| 92 int num_client_hellos_; | 105 int num_client_hellos_; |
| 93 | 106 |
| 94 QuicCryptoClientConfig* const crypto_config_; | 107 QuicCryptoClientConfig* const crypto_config_; |
| 95 | 108 |
| 96 // Client's connection nonce (4-byte timestamp + 28 random bytes) | 109 // Client's connection nonce (4-byte timestamp + 28 random bytes) |
| 97 std::string nonce_; | 110 std::string nonce_; |
| 98 // Server's hostname | 111 // Server's hostname |
| (...skipping 15 matching lines...) Expand all Loading... |
| 114 | 127 |
| 115 // The result of certificate verification. | 128 // The result of certificate verification. |
| 116 scoped_ptr<CertVerifyResult> cert_verify_result_; | 129 scoped_ptr<CertVerifyResult> cert_verify_result_; |
| 117 | 130 |
| 118 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); | 131 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); |
| 119 }; | 132 }; |
| 120 | 133 |
| 121 } // namespace net | 134 } // namespace net |
| 122 | 135 |
| 123 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ | 136 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ |
| OLD | NEW |