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