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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // Create and return the time wait list manager for this dispatcher, which | 197 // Create and return the time wait list manager for this dispatcher, which |
198 // will be owned by the dispatcher as time_wait_list_manager_ | 198 // will be owned by the dispatcher as time_wait_list_manager_ |
199 virtual QuicTimeWaitListManager* CreateQuicTimeWaitListManager(); | 199 virtual QuicTimeWaitListManager* CreateQuicTimeWaitListManager(); |
200 | 200 |
201 // Called when |connection_id| doesn't have an open connection yet, to buffer | 201 // Called when |connection_id| doesn't have an open connection yet, to buffer |
202 // |current_packet_| until it can be delivered to the connection. | 202 // |current_packet_| until it can be delivered to the connection. |
203 void BufferEarlyPacket(QuicConnectionId connection_id); | 203 void BufferEarlyPacket(QuicConnectionId connection_id); |
204 | 204 |
205 // Called when |current_packet_| is a CHLO packet. Creates a new connection | 205 // Called when |current_packet_| is a CHLO packet. Creates a new connection |
206 // and delivers any buffered packets for that connection id. | 206 // and delivers any buffered packets for that connection id. |
207 void ProcessChlo(QuicPacketNumber packet_number); | 207 void ProcessChlo(); |
208 | 208 |
209 QuicTimeWaitListManager* time_wait_list_manager() { | 209 QuicTimeWaitListManager* time_wait_list_manager() { |
210 return time_wait_list_manager_.get(); | 210 return time_wait_list_manager_.get(); |
211 } | 211 } |
212 | 212 |
213 const QuicVersionVector& GetSupportedVersions(); | 213 const QuicVersionVector& GetSupportedVersions(); |
214 | 214 |
215 QuicConnectionId current_connection_id() { return current_connection_id_; } | 215 QuicConnectionId current_connection_id() { return current_connection_id_; } |
216 const QuicSocketAddress& current_server_address() { | 216 const QuicSocketAddress& current_server_address() { |
217 return current_server_address_; | 217 return current_server_address_; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 289 |
290 typedef std::unordered_set<QuicConnectionId> QuicConnectionIdSet; | 290 typedef std::unordered_set<QuicConnectionId> QuicConnectionIdSet; |
291 | 291 |
292 bool HandlePacketForTimeWait(const QuicPacketPublicHeader& header); | 292 bool HandlePacketForTimeWait(const QuicPacketPublicHeader& header); |
293 | 293 |
294 // Attempts to reject the connection statelessly, if stateless rejects are | 294 // Attempts to reject the connection statelessly, if stateless rejects are |
295 // possible and if the current packet contains a CHLO message. Determines a | 295 // possible and if the current packet contains a CHLO message. Determines a |
296 // fate which describes what subsequent processing should be performed on the | 296 // fate which describes what subsequent processing should be performed on the |
297 // packets, like ValidityChecks, and invokes ProcessUnauthenticatedHeaderFate. | 297 // packets, like ValidityChecks, and invokes ProcessUnauthenticatedHeaderFate. |
298 void MaybeRejectStatelessly(QuicConnectionId connection_id, | 298 void MaybeRejectStatelessly(QuicConnectionId connection_id, |
299 const QuicPacketHeader& header); | 299 QuicVersion version); |
300 | 300 |
301 // Deliver |packets| to |session| for further processing. | 301 // Deliver |packets| to |session| for further processing. |
302 void DeliverPacketsToSession( | 302 void DeliverPacketsToSession( |
303 const std::list<QuicBufferedPacketStore::BufferedPacket>& packets, | 303 const std::list<QuicBufferedPacketStore::BufferedPacket>& packets, |
304 QuicSession* session); | 304 QuicSession* session); |
305 | 305 |
306 // Perform the appropriate actions on the current packet based on |fate| - | 306 // Perform the appropriate actions on the current packet based on |fate| - |
307 // either process, buffer, or drop it. | 307 // either process, buffer, or drop it. |
308 void ProcessUnauthenticatedHeaderFate(QuicPacketFate fate, | 308 void ProcessUnauthenticatedHeaderFate(QuicPacketFate fate, |
309 QuicConnectionId connection_id, | 309 QuicConnectionId connection_id); |
310 QuicPacketNumber packet_number); | |
311 | 310 |
312 // Invoked when StatelessRejector::Process completes. | 311 // Invoked when StatelessRejector::Process completes. |
313 void OnStatelessRejectorProcessDone( | 312 void OnStatelessRejectorProcessDone( |
314 std::unique_ptr<StatelessRejector> rejector, | 313 std::unique_ptr<StatelessRejector> rejector, |
315 const QuicSocketAddress& current_client_address, | 314 const QuicSocketAddress& current_client_address, |
316 const QuicSocketAddress& current_server_address, | 315 const QuicSocketAddress& current_server_address, |
317 std::unique_ptr<QuicReceivedPacket> current_packet, | 316 std::unique_ptr<QuicReceivedPacket> current_packet, |
318 QuicPacketNumber packet_number, | |
319 QuicVersion first_version); | 317 QuicVersion first_version); |
320 | 318 |
321 // Examine the state of the rejector and decide what to do with the current | 319 // Examine the state of the rejector and decide what to do with the current |
322 // packet. | 320 // packet. |
323 void ProcessStatelessRejectorState( | 321 void ProcessStatelessRejectorState( |
324 std::unique_ptr<StatelessRejector> rejector, | 322 std::unique_ptr<StatelessRejector> rejector, |
325 QuicPacketNumber packet_number, | |
326 QuicVersion first_version); | 323 QuicVersion first_version); |
327 | 324 |
328 void set_new_sessions_allowed_per_event_loop( | 325 void set_new_sessions_allowed_per_event_loop( |
329 int16_t new_sessions_allowed_per_event_loop) { | 326 int16_t new_sessions_allowed_per_event_loop) { |
330 new_sessions_allowed_per_event_loop_ = new_sessions_allowed_per_event_loop; | 327 new_sessions_allowed_per_event_loop_ = new_sessions_allowed_per_event_loop; |
331 } | 328 } |
332 | 329 |
333 const QuicConfig& config_; | 330 const QuicConfig& config_; |
334 | 331 |
335 const QuicCryptoServerConfig* crypto_config_; | 332 const QuicCryptoServerConfig* crypto_config_; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 | 390 |
394 // True if this dispatcher is not draining. | 391 // True if this dispatcher is not draining. |
395 bool accept_new_connections_; | 392 bool accept_new_connections_; |
396 | 393 |
397 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); | 394 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); |
398 }; | 395 }; |
399 | 396 |
400 } // namespace net | 397 } // namespace net |
401 | 398 |
402 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ | 399 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ |
OLD | NEW |