OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_QUIC_QUIC_DISPATCHER_H_ | 8 #ifndef NET_QUIC_QUIC_DISPATCHER_H_ |
9 #define NET_QUIC_QUIC_DISPATCHER_H_ | 9 #define NET_QUIC_QUIC_DISPATCHER_H_ |
10 | 10 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 protected: | 127 protected: |
128 virtual QuicSession* CreateQuicSession(QuicConnectionId connection_id, | 128 virtual QuicSession* CreateQuicSession(QuicConnectionId connection_id, |
129 const IPEndPoint& server_address, | 129 const IPEndPoint& server_address, |
130 const IPEndPoint& client_address); | 130 const IPEndPoint& client_address); |
131 | 131 |
132 // Called by |framer_visitor_| when the public header has been parsed. | 132 // Called by |framer_visitor_| when the public header has been parsed. |
133 virtual bool OnUnauthenticatedPublicHeader( | 133 virtual bool OnUnauthenticatedPublicHeader( |
134 const QuicPacketPublicHeader& header); | 134 const QuicPacketPublicHeader& header); |
135 | 135 |
| 136 // Called by OnUnauthenticatedPublicHeader when the packet is not for a |
| 137 // connection that the dispatcher has a record of, but is not handled by |
| 138 // certain simple processing rules. This method may apply validity checks to |
| 139 // reject stray packets. If the packet appears to be valid, it calls |
| 140 // CreateQuicSession to create a new session for the packet. Returns the |
| 141 // QuicSession that was created, or nullptr if the packet failed the validity |
| 142 // checks. |
| 143 virtual QuicSession* AdditionalValidityChecksThenCreateSession( |
| 144 const QuicPacketPublicHeader& header, |
| 145 QuicConnectionId connection_id); |
| 146 |
136 // Create and return the time wait list manager for this dispatcher, which | 147 // Create and return the time wait list manager for this dispatcher, which |
137 // will be owned by the dispatcher as time_wait_list_manager_ | 148 // will be owned by the dispatcher as time_wait_list_manager_ |
138 virtual QuicTimeWaitListManager* CreateQuicTimeWaitListManager(); | 149 virtual QuicTimeWaitListManager* CreateQuicTimeWaitListManager(); |
139 | 150 |
140 QuicTimeWaitListManager* time_wait_list_manager() { | 151 QuicTimeWaitListManager* time_wait_list_manager() { |
141 return time_wait_list_manager_.get(); | 152 return time_wait_list_manager_.get(); |
142 } | 153 } |
143 | 154 |
144 const QuicVersionVector& supported_versions() const { | 155 const QuicVersionVector& supported_versions() const { |
145 return supported_versions_; | 156 return supported_versions_; |
(...skipping 26 matching lines...) Expand all Loading... |
172 private: | 183 private: |
173 class QuicFramerVisitor; | 184 class QuicFramerVisitor; |
174 friend class net::test::QuicDispatcherPeer; | 185 friend class net::test::QuicDispatcherPeer; |
175 | 186 |
176 // An adapter that creates packet writers using the dispatcher's | 187 // An adapter that creates packet writers using the dispatcher's |
177 // PacketWriterFactory and shared writer. Essentially, it just curries the | 188 // PacketWriterFactory and shared writer. Essentially, it just curries the |
178 // writer argument away from QuicDispatcher::PacketWriterFactory. | 189 // writer argument away from QuicDispatcher::PacketWriterFactory. |
179 class PacketWriterFactoryAdapter : | 190 class PacketWriterFactoryAdapter : |
180 public QuicConnection::PacketWriterFactory { | 191 public QuicConnection::PacketWriterFactory { |
181 public: | 192 public: |
182 PacketWriterFactoryAdapter(QuicDispatcher* dispatcher); | 193 explicit PacketWriterFactoryAdapter(QuicDispatcher* dispatcher); |
183 ~PacketWriterFactoryAdapter() override; | 194 ~PacketWriterFactoryAdapter() override; |
184 | 195 |
185 QuicPacketWriter* Create(QuicConnection* connection) const override; | 196 QuicPacketWriter* Create(QuicConnection* connection) const override; |
186 | 197 |
187 private: | 198 private: |
188 QuicDispatcher* dispatcher_; | 199 QuicDispatcher* dispatcher_; |
189 }; | 200 }; |
190 | 201 |
191 // Called by |framer_visitor_| when the private header has been parsed | 202 // Called by |framer_visitor_| when the private header has been parsed |
192 // of a data packet that is destined for the time wait manager. | 203 // of a data packet that is destined for the time wait manager. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 252 |
242 QuicFramer framer_; | 253 QuicFramer framer_; |
243 scoped_ptr<QuicFramerVisitor> framer_visitor_; | 254 scoped_ptr<QuicFramerVisitor> framer_visitor_; |
244 | 255 |
245 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); | 256 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); |
246 }; | 257 }; |
247 | 258 |
248 } // namespace net | 259 } // namespace net |
249 | 260 |
250 #endif // NET_QUIC_QUIC_DISPATCHER_H_ | 261 #endif // NET_QUIC_QUIC_DISPATCHER_H_ |
OLD | NEW |