| 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 QuicChromiumClientSessionPeer; | 23 class QuicChromiumClientSessionPeer; |
| 24 } // namespace test | 24 } // namespace test |
| 25 | 25 |
| 26 class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoStream { | 26 class NET_EXPORT_PRIVATE QuicCryptoClientStreamBase : public QuicCryptoStream { |
| 27 public: |
| 28 explicit QuicCryptoClientStreamBase(QuicClientSessionBase* session); |
| 29 |
| 30 ~QuicCryptoClientStreamBase() override {}; |
| 31 |
| 32 // Performs a crypto handshake with the server. |
| 33 virtual void CryptoConnect() = 0; |
| 34 |
| 35 // num_sent_client_hellos returns the number of client hello messages that |
| 36 // have been sent. If the handshake has completed then this is one greater |
| 37 // than the number of round-trips needed for the handshake. |
| 38 virtual int num_sent_client_hellos() const = 0; |
| 39 }; |
| 40 |
| 41 class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoClientStreamB
ase { |
| 27 public: | 42 public: |
| 28 // kMaxClientHellos is the maximum number of times that we'll send a client | 43 // kMaxClientHellos is the maximum number of times that we'll send a client |
| 29 // hello. The value 3 accounts for: | 44 // hello. The value 3 accounts for: |
| 30 // * One failure due to an incorrect or missing source-address token. | 45 // * One failure due to an incorrect or missing source-address token. |
| 31 // * One failure due the server's certificate chain being unavailible and | 46 // * One failure due the server's certificate chain being unavailible and |
| 32 // the server being unwilling to send it without a valid source-address | 47 // the server being unwilling to send it without a valid source-address |
| 33 // token. | 48 // token. |
| 34 static const int kMaxClientHellos = 3; | 49 static const int kMaxClientHellos = 3; |
| 35 | |
| 36 QuicCryptoClientStream(const QuicServerId& server_id, | 50 QuicCryptoClientStream(const QuicServerId& server_id, |
| 37 QuicClientSessionBase* session, | 51 QuicClientSessionBase* session, |
| 38 ProofVerifyContext* verify_context, | 52 ProofVerifyContext* verify_context, |
| 39 QuicCryptoClientConfig* crypto_config); | 53 QuicCryptoClientConfig* crypto_config); |
| 54 |
| 40 ~QuicCryptoClientStream() override; | 55 ~QuicCryptoClientStream() override; |
| 41 | 56 |
| 57 // From QuicCryptoClientStreamBase |
| 58 void CryptoConnect() override; |
| 59 int num_sent_client_hellos() const override; |
| 60 |
| 42 // CryptoFramerVisitorInterface implementation | 61 // CryptoFramerVisitorInterface implementation |
| 43 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override; | 62 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override; |
| 44 | 63 |
| 45 // Performs a crypto handshake with the server. | |
| 46 virtual void CryptoConnect(); | |
| 47 | |
| 48 // num_sent_client_hellos returns the number of client hello messages that | |
| 49 // have been sent. If the handshake has completed then this is one greater | |
| 50 // than the number of round-trips needed for the handshake. | |
| 51 int num_sent_client_hellos() const; | |
| 52 | |
| 53 // Returns true if a channel ID was sent on this connection. | 64 // Returns true if a channel ID was sent on this connection. |
| 54 bool WasChannelIDSent() const; | 65 bool WasChannelIDSent() const; |
| 55 | 66 |
| 56 // Returns true if our ChannelIDSourceCallback was run, which implies the | 67 // Returns true if our ChannelIDSourceCallback was run, which implies the |
| 57 // ChannelIDSource operated asynchronously. Intended for testing. | 68 // ChannelIDSource operated asynchronously. Intended for testing. |
| 58 bool WasChannelIDSourceCallbackRun() const; | 69 bool WasChannelIDSourceCallbackRun() const; |
| 59 | 70 |
| 60 private: | 71 private: |
| 61 // ChannelIDSourceCallbackImpl is passed as the callback method to | 72 // ChannelIDSourceCallbackImpl is passed as the callback method to |
| 62 // GetChannelIDKey. The ChannelIDSource calls this class with the result of | 73 // GetChannelIDKey. The ChannelIDSource calls this class with the result of |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 // reject. Used for book-keeping between the STATE_RECV_REJ, | 232 // reject. Used for book-keeping between the STATE_RECV_REJ, |
| 222 // STATE_VERIFY_PROOF*, and subsequent STATE_SEND_CHLO state. | 233 // STATE_VERIFY_PROOF*, and subsequent STATE_SEND_CHLO state. |
| 223 bool stateless_reject_received_; | 234 bool stateless_reject_received_; |
| 224 | 235 |
| 225 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); | 236 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); |
| 226 }; | 237 }; |
| 227 | 238 |
| 228 } // namespace net | 239 } // namespace net |
| 229 | 240 |
| 230 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ | 241 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ |
| OLD | NEW |