| 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 <string> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 14 #include "base/containers/hash_tables.h" | 15 #include "base/containers/hash_tables.h" |
| 15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 16 #include "net/quic/quic_crypto_server_stream.h" | 17 #include "net/quic/quic_crypto_server_stream.h" |
| 17 #include "net/quic/quic_protocol.h" | 18 #include "net/quic/quic_protocol.h" |
| 18 #include "net/quic/quic_session.h" | 19 #include "net/quic/quic_session.h" |
| 19 | 20 |
| 20 namespace net { | 21 namespace net { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 62 |
| 62 virtual void InitializeSession(const QuicCryptoServerConfig& crypto_config); | 63 virtual void InitializeSession(const QuicCryptoServerConfig& crypto_config); |
| 63 | 64 |
| 64 const QuicCryptoServerStream* crypto_stream() const { | 65 const QuicCryptoServerStream* crypto_stream() const { |
| 65 return crypto_stream_.get(); | 66 return crypto_stream_.get(); |
| 66 } | 67 } |
| 67 | 68 |
| 68 // Override base class to process FEC config received from client. | 69 // Override base class to process FEC config received from client. |
| 69 void OnConfigNegotiated() override; | 70 void OnConfigNegotiated() override; |
| 70 | 71 |
| 71 void set_serving_region(string serving_region) { | 72 void set_serving_region(std::string serving_region) { |
| 72 serving_region_ = serving_region; | 73 serving_region_ = serving_region; |
| 73 } | 74 } |
| 74 | 75 |
| 75 protected: | 76 protected: |
| 76 // QuicSession methods: | 77 // QuicSession methods: |
| 77 QuicDataStream* CreateIncomingDataStream(QuicStreamId id) override; | 78 QuicDataStream* CreateIncomingDataStream(QuicStreamId id) override; |
| 78 QuicDataStream* CreateOutgoingDataStream() override; | 79 QuicDataStream* CreateOutgoingDataStream() override; |
| 79 QuicCryptoServerStream* GetCryptoStream() override; | 80 QuicCryptoServerStream* GetCryptoStream() override; |
| 80 | 81 |
| 81 // If we should create an incoming stream, returns true. Otherwise | 82 // If we should create an incoming stream, returns true. Otherwise |
| 82 // does error handling, including communicating the error to the client and | 83 // does error handling, including communicating the error to the client and |
| 83 // possibly closing the connection, and returns false. | 84 // possibly closing the connection, and returns false. |
| 84 virtual bool ShouldCreateIncomingDataStream(QuicStreamId id); | 85 virtual bool ShouldCreateIncomingDataStream(QuicStreamId id); |
| 85 | 86 |
| 86 virtual QuicCryptoServerStream* CreateQuicCryptoServerStream( | 87 virtual QuicCryptoServerStream* CreateQuicCryptoServerStream( |
| 87 const QuicCryptoServerConfig& crypto_config); | 88 const QuicCryptoServerConfig& crypto_config); |
| 88 | 89 |
| 89 private: | 90 private: |
| 90 friend class test::QuicServerSessionPeer; | 91 friend class test::QuicServerSessionPeer; |
| 91 | 92 |
| 92 scoped_ptr<QuicCryptoServerStream> crypto_stream_; | 93 scoped_ptr<QuicCryptoServerStream> crypto_stream_; |
| 93 QuicServerSessionVisitor* visitor_; | 94 QuicServerSessionVisitor* visitor_; |
| 94 | 95 |
| 95 // The most recent bandwidth estimate sent to the client. | 96 // The most recent bandwidth estimate sent to the client. |
| 96 QuicBandwidth bandwidth_estimate_sent_to_client_; | 97 QuicBandwidth bandwidth_estimate_sent_to_client_; |
| 97 | 98 |
| 98 // Text describing server location. Sent to the client as part of the bandwith | 99 // Text describing server location. Sent to the client as part of the bandwith |
| 99 // estimate in the source-address token. Optional, can be left empty. | 100 // estimate in the source-address token. Optional, can be left empty. |
| 100 string serving_region_; | 101 std::string serving_region_; |
| 101 | 102 |
| 102 // Time at which we send the last SCUP to the client. | 103 // Time at which we send the last SCUP to the client. |
| 103 QuicTime last_scup_time_; | 104 QuicTime last_scup_time_; |
| 104 | 105 |
| 105 // Number of packets sent to the peer, at the time we last sent a SCUP. | 106 // Number of packets sent to the peer, at the time we last sent a SCUP. |
| 106 int64 last_scup_sequence_number_; | 107 int64 last_scup_sequence_number_; |
| 107 | 108 |
| 108 DISALLOW_COPY_AND_ASSIGN(QuicServerSession); | 109 DISALLOW_COPY_AND_ASSIGN(QuicServerSession); |
| 109 }; | 110 }; |
| 110 | 111 |
| 111 } // namespace tools | 112 } // namespace tools |
| 112 } // namespace net | 113 } // namespace net |
| 113 | 114 |
| 114 #endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ | 115 #endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ |
| OLD | NEW |