| 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> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 // An interface from the session to the entity owning the session. | 34 // An interface from the session to the entity owning the session. |
| 35 // This lets the session notify its owner (the Dispatcher) when the connection | 35 // This lets the session notify its owner (the Dispatcher) when the connection |
| 36 // is closed or blocked. | 36 // is closed or blocked. |
| 37 class QuicServerSessionVisitor { | 37 class QuicServerSessionVisitor { |
| 38 public: | 38 public: |
| 39 virtual ~QuicServerSessionVisitor() {} | 39 virtual ~QuicServerSessionVisitor() {} |
| 40 | 40 |
| 41 virtual void OnConnectionClosed(QuicConnectionId connection_id, | 41 virtual void OnConnectionClosed(QuicConnectionId connection_id, |
| 42 QuicErrorCode error) = 0; | 42 QuicErrorCode error) = 0; |
| 43 virtual void OnWriteBlocked(QuicBlockedWriterInterface* writer) = 0; | 43 virtual void OnWriteBlocked(QuicBlockedWriterInterface* blocked_writer) = 0; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 class QuicServerSession : public QuicSession { | 46 class QuicServerSession : public QuicSession { |
| 47 public: | 47 public: |
| 48 QuicServerSession(const QuicConfig& config, | 48 QuicServerSession(const QuicConfig& config, |
| 49 QuicConnection* connection, | 49 QuicConnection* connection, |
| 50 QuicServerSessionVisitor* visitor); | 50 QuicServerSessionVisitor* visitor); |
| 51 | 51 |
| 52 // Override the base class to notify the owner of the connection close. | 52 // Override the base class to notify the owner of the connection close. |
| 53 virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) OVERRIDE; | 53 virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) OVERRIDE; |
| 54 virtual void OnWriteBlocked() OVERRIDE; | 54 virtual void OnWriteBlocked() OVERRIDE; |
| 55 | 55 |
| 56 virtual ~QuicServerSession(); | 56 virtual ~QuicServerSession(); |
| 57 | 57 |
| 58 virtual void InitializeSession(const QuicCryptoServerConfig& crypto_config); | 58 virtual void InitializeSession(const QuicCryptoServerConfig& crypto_config); |
| 59 | 59 |
| 60 const QuicCryptoServerStream* crypto_stream() const { | 60 const QuicCryptoServerStream* crypto_stream() const { |
| 61 return crypto_stream_.get(); | 61 return crypto_stream_.get(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Override base class to process FEC config received from client. |
| 65 virtual void OnConfigNegotiated() OVERRIDE; |
| 66 |
| 64 protected: | 67 protected: |
| 65 // QuicSession methods: | 68 // QuicSession methods: |
| 66 virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) OVERRIDE; | 69 virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) OVERRIDE; |
| 67 virtual QuicDataStream* CreateOutgoingDataStream() OVERRIDE; | 70 virtual QuicDataStream* CreateOutgoingDataStream() OVERRIDE; |
| 68 virtual QuicCryptoServerStream* GetCryptoStream() OVERRIDE; | 71 virtual QuicCryptoServerStream* GetCryptoStream() OVERRIDE; |
| 69 | 72 |
| 70 // If we should create an incoming stream, returns true. Otherwise | 73 // If we should create an incoming stream, returns true. Otherwise |
| 71 // does error handling, including communicating the error to the client and | 74 // does error handling, including communicating the error to the client and |
| 72 // possibly closing the connection, and returns false. | 75 // possibly closing the connection, and returns false. |
| 73 virtual bool ShouldCreateIncomingDataStream(QuicStreamId id); | 76 virtual bool ShouldCreateIncomingDataStream(QuicStreamId id); |
| 74 | 77 |
| 75 virtual QuicCryptoServerStream* CreateQuicCryptoServerStream( | 78 virtual QuicCryptoServerStream* CreateQuicCryptoServerStream( |
| 76 const QuicCryptoServerConfig& crypto_config); | 79 const QuicCryptoServerConfig& crypto_config); |
| 77 | 80 |
| 78 private: | 81 private: |
| 79 friend class test::QuicServerSessionPeer; | 82 friend class test::QuicServerSessionPeer; |
| 80 | 83 |
| 81 scoped_ptr<QuicCryptoServerStream> crypto_stream_; | 84 scoped_ptr<QuicCryptoServerStream> crypto_stream_; |
| 82 QuicServerSessionVisitor* visitor_; | 85 QuicServerSessionVisitor* visitor_; |
| 83 | 86 |
| 84 DISALLOW_COPY_AND_ASSIGN(QuicServerSession); | 87 DISALLOW_COPY_AND_ASSIGN(QuicServerSession); |
| 85 }; | 88 }; |
| 86 | 89 |
| 87 } // namespace tools | 90 } // namespace tools |
| 88 } // namespace net | 91 } // namespace net |
| 89 | 92 |
| 90 #endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ | 93 #endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ |
| OLD | NEW |