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 // Returns true if a channel ID was sent on this connection. |
| 49 bool WasChannelIDSent() const; |
| 50 |
47 private: | 51 private: |
48 // ChannelIDSourceCallbackImpl is passed as the callback method to | 52 // ChannelIDSourceCallbackImpl is passed as the callback method to |
49 // GetChannelIDKey. The ChannelIDSource calls this class with the result of | 53 // GetChannelIDKey. The ChannelIDSource calls this class with the result of |
50 // channel ID lookup when lookup is performed asynchronously. | 54 // channel ID lookup when lookup is performed asynchronously. |
51 class ChannelIDSourceCallbackImpl : public ChannelIDSourceCallback { | 55 class ChannelIDSourceCallbackImpl : public ChannelIDSourceCallback { |
52 public: | 56 public: |
53 explicit ChannelIDSourceCallbackImpl(QuicCryptoClientStream* stream); | 57 explicit ChannelIDSourceCallbackImpl(QuicCryptoClientStream* stream); |
54 virtual ~ChannelIDSourceCallbackImpl(); | 58 virtual ~ChannelIDSourceCallbackImpl(); |
55 | 59 |
56 // ChannelIDSourceCallback interface. | 60 // ChannelIDSourceCallback interface. |
(...skipping 22 matching lines...) Expand all Loading... |
79 | 83 |
80 // Cancel causes any future callbacks to be ignored. It must be called on | 84 // Cancel causes any future callbacks to be ignored. It must be called on |
81 // the same thread as the callback will be made on. | 85 // the same thread as the callback will be made on. |
82 void Cancel(); | 86 void Cancel(); |
83 | 87 |
84 private: | 88 private: |
85 QuicCryptoClientStream* stream_; | 89 QuicCryptoClientStream* stream_; |
86 }; | 90 }; |
87 | 91 |
88 friend class test::CryptoTestUtils; | 92 friend class test::CryptoTestUtils; |
| 93 friend class test::QuicClientSessionPeer; |
89 | 94 |
90 enum State { | 95 enum State { |
91 STATE_IDLE, | 96 STATE_IDLE, |
92 STATE_INITIALIZE, | 97 STATE_INITIALIZE, |
93 STATE_SEND_CHLO, | 98 STATE_SEND_CHLO, |
94 STATE_RECV_REJ, | 99 STATE_RECV_REJ, |
95 STATE_VERIFY_PROOF, | 100 STATE_VERIFY_PROOF, |
96 STATE_VERIFY_PROOF_COMPLETE, | 101 STATE_VERIFY_PROOF_COMPLETE, |
97 STATE_GET_CHANNEL_ID, | 102 STATE_GET_CHANNEL_ID, |
98 STATE_GET_CHANNEL_ID_COMPLETE, | 103 STATE_GET_CHANNEL_ID_COMPLETE, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 bool verify_ok_; | 157 bool verify_ok_; |
153 string verify_error_details_; | 158 string verify_error_details_; |
154 scoped_ptr<ProofVerifyDetails> verify_details_; | 159 scoped_ptr<ProofVerifyDetails> verify_details_; |
155 | 160 |
156 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); | 161 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); |
157 }; | 162 }; |
158 | 163 |
159 } // namespace net | 164 } // namespace net |
160 | 165 |
161 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ | 166 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ |
OLD | NEW |