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_CORE_QUIC_CRYPTO_CLIENT_STREAM_H_ | 5 #ifndef NET_QUIC_CORE_QUIC_CRYPTO_CLIENT_STREAM_H_ |
6 #define NET_QUIC_CORE_QUIC_CRYPTO_CLIENT_STREAM_H_ | 6 #define NET_QUIC_CORE_QUIC_CRYPTO_CLIENT_STREAM_H_ |
7 | 7 |
8 #include <cstdint> | 8 #include <cstdint> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "net/base/net_export.h" | |
14 #include "net/quic/core/crypto/channel_id.h" | 13 #include "net/quic/core/crypto/channel_id.h" |
15 #include "net/quic/core/crypto/proof_verifier.h" | 14 #include "net/quic/core/crypto/proof_verifier.h" |
16 #include "net/quic/core/crypto/quic_crypto_client_config.h" | 15 #include "net/quic/core/crypto/quic_crypto_client_config.h" |
17 #include "net/quic/core/quic_config.h" | 16 #include "net/quic/core/quic_config.h" |
18 #include "net/quic/core/quic_crypto_stream.h" | 17 #include "net/quic/core/quic_crypto_stream.h" |
19 #include "net/quic/core/quic_server_id.h" | 18 #include "net/quic/core/quic_server_id.h" |
| 19 #include "net/quic/platform/api/quic_export.h" |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 | 22 |
23 namespace test { | 23 namespace test { |
24 class CryptoTestUtils; | 24 class CryptoTestUtils; |
25 class QuicChromiumClientSessionPeer; | 25 class QuicChromiumClientSessionPeer; |
26 } // namespace test | 26 } // namespace test |
27 | 27 |
28 class NET_EXPORT_PRIVATE QuicCryptoClientStreamBase : public QuicCryptoStream { | 28 class QUIC_EXPORT_PRIVATE QuicCryptoClientStreamBase : public QuicCryptoStream { |
29 public: | 29 public: |
30 explicit QuicCryptoClientStreamBase(QuicSession* session); | 30 explicit QuicCryptoClientStreamBase(QuicSession* session); |
31 | 31 |
32 ~QuicCryptoClientStreamBase() override{}; | 32 ~QuicCryptoClientStreamBase() override{}; |
33 | 33 |
34 // Performs a crypto handshake with the server. | 34 // Performs a crypto handshake with the server. |
35 virtual void CryptoConnect() = 0; | 35 virtual void CryptoConnect() = 0; |
36 | 36 |
37 // num_sent_client_hellos returns the number of client hello messages that | 37 // num_sent_client_hellos returns the number of client hello messages that |
38 // have been sent. If the handshake has completed then this is one greater | 38 // have been sent. If the handshake has completed then this is one greater |
39 // than the number of round-trips needed for the handshake. | 39 // than the number of round-trips needed for the handshake. |
40 virtual int num_sent_client_hellos() const = 0; | 40 virtual int num_sent_client_hellos() const = 0; |
41 | 41 |
42 // The number of server config update messages received by the | 42 // The number of server config update messages received by the |
43 // client. Does not count update messages that were received prior | 43 // client. Does not count update messages that were received prior |
44 // to handshake confirmation. | 44 // to handshake confirmation. |
45 virtual int num_scup_messages_received() const = 0; | 45 virtual int num_scup_messages_received() const = 0; |
46 }; | 46 }; |
47 | 47 |
48 class NET_EXPORT_PRIVATE QuicCryptoClientStream | 48 class QUIC_EXPORT_PRIVATE QuicCryptoClientStream |
49 : public QuicCryptoClientStreamBase { | 49 : public QuicCryptoClientStreamBase { |
50 public: | 50 public: |
51 // kMaxClientHellos is the maximum number of times that we'll send a client | 51 // kMaxClientHellos is the maximum number of times that we'll send a client |
52 // hello. The value 3 accounts for: | 52 // hello. The value 3 accounts for: |
53 // * One failure due to an incorrect or missing source-address token. | 53 // * One failure due to an incorrect or missing source-address token. |
54 // * One failure due the server's certificate chain being unavailible and | 54 // * One failure due the server's certificate chain being unavailible and |
55 // the server being unwilling to send it without a valid source-address | 55 // the server being unwilling to send it without a valid source-address |
56 // token. | 56 // token. |
57 static const int kMaxClientHellos = 3; | 57 static const int kMaxClientHellos = 3; |
58 | 58 |
59 // ProofHandler is an interface that handles callbacks from the crypto | 59 // ProofHandler is an interface that handles callbacks from the crypto |
60 // stream when the client has proof verification details of the server. | 60 // stream when the client has proof verification details of the server. |
61 class NET_EXPORT_PRIVATE ProofHandler { | 61 class QUIC_EXPORT_PRIVATE ProofHandler { |
62 public: | 62 public: |
63 virtual ~ProofHandler() {} | 63 virtual ~ProofHandler() {} |
64 | 64 |
65 // Called when the proof in |cached| is marked valid. If this is a secure | 65 // Called when the proof in |cached| is marked valid. If this is a secure |
66 // QUIC session, then this will happen only after the proof verifier | 66 // QUIC session, then this will happen only after the proof verifier |
67 // completes. | 67 // completes. |
68 virtual void OnProofValid( | 68 virtual void OnProofValid( |
69 const QuicCryptoClientConfig::CachedState& cached) = 0; | 69 const QuicCryptoClientConfig::CachedState& cached) = 0; |
70 | 70 |
71 // Called when proof verification details become available, either because | 71 // Called when proof verification details become available, either because |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 base::TimeTicks proof_verify_start_time_; | 270 base::TimeTicks proof_verify_start_time_; |
271 | 271 |
272 int num_scup_messages_received_; | 272 int num_scup_messages_received_; |
273 | 273 |
274 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); | 274 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); |
275 }; | 275 }; |
276 | 276 |
277 } // namespace net | 277 } // namespace net |
278 | 278 |
279 #endif // NET_QUIC_CORE_QUIC_CRYPTO_CLIENT_STREAM_H_ | 279 #endif // NET_QUIC_CORE_QUIC_CRYPTO_CLIENT_STREAM_H_ |
OLD | NEW |