| 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 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 public: | 54 public: |
| 55 // Ideally we'd have a linked_hash_set: the boolean is unused. | 55 // Ideally we'd have a linked_hash_set: the boolean is unused. |
| 56 typedef linked_hash_map<QuicBlockedWriterInterface*, bool> WriteBlockedList; | 56 typedef linked_hash_map<QuicBlockedWriterInterface*, bool> WriteBlockedList; |
| 57 | 57 |
| 58 // Due to the way delete_sessions_closure_ is registered, the Dispatcher | 58 // Due to the way delete_sessions_closure_ is registered, the Dispatcher |
| 59 // must live until epoll_server Shutdown. |supported_versions| specifies the | 59 // must live until epoll_server Shutdown. |supported_versions| specifies the |
| 60 // list of supported QUIC versions. | 60 // list of supported QUIC versions. |
| 61 QuicDispatcher(const QuicConfig& config, | 61 QuicDispatcher(const QuicConfig& config, |
| 62 const QuicCryptoServerConfig& crypto_config, | 62 const QuicCryptoServerConfig& crypto_config, |
| 63 const QuicVersionVector& supported_versions, | 63 const QuicVersionVector& supported_versions, |
| 64 EpollServer* epoll_server, | 64 EpollServer* epoll_server); |
| 65 uint32 initial_flow_control_window_bytes); | |
| 66 | 65 |
| 67 virtual ~QuicDispatcher(); | 66 virtual ~QuicDispatcher(); |
| 68 | 67 |
| 69 virtual void Initialize(int fd); | 68 virtual void Initialize(int fd); |
| 70 | 69 |
| 71 // Process the incoming packet by creating a new session, passing it to | 70 // Process the incoming packet by creating a new session, passing it to |
| 72 // an existing session, or passing it to the TimeWaitListManager. | 71 // an existing session, or passing it to the TimeWaitListManager. |
| 73 virtual void ProcessPacket(const IPEndPoint& server_address, | 72 virtual void ProcessPacket(const IPEndPoint& server_address, |
| 74 const IPEndPoint& client_address, | 73 const IPEndPoint& client_address, |
| 75 const QuicEncryptedPacket& packet); | 74 const QuicEncryptedPacket& packet); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 const QuicConfig& config() const { return config_; } | 158 const QuicConfig& config() const { return config_; } |
| 160 | 159 |
| 161 const QuicCryptoServerConfig& crypto_config() const { return crypto_config_; } | 160 const QuicCryptoServerConfig& crypto_config() const { return crypto_config_; } |
| 162 | 161 |
| 163 QuicFramer* framer() { return &framer_; } | 162 QuicFramer* framer() { return &framer_; } |
| 164 | 163 |
| 165 QuicEpollConnectionHelper* helper() { return helper_.get(); } | 164 QuicEpollConnectionHelper* helper() { return helper_.get(); } |
| 166 | 165 |
| 167 QuicPacketWriter* writer() { return writer_.get(); } | 166 QuicPacketWriter* writer() { return writer_.get(); } |
| 168 | 167 |
| 169 const uint32 initial_flow_control_window_bytes() const { | |
| 170 return initial_flow_control_window_bytes_; | |
| 171 } | |
| 172 | |
| 173 private: | 168 private: |
| 174 class QuicFramerVisitor; | 169 class QuicFramerVisitor; |
| 175 friend class net::tools::test::QuicDispatcherPeer; | 170 friend class net::tools::test::QuicDispatcherPeer; |
| 176 | 171 |
| 177 // Called by |framer_visitor_| when the private header has been parsed | 172 // Called by |framer_visitor_| when the private header has been parsed |
| 178 // of a data packet that is destined for the time wait manager. | 173 // of a data packet that is destined for the time wait manager. |
| 179 void OnUnauthenticatedHeader(const QuicPacketHeader& header); | 174 void OnUnauthenticatedHeader(const QuicPacketHeader& header); |
| 180 | 175 |
| 181 // Removes the session from the session map and write blocked list, and | 176 // Removes the session from the session map and write blocked list, and |
| 182 // adds the ConnectionId to the time-wait list. | 177 // adds the ConnectionId to the time-wait list. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 QuicVersionVector supported_versions_no_connection_flow_control_; | 226 QuicVersionVector supported_versions_no_connection_flow_control_; |
| 232 | 227 |
| 233 // Information about the packet currently being handled. | 228 // Information about the packet currently being handled. |
| 234 IPEndPoint current_client_address_; | 229 IPEndPoint current_client_address_; |
| 235 IPEndPoint current_server_address_; | 230 IPEndPoint current_server_address_; |
| 236 const QuicEncryptedPacket* current_packet_; | 231 const QuicEncryptedPacket* current_packet_; |
| 237 | 232 |
| 238 QuicFramer framer_; | 233 QuicFramer framer_; |
| 239 scoped_ptr<QuicFramerVisitor> framer_visitor_; | 234 scoped_ptr<QuicFramerVisitor> framer_visitor_; |
| 240 | 235 |
| 241 // Initial flow control window size to advertize to peer on newly created | |
| 242 // connections. | |
| 243 const uint32 initial_flow_control_window_bytes_; | |
| 244 | |
| 245 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); | 236 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); |
| 246 }; | 237 }; |
| 247 | 238 |
| 248 } // namespace tools | 239 } // namespace tools |
| 249 } // namespace net | 240 } // namespace net |
| 250 | 241 |
| 251 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ | 242 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ |
| OLD | NEW |