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

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

Issue 352253002: Added ProcessPacketInterface interface and QuicDispatcher is derived (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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.h ('k') | net/tools/quic/quic_server.h » ('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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 class QuicPacketWriterWrapper; 44 class QuicPacketWriterWrapper;
45 45
46 namespace test { 46 namespace test {
47 class QuicDispatcherPeer; 47 class QuicDispatcherPeer;
48 } // namespace test 48 } // namespace test
49 49
50 class DeleteSessionsAlarm; 50 class DeleteSessionsAlarm;
51 class QuicEpollConnectionHelper; 51 class QuicEpollConnectionHelper;
52 52
53 class QuicDispatcher : public QuicServerSessionVisitor { 53 class ProcessPacketInterface {
54 public:
55 virtual ~ProcessPacketInterface() {}
56 virtual void ProcessPacket(const IPEndPoint& server_address,
57 const IPEndPoint& client_address,
58 const QuicEncryptedPacket& packet) = 0;
59 };
60
61 class QuicDispatcher : public QuicServerSessionVisitor,
62 public ProcessPacketInterface {
54 public: 63 public:
55 // Ideally we'd have a linked_hash_set: the boolean is unused. 64 // Ideally we'd have a linked_hash_set: the boolean is unused.
56 typedef linked_hash_map<QuicBlockedWriterInterface*, bool> WriteBlockedList; 65 typedef linked_hash_map<QuicBlockedWriterInterface*, bool> WriteBlockedList;
57 66
58 // Due to the way delete_sessions_closure_ is registered, the Dispatcher 67 // Due to the way delete_sessions_closure_ is registered, the Dispatcher
59 // must live until epoll_server Shutdown. |supported_versions| specifies the 68 // must live until epoll_server Shutdown. |supported_versions| specifies the
60 // list of supported QUIC versions. 69 // list of supported QUIC versions.
61 QuicDispatcher(const QuicConfig& config, 70 QuicDispatcher(const QuicConfig& config,
62 const QuicCryptoServerConfig& crypto_config, 71 const QuicCryptoServerConfig& crypto_config,
63 const QuicVersionVector& supported_versions, 72 const QuicVersionVector& supported_versions,
64 EpollServer* epoll_server); 73 EpollServer* epoll_server);
65 74
66 virtual ~QuicDispatcher(); 75 virtual ~QuicDispatcher();
67 76
68 virtual void Initialize(int fd); 77 virtual void Initialize(int fd);
69 78
70 // Process the incoming packet by creating a new session, passing it to 79 // Process the incoming packet by creating a new session, passing it to
71 // an existing session, or passing it to the TimeWaitListManager. 80 // an existing session, or passing it to the TimeWaitListManager.
72 virtual void ProcessPacket(const IPEndPoint& server_address, 81 virtual void ProcessPacket(const IPEndPoint& server_address,
73 const IPEndPoint& client_address, 82 const IPEndPoint& client_address,
74 const QuicEncryptedPacket& packet); 83 const QuicEncryptedPacket& packet) OVERRIDE;
75 84
76 // Called when the socket becomes writable to allow queued writes to happen. 85 // Called when the socket becomes writable to allow queued writes to happen.
77 virtual void OnCanWrite(); 86 virtual void OnCanWrite();
78 87
79 // Returns true if there's anything in the blocked writer list. 88 // Returns true if there's anything in the blocked writer list.
80 virtual bool HasPendingWrites() const; 89 virtual bool HasPendingWrites() const;
81 90
82 // Sends ConnectionClose frames to all connected clients. 91 // Sends ConnectionClose frames to all connected clients.
83 void Shutdown(); 92 void Shutdown();
84 93
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 QuicFramer framer_; 242 QuicFramer framer_;
234 scoped_ptr<QuicFramerVisitor> framer_visitor_; 243 scoped_ptr<QuicFramerVisitor> framer_visitor_;
235 244
236 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); 245 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher);
237 }; 246 };
238 247
239 } // namespace tools 248 } // namespace tools
240 } // namespace net 249 } // namespace net
241 250
242 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ 251 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client.h ('k') | net/tools/quic/quic_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698