| 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_BASE_H_ | 7 #ifndef NET_TOOLS_QUIC_QUIC_SERVER_SESSION_BASE_H_ |
| 8 #define NET_TOOLS_QUIC_QUIC_SERVER_SESSION_BASE_H_ | 8 #define NET_TOOLS_QUIC_QUIC_SERVER_SESSION_BASE_H_ |
| 9 | 9 |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| 11 | 11 |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 19 #include "net/quic/crypto/quic_compressed_certs_cache.h" |
| 19 #include "net/quic/quic_crypto_server_stream.h" | 20 #include "net/quic/quic_crypto_server_stream.h" |
| 20 #include "net/quic/quic_protocol.h" | 21 #include "net/quic/quic_protocol.h" |
| 21 #include "net/quic/quic_spdy_session.h" | 22 #include "net/quic/quic_spdy_session.h" |
| 22 | 23 |
| 23 namespace net { | 24 namespace net { |
| 24 | 25 |
| 25 class QuicBlockedWriterInterface; | 26 class QuicBlockedWriterInterface; |
| 26 class QuicConfig; | 27 class QuicConfig; |
| 27 class QuicConnection; | 28 class QuicConnection; |
| 28 class QuicCryptoServerConfig; | 29 class QuicCryptoServerConfig; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 51 virtual void OnConnectionRemovedFromTimeWaitList( | 52 virtual void OnConnectionRemovedFromTimeWaitList( |
| 52 QuicConnectionId connection_id) {} | 53 QuicConnectionId connection_id) {} |
| 53 }; | 54 }; |
| 54 | 55 |
| 55 class QuicServerSessionBase : public QuicSpdySession { | 56 class QuicServerSessionBase : public QuicSpdySession { |
| 56 public: | 57 public: |
| 57 // |crypto_config| must outlive the session. | 58 // |crypto_config| must outlive the session. |
| 58 QuicServerSessionBase(const QuicConfig& config, | 59 QuicServerSessionBase(const QuicConfig& config, |
| 59 QuicConnection* connection, | 60 QuicConnection* connection, |
| 60 QuicServerSessionVisitor* visitor, | 61 QuicServerSessionVisitor* visitor, |
| 61 const QuicCryptoServerConfig* crypto_config); | 62 const QuicCryptoServerConfig* crypto_config, |
| 63 QuicCompressedCertsCache* compressed_certs_cache); |
| 62 | 64 |
| 63 // Override the base class to notify the owner of the connection close. | 65 // Override the base class to notify the owner of the connection close. |
| 64 void OnConnectionClosed(QuicErrorCode error, | 66 void OnConnectionClosed(QuicErrorCode error, |
| 65 ConnectionCloseSource source) override; | 67 ConnectionCloseSource source) override; |
| 66 void OnWriteBlocked() override; | 68 void OnWriteBlocked() override; |
| 67 | 69 |
| 68 // Sends a server config update to the client, containing new bandwidth | 70 // Sends a server config update to the client, containing new bandwidth |
| 69 // estimate. | 71 // estimate. |
| 70 void OnCongestionWindowChange(QuicTime now) override; | 72 void OnCongestionWindowChange(QuicTime now) override; |
| 71 | 73 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 102 virtual QuicCryptoServerStreamBase* CreateQuicCryptoServerStream( | 104 virtual QuicCryptoServerStreamBase* CreateQuicCryptoServerStream( |
| 103 const QuicCryptoServerConfig* crypto_config) = 0; | 105 const QuicCryptoServerConfig* crypto_config) = 0; |
| 104 | 106 |
| 105 const QuicCryptoServerConfig* crypto_config() { return crypto_config_; } | 107 const QuicCryptoServerConfig* crypto_config() { return crypto_config_; } |
| 106 | 108 |
| 107 private: | 109 private: |
| 108 friend class test::QuicServerSessionBasePeer; | 110 friend class test::QuicServerSessionBasePeer; |
| 109 friend class test::QuicSimpleServerSessionPeer; | 111 friend class test::QuicSimpleServerSessionPeer; |
| 110 | 112 |
| 111 const QuicCryptoServerConfig* crypto_config_; | 113 const QuicCryptoServerConfig* crypto_config_; |
| 114 |
| 115 // The cache which contains most recently compressed certs. |
| 116 // Owned by QuicDispatcher. |
| 117 QuicCompressedCertsCache* compressed_certs_cache_; |
| 118 |
| 112 scoped_ptr<QuicCryptoServerStreamBase> crypto_stream_; | 119 scoped_ptr<QuicCryptoServerStreamBase> crypto_stream_; |
| 113 QuicServerSessionVisitor* visitor_; | 120 QuicServerSessionVisitor* visitor_; |
| 114 | 121 |
| 115 // Whether bandwidth resumption is enabled for this connection. | 122 // Whether bandwidth resumption is enabled for this connection. |
| 116 bool bandwidth_resumption_enabled_; | 123 bool bandwidth_resumption_enabled_; |
| 117 | 124 |
| 118 // The most recent bandwidth estimate sent to the client. | 125 // The most recent bandwidth estimate sent to the client. |
| 119 QuicBandwidth bandwidth_estimate_sent_to_client_; | 126 QuicBandwidth bandwidth_estimate_sent_to_client_; |
| 120 | 127 |
| 121 // Text describing server location. Sent to the client as part of the bandwith | 128 // Text describing server location. Sent to the client as part of the bandwith |
| 122 // estimate in the source-address token. Optional, can be left empty. | 129 // estimate in the source-address token. Optional, can be left empty. |
| 123 std::string serving_region_; | 130 std::string serving_region_; |
| 124 | 131 |
| 125 // Time at which we send the last SCUP to the client. | 132 // Time at which we send the last SCUP to the client. |
| 126 QuicTime last_scup_time_; | 133 QuicTime last_scup_time_; |
| 127 | 134 |
| 128 // Number of packets sent to the peer, at the time we last sent a SCUP. | 135 // Number of packets sent to the peer, at the time we last sent a SCUP. |
| 129 int64_t last_scup_packet_number_; | 136 int64_t last_scup_packet_number_; |
| 130 | 137 |
| 131 DISALLOW_COPY_AND_ASSIGN(QuicServerSessionBase); | 138 DISALLOW_COPY_AND_ASSIGN(QuicServerSessionBase); |
| 132 }; | 139 }; |
| 133 | 140 |
| 134 } // namespace net | 141 } // namespace net |
| 135 | 142 |
| 136 #endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_BASE_H_ | 143 #endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_BASE_H_ |
| OLD | NEW |