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 toy client, which connects to a specified port and sends QUIC | 5 // A toy client, which connects to a specified port and sends QUIC |
6 // request to that endpoint. | 6 // request to that endpoint. |
7 | 7 |
8 #ifndef NET_TOOLS_QUIC_QUIC_SIMPLE_CLIENT_H_ | 8 #ifndef NET_TOOLS_QUIC_QUIC_SIMPLE_CLIENT_H_ |
9 #define NET_TOOLS_QUIC_QUIC_SIMPLE_CLIENT_H_ | 9 #define NET_TOOLS_QUIC_QUIC_SIMPLE_CLIENT_H_ |
10 | 10 |
11 #include <stddef.h> | 11 #include <stddef.h> |
12 | 12 |
| 13 #include <memory> |
13 #include <string> | 14 #include <string> |
14 | 15 |
15 #include "base/command_line.h" | 16 #include "base/command_line.h" |
16 #include "base/macros.h" | 17 #include "base/macros.h" |
17 #include "base/memory/scoped_ptr.h" | |
18 #include "base/strings/string_piece.h" | 18 #include "base/strings/string_piece.h" |
19 #include "net/base/ip_address.h" | 19 #include "net/base/ip_address.h" |
20 #include "net/base/ip_endpoint.h" | 20 #include "net/base/ip_endpoint.h" |
21 #include "net/http/http_response_headers.h" | 21 #include "net/http/http_response_headers.h" |
22 #include "net/log/net_log.h" | 22 #include "net/log/net_log.h" |
23 #include "net/quic/quic_chromium_packet_reader.h" | 23 #include "net/quic/quic_chromium_packet_reader.h" |
24 #include "net/quic/quic_config.h" | 24 #include "net/quic/quic_config.h" |
25 #include "net/quic/quic_spdy_stream.h" | 25 #include "net/quic/quic_spdy_stream.h" |
26 #include "net/tools/quic/quic_client_base.h" | 26 #include "net/tools/quic/quic_client_base.h" |
27 | 27 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // Address of the client if the client is connected to the server. | 213 // Address of the client if the client is connected to the server. |
214 IPEndPoint client_address_; | 214 IPEndPoint client_address_; |
215 | 215 |
216 // If initialized, the address to bind to. | 216 // If initialized, the address to bind to. |
217 IPAddress bind_to_address_; | 217 IPAddress bind_to_address_; |
218 | 218 |
219 // Local port to bind to. Initialize to 0. | 219 // Local port to bind to. Initialize to 0. |
220 int local_port_; | 220 int local_port_; |
221 | 221 |
222 // UDP socket connected to the server. | 222 // UDP socket connected to the server. |
223 scoped_ptr<UDPClientSocket> socket_; | 223 std::unique_ptr<UDPClientSocket> socket_; |
224 | 224 |
225 // Listens for full responses. | 225 // Listens for full responses. |
226 scoped_ptr<ResponseListener> response_listener_; | 226 std::unique_ptr<ResponseListener> response_listener_; |
227 | 227 |
228 // Tracks if the client is initialized to connect. | 228 // Tracks if the client is initialized to connect. |
229 bool initialized_; | 229 bool initialized_; |
230 | 230 |
231 // If overflow_supported_ is true, this will be the number of packets dropped | 231 // If overflow_supported_ is true, this will be the number of packets dropped |
232 // during the lifetime of the server. | 232 // during the lifetime of the server. |
233 QuicPacketCount packets_dropped_; | 233 QuicPacketCount packets_dropped_; |
234 | 234 |
235 // True if the kernel supports SO_RXQ_OVFL, the number of packets dropped | 235 // True if the kernel supports SO_RXQ_OVFL, the number of packets dropped |
236 // because the socket would otherwise overflow. | 236 // because the socket would otherwise overflow. |
(...skipping 11 matching lines...) Expand all Loading... |
248 // Keeps track of any data sent before the handshake. | 248 // Keeps track of any data sent before the handshake. |
249 std::vector<QuicDataToResend*> data_sent_before_handshake_; | 249 std::vector<QuicDataToResend*> data_sent_before_handshake_; |
250 | 250 |
251 // Once the client receives a stateless reject, keeps track of any data that | 251 // Once the client receives a stateless reject, keeps track of any data that |
252 // must be resent upon a subsequent successful connection. | 252 // must be resent upon a subsequent successful connection. |
253 std::vector<QuicDataToResend*> data_to_resend_on_connect_; | 253 std::vector<QuicDataToResend*> data_to_resend_on_connect_; |
254 | 254 |
255 // The log used for the sockets. | 255 // The log used for the sockets. |
256 NetLog net_log_; | 256 NetLog net_log_; |
257 | 257 |
258 scoped_ptr<QuicChromiumPacketReader> packet_reader_; | 258 std::unique_ptr<QuicChromiumPacketReader> packet_reader_; |
259 | 259 |
260 bool packet_reader_started_; | 260 bool packet_reader_started_; |
261 | 261 |
262 base::WeakPtrFactory<QuicSimpleClient> weak_factory_; | 262 base::WeakPtrFactory<QuicSimpleClient> weak_factory_; |
263 | 263 |
264 DISALLOW_COPY_AND_ASSIGN(QuicSimpleClient); | 264 DISALLOW_COPY_AND_ASSIGN(QuicSimpleClient); |
265 }; | 265 }; |
266 | 266 |
267 } // namespace net | 267 } // namespace net |
268 | 268 |
269 #endif // NET_TOOLS_QUIC_QUIC_SIMPLE_CLIENT_H_ | 269 #endif // NET_TOOLS_QUIC_QUIC_SIMPLE_CLIENT_H_ |
OLD | NEW |