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 "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "net/cert/cert_verify_result.h" | 12 #include "net/cert/cert_verify_result.h" |
13 #include "net/cert/x509_certificate.h" | 13 #include "net/cert/x509_certificate.h" |
14 #include "net/quic/crypto/proof_verifier.h" | 14 #include "net/quic/crypto/proof_verifier.h" |
15 #include "net/quic/crypto/quic_crypto_client_config.h" | 15 #include "net/quic/crypto/quic_crypto_client_config.h" |
16 #include "net/quic/quic_config.h" | 16 #include "net/quic/quic_config.h" |
17 #include "net/quic/quic_crypto_stream.h" | 17 #include "net/quic/quic_crypto_stream.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
21 class ProofVerifyDetails; | 21 class QuicServerInfo; |
22 class QuicSession; | 22 class QuicSession; |
23 class SSLInfo; | 23 class SSLInfo; |
24 | 24 |
25 namespace test { | 25 namespace test { |
26 class CryptoTestUtils; | 26 class CryptoTestUtils; |
27 } // namespace test | 27 } // namespace test |
28 | 28 |
29 class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoStream { | 29 class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoStream { |
30 public: | 30 public: |
31 QuicCryptoClientStream(const string& server_hostname, | 31 QuicCryptoClientStream(const string& server_hostname, |
(...skipping 13 matching lines...) Expand all Loading... | |
45 // num_sent_client_hellos returns the number of client hello messages that | 45 // num_sent_client_hellos returns the number of client hello messages that |
46 // have been sent. If the handshake has completed then this is one greater | 46 // have been sent. If the handshake has completed then this is one greater |
47 // than the number of round-trips needed for the handshake. | 47 // than the number of round-trips needed for the handshake. |
48 int num_sent_client_hellos() const; | 48 int num_sent_client_hellos() const; |
49 | 49 |
50 // Gets the SSL connection information. | 50 // Gets the SSL connection information. |
51 virtual bool GetSSLInfo(SSLInfo* ssl_info); | 51 virtual bool GetSSLInfo(SSLInfo* ssl_info); |
52 | 52 |
53 void OnIOComplete(int result); | 53 void OnIOComplete(int result); |
54 | 54 |
55 void SetQuicServerInfo(scoped_ptr<QuicServerInfo> server_info); | |
56 | |
55 private: | 57 private: |
56 // ProofVerifierCallbackImpl is passed as the callback method to VerifyProof. | 58 // ProofVerifierCallbackImpl is passed as the callback method to VerifyProof. |
57 // The ProofVerifier calls this class with the result of proof verification | 59 // The ProofVerifier calls this class with the result of proof verification |
58 // when verification is performed asynchronously. | 60 // when verification is performed asynchronously. |
59 class ProofVerifierCallbackImpl : public ProofVerifierCallback { | 61 class ProofVerifierCallbackImpl : public ProofVerifierCallback { |
60 public: | 62 public: |
61 explicit ProofVerifierCallbackImpl(QuicCryptoClientStream* stream); | 63 explicit ProofVerifierCallbackImpl(QuicCryptoClientStream* stream); |
62 virtual ~ProofVerifierCallbackImpl(); | 64 virtual ~ProofVerifierCallbackImpl(); |
63 | 65 |
64 // ProofVerifierCallback interface. | 66 // ProofVerifierCallback interface. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 // functions. | 98 // functions. |
97 | 99 |
98 // Call QuicServerInfo's WaitForDataReady to load the server information from | 100 // Call QuicServerInfo's WaitForDataReady to load the server information from |
99 // the disk cache. | 101 // the disk cache. |
100 int DoLoadQuicServerInfo(QuicCryptoClientConfig::CachedState* cached); | 102 int DoLoadQuicServerInfo(QuicCryptoClientConfig::CachedState* cached); |
101 void DoLoadQuicServerInfoComplete( | 103 void DoLoadQuicServerInfoComplete( |
102 QuicCryptoClientConfig::CachedState* cached); | 104 QuicCryptoClientConfig::CachedState* cached); |
103 // LoadQuicServerInfo is a helper function for DoLoadQuicServerInfoComplete. | 105 // LoadQuicServerInfo is a helper function for DoLoadQuicServerInfoComplete. |
104 void LoadQuicServerInfo(QuicCryptoClientConfig::CachedState* cached); | 106 void LoadQuicServerInfo(QuicCryptoClientConfig::CachedState* cached); |
105 | 107 |
108 void SaveQuicServerInfo(QuicCryptoClientConfig::CachedState* cached); | |
wtc
2014/03/12 23:13:20
1. Please document that we should call SaveQuicSer
Ryan Hamilton
2014/03/13 16:38:07
Done.
| |
109 | |
106 State next_state_; | 110 State next_state_; |
107 // num_client_hellos_ contains the number of client hello messages that this | 111 // num_client_hellos_ contains the number of client hello messages that this |
108 // connection has sent. | 112 // connection has sent. |
109 int num_client_hellos_; | 113 int num_client_hellos_; |
110 | 114 |
111 QuicCryptoClientConfig* const crypto_config_; | 115 QuicCryptoClientConfig* const crypto_config_; |
112 | 116 |
113 // Client's connection nonce (4-byte timestamp + 28 random bytes) | 117 // Client's connection nonce (4-byte timestamp + 28 random bytes) |
114 std::string nonce_; | 118 std::string nonce_; |
115 // Server's hostname | 119 // Server's hostname |
116 std::string server_hostname_; | 120 std::string server_hostname_; |
117 | 121 |
118 // Generation counter from QuicCryptoClientConfig's CachedState. | 122 // Generation counter from QuicCryptoClientConfig's CachedState. |
119 uint64 generation_counter_; | 123 uint64 generation_counter_; |
120 | 124 |
121 // proof_verify_callback_ contains the callback object that we passed to an | 125 // proof_verify_callback_ contains the callback object that we passed to an |
122 // asynchronous proof verification. The ProofVerifier owns this object. | 126 // asynchronous proof verification. The ProofVerifier owns this object. |
123 ProofVerifierCallbackImpl* proof_verify_callback_; | 127 ProofVerifierCallbackImpl* proof_verify_callback_; |
124 | 128 |
125 // These members are used to store the result of an asynchronous proof | 129 // These members are used to store the result of an asynchronous proof |
126 // verification. These members must not be used after | 130 // verification. These members must not be used after |
127 // STATE_VERIFY_PROOF_COMPLETE. | 131 // STATE_VERIFY_PROOF_COMPLETE. |
128 bool verify_ok_; | 132 bool verify_ok_; |
129 string verify_error_details_; | 133 string verify_error_details_; |
130 scoped_ptr<ProofVerifyDetails> verify_details_; | 134 scoped_ptr<ProofVerifyDetails> verify_details_; |
131 | 135 |
132 // The result of certificate verification. | 136 // The result of certificate verification. |
133 scoped_ptr<CertVerifyResult> cert_verify_result_; | 137 scoped_ptr<CertVerifyResult> cert_verify_result_; |
138 scoped_ptr<QuicServerInfo> quic_server_info_; | |
wtc
2014/03/12 23:13:20
Nit: because of the "The result of certificate ver
Ryan Hamilton
2014/03/13 16:38:07
Done.
| |
134 | 139 |
135 // This member is used to store the result of an asynchronous disk cache read. | 140 // This member is used to store the result of an asynchronous disk cache read. |
136 // It must not be used after STATE_LOAD_QUIC_SERVER_INFO_COMPLETE. | 141 // It must not be used after STATE_LOAD_QUIC_SERVER_INFO_COMPLETE. |
137 int disk_cache_load_result_; | 142 int disk_cache_load_result_; |
138 | 143 |
139 // Time when call to WaitForDataReady was made, used for computing time spent | 144 // Time when call to WaitForDataReady was made, used for computing time spent |
140 // to load QUIC server information from disk cache. | 145 // to load QUIC server information from disk cache. |
141 base::TimeTicks disk_cache_load_start_time_; | 146 base::TimeTicks disk_cache_load_start_time_; |
142 | 147 |
143 base::WeakPtrFactory<QuicCryptoClientStream> weak_factory_; | 148 base::WeakPtrFactory<QuicCryptoClientStream> weak_factory_; |
144 | 149 |
145 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); | 150 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); |
146 }; | 151 }; |
147 | 152 |
148 } // namespace net | 153 } // namespace net |
149 | 154 |
150 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ | 155 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ |
OLD | NEW |