Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(768)

Side by Side Diff: net/quic/quic_crypto_client_stream.h

Issue 13976007: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated copyright notice Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_crypto_client_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "net/quic/quic_config.h"
11 #include "net/quic/quic_crypto_stream.h" 12 #include "net/quic/quic_crypto_stream.h"
12 13
13 namespace net { 14 namespace net {
14 15
16 class QuicConfig;
15 class QuicSession; 17 class QuicSession;
16 18
17 namespace test { 19 namespace test {
18 class CryptoTestUtils; 20 class CryptoTestUtils;
19 } // namespace test 21 } // namespace test
20 22
21 class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoStream { 23 class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoStream {
22 public: 24 public:
23 QuicCryptoClientStream(QuicSession* session, const string& server_hostname); 25 QuicCryptoClientStream(const string& server_hostname,
26 const QuicConfig& config,
27 QuicSession* session,
28 QuicCryptoClientConfig* crypto_config);
24 virtual ~QuicCryptoClientStream(); 29 virtual ~QuicCryptoClientStream();
25 30
26 // CryptoFramerVisitorInterface implementation 31 // CryptoFramerVisitorInterface implementation
27 virtual void OnHandshakeMessage( 32 virtual void OnHandshakeMessage(
28 const CryptoHandshakeMessage& message) OVERRIDE; 33 const CryptoHandshakeMessage& message) OVERRIDE;
29 34
30 // 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
31 // handshake is started successfully. 36 // handshake is started successfully.
32 // TODO(agl): this should probably return void. 37 // TODO(agl): this should probably return void.
33 virtual bool CryptoConnect(); 38 virtual bool CryptoConnect();
34 39
35 const QuicNegotiatedParameters& negotiated_params() const; 40 const QuicNegotiatedParameters& negotiated_params() const;
36 const QuicCryptoNegotiatedParameters& crypto_negotiated_params() const; 41 const QuicCryptoNegotiatedParameters& crypto_negotiated_params() const;
37 42
38 private: 43 private:
39 friend class test::CryptoTestUtils; 44 friend class test::CryptoTestUtils;
40 45
41 enum State { 46 enum State {
42 STATE_IDLE, 47 STATE_IDLE,
43 STATE_SEND_CHLO, 48 STATE_SEND_CHLO,
44 STATE_RECV_REJ, 49 STATE_RECV_REJ,
45 STATE_RECV_SHLO, 50 STATE_RECV_SHLO,
46 }; 51 };
47 52
48 // DoHandshakeLoop performs a step of the handshake state machine. Note that 53 // DoHandshakeLoop performs a step of the handshake state machine. Note that
49 // |in| is NULL for the first call. 54 // |in| is NULL for the first call.
50 void DoHandshakeLoop(const CryptoHandshakeMessage* in); 55 void DoHandshakeLoop(const CryptoHandshakeMessage* in);
51 56
52 State next_state_; 57 State next_state_;
58 // num_client_hellos_ contains the number of client hello messages that this
59 // connection has sent.
60 int num_client_hellos_;
53 61
54 QuicConfig config_; 62 const QuicConfig& config_;
55 QuicCryptoClientConfig crypto_config_; 63 QuicCryptoClientConfig* const crypto_config_;
56 64
57 QuicNegotiatedParameters negotiated_params_; 65 QuicNegotiatedParameters negotiated_params_;
58 QuicCryptoNegotiatedParameters crypto_negotiated_params_; 66 QuicCryptoNegotiatedParameters crypto_negotiated_params_;
59 67
68 // decrypter_pushed_ is true if we have installed a QuicDecrypter in the
69 // connection. We need to track this because, in the event of a handshake
70 // failure, we have to remove any previous decrypters as they will have the
71 // wrong keys.
60 bool decrypter_pushed_; 72 bool decrypter_pushed_;
61 73
62 // Client's connection nonce (4-byte timestamp + 28 random bytes) 74 // Client's connection nonce (4-byte timestamp + 28 random bytes)
63 std::string nonce_; 75 std::string nonce_;
64 // Server's hostname 76 // Server's hostname
65 std::string server_hostname_; 77 std::string server_hostname_;
66 78
67 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); 79 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream);
68 }; 80 };
69 81
70 } // namespace net 82 } // namespace net
71 83
72 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_ 84 #endif // NET_QUIC_QUIC_CRYPTO_CLIENT_STREAM_H_
OLDNEW
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_crypto_client_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698