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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 virtual QuicPacketWriter* CreateWriter(int fd); | 132 virtual QuicPacketWriter* CreateWriter(int fd); |
133 | 133 |
134 virtual QuicSession* CreateQuicSession(QuicConnectionId connection_id, | 134 virtual QuicSession* CreateQuicSession(QuicConnectionId connection_id, |
135 const IPEndPoint& server_address, | 135 const IPEndPoint& server_address, |
136 const IPEndPoint& client_address); | 136 const IPEndPoint& client_address); |
137 | 137 |
138 // Called by |framer_visitor_| when the public header has been parsed. | 138 // Called by |framer_visitor_| when the public header has been parsed. |
139 virtual bool OnUnauthenticatedPublicHeader( | 139 virtual bool OnUnauthenticatedPublicHeader( |
140 const QuicPacketPublicHeader& header); | 140 const QuicPacketPublicHeader& header); |
141 | 141 |
| 142 // Called by OnUnauthenticatedPublicHeader when the packet is not for a |
| 143 // connection that the dispatcher has a record of, but is not handled by |
| 144 // certain simple processing rules. This method may apply validity checks to |
| 145 // reject stray packets. If the packet appears to be valid, it calls |
| 146 // CreateQuicSession to create a new session for the packet. Returns the |
| 147 // QuicSession that was created, or nullptr if the packet failed the validity |
| 148 // checks. |
| 149 virtual QuicSession* AdditionalValidityChecksThenCreateSession( |
| 150 const QuicPacketPublicHeader& header, |
| 151 QuicConnectionId connection_id); |
| 152 |
142 // Create and return the time wait list manager for this dispatcher, which | 153 // Create and return the time wait list manager for this dispatcher, which |
143 // will be owned by the dispatcher as time_wait_list_manager_ | 154 // will be owned by the dispatcher as time_wait_list_manager_ |
144 virtual QuicTimeWaitListManager* CreateQuicTimeWaitListManager(); | 155 virtual QuicTimeWaitListManager* CreateQuicTimeWaitListManager(); |
145 | 156 |
146 QuicTimeWaitListManager* time_wait_list_manager() { | 157 QuicTimeWaitListManager* time_wait_list_manager() { |
147 return time_wait_list_manager_.get(); | 158 return time_wait_list_manager_.get(); |
148 } | 159 } |
149 | 160 |
150 EpollServer* epoll_server() { return epoll_server_; } | 161 EpollServer* epoll_server() { return epoll_server_; } |
151 | 162 |
(...skipping 28 matching lines...) Expand all Loading... |
180 private: | 191 private: |
181 class QuicFramerVisitor; | 192 class QuicFramerVisitor; |
182 friend class net::tools::test::QuicDispatcherPeer; | 193 friend class net::tools::test::QuicDispatcherPeer; |
183 | 194 |
184 // An adapter that creates packet writers using the dispatcher's | 195 // An adapter that creates packet writers using the dispatcher's |
185 // PacketWriterFactory and shared writer. Essentially, it just curries the | 196 // PacketWriterFactory and shared writer. Essentially, it just curries the |
186 // writer argument away from QuicDispatcher::PacketWriterFactory. | 197 // writer argument away from QuicDispatcher::PacketWriterFactory. |
187 class PacketWriterFactoryAdapter : | 198 class PacketWriterFactoryAdapter : |
188 public QuicConnection::PacketWriterFactory { | 199 public QuicConnection::PacketWriterFactory { |
189 public: | 200 public: |
190 PacketWriterFactoryAdapter(QuicDispatcher* dispatcher); | 201 explicit PacketWriterFactoryAdapter(QuicDispatcher* dispatcher); |
191 ~PacketWriterFactoryAdapter() override; | 202 ~PacketWriterFactoryAdapter() override; |
192 | 203 |
193 QuicPacketWriter* Create(QuicConnection* connection) const override; | 204 QuicPacketWriter* Create(QuicConnection* connection) const override; |
194 | 205 |
195 private: | 206 private: |
196 QuicDispatcher* dispatcher_; | 207 QuicDispatcher* dispatcher_; |
197 }; | 208 }; |
198 | 209 |
199 // Called by |framer_visitor_| when the private header has been parsed | 210 // Called by |framer_visitor_| when the private header has been parsed |
200 // of a data packet that is destined for the time wait manager. | 211 // of a data packet that is destined for the time wait manager. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 QuicFramer framer_; | 263 QuicFramer framer_; |
253 scoped_ptr<QuicFramerVisitor> framer_visitor_; | 264 scoped_ptr<QuicFramerVisitor> framer_visitor_; |
254 | 265 |
255 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); | 266 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); |
256 }; | 267 }; |
257 | 268 |
258 } // namespace tools | 269 } // namespace tools |
259 } // namespace net | 270 } // namespace net |
260 | 271 |
261 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ | 272 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ |
OLD | NEW |