| 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_QUIC_QUIC_SERVER_SESSION_BASE_H_ | 7 #ifndef NET_QUIC_QUIC_SERVER_SESSION_BASE_H_ |
| 8 #define NET_QUIC_QUIC_SERVER_SESSION_BASE_H_ | 8 #define NET_QUIC_QUIC_SERVER_SESSION_BASE_H_ |
| 9 | 9 |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 | 89 |
| 90 // Override base class to process bandwidth related config received from | 90 // Override base class to process bandwidth related config received from |
| 91 // client. | 91 // client. |
| 92 void OnConfigNegotiated() override; | 92 void OnConfigNegotiated() override; |
| 93 | 93 |
| 94 void set_serving_region(const std::string& serving_region) { | 94 void set_serving_region(const std::string& serving_region) { |
| 95 serving_region_ = serving_region; | 95 serving_region_ = serving_region; |
| 96 } | 96 } |
| 97 | 97 |
| 98 bool server_push_enabled() const { return server_push_enabled_; } | |
| 99 | |
| 100 protected: | 98 protected: |
| 101 // QuicSession methods(override them with return type of QuicSpdyStream*): | 99 // QuicSession methods(override them with return type of QuicSpdyStream*): |
| 102 QuicCryptoServerStreamBase* GetCryptoStream() override; | 100 QuicCryptoServerStreamBase* GetCryptoStream() override; |
| 103 | 101 |
| 104 // If an outgoing stream can be created, return true. | 102 // If an outgoing stream can be created, return true. |
| 105 // Return false when connection is closed or forward secure encryption hasn't | 103 // Return false when connection is closed or forward secure encryption hasn't |
| 106 // established yet or number of server initiated streams already reaches the | 104 // established yet or number of server initiated streams already reaches the |
| 107 // upper limit. | 105 // upper limit. |
| 108 bool ShouldCreateOutgoingDynamicStream() override; | 106 bool ShouldCreateOutgoingDynamicStream() override; |
| 109 | 107 |
| 110 // If we should create an incoming stream, returns true. Otherwise | 108 // If we should create an incoming stream, returns true. Otherwise |
| 111 // does error handling, including communicating the error to the client and | 109 // does error handling, including communicating the error to the client and |
| 112 // possibly closing the connection, and returns false. | 110 // possibly closing the connection, and returns false. |
| 113 bool ShouldCreateIncomingDynamicStream(QuicStreamId id) override; | 111 bool ShouldCreateIncomingDynamicStream(QuicStreamId id) override; |
| 114 | 112 |
| 115 virtual QuicCryptoServerStreamBase* CreateQuicCryptoServerStream( | 113 virtual QuicCryptoServerStreamBase* CreateQuicCryptoServerStream( |
| 116 const QuicCryptoServerConfig* crypto_config, | 114 const QuicCryptoServerConfig* crypto_config, |
| 117 QuicCompressedCertsCache* compressed_certs_cache) = 0; | 115 QuicCompressedCertsCache* compressed_certs_cache) = 0; |
| 118 | 116 |
| 119 const QuicCryptoServerConfig* crypto_config() { return crypto_config_; } | 117 const QuicCryptoServerConfig* crypto_config() { return crypto_config_; } |
| 120 | 118 |
| 121 void set_server_push_enabled(bool enable) { server_push_enabled_ = enable; } | |
| 122 | |
| 123 Visitor* visitor() { return visitor_; } | 119 Visitor* visitor() { return visitor_; } |
| 124 | 120 |
| 125 QuicCryptoServerStream::Helper* stream_helper() { return helper_; } | 121 QuicCryptoServerStream::Helper* stream_helper() { return helper_; } |
| 126 | 122 |
| 127 private: | 123 private: |
| 128 friend class test::QuicServerSessionBasePeer; | 124 friend class test::QuicServerSessionBasePeer; |
| 129 friend class test::QuicSimpleServerSessionPeer; | 125 friend class test::QuicSimpleServerSessionPeer; |
| 130 | 126 |
| 131 const QuicCryptoServerConfig* crypto_config_; | 127 const QuicCryptoServerConfig* crypto_config_; |
| 132 | 128 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 156 | 152 |
| 157 // Number of packets sent to the peer, at the time we last sent a SCUP. | 153 // Number of packets sent to the peer, at the time we last sent a SCUP. |
| 158 int64_t last_scup_packet_number_; | 154 int64_t last_scup_packet_number_; |
| 159 | 155 |
| 160 // Converts QuicBandwidth to an int32 bytes/second that can be | 156 // Converts QuicBandwidth to an int32 bytes/second that can be |
| 161 // stored in CachedNetworkParameters. TODO(jokulik): This function | 157 // stored in CachedNetworkParameters. TODO(jokulik): This function |
| 162 // should go away once we fix http://b//27897982 | 158 // should go away once we fix http://b//27897982 |
| 163 int32_t BandwidthToCachedParameterBytesPerSecond( | 159 int32_t BandwidthToCachedParameterBytesPerSecond( |
| 164 const QuicBandwidth& bandwidth); | 160 const QuicBandwidth& bandwidth); |
| 165 | 161 |
| 166 // Set during handshake. If true, resources in x-associated-content and link | |
| 167 // headers will be pushed. see: go/gfe_server_push. | |
| 168 bool server_push_enabled_; | |
| 169 | |
| 170 DISALLOW_COPY_AND_ASSIGN(QuicServerSessionBase); | 162 DISALLOW_COPY_AND_ASSIGN(QuicServerSessionBase); |
| 171 }; | 163 }; |
| 172 | 164 |
| 173 } // namespace net | 165 } // namespace net |
| 174 | 166 |
| 175 #endif // NET_QUIC_QUIC_SERVER_SESSION_BASE_H_ | 167 #endif // NET_QUIC_QUIC_SERVER_SESSION_BASE_H_ |
| OLD | NEW |