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/quic/crypto/channel_id.h" | 10 #include "net/quic/crypto/channel_id.h" |
11 #include "net/quic/crypto/proof_verifier.h" | 11 #include "net/quic/crypto/proof_verifier.h" |
12 #include "net/quic/crypto/quic_crypto_client_config.h" | 12 #include "net/quic/crypto/quic_crypto_client_config.h" |
13 #include "net/quic/quic_config.h" | 13 #include "net/quic/quic_config.h" |
14 #include "net/quic/quic_crypto_stream.h" | 14 #include "net/quic/quic_crypto_stream.h" |
15 #include "net/quic/quic_server_id.h" | 15 #include "net/quic/quic_server_id.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 class QuicClientSessionBase; | 19 class QuicClientSessionBase; |
20 | 20 |
21 namespace test { | 21 namespace test { |
22 class CryptoTestUtils; | 22 class CryptoTestUtils; |
23 class QuicClientSessionPeer; | |
23 } // namespace test | 24 } // namespace test |
24 | 25 |
25 class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoStream { | 26 class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoStream { |
26 public: | 27 public: |
27 QuicCryptoClientStream(const QuicServerId& server_id, | 28 QuicCryptoClientStream(const QuicServerId& server_id, |
28 QuicClientSessionBase* session, | 29 QuicClientSessionBase* session, |
29 ProofVerifyContext* verify_context, | 30 ProofVerifyContext* verify_context, |
30 QuicCryptoClientConfig* crypto_config); | 31 QuicCryptoClientConfig* crypto_config); |
31 virtual ~QuicCryptoClientStream(); | 32 virtual ~QuicCryptoClientStream(); |
32 | 33 |
33 // CryptoFramerVisitorInterface implementation | 34 // CryptoFramerVisitorInterface implementation |
34 virtual void OnHandshakeMessage( | 35 virtual void OnHandshakeMessage( |
35 const CryptoHandshakeMessage& message) OVERRIDE; | 36 const CryptoHandshakeMessage& message) OVERRIDE; |
36 | 37 |
37 // Performs a crypto handshake with the server. Returns true if the crypto | 38 // Performs a crypto handshake with the server. Returns true if the crypto |
38 // handshake is started successfully. | 39 // handshake is started successfully. |
39 // TODO(agl): this should probably return void. | 40 // TODO(agl): this should probably return void. |
40 virtual bool CryptoConnect(); | 41 virtual bool CryptoConnect(); |
41 | 42 |
42 // 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 |
43 // 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 |
44 // than the number of round-trips needed for the handshake. | 45 // than the number of round-trips needed for the handshake. |
45 int num_sent_client_hellos() const; | 46 int num_sent_client_hellos() const; |
46 | 47 |
48 bool WasChannelIDSent() const; | |
wtc
2014/07/01 23:00:15
Please document this method.
For your reference,
Ryan Hamilton
2014/07/01 23:26:20
Done.
| |
49 | |
47 private: | 50 private: |
48 // ChannelIDSourceCallbackImpl is passed as the callback method to | 51 // ChannelIDSourceCallbackImpl is passed as the callback method to |
49 // GetChannelIDKey. The ChannelIDSource calls this class with the result of | 52 // GetChannelIDKey. The ChannelIDSource calls this class with the result of |
50 // channel ID lookup when lookup is performed asynchronously. | 53 // channel ID lookup when lookup is performed asynchronously. |
51 class ChannelIDSourceCallbackImpl : public ChannelIDSourceCallback { | 54 class ChannelIDSourceCallbackImpl : public ChannelIDSourceCallback { |
52 public: | 55 public: |
53 explicit ChannelIDSourceCallbackImpl(QuicCryptoClientStream* stream); | 56 explicit ChannelIDSourceCallbackImpl(QuicCryptoClientStream* stream); |
54 virtual ~ChannelIDSourceCallbackImpl(); | 57 virtual ~ChannelIDSourceCallbackImpl(); |
55 | 58 |
56 // ChannelIDSourceCallback interface. | 59 // ChannelIDSourceCallback interface. |
(...skipping 22 matching lines...) Expand all Loading... | |
79 | 82 |
80 // Cancel causes any future callbacks to be ignored. It must be called on | 83 // Cancel causes any future callbacks to be ignored. It must be called on |
81 // the same thread as the callback will be made on. | 84 // the same thread as the callback will be made on. |
82 void Cancel(); | 85 void Cancel(); |
83 | 86 |
84 private: | 87 private: |
85 QuicCryptoClientStream* stream_; | 88 QuicCryptoClientStream* stream_; |
86 }; | 89 }; |
87 | 90 |
88 friend class test::CryptoTestUtils; | 91 friend class test::CryptoTestUtils; |
92 friend class test::QuicClientSessionPeer; | |
89 | 93 |
90 enum State { | 94 enum State { |
91 STATE_IDLE, | 95 STATE_IDLE, |
92 STATE_INITIALIZE, | 96 STATE_INITIALIZE, |
93 STATE_SEND_CHLO, | 97 STATE_SEND_CHLO, |
94 STATE_RECV_REJ, | 98 STATE_RECV_REJ, |
95 STATE_VERIFY_PROOF, | 99 STATE_VERIFY_PROOF, |
96 STATE_VERIFY_PROOF_COMPLETE, | 100 STATE_VERIFY_PROOF_COMPLETE, |
97 STATE_GET_CHANNEL_ID, | 101 STATE_GET_CHANNEL_ID, |
98 STATE_GET_CHANNEL_ID_COMPLETE, | 102 STATE_GET_CHANNEL_ID_COMPLETE, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 bool verify_ok_; | 156 bool verify_ok_; |
153 string verify_error_details_; | 157 string verify_error_details_; |
154 scoped_ptr<ProofVerifyDetails> verify_details_; | 158 scoped_ptr<ProofVerifyDetails> verify_details_; |
155 | 159 |
156 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); | 160 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); |
157 }; | 161 }; |
158 | 162 |
159 } // namespace net | 163 } // namespace net |
160 | 164 |
161 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ | 165 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ |
OLD | NEW |