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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class CryptoTestUtils; | 22 class CryptoTestUtils; |
23 class QuicClientSessionPeer; | 23 class QuicClientSessionPeer; |
24 } // namespace test | 24 } // namespace test |
25 | 25 |
26 class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoStream { | 26 class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoStream { |
27 public: | 27 public: |
28 QuicCryptoClientStream(const QuicServerId& server_id, | 28 QuicCryptoClientStream(const QuicServerId& server_id, |
29 QuicClientSessionBase* session, | 29 QuicClientSessionBase* session, |
30 ProofVerifyContext* verify_context, | 30 ProofVerifyContext* verify_context, |
31 QuicCryptoClientConfig* crypto_config); | 31 QuicCryptoClientConfig* crypto_config); |
32 virtual ~QuicCryptoClientStream(); | 32 ~QuicCryptoClientStream() override; |
33 | 33 |
34 // CryptoFramerVisitorInterface implementation | 34 // CryptoFramerVisitorInterface implementation |
35 virtual void OnHandshakeMessage( | 35 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override; |
36 const CryptoHandshakeMessage& message) override; | |
37 | 36 |
38 // Performs a crypto handshake with the server. Returns true if the crypto | 37 // Performs a crypto handshake with the server. Returns true if the crypto |
39 // handshake is started successfully. | 38 // handshake is started successfully. |
40 // TODO(agl): this should probably return void. | 39 // TODO(agl): this should probably return void. |
41 virtual bool CryptoConnect(); | 40 virtual bool CryptoConnect(); |
42 | 41 |
43 // num_sent_client_hellos returns the number of client hello messages that | 42 // 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 | 43 // have been sent. If the handshake has completed then this is one greater |
45 // than the number of round-trips needed for the handshake. | 44 // than the number of round-trips needed for the handshake. |
46 int num_sent_client_hellos() const; | 45 int num_sent_client_hellos() const; |
47 | 46 |
48 // Returns true if a channel ID was sent on this connection. | 47 // Returns true if a channel ID was sent on this connection. |
49 bool WasChannelIDSent() const; | 48 bool WasChannelIDSent() const; |
50 | 49 |
51 // Returns true if our ChannelIDSourceCallback was run, which implies the | 50 // Returns true if our ChannelIDSourceCallback was run, which implies the |
52 // ChannelIDSource operated asynchronously. Intended for testing. | 51 // ChannelIDSource operated asynchronously. Intended for testing. |
53 bool WasChannelIDSourceCallbackRun() const; | 52 bool WasChannelIDSourceCallbackRun() const; |
54 | 53 |
55 private: | 54 private: |
56 // ChannelIDSourceCallbackImpl is passed as the callback method to | 55 // ChannelIDSourceCallbackImpl is passed as the callback method to |
57 // GetChannelIDKey. The ChannelIDSource calls this class with the result of | 56 // GetChannelIDKey. The ChannelIDSource calls this class with the result of |
58 // channel ID lookup when lookup is performed asynchronously. | 57 // channel ID lookup when lookup is performed asynchronously. |
59 class ChannelIDSourceCallbackImpl : public ChannelIDSourceCallback { | 58 class ChannelIDSourceCallbackImpl : public ChannelIDSourceCallback { |
60 public: | 59 public: |
61 explicit ChannelIDSourceCallbackImpl(QuicCryptoClientStream* stream); | 60 explicit ChannelIDSourceCallbackImpl(QuicCryptoClientStream* stream); |
62 virtual ~ChannelIDSourceCallbackImpl(); | 61 ~ChannelIDSourceCallbackImpl() override; |
63 | 62 |
64 // ChannelIDSourceCallback interface. | 63 // ChannelIDSourceCallback interface. |
65 virtual void Run(scoped_ptr<ChannelIDKey>* channel_id_key) override; | 64 void Run(scoped_ptr<ChannelIDKey>* channel_id_key) override; |
66 | 65 |
67 // Cancel causes any future callbacks to be ignored. It must be called on | 66 // Cancel causes any future callbacks to be ignored. It must be called on |
68 // the same thread as the callback will be made on. | 67 // the same thread as the callback will be made on. |
69 void Cancel(); | 68 void Cancel(); |
70 | 69 |
71 private: | 70 private: |
72 QuicCryptoClientStream* stream_; | 71 QuicCryptoClientStream* stream_; |
73 }; | 72 }; |
74 | 73 |
75 // ProofVerifierCallbackImpl is passed as the callback method to VerifyProof. | 74 // ProofVerifierCallbackImpl is passed as the callback method to VerifyProof. |
76 // The ProofVerifier calls this class with the result of proof verification | 75 // The ProofVerifier calls this class with the result of proof verification |
77 // when verification is performed asynchronously. | 76 // when verification is performed asynchronously. |
78 class ProofVerifierCallbackImpl : public ProofVerifierCallback { | 77 class ProofVerifierCallbackImpl : public ProofVerifierCallback { |
79 public: | 78 public: |
80 explicit ProofVerifierCallbackImpl(QuicCryptoClientStream* stream); | 79 explicit ProofVerifierCallbackImpl(QuicCryptoClientStream* stream); |
81 virtual ~ProofVerifierCallbackImpl(); | 80 ~ProofVerifierCallbackImpl() override; |
82 | 81 |
83 // ProofVerifierCallback interface. | 82 // ProofVerifierCallback interface. |
84 virtual void Run(bool ok, | 83 void Run(bool ok, |
85 const string& error_details, | 84 const string& error_details, |
86 scoped_ptr<ProofVerifyDetails>* details) override; | 85 scoped_ptr<ProofVerifyDetails>* details) override; |
87 | 86 |
88 // Cancel causes any future callbacks to be ignored. It must be called on | 87 // Cancel causes any future callbacks to be ignored. It must be called on |
89 // the same thread as the callback will be made on. | 88 // the same thread as the callback will be made on. |
90 void Cancel(); | 89 void Cancel(); |
91 | 90 |
92 private: | 91 private: |
93 QuicCryptoClientStream* stream_; | 92 QuicCryptoClientStream* stream_; |
94 }; | 93 }; |
95 | 94 |
96 friend class test::CryptoTestUtils; | 95 friend class test::CryptoTestUtils; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 bool verify_ok_; | 210 bool verify_ok_; |
212 string verify_error_details_; | 211 string verify_error_details_; |
213 scoped_ptr<ProofVerifyDetails> verify_details_; | 212 scoped_ptr<ProofVerifyDetails> verify_details_; |
214 | 213 |
215 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); | 214 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); |
216 }; | 215 }; |
217 | 216 |
218 } // namespace net | 217 } // namespace net |
219 | 218 |
220 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ | 219 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ |
OLD | NEW |