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

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

Issue 1037643002: Land Recent QUIC Changes until 03/22/2015. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: deleted duplicated using statements in net/tools/quic/test_tools/quic_test_utils.cc Created 5 years, 9 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
« no previous file with comments | « net/tools/quic/quic_client_bin.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
11 #include <list> 11 #include <list>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/containers/hash_tables.h" 14 #include "base/containers/hash_tables.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "net/base/ip_endpoint.h" 16 #include "net/base/ip_endpoint.h"
17 #include "net/base/linked_hash_map.h" 17 #include "net/base/linked_hash_map.h"
18 #include "net/quic/quic_blocked_writer_interface.h" 18 #include "net/quic/quic_blocked_writer_interface.h"
19 #include "net/quic/quic_protocol.h" 19 #include "net/quic/quic_protocol.h"
20 #include "net/tools/quic/quic_server_session.h" 20 #include "net/tools/quic/quic_server_session.h"
21 #include "net/tools/quic/quic_time_wait_list_manager.h" 21 #include "net/tools/quic/quic_time_wait_list_manager.h"
22 22
23 namespace net { 23 namespace net {
24 24
25 class QuicConfig; 25 class QuicConfig;
26 class QuicCryptoServerConfig; 26 class QuicCryptoServerConfig;
27 class QuicSession; 27 class QuicServerSession;
28 28
29 namespace tools { 29 namespace tools {
30 30
31 namespace test { 31 namespace test {
32 class QuicDispatcherPeer; 32 class QuicDispatcherPeer;
33 } // namespace test 33 } // namespace test
34 34
35 class ProcessPacketInterface { 35 class ProcessPacketInterface {
36 public: 36 public:
37 virtual ~ProcessPacketInterface() {} 37 virtual ~ProcessPacketInterface() {}
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 // Called whenever the QuicTimeWaitListManager adds a new connection to the 108 // Called whenever the QuicTimeWaitListManager adds a new connection to the
109 // time-wait list. 109 // time-wait list.
110 void OnConnectionAddedToTimeWaitList(QuicConnectionId connection_id) override; 110 void OnConnectionAddedToTimeWaitList(QuicConnectionId connection_id) override;
111 111
112 // Called whenever the QuicTimeWaitListManager removes an old connection from 112 // Called whenever the QuicTimeWaitListManager removes an old connection from
113 // the time-wait list. 113 // the time-wait list.
114 void OnConnectionRemovedFromTimeWaitList( 114 void OnConnectionRemovedFromTimeWaitList(
115 QuicConnectionId connection_id) override; 115 QuicConnectionId connection_id) override;
116 116
117 typedef base::hash_map<QuicConnectionId, QuicSession*> SessionMap; 117 typedef base::hash_map<QuicConnectionId, QuicServerSession*> SessionMap;
118 118
119 const SessionMap& session_map() const { return session_map_; } 119 const SessionMap& session_map() const { return session_map_; }
120 120
121 // Deletes all sessions on the closed session list and clears the list. 121 // Deletes all sessions on the closed session list and clears the list.
122 void DeleteSessions(); 122 void DeleteSessions();
123 123
124 protected: 124 protected:
125 // Instantiates a new low-level packet writer. Caller takes ownership of the 125 // Instantiates a new low-level packet writer. Caller takes ownership of the
126 // returned object. 126 // returned object.
127 virtual QuicPacketWriter* CreateWriter(int fd); 127 virtual QuicPacketWriter* CreateWriter(int fd);
128 128
129 virtual QuicSession* CreateQuicSession(QuicConnectionId connection_id, 129 virtual QuicServerSession* CreateQuicSession(
130 const IPEndPoint& server_address, 130 QuicConnectionId connection_id,
131 const IPEndPoint& client_address); 131 const IPEndPoint& server_address,
132 const IPEndPoint& client_address);
132 133
133 // Called by |framer_visitor_| when the public header has been parsed. 134 // Called by |framer_visitor_| when the public header has been parsed.
134 virtual bool OnUnauthenticatedPublicHeader( 135 virtual bool OnUnauthenticatedPublicHeader(
135 const QuicPacketPublicHeader& header); 136 const QuicPacketPublicHeader& header);
136 137
137 // Called by OnUnauthenticatedPublicHeader when the packet is not for a 138 // Called by OnUnauthenticatedPublicHeader when the packet is not for a
138 // connection that the dispatcher has a record of, but is not handled by 139 // connection that the dispatcher has a record of, but is not handled by
139 // certain simple processing rules. This method may apply validity checks to 140 // certain simple processing rules. This method may apply validity checks to
140 // reject stray packets. If the packet appears to be valid, it calls 141 // reject stray packets. If the packet appears to be valid, it calls
141 // CreateQuicSession to create a new session for the packet. Returns the 142 // CreateQuicSession to create a new session for the packet. Returns the
142 // QuicSession that was created, or nullptr if the packet failed the validity 143 // QuicServerSession that was created, or nullptr if the packet failed the
143 // checks. 144 // validity checks.
144 virtual QuicSession* AdditionalValidityChecksThenCreateSession( 145 virtual QuicServerSession* AdditionalValidityChecksThenCreateSession(
145 const QuicPacketPublicHeader& header, 146 const QuicPacketPublicHeader& header,
146 QuicConnectionId connection_id); 147 QuicConnectionId connection_id);
147 148
148 // Create and return the time wait list manager for this dispatcher, which 149 // Create and return the time wait list manager for this dispatcher, which
149 // will be owned by the dispatcher as time_wait_list_manager_ 150 // will be owned by the dispatcher as time_wait_list_manager_
150 virtual QuicTimeWaitListManager* CreateQuicTimeWaitListManager(); 151 virtual QuicTimeWaitListManager* CreateQuicTimeWaitListManager();
151 152
152 QuicTimeWaitListManager* time_wait_list_manager() { 153 QuicTimeWaitListManager* time_wait_list_manager() {
153 return time_wait_list_manager_.get(); 154 return time_wait_list_manager_.get();
154 } 155 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 217
217 // The list of connections waiting to write. 218 // The list of connections waiting to write.
218 WriteBlockedList write_blocked_list_; 219 WriteBlockedList write_blocked_list_;
219 220
220 SessionMap session_map_; 221 SessionMap session_map_;
221 222
222 // Entity that manages connection_ids in time wait state. 223 // Entity that manages connection_ids in time wait state.
223 scoped_ptr<QuicTimeWaitListManager> time_wait_list_manager_; 224 scoped_ptr<QuicTimeWaitListManager> time_wait_list_manager_;
224 225
225 // The list of closed but not-yet-deleted sessions. 226 // The list of closed but not-yet-deleted sessions.
226 std::list<QuicSession*> closed_session_list_; 227 std::list<QuicServerSession*> closed_session_list_;
227 228
228 // The helper used for all connections. 229 // The helper used for all connections.
229 scoped_ptr<QuicConnectionHelperInterface> helper_; 230 scoped_ptr<QuicConnectionHelperInterface> helper_;
230 231
231 // An alarm which deletes closed sessions. 232 // An alarm which deletes closed sessions.
232 scoped_ptr<QuicAlarm> delete_sessions_alarm_; 233 scoped_ptr<QuicAlarm> delete_sessions_alarm_;
233 234
234 // The writer to write to the socket with. 235 // The writer to write to the socket with.
235 scoped_ptr<QuicPacketWriter> writer_; 236 scoped_ptr<QuicPacketWriter> writer_;
236 237
(...skipping 17 matching lines...) Expand all
254 QuicFramer framer_; 255 QuicFramer framer_;
255 scoped_ptr<QuicFramerVisitor> framer_visitor_; 256 scoped_ptr<QuicFramerVisitor> framer_visitor_;
256 257
257 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); 258 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher);
258 }; 259 };
259 260
260 } // namespace tools 261 } // namespace tools
261 } // namespace net 262 } // namespace net
262 263
263 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ 264 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client_bin.cc ('k') | net/tools/quic/quic_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698