| 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 server specific QuicSession subclass. | 5 // A server specific QuicSession subclass. |
| 6 | 6 |
| 7 #ifndef NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ | 7 #ifndef NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ |
| 8 #define NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ | 8 #define NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/hash_tables.h" | 13 #include "base/hash_tables.h" |
| 14 #include "net/quic/quic_crypto_server_stream.h" | 14 #include "net/quic/quic_crypto_server_stream.h" |
| 15 #include "net/quic/quic_protocol.h" | 15 #include "net/quic/quic_protocol.h" |
| 16 #include "net/quic/quic_session.h" | 16 #include "net/quic/quic_session.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 class QuicConfig; |
| 20 class QuicConnection; | 21 class QuicConnection; |
| 22 class QuicCryptoServerConfig; |
| 21 class ReliableQuicStream; | 23 class ReliableQuicStream; |
| 22 | 24 |
| 23 namespace tools { | 25 namespace tools { |
| 24 | 26 |
| 25 // An interface from the session to the entity owning the session. | 27 // An interface from the session to the entity owning the session. |
| 26 // This lets the session notify its owner (the Dispatcher) when the connection | 28 // This lets the session notify its owner (the Dispatcher) when the connection |
| 27 // is closed. | 29 // is closed. |
| 28 class QuicSessionOwner { | 30 class QuicSessionOwner { |
| 29 public: | 31 public: |
| 30 virtual ~QuicSessionOwner() {} | 32 virtual ~QuicSessionOwner() {} |
| 31 | 33 |
| 32 virtual void OnConnectionClose(QuicGuid guid, QuicErrorCode error) = 0; | 34 virtual void OnConnectionClose(QuicGuid guid, QuicErrorCode error) = 0; |
| 33 }; | 35 }; |
| 34 | 36 |
| 35 class QuicServerSession : public QuicSession { | 37 class QuicServerSession : public QuicSession { |
| 36 public: | 38 public: |
| 37 QuicServerSession(QuicConnection *connection, QuicSessionOwner* owner); | 39 QuicServerSession(const QuicConfig& config, |
| 40 const QuicCryptoServerConfig& crypto_config, |
| 41 QuicConnection* connection, |
| 42 QuicSessionOwner* owner); |
| 38 | 43 |
| 39 // Override the base class to notify the owner of the connection close. | 44 // Override the base class to notify the owner of the connection close. |
| 40 virtual void ConnectionClose(QuicErrorCode error, bool from_peer) OVERRIDE; | 45 virtual void ConnectionClose(QuicErrorCode error, bool from_peer) OVERRIDE; |
| 41 | 46 |
| 42 virtual ~QuicServerSession(); | 47 virtual ~QuicServerSession(); |
| 43 | 48 |
| 44 protected: | 49 protected: |
| 45 // QuicSession methods: | 50 // QuicSession methods: |
| 46 virtual ReliableQuicStream* CreateIncomingReliableStream( | 51 virtual ReliableQuicStream* CreateIncomingReliableStream( |
| 47 QuicStreamId id) OVERRIDE; | 52 QuicStreamId id) OVERRIDE; |
| 48 virtual ReliableQuicStream* CreateOutgoingReliableStream() OVERRIDE; | 53 virtual ReliableQuicStream* CreateOutgoingReliableStream() OVERRIDE; |
| 49 virtual QuicCryptoServerStream* GetCryptoStream() OVERRIDE; | 54 virtual QuicCryptoServerStream* GetCryptoStream() OVERRIDE; |
| 50 | 55 |
| 51 // If we should create an incoming stream, returns true. Otherwise | 56 // If we should create an incoming stream, returns true. Otherwise |
| 52 // does error handling, including communicating the error to the client and | 57 // does error handling, including communicating the error to the client and |
| 53 // possibly closing the connection, and returns false. | 58 // possibly closing the connection, and returns false. |
| 54 virtual bool ShouldCreateIncomingReliableStream(QuicStreamId id); | 59 virtual bool ShouldCreateIncomingReliableStream(QuicStreamId id); |
| 55 | 60 |
| 56 private: | 61 private: |
| 57 QuicCryptoServerStream crypto_stream_; | 62 QuicCryptoServerStream crypto_stream_; |
| 58 QuicSessionOwner* owner_; | 63 QuicSessionOwner* owner_; |
| 59 | 64 |
| 60 DISALLOW_COPY_AND_ASSIGN(QuicServerSession); | 65 DISALLOW_COPY_AND_ASSIGN(QuicServerSession); |
| 61 }; | 66 }; |
| 62 | 67 |
| 63 } // namespace tools | 68 } // namespace tools |
| 64 } // namespace net | 69 } // namespace net |
| 65 | 70 |
| 66 #endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ | 71 #endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ |
| OLD | NEW |