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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 }; | 66 }; |
67 | 67 |
68 // Ideally we'd have a linked_hash_set: the boolean is unused. | 68 // Ideally we'd have a linked_hash_set: the boolean is unused. |
69 typedef linked_hash_map<QuicBlockedWriterInterface*, bool> WriteBlockedList; | 69 typedef linked_hash_map<QuicBlockedWriterInterface*, bool> WriteBlockedList; |
70 | 70 |
71 // Due to the way delete_sessions_closure_ is registered, the Dispatcher must | 71 // Due to the way delete_sessions_closure_ is registered, the Dispatcher must |
72 // live until epoll_server Shutdown. |supported_versions| specifies the list | 72 // live until epoll_server Shutdown. |supported_versions| specifies the list |
73 // of supported QUIC versions. Takes ownership of |packet_writer_factory|, | 73 // of supported QUIC versions. Takes ownership of |packet_writer_factory|, |
74 // which is used to create per-connection writers. | 74 // which is used to create per-connection writers. |
75 QuicDispatcher(const QuicConfig& config, | 75 QuicDispatcher(const QuicConfig& config, |
76 const QuicCryptoServerConfig& crypto_config, | 76 const QuicCryptoServerConfig* crypto_config, |
77 const QuicVersionVector& supported_versions, | 77 const QuicVersionVector& supported_versions, |
78 PacketWriterFactory* packet_writer_factory, | 78 PacketWriterFactory* packet_writer_factory, |
79 QuicConnectionHelperInterface* helper); | 79 QuicConnectionHelperInterface* helper); |
80 | 80 |
81 ~QuicDispatcher() override; | 81 ~QuicDispatcher() override; |
82 | 82 |
83 // Takes ownership of |writer|. | 83 // Takes ownership of |writer|. |
84 void InitializeWithWriter(QuicPacketWriter* writer); | 84 void InitializeWithWriter(QuicPacketWriter* writer); |
85 | 85 |
86 // Process the incoming packet by creating a new session, passing it to | 86 // Process the incoming packet by creating a new session, passing it to |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 160 } |
161 const IPEndPoint& current_client_address() { | 161 const IPEndPoint& current_client_address() { |
162 return current_client_address_; | 162 return current_client_address_; |
163 } | 163 } |
164 const QuicEncryptedPacket& current_packet() { | 164 const QuicEncryptedPacket& current_packet() { |
165 return *current_packet_; | 165 return *current_packet_; |
166 } | 166 } |
167 | 167 |
168 const QuicConfig& config() const { return config_; } | 168 const QuicConfig& config() const { return config_; } |
169 | 169 |
170 const QuicCryptoServerConfig& crypto_config() const { return crypto_config_; } | 170 const QuicCryptoServerConfig* crypto_config() const { |
| 171 return crypto_config_; |
| 172 } |
171 | 173 |
172 QuicFramer* framer() { return &framer_; } | 174 QuicFramer* framer() { return &framer_; } |
173 | 175 |
174 QuicConnectionHelperInterface* helper() { return helper_.get(); } | 176 QuicConnectionHelperInterface* helper() { return helper_.get(); } |
175 | 177 |
176 QuicPacketWriter* writer() { return writer_.get(); } | 178 QuicPacketWriter* writer() { return writer_.get(); } |
177 | 179 |
178 const QuicConnection::PacketWriterFactory& connection_writer_factory() { | 180 const QuicConnection::PacketWriterFactory& connection_writer_factory() { |
179 return connection_writer_factory_; | 181 return connection_writer_factory_; |
180 } | 182 } |
(...skipping 22 matching lines...) Expand all Loading... |
203 void OnUnauthenticatedHeader(const QuicPacketHeader& header); | 205 void OnUnauthenticatedHeader(const QuicPacketHeader& header); |
204 | 206 |
205 // Removes the session from the session map and write blocked list, and | 207 // Removes the session from the session map and write blocked list, and |
206 // adds the ConnectionId to the time-wait list. | 208 // adds the ConnectionId to the time-wait list. |
207 void CleanUpSession(SessionMap::iterator it); | 209 void CleanUpSession(SessionMap::iterator it); |
208 | 210 |
209 bool HandlePacketForTimeWait(const QuicPacketPublicHeader& header); | 211 bool HandlePacketForTimeWait(const QuicPacketPublicHeader& header); |
210 | 212 |
211 const QuicConfig& config_; | 213 const QuicConfig& config_; |
212 | 214 |
213 const QuicCryptoServerConfig& crypto_config_; | 215 const QuicCryptoServerConfig* crypto_config_; |
214 | 216 |
215 // The list of connections waiting to write. | 217 // The list of connections waiting to write. |
216 WriteBlockedList write_blocked_list_; | 218 WriteBlockedList write_blocked_list_; |
217 | 219 |
218 SessionMap session_map_; | 220 SessionMap session_map_; |
219 | 221 |
220 // Entity that manages connection_ids in time wait state. | 222 // Entity that manages connection_ids in time wait state. |
221 scoped_ptr<QuicTimeWaitListManager> time_wait_list_manager_; | 223 scoped_ptr<QuicTimeWaitListManager> time_wait_list_manager_; |
222 | 224 |
223 // The list of closed but not-yet-deleted sessions. | 225 // The list of closed but not-yet-deleted sessions. |
(...skipping 28 matching lines...) Expand all Loading... |
252 QuicFramer framer_; | 254 QuicFramer framer_; |
253 scoped_ptr<QuicFramerVisitor> framer_visitor_; | 255 scoped_ptr<QuicFramerVisitor> framer_visitor_; |
254 | 256 |
255 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); | 257 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); |
256 }; | 258 }; |
257 | 259 |
258 } // namespace tools | 260 } // namespace tools |
259 } // namespace net | 261 } // namespace net |
260 | 262 |
261 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ | 263 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ |
OLD | NEW |