| 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 <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "net/base/ip_endpoint.h" | 16 #include "net/base/ip_endpoint.h" |
| 17 #include "net/base/linked_hash_map.h" | 17 #include "net/base/linked_hash_map.h" |
| 18 #include "net/quic/quic_blocked_writer_interface.h" | 18 #include "net/quic/quic_blocked_writer_interface.h" |
| 19 #include "net/quic/quic_connection.h" | 19 #include "net/quic/quic_connection.h" |
| 20 #include "net/quic/quic_protocol.h" | 20 #include "net/quic/quic_protocol.h" |
| 21 #include "net/tools/quic/quic_packet_reader.h" |
| 21 #include "net/tools/quic/quic_server_session_base.h" | 22 #include "net/tools/quic/quic_server_session_base.h" |
| 22 #include "net/tools/quic/quic_time_wait_list_manager.h" | 23 #include "net/tools/quic/quic_time_wait_list_manager.h" |
| 23 | 24 |
| 24 namespace net { | 25 namespace net { |
| 25 | 26 |
| 26 class QuicConfig; | 27 class QuicConfig; |
| 27 class QuicCryptoServerConfig; | 28 class QuicCryptoServerConfig; |
| 28 class QuicServerSessionBase; | 29 class QuicServerSessionBase; |
| 29 | 30 |
| 30 namespace tools { | 31 namespace tools { |
| 31 | 32 |
| 32 namespace test { | 33 namespace test { |
| 33 class QuicDispatcherPeer; | 34 class QuicDispatcherPeer; |
| 34 } // namespace test | 35 } // namespace test |
| 35 | 36 |
| 36 class ProcessPacketInterface { | |
| 37 public: | |
| 38 virtual ~ProcessPacketInterface() {} | |
| 39 virtual void ProcessPacket(const IPEndPoint& server_address, | |
| 40 const IPEndPoint& client_address, | |
| 41 const QuicEncryptedPacket& packet) = 0; | |
| 42 }; | |
| 43 | |
| 44 class QuicDispatcher : public QuicServerSessionVisitor, | 37 class QuicDispatcher : public QuicServerSessionVisitor, |
| 45 public ProcessPacketInterface, | 38 public ProcessPacketInterface, |
| 46 public QuicBlockedWriterInterface { | 39 public QuicBlockedWriterInterface { |
| 47 public: | 40 public: |
| 48 // Ideally we'd have a linked_hash_set: the boolean is unused. | 41 // Ideally we'd have a linked_hash_set: the boolean is unused. |
| 49 typedef linked_hash_map<QuicBlockedWriterInterface*, bool> WriteBlockedList; | 42 typedef linked_hash_map<QuicBlockedWriterInterface*, bool> WriteBlockedList; |
| 50 | 43 |
| 51 // Due to the way delete_sessions_closure_ is registered, the Dispatcher must | 44 // Due to the way delete_sessions_closure_ is registered, the Dispatcher must |
| 52 // live until server Shutdown. |supported_versions| specifies the std::list | 45 // live until server Shutdown. |supported_versions| specifies the std::list |
| 53 // of supported QUIC versions. Takes ownership of |packet_writer_factory|, | 46 // of supported QUIC versions. Takes ownership of |packet_writer_factory|, |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // framer_visitor_->OnError(). | 230 // framer_visitor_->OnError(). |
| 238 QuicErrorCode last_error_; | 231 QuicErrorCode last_error_; |
| 239 | 232 |
| 240 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); | 233 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); |
| 241 }; | 234 }; |
| 242 | 235 |
| 243 } // namespace tools | 236 } // namespace tools |
| 244 } // namespace net | 237 } // namespace net |
| 245 | 238 |
| 246 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ | 239 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ |
| OLD | NEW |