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/crypto_handshake.h" | 10 #include "net/quic/crypto/crypto_handshake.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // CryptoFramerVisitorInterface implementation | 31 // CryptoFramerVisitorInterface implementation |
32 virtual void OnHandshakeMessage( | 32 virtual void OnHandshakeMessage( |
33 const CryptoHandshakeMessage& message) OVERRIDE; | 33 const CryptoHandshakeMessage& message) OVERRIDE; |
34 | 34 |
35 // Performs a crypto handshake with the server. Returns true if the crypto | 35 // Performs a crypto handshake with the server. Returns true if the crypto |
36 // handshake is started successfully. | 36 // handshake is started successfully. |
37 // TODO(agl): this should probably return void. | 37 // TODO(agl): this should probably return void. |
38 virtual bool CryptoConnect(); | 38 virtual bool CryptoConnect(); |
39 | 39 |
40 const QuicNegotiatedParameters& negotiated_params() const; | |
41 const QuicCryptoNegotiatedParameters& crypto_negotiated_params() const; | |
42 | |
43 // num_sent_client_hellos returns the number of client hello messages that | 40 // 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 | 41 // have been sent. If the handshake has completed then this is one greater |
45 // than the number of round-trips needed for the handshake. | 42 // than the number of round-trips needed for the handshake. |
46 int num_sent_client_hellos() const; | 43 int num_sent_client_hellos() const; |
47 | 44 |
48 private: | 45 private: |
49 friend class test::CryptoTestUtils; | 46 friend class test::CryptoTestUtils; |
50 | 47 |
51 enum State { | 48 enum State { |
52 STATE_IDLE, | 49 STATE_IDLE, |
53 STATE_SEND_CHLO, | 50 STATE_SEND_CHLO, |
54 STATE_RECV_REJ, | 51 STATE_RECV_REJ, |
55 STATE_RECV_SHLO, | 52 STATE_RECV_SHLO, |
56 }; | 53 }; |
57 | 54 |
58 // DoHandshakeLoop performs a step of the handshake state machine. Note that | 55 // DoHandshakeLoop performs a step of the handshake state machine. Note that |
59 // |in| is NULL for the first call. | 56 // |in| is NULL for the first call. |
60 void DoHandshakeLoop(const CryptoHandshakeMessage* in); | 57 void DoHandshakeLoop(const CryptoHandshakeMessage* in); |
61 | 58 |
62 State next_state_; | 59 State next_state_; |
63 // num_client_hellos_ contains the number of client hello messages that this | 60 // num_client_hellos_ contains the number of client hello messages that this |
64 // connection has sent. | 61 // connection has sent. |
65 int num_client_hellos_; | 62 int num_client_hellos_; |
66 | 63 |
67 const QuicConfig& config_; | 64 const QuicConfig& config_; |
68 QuicCryptoClientConfig* const crypto_config_; | 65 QuicCryptoClientConfig* const crypto_config_; |
69 | 66 |
70 QuicNegotiatedParameters negotiated_params_; | |
71 QuicCryptoNegotiatedParameters crypto_negotiated_params_; | |
72 | |
73 // Client's connection nonce (4-byte timestamp + 28 random bytes) | 67 // Client's connection nonce (4-byte timestamp + 28 random bytes) |
74 std::string nonce_; | 68 std::string nonce_; |
75 // Server's hostname | 69 // Server's hostname |
76 std::string server_hostname_; | 70 std::string server_hostname_; |
77 | 71 |
78 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); | 72 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); |
79 }; | 73 }; |
80 | 74 |
81 } // namespace net | 75 } // namespace net |
82 | 76 |
83 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ | 77 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ |
OLD | NEW |