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