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

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

Issue 1760423002: n/a (QUIC toy client/server) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@115456160
Patch Set: Update dependency Created 4 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 | « no previous file | net/tools/quic/quic_client.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 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_CLIENT_H_ 8 #ifndef NET_TOOLS_QUIC_QUIC_CLIENT_H_
9 #define NET_TOOLS_QUIC_QUIC_CLIENT_H_ 9 #define NET_TOOLS_QUIC_QUIC_CLIENT_H_
10 10
11 #include <stddef.h> 11 #include <stddef.h>
12 12
13 #include <string> 13 #include <string>
14 14
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/scoped_ptr.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/quic/quic_client_push_promise_index.h" 21 #include "net/quic/quic_client_push_promise_index.h"
22 #include "net/quic/quic_config.h" 22 #include "net/quic/quic_config.h"
23 #include "net/quic/quic_spdy_stream.h" 23 #include "net/quic/quic_spdy_stream.h"
24 #include "net/tools/balsa/balsa_headers.h" 24 #include "net/tools/balsa/balsa_headers.h"
25 #include "net/tools/epoll_server/epoll_server.h" 25 #include "net/tools/epoll_server/epoll_server.h"
26 #include "net/tools/quic/quic_client_base.h" 26 #include "net/tools/quic/quic_client_base.h"
27 #include "net/tools/quic/quic_client_session.h" 27 #include "net/tools/quic/quic_client_session.h"
28 #include "net/tools/quic/quic_packet_reader.h"
28 #include "net/tools/quic/quic_process_packet_interface.h" 29 #include "net/tools/quic/quic_process_packet_interface.h"
29 30
30 namespace net { 31 namespace net {
31 32
32 class QuicServerId; 33 class QuicServerId;
33 34
34 class QuicEpollConnectionHelper; 35 class QuicEpollConnectionHelper;
35 class QuicPacketReader;
36 36
37 namespace test { 37 namespace test {
38 class QuicClientPeer; 38 class QuicClientPeer;
39 } // namespace test 39 } // namespace test
40 40
41 class QuicClient : public QuicClientBase, 41 class QuicClient : public QuicClientBase,
42 public EpollCallbackInterface, 42 public EpollCallbackInterface,
43 public QuicSpdyStream::Visitor, 43 public QuicSpdyStream::Visitor,
44 public ProcessPacketInterface, 44 public ProcessPacketInterface,
45 public QuicClientPushPromiseIndex::Delegate { 45 public QuicClientPushPromiseIndex::Delegate {
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 DISALLOW_COPY_AND_ASSIGN(ClientQuicDataToResend); 236 DISALLOW_COPY_AND_ASSIGN(ClientQuicDataToResend);
237 }; 237 };
238 238
239 // Used during initialization: creates the UDP socket FD, sets socket options, 239 // Used during initialization: creates the UDP socket FD, sets socket options,
240 // and binds the socket to our address. 240 // and binds the socket to our address.
241 bool CreateUDPSocketAndBind(); 241 bool CreateUDPSocketAndBind();
242 242
243 // Actually clean up |fd|. 243 // Actually clean up |fd|.
244 void CleanUpUDPSocketImpl(int fd); 244 void CleanUpUDPSocketImpl(int fd);
245 245
246 // Read a UDP packet and hand it to the framer.
247 bool ReadAndProcessPacket();
248
249 // Read available UDP packets up to kNumPacketsPerReadCall
250 // and hand them to the connection.
251 // TODO(rtenneti): Add support for ReadAndProcessPackets().
252 // bool ReadAndProcessPackets();
253
254 // If the request URL matches a push promise, bypass sending the 246 // If the request URL matches a push promise, bypass sending the
255 // request. 247 // request.
256 bool MaybeHandlePromised(const BalsaHeaders& headers, 248 bool MaybeHandlePromised(const BalsaHeaders& headers,
257 const SpdyHeaderBlock& spdy_headers, 249 const SpdyHeaderBlock& spdy_headers,
258 base::StringPiece body, 250 base::StringPiece body,
259 bool fin); 251 bool fin);
260 252
261 // Address of the server. 253 // Address of the server.
262 const IPEndPoint server_address_; 254 const IPEndPoint server_address_;
263 255
(...skipping 20 matching lines...) Expand all
284 bool initialized_; 276 bool initialized_;
285 277
286 // If overflow_supported_ is true, this will be the number of packets dropped 278 // If overflow_supported_ is true, this will be the number of packets dropped
287 // during the lifetime of the server. 279 // during the lifetime of the server.
288 QuicPacketCount packets_dropped_; 280 QuicPacketCount packets_dropped_;
289 281
290 // True if the kernel supports SO_RXQ_OVFL, the number of packets dropped 282 // True if the kernel supports SO_RXQ_OVFL, the number of packets dropped
291 // because the socket would otherwise overflow. 283 // because the socket would otherwise overflow.
292 bool overflow_supported_; 284 bool overflow_supported_;
293 285
286 // If true, use recvmmsg for reading.
287 bool use_recvmmsg_;
288
294 // If true, store the latest response code, headers, and body. 289 // If true, store the latest response code, headers, and body.
295 bool store_response_; 290 bool store_response_;
296 // HTTP response code from most recent response. 291 // HTTP response code from most recent response.
297 size_t latest_response_code_; 292 size_t latest_response_code_;
298 // HTTP/2 headers from most recent response. 293 // HTTP/2 headers from most recent response.
299 std::string latest_response_headers_; 294 std::string latest_response_headers_;
300 // Body of most recent response. 295 // Body of most recent response.
301 std::string latest_response_body_; 296 std::string latest_response_body_;
302 // HTTP/2 trailers from most recent response. 297 // HTTP/2 trailers from most recent response.
303 std::string latest_response_trailers_; 298 std::string latest_response_trailers_;
(...skipping 13 matching lines...) Expand all
317 QuicPacketReader* packet_reader_; 312 QuicPacketReader* packet_reader_;
318 313
319 std::unique_ptr<ClientQuicDataToResend> push_promise_data_to_resend_; 314 std::unique_ptr<ClientQuicDataToResend> push_promise_data_to_resend_;
320 315
321 DISALLOW_COPY_AND_ASSIGN(QuicClient); 316 DISALLOW_COPY_AND_ASSIGN(QuicClient);
322 }; 317 };
323 318
324 } // namespace net 319 } // namespace net
325 320
326 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ 321 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_
OLDNEW
« no previous file with comments | « no previous file | net/tools/quic/quic_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698