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 |
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/epoll_server/epoll_server.h" | 20 #include "net/tools/epoll_server/epoll_server.h" |
21 #include "net/tools/quic/quic_server_session.h" | 21 #include "net/tools/quic/quic_server_session.h" |
22 #include "net/tools/quic/quic_time_wait_list_manager.h" | 22 #include "net/tools/quic/quic_time_wait_list_manager.h" |
23 | 23 |
24 #if defined(COMPILER_GCC) | 24 #if defined(COMPILER_GCC) |
25 namespace BASE_HASH_NAMESPACE { | 25 namespace BASE_HASH_NAMESPACE { |
26 template<> | 26 template <> |
27 struct hash<net::QuicBlockedWriterInterface*> { | 27 struct hash<net::QuicBlockedWriterInterface*> { |
28 std::size_t operator()( | 28 std::size_t operator()(const net::QuicBlockedWriterInterface* ptr) const { |
29 const net::QuicBlockedWriterInterface* ptr) const { | |
30 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); | 29 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); |
31 } | 30 } |
32 }; | 31 }; |
33 } | 32 } |
34 #endif | 33 #endif |
35 | 34 |
36 namespace net { | 35 namespace net { |
37 | 36 |
38 class EpollServer; | 37 class EpollServer; |
39 class QuicConfig; | 38 class QuicConfig; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 117 |
119 // Called by |framer_visitor_| when the public header has been parsed. | 118 // Called by |framer_visitor_| when the public header has been parsed. |
120 virtual bool OnUnauthenticatedPublicHeader( | 119 virtual bool OnUnauthenticatedPublicHeader( |
121 const QuicPacketPublicHeader& header); | 120 const QuicPacketPublicHeader& header); |
122 | 121 |
123 // Create and return the time wait list manager for this dispatcher, which | 122 // Create and return the time wait list manager for this dispatcher, which |
124 // will be owned by the dispatcher as time_wait_list_manager_ | 123 // will be owned by the dispatcher as time_wait_list_manager_ |
125 virtual QuicTimeWaitListManager* CreateQuicTimeWaitListManager(); | 124 virtual QuicTimeWaitListManager* CreateQuicTimeWaitListManager(); |
126 | 125 |
127 // Replaces the packet writer with |writer|. Takes ownership of |writer|. | 126 // Replaces the packet writer with |writer|. Takes ownership of |writer|. |
128 void set_writer(QuicPacketWriter* writer) { | 127 void set_writer(QuicPacketWriter* writer) { writer_.reset(writer); } |
129 writer_.reset(writer); | |
130 } | |
131 | 128 |
132 QuicTimeWaitListManager* time_wait_list_manager() { | 129 QuicTimeWaitListManager* time_wait_list_manager() { |
133 return time_wait_list_manager_.get(); | 130 return time_wait_list_manager_.get(); |
134 } | 131 } |
135 | 132 |
136 EpollServer* epoll_server() { return epoll_server_; } | 133 EpollServer* epoll_server() { return epoll_server_; } |
137 | 134 |
138 const QuicVersionVector& supported_versions() const { | 135 const QuicVersionVector& supported_versions() const { |
139 return supported_versions_; | 136 return supported_versions_; |
140 } | 137 } |
141 | 138 |
142 const QuicVersionVector& supported_versions_no_flow_control() const { | 139 const QuicVersionVector& supported_versions_no_flow_control() const { |
143 return supported_versions_no_flow_control_; | 140 return supported_versions_no_flow_control_; |
144 } | 141 } |
145 | 142 |
146 const IPEndPoint& current_server_address() { | 143 const IPEndPoint& current_server_address() { return current_server_address_; } |
147 return current_server_address_; | 144 const IPEndPoint& current_client_address() { return current_client_address_; } |
148 } | 145 const QuicEncryptedPacket& current_packet() { return *current_packet_; } |
149 const IPEndPoint& current_client_address() { | |
150 return current_client_address_; | |
151 } | |
152 const QuicEncryptedPacket& current_packet() { | |
153 return *current_packet_; | |
154 } | |
155 | 146 |
156 const QuicConfig& config() const { return config_; } | 147 const QuicConfig& config() const { return config_; } |
157 | 148 |
158 const QuicCryptoServerConfig& crypto_config() const { return crypto_config_; } | 149 const QuicCryptoServerConfig& crypto_config() const { return crypto_config_; } |
159 | 150 |
160 QuicFramer* framer() { return &framer_; } | 151 QuicFramer* framer() { return &framer_; } |
161 | 152 |
162 QuicEpollConnectionHelper* helper() { return helper_.get(); } | 153 QuicEpollConnectionHelper* helper() { return helper_.get(); } |
163 | 154 |
164 QuicPacketWriter* writer() { return writer_.get(); } | 155 QuicPacketWriter* writer() { return writer_.get(); } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // connections. | 223 // connections. |
233 const uint32 initial_flow_control_window_bytes_; | 224 const uint32 initial_flow_control_window_bytes_; |
234 | 225 |
235 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); | 226 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); |
236 }; | 227 }; |
237 | 228 |
238 } // namespace tools | 229 } // namespace tools |
239 } // namespace net | 230 } // namespace net |
240 | 231 |
241 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ | 232 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ |
OLD | NEW |