Chromium Code Reviews| 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, | |
| 78 STATE_SEND_CHLO, | 81 STATE_SEND_CHLO, |
| 79 STATE_RECV_REJ, | 82 STATE_RECV_REJ, |
| 80 STATE_VERIFY_PROOF, | 83 STATE_VERIFY_PROOF, |
| 81 STATE_VERIFY_PROOF_COMPLETE, | 84 STATE_VERIFY_PROOF_COMPLETE, |
| 82 STATE_RECV_SHLO, | 85 STATE_RECV_SHLO, |
| 83 }; | 86 }; |
| 84 | 87 |
| 85 // DoHandshakeLoop performs a step of the handshake state machine. Note that | 88 // 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 | 89 // |in| may be NULL if the call did not result from a received message |
| 87 void DoHandshakeLoop(const CryptoHandshakeMessage* in); | 90 void DoHandshakeLoop(const CryptoHandshakeMessage* in); |
| 88 | 91 |
| 92 // Calls QuicServerInfo's WaitForDataReady to load the server information from | |
| 93 // the disk cache. | |
| 94 int DoLoadQuicServerInfo(QuicCryptoClientConfig::CachedState* cached); | |
|
wtc
2014/02/07 00:54:11
Right now STATE_LOAD_QUIC_SERVER_INFO is the only
ramant (doing other things)
2014/02/07 20:30:51
Added a TODO.
Done.
| |
| 95 | |
| 89 State next_state_; | 96 State next_state_; |
| 90 // num_client_hellos_ contains the number of client hello messages that this | 97 // num_client_hellos_ contains the number of client hello messages that this |
| 91 // connection has sent. | 98 // connection has sent. |
| 92 int num_client_hellos_; | 99 int num_client_hellos_; |
| 93 | 100 |
| 94 QuicCryptoClientConfig* const crypto_config_; | 101 QuicCryptoClientConfig* const crypto_config_; |
| 95 | 102 |
| 96 // Client's connection nonce (4-byte timestamp + 28 random bytes) | 103 // Client's connection nonce (4-byte timestamp + 28 random bytes) |
| 97 std::string nonce_; | 104 std::string nonce_; |
| 98 // Server's hostname | 105 // Server's hostname |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 114 | 121 |
| 115 // The result of certificate verification. | 122 // The result of certificate verification. |
| 116 scoped_ptr<CertVerifyResult> cert_verify_result_; | 123 scoped_ptr<CertVerifyResult> cert_verify_result_; |
| 117 | 124 |
| 118 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); | 125 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); |
| 119 }; | 126 }; |
| 120 | 127 |
| 121 } // namespace net | 128 } // namespace net |
| 122 | 129 |
| 123 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ | 130 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ |
| OLD | NEW |