| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 87 // an existing session, or passing it to the TimeWaitListManager. | 87 // an existing session, or passing it to the time wait list. |
| 88 void ProcessPacket(const IPEndPoint& server_address, | 88 void ProcessPacket(const IPEndPoint& server_address, |
| 89 const IPEndPoint& client_address, | 89 const IPEndPoint& client_address, |
| 90 const QuicEncryptedPacket& packet) override; | 90 const QuicEncryptedPacket& packet) override; |
| 91 | 91 |
| 92 // Called when the socket becomes writable to allow queued writes to happen. | 92 // Called when the socket becomes writable to allow queued writes to happen. |
| 93 void OnCanWrite() override; | 93 void OnCanWrite() override; |
| 94 | 94 |
| 95 // Returns true if there's anything in the blocked writer list. | 95 // Returns true if there's anything in the blocked writer list. |
| 96 virtual bool HasPendingWrites() const; | 96 virtual bool HasPendingWrites() const; |
| 97 | 97 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 protected: | 141 protected: |
| 142 virtual QuicServerSession* CreateQuicSession( | 142 virtual QuicServerSession* CreateQuicSession( |
| 143 QuicConnectionId connection_id, | 143 QuicConnectionId connection_id, |
| 144 const IPEndPoint& server_address, | 144 const IPEndPoint& server_address, |
| 145 const IPEndPoint& client_address); | 145 const IPEndPoint& client_address); |
| 146 | 146 |
| 147 // Called by |framer_visitor_| when the public header has been parsed. | 147 // Called by |framer_visitor_| when the public header has been parsed. |
| 148 virtual bool OnUnauthenticatedPublicHeader( | 148 virtual bool OnUnauthenticatedPublicHeader( |
| 149 const QuicPacketPublicHeader& header); | 149 const QuicPacketPublicHeader& header); |
| 150 | 150 |
| 151 // Values to be returned by ValidityChecks() to indicate what should | 151 // Values to be returned by ValidityChecks() to indicate what should be done |
| 152 // be done with a packet. Fates with greater values are considered | 152 // with a packet. Fates with greater values are considered to be higher |
| 153 // to be higher priority, in that if one validity test indicates a | 153 // priority, in that if one validity check indicates a lower-valued fate and |
| 154 // lower-valued fate and another validity test indicates a | 154 // another validity check indicates a higher-valued fate, the higher-valued |
| 155 // higher-valued fate, the higher-valued fate should be obeyed. | 155 // fate should be obeyed. |
| 156 enum QuicPacketFate { | 156 enum QuicPacketFate { |
| 157 // Process the packet normally, which is usually to establish a connection. | 157 // Process the packet normally, which is usually to establish a connection. |
| 158 kFateProcess, | 158 kFateProcess, |
| 159 // Put the connection ID into time-wait state and send a public reset. | 159 // Put the connection ID into time-wait state and send a public reset. |
| 160 kFateTimeWait, | 160 kFateTimeWait, |
| 161 // Drop the packet (ignore and give no response). | 161 // Drop the packet (ignore and give no response). |
| 162 kFateDrop, | 162 kFateDrop, |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 // This method is called by OnUnauthenticatedHeader on packets not associated | 165 // This method is called by OnUnauthenticatedHeader on packets not associated |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 // framer_visitor_->OnError(). | 283 // framer_visitor_->OnError(). |
| 284 QuicErrorCode last_error_; | 284 QuicErrorCode last_error_; |
| 285 | 285 |
| 286 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); | 286 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); |
| 287 }; | 287 }; |
| 288 | 288 |
| 289 } // namespace tools | 289 } // namespace tools |
| 290 } // namespace net | 290 } // namespace net |
| 291 | 291 |
| 292 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ | 292 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ |
| OLD | NEW |