Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(706)

Side by Side Diff: net/tools/quic/quic_dispatcher.h

Issue 123303003: Move all the packet parsing logic into QuicDispatcher from the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/tools/quic/quic_client.cc ('k') | net/tools/quic/quic_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const char* buffer, size_t buf_len, 69 const char* buffer, size_t buf_len,
70 const IPAddressNumber& self_address, 70 const IPAddressNumber& self_address,
71 const IPEndPoint& peer_address, 71 const IPEndPoint& peer_address,
72 QuicBlockedWriterInterface* writer) OVERRIDE; 72 QuicBlockedWriterInterface* writer) OVERRIDE;
73 virtual bool IsWriteBlockedDataBuffered() const OVERRIDE; 73 virtual bool IsWriteBlockedDataBuffered() const OVERRIDE;
74 74
75 // Process the incoming packet by creating a new session, passing it to 75 // Process the incoming packet by creating a new session, passing it to
76 // an existing session, or passing it to the TimeWaitListManager. 76 // an existing session, or passing it to the TimeWaitListManager.
77 virtual void ProcessPacket(const IPEndPoint& server_address, 77 virtual void ProcessPacket(const IPEndPoint& server_address,
78 const IPEndPoint& client_address, 78 const IPEndPoint& client_address,
79 QuicGuid guid,
80 bool has_version_flag,
81 const QuicEncryptedPacket& packet); 79 const QuicEncryptedPacket& packet);
82 80
83 // Called when the underyling connection becomes writable to allow 81 // Called when the underyling connection becomes writable to allow
84 // queued writes to happen. 82 // queued writes to happen.
85 // 83 //
86 // Returns true if more writes are possible, false otherwise. 84 // Returns true if more writes are possible, false otherwise.
87 virtual bool OnCanWrite(); 85 virtual bool OnCanWrite();
88 86
89 // Sends ConnectionClose frames to all connected clients. 87 // Sends ConnectionClose frames to all connected clients.
90 void Shutdown(); 88 void Shutdown();
(...skipping 30 matching lines...) Expand all
121 return time_wait_list_manager_.get(); 119 return time_wait_list_manager_.get();
122 } 120 }
123 121
124 QuicEpollConnectionHelper* helper() { return helper_.get(); } 122 QuicEpollConnectionHelper* helper() { return helper_.get(); }
125 EpollServer* epoll_server() { return epoll_server_; } 123 EpollServer* epoll_server() { return epoll_server_; }
126 124
127 const QuicVersionVector& supported_versions() const { 125 const QuicVersionVector& supported_versions() const {
128 return supported_versions_; 126 return supported_versions_;
129 } 127 }
130 128
129 protected:
130 // Called by |framer_visitor_| when the public header has been parsed.
131 virtual bool OnUnauthenticatedPublicHeader(
132 const QuicPacketPublicHeader& header);
133
134 // Information about the packet currently being dispatched.
135 const IPEndPoint& current_client_address() {
136 return current_client_address_;
137 }
138 const IPEndPoint& current_server_address() {
139 return current_server_address_;
140 }
141 const QuicEncryptedPacket& current_packet() {
142 return *current_packet_;
143 }
144
131 private: 145 private:
146 class QuicFramerVisitor;
132 friend class net::tools::test::QuicDispatcherPeer; 147 friend class net::tools::test::QuicDispatcherPeer;
133 148
149 // Called by |framer_visitor_| when the private header has been parsed
150 // of a data packet that is destined for the time wait manager.
151 void OnUnauthenticatedHeader(const QuicPacketHeader& header);
152
134 // Removes the session from the session map and write blocked list, and 153 // Removes the session from the session map and write blocked list, and
135 // adds the GUID to the time-wait list. 154 // adds the GUID to the time-wait list.
136 void CleanUpSession(SessionMap::iterator it); 155 void CleanUpSession(SessionMap::iterator it);
137 156
157 bool HandlePacketForTimeWait(const QuicPacketPublicHeader& header);
158
138 // The list of connections waiting to write. 159 // The list of connections waiting to write.
139 WriteBlockedList write_blocked_list_; 160 WriteBlockedList write_blocked_list_;
140 161
141 SessionMap session_map_; 162 SessionMap session_map_;
142 163
143 // Entity that manages guids in time wait state. 164 // Entity that manages guids in time wait state.
144 scoped_ptr<QuicTimeWaitListManager> time_wait_list_manager_; 165 scoped_ptr<QuicTimeWaitListManager> time_wait_list_manager_;
145 166
146 // An alarm which deletes closed sessions. 167 // An alarm which deletes closed sessions.
147 scoped_ptr<DeleteSessionsAlarm> delete_sessions_alarm_; 168 scoped_ptr<DeleteSessionsAlarm> delete_sessions_alarm_;
(...skipping 15 matching lines...) Expand all
163 184
164 // The writer to write to the socket with. 185 // The writer to write to the socket with.
165 scoped_ptr<QuicPacketWriter> writer_; 186 scoped_ptr<QuicPacketWriter> writer_;
166 187
167 // This vector contains QUIC versions which we currently support. 188 // This vector contains QUIC versions which we currently support.
168 // This should be ordered such that the highest supported version is the first 189 // This should be ordered such that the highest supported version is the first
169 // element, with subsequent elements in descending order (versions can be 190 // element, with subsequent elements in descending order (versions can be
170 // skipped as necessary). 191 // skipped as necessary).
171 const QuicVersionVector supported_versions_; 192 const QuicVersionVector supported_versions_;
172 193
194 // Information about the packet currently being handled.
195 IPEndPoint current_client_address_;
196 IPEndPoint current_server_address_;
197 const QuicEncryptedPacket* current_packet_;
198
199 QuicFramer framer_;
200 scoped_ptr<QuicFramerVisitor> framer_visitor_;
201
173 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); 202 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher);
174 }; 203 };
175 204
176 } // namespace tools 205 } // namespace tools
177 } // namespace net 206 } // namespace net
178 207
179 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ 208 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client.cc ('k') | net/tools/quic/quic_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698