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 // A client specific QuicSession subclass. | 5 // A client specific QuicSession subclass. |
6 | 6 |
7 #ifndef NET_TOOLS_QUIC_QUIC_CLIENT_SESSION_H_ | 7 #ifndef NET_TOOLS_QUIC_QUIC_CLIENT_SESSION_H_ |
8 #define NET_TOOLS_QUIC_QUIC_CLIENT_SESSION_H_ | 8 #define NET_TOOLS_QUIC_QUIC_CLIENT_SESSION_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "net/quic/quic_crypto_client_stream.h" | 12 #include "net/quic/quic_crypto_client_stream.h" |
13 #include "net/quic/quic_protocol.h" | 13 #include "net/quic/quic_protocol.h" |
14 #include "net/quic/quic_session.h" | 14 #include "net/quic/quic_session.h" |
15 #include "net/tools/quic/quic_reliable_client_stream.h" | 15 #include "net/tools/quic/quic_spdy_client_stream.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 class QuicConnection; | 19 class QuicConnection; |
20 class ReliableQuicStream; | 20 class ReliableQuicStream; |
21 | 21 |
22 namespace tools { | 22 namespace tools { |
23 | 23 |
24 class QuicReliableClientStream; | |
25 | |
26 class QuicClientSession : public QuicSession { | 24 class QuicClientSession : public QuicSession { |
27 public: | 25 public: |
28 QuicClientSession(const std::string& server_hostname, | 26 QuicClientSession(const std::string& server_hostname, |
29 const QuicConfig& config, | 27 const QuicConfig& config, |
30 QuicConnection* connection, | 28 QuicConnection* connection, |
31 QuicCryptoClientConfig* crypto_config); | 29 QuicCryptoClientConfig* crypto_config); |
32 virtual ~QuicClientSession(); | 30 virtual ~QuicClientSession(); |
33 | 31 |
34 // QuicSession methods: | 32 // QuicSession methods: |
35 virtual QuicReliableClientStream* CreateOutgoingReliableStream() OVERRIDE; | 33 virtual QuicSpdyClientStream* CreateOutgoingReliableStream() OVERRIDE; |
36 virtual QuicCryptoClientStream* GetCryptoStream() OVERRIDE; | 34 virtual QuicCryptoClientStream* GetCryptoStream() OVERRIDE; |
37 | 35 |
38 // Performs a crypto handshake with the server. Returns true if the crypto | 36 // Performs a crypto handshake with the server. Returns true if the crypto |
39 // handshake is started successfully. | 37 // handshake is started successfully. |
40 bool CryptoConnect(); | 38 bool CryptoConnect(); |
41 | 39 |
42 // Returns the number of client hello messages that have been sent on the | 40 // Returns the number of client hello messages that have been sent on the |
43 // crypto stream. If the handshake has completed then this is one greater | 41 // crypto stream. If the handshake has completed then this is one greater |
44 // than the number of round-trips needed for the handshake. | 42 // than the number of round-trips needed for the handshake. |
45 int GetNumSentClientHellos() const; | 43 int GetNumSentClientHellos() const; |
46 | 44 |
47 protected: | 45 protected: |
48 // QuicSession methods: | 46 // QuicSession methods: |
49 virtual ReliableQuicStream* CreateIncomingReliableStream( | 47 virtual ReliableQuicStream* CreateIncomingReliableStream( |
50 QuicStreamId id) OVERRIDE; | 48 QuicStreamId id) OVERRIDE; |
51 | 49 |
52 private: | 50 private: |
53 QuicCryptoClientStream crypto_stream_; | 51 QuicCryptoClientStream crypto_stream_; |
54 | 52 |
55 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); | 53 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); |
56 }; | 54 }; |
57 | 55 |
58 } // namespace tools | 56 } // namespace tools |
59 } // namespace net | 57 } // namespace net |
60 | 58 |
61 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_SESSION_H_ | 59 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_SESSION_H_ |
OLD | NEW |