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_QUIC_QUIC_CLIENT_SESSION_H_ | 7 #ifndef NET_QUIC_QUIC_CLIENT_SESSION_H_ |
8 #define NET_QUIC_QUIC_CLIENT_SESSION_H_ | 8 #define NET_QUIC_QUIC_CLIENT_SESSION_H_ |
9 | 9 |
| 10 #include "base/hash_tables.h" |
10 #include "net/base/completion_callback.h" | 11 #include "net/base/completion_callback.h" |
11 #include "net/quic/quic_crypto_client_stream.h" | 12 #include "net/quic/quic_crypto_client_stream.h" |
12 #include "net/quic/quic_reliable_client_stream.h" | 13 #include "net/quic/quic_reliable_client_stream.h" |
13 #include "net/quic/quic_session.h" | 14 #include "net/quic/quic_session.h" |
14 | 15 |
15 namespace net { | 16 namespace net { |
16 | 17 |
17 class NET_EXPORT_PRIVATE QuicClientSession : public QuicSession { | 18 class NET_EXPORT_PRIVATE QuicClientSession : public QuicSession { |
18 public: | 19 public: |
19 explicit QuicClientSession(QuicConnection* connection); | 20 explicit QuicClientSession(QuicConnection* connection); |
20 | 21 |
21 virtual ~QuicClientSession(); | 22 virtual ~QuicClientSession(); |
22 | 23 |
23 // QuicSession methods: | 24 // QuicSession methods: |
24 virtual QuicReliableClientStream* CreateOutgoingReliableStream() OVERRIDE; | 25 virtual QuicReliableClientStream* CreateOutgoingReliableStream() OVERRIDE; |
25 virtual QuicCryptoClientStream* GetCryptoStream() OVERRIDE; | 26 virtual QuicCryptoClientStream* GetCryptoStream() OVERRIDE; |
| 27 virtual void CloseStream(QuicStreamId stream_id) OVERRIDE; |
26 virtual void OnCryptoHandshakeComplete(QuicErrorCode error) OVERRIDE; | 28 virtual void OnCryptoHandshakeComplete(QuicErrorCode error) OVERRIDE; |
27 | 29 |
28 // Perform a crypto handshake with the server. | 30 // Perform a crypto handshake with the server. |
29 int CryptoConnect(const CompletionCallback& callback); | 31 int CryptoConnect(const CompletionCallback& callback); |
30 | 32 |
31 protected: | 33 protected: |
32 // QuicSession methods: | 34 // QuicSession methods: |
33 virtual ReliableQuicStream* CreateIncomingReliableStream( | 35 virtual ReliableQuicStream* CreateIncomingReliableStream( |
34 QuicStreamId id) OVERRIDE; | 36 QuicStreamId id) OVERRIDE; |
35 | 37 |
36 private: | 38 private: |
| 39 typedef base::hash_map<QuicStreamId, ReliableQuicStream*> StreamMap; |
37 QuicCryptoClientStream crypto_stream_; | 40 QuicCryptoClientStream crypto_stream_; |
| 41 StreamMap streams_; |
38 | 42 |
39 CompletionCallback callback_; | 43 CompletionCallback callback_; |
40 | 44 |
41 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); | 45 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); |
42 }; | 46 }; |
43 | 47 |
44 } // namespace net | 48 } // namespace net |
45 | 49 |
46 #endif // NET_QUIC_QUIC_CLIENT_SESSION_H_ | 50 #endif // NET_QUIC_QUIC_CLIENT_SESSION_H_ |
OLD | NEW |