| 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 side dispatcher which dispatches a given client's data to their | 5 // A server side dispatcher which dispatches a given client's data to their |
| 6 // stream. | 6 // stream. |
| 7 | 7 |
| 8 #ifndef NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ | 8 #ifndef NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ |
| 9 #define NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ | 9 #define NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ |
| 10 | 10 |
| 11 #include <unordered_map> | 11 #include <unordered_map> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "net/base/ip_endpoint.h" | 17 #include "net/base/ip_endpoint.h" |
| 18 #include "net/base/linked_hash_map.h" | 18 #include "net/base/linked_hash_map.h" |
| 19 #include "net/quic/crypto/quic_compressed_certs_cache.h" |
| 19 #include "net/quic/quic_blocked_writer_interface.h" | 20 #include "net/quic/quic_blocked_writer_interface.h" |
| 20 #include "net/quic/quic_connection.h" | 21 #include "net/quic/quic_connection.h" |
| 21 #include "net/quic/quic_protocol.h" | 22 #include "net/quic/quic_protocol.h" |
| 22 #include "net/tools/quic/quic_process_packet_interface.h" | 23 #include "net/tools/quic/quic_process_packet_interface.h" |
| 23 #include "net/tools/quic/quic_server_session_base.h" | 24 #include "net/tools/quic/quic_server_session_base.h" |
| 24 #include "net/tools/quic/quic_time_wait_list_manager.h" | 25 #include "net/tools/quic/quic_time_wait_list_manager.h" |
| 25 | 26 |
| 26 namespace net { | 27 namespace net { |
| 27 | 28 |
| 28 class QuicConfig; | 29 class QuicConfig; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 } | 181 } |
| 181 | 182 |
| 182 const IPEndPoint& current_server_address() { return current_server_address_; } | 183 const IPEndPoint& current_server_address() { return current_server_address_; } |
| 183 const IPEndPoint& current_client_address() { return current_client_address_; } | 184 const IPEndPoint& current_client_address() { return current_client_address_; } |
| 184 const QuicEncryptedPacket& current_packet() { return *current_packet_; } | 185 const QuicEncryptedPacket& current_packet() { return *current_packet_; } |
| 185 | 186 |
| 186 const QuicConfig& config() const { return config_; } | 187 const QuicConfig& config() const { return config_; } |
| 187 | 188 |
| 188 const QuicCryptoServerConfig* crypto_config() const { return crypto_config_; } | 189 const QuicCryptoServerConfig* crypto_config() const { return crypto_config_; } |
| 189 | 190 |
| 191 QuicCompressedCertsCache* compressed_certs_cache() { |
| 192 return &compressed_certs_cache_; |
| 193 } |
| 194 |
| 190 QuicFramer* framer() { return &framer_; } | 195 QuicFramer* framer() { return &framer_; } |
| 191 | 196 |
| 192 QuicConnectionHelperInterface* helper() { return helper_.get(); } | 197 QuicConnectionHelperInterface* helper() { return helper_.get(); } |
| 193 | 198 |
| 194 QuicPacketWriter* writer() { return writer_.get(); } | 199 QuicPacketWriter* writer() { return writer_.get(); } |
| 195 | 200 |
| 196 // Creates per-connection packet writers out of the QuicDispatcher's shared | 201 // Creates per-connection packet writers out of the QuicDispatcher's shared |
| 197 // QuicPacketWriter. The per-connection writers' IsWriteBlocked() state must | 202 // QuicPacketWriter. The per-connection writers' IsWriteBlocked() state must |
| 198 // always be the same as the shared writer's IsWriteBlocked(), or else the | 203 // always be the same as the shared writer's IsWriteBlocked(), or else the |
| 199 // QuicDispatcher::OnCanWrite logic will not work. (This will hopefully be | 204 // QuicDispatcher::OnCanWrite logic will not work. (This will hopefully be |
| (...skipping 13 matching lines...) Expand all Loading... |
| 213 // the ConnectionId to the time-wait list. If |session_closed_statelessly| is | 218 // the ConnectionId to the time-wait list. If |session_closed_statelessly| is |
| 214 // true, any future packets for the ConnectionId will be black-holed. | 219 // true, any future packets for the ConnectionId will be black-holed. |
| 215 void CleanUpSession(SessionMap::iterator it, bool session_closed_statelessly); | 220 void CleanUpSession(SessionMap::iterator it, bool session_closed_statelessly); |
| 216 | 221 |
| 217 bool HandlePacketForTimeWait(const QuicPacketPublicHeader& header); | 222 bool HandlePacketForTimeWait(const QuicPacketPublicHeader& header); |
| 218 | 223 |
| 219 const QuicConfig& config_; | 224 const QuicConfig& config_; |
| 220 | 225 |
| 221 const QuicCryptoServerConfig* crypto_config_; | 226 const QuicCryptoServerConfig* crypto_config_; |
| 222 | 227 |
| 228 // The cache for most recently compressed certs. |
| 229 QuicCompressedCertsCache compressed_certs_cache_; |
| 230 |
| 223 // The list of connections waiting to write. | 231 // The list of connections waiting to write. |
| 224 WriteBlockedList write_blocked_list_; | 232 WriteBlockedList write_blocked_list_; |
| 225 | 233 |
| 226 SessionMap session_map_; | 234 SessionMap session_map_; |
| 227 | 235 |
| 228 // Entity that manages connection_ids in time wait state. | 236 // Entity that manages connection_ids in time wait state. |
| 229 scoped_ptr<QuicTimeWaitListManager> time_wait_list_manager_; | 237 scoped_ptr<QuicTimeWaitListManager> time_wait_list_manager_; |
| 230 | 238 |
| 231 // The list of closed but not-yet-deleted sessions. | 239 // The list of closed but not-yet-deleted sessions. |
| 232 std::vector<QuicServerSessionBase*> closed_session_list_; | 240 std::vector<QuicServerSessionBase*> closed_session_list_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 257 // The last error set by SetLastError(), which is called by | 265 // The last error set by SetLastError(), which is called by |
| 258 // framer_visitor_->OnError(). | 266 // framer_visitor_->OnError(). |
| 259 QuicErrorCode last_error_; | 267 QuicErrorCode last_error_; |
| 260 | 268 |
| 261 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); | 269 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); |
| 262 }; | 270 }; |
| 263 | 271 |
| 264 } // namespace net | 272 } // namespace net |
| 265 | 273 |
| 266 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ | 274 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ |
| OLD | NEW |