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

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

Issue 1035533006: Unify the QUIC client classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ssize_t 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/net.gypi ('k') | net/tools/quic/quic_simple_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_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 <string> 11 #include <string>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/strings/string_piece.h" 16 #include "base/strings/string_piece.h"
17 #include "net/base/io_buffer.h" 17 #include "net/base/io_buffer.h"
18 #include "net/base/ip_endpoint.h" 18 #include "net/base/ip_endpoint.h"
19 #include "net/base/net_log.h" 19 #include "net/base/net_log.h"
20 #include "net/http/http_response_headers.h" 20 #include "net/http/http_response_headers.h"
21 #include "net/quic/crypto/crypto_handshake.h" 21 #include "net/quic/crypto/crypto_handshake.h"
22 #include "net/quic/quic_config.h" 22 #include "net/quic/quic_config.h"
23 #include "net/quic/quic_framer.h" 23 #include "net/quic/quic_framer.h"
24 #include "net/quic/quic_packet_creator.h" 24 #include "net/quic/quic_packet_creator.h"
25 #include "net/quic/quic_packet_reader.h" 25 #include "net/quic/quic_packet_reader.h"
26 #include "net/tools/quic/quic_simple_client_session.h" 26 #include "net/tools/quic/quic_client_session.h"
27 #include "net/tools/quic/quic_simple_client_stream.h" 27 #include "net/tools/quic/quic_spdy_client_stream.h"
28 28
29 namespace net { 29 namespace net {
30 30
31 struct HttpRequestInfo; 31 struct HttpRequestInfo;
32 class ProofVerifier; 32 class ProofVerifier;
33 class QuicServerId; 33 class QuicServerId;
34 class QuicConnectionHelper; 34 class QuicConnectionHelper;
35 class UDPClientSocket; 35 class UDPClientSocket;
36 36
37 namespace tools { 37 namespace tools {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // Sends an HTTP request and waits for response before returning. 94 // Sends an HTTP request and waits for response before returning.
95 void SendRequestAndWaitForResponse(const HttpRequestInfo& headers, 95 void SendRequestAndWaitForResponse(const HttpRequestInfo& headers,
96 base::StringPiece body, 96 base::StringPiece body,
97 bool fin); 97 bool fin);
98 98
99 // Sends a request simple GET for each URL in |args|, and then waits for 99 // Sends a request simple GET for each URL in |args|, and then waits for
100 // each to complete. 100 // each to complete.
101 void SendRequestsAndWaitForResponse( 101 void SendRequestsAndWaitForResponse(
102 const base::CommandLine::StringVector& url_list); 102 const base::CommandLine::StringVector& url_list);
103 103
104 // Returns a newly created QuicSimpleClientStream, owned by the 104 // Returns a newly created QuicSpdyClientStream, owned by the
105 // QuicSimpleClient. 105 // QuicSimpleClient.
106 QuicSimpleClientStream* CreateReliableClientStream(); 106 QuicSpdyClientStream* CreateReliableClientStream();
107 107
108 // Wait for events until the stream with the given ID is closed. 108 // Wait for events until the stream with the given ID is closed.
109 void WaitForStreamToClose(QuicStreamId id); 109 void WaitForStreamToClose(QuicStreamId id);
110 110
111 // Wait for events until the handshake is confirmed. 111 // Wait for events until the handshake is confirmed.
112 void WaitForCryptoHandshakeConfirmed(); 112 void WaitForCryptoHandshakeConfirmed();
113 113
114 // Wait up to 50ms, and handle any events which occur. 114 // Wait up to 50ms, and handle any events which occur.
115 // Returns true if there are any outstanding requests. 115 // Returns true if there are any outstanding requests.
116 bool WaitForEvents(); 116 bool WaitForEvents();
117 117
118 // QuicPacketReader::Visitor 118 // QuicPacketReader::Visitor
119 void OnReadError(int result) override; 119 void OnReadError(int result) override;
120 bool OnPacket(const QuicEncryptedPacket& packet, 120 bool OnPacket(const QuicEncryptedPacket& packet,
121 IPEndPoint local_address, 121 IPEndPoint local_address,
122 IPEndPoint peer_address) override; 122 IPEndPoint peer_address) override;
123 123
124 // QuicDataStream::Visitor 124 // QuicDataStream::Visitor
125 void OnClose(QuicDataStream* stream) override; 125 void OnClose(QuicDataStream* stream) override;
126 126
127 QuicSimpleClientSession* session() { return session_.get(); } 127 QuicClientSession* session() { return session_.get(); }
128 128
129 bool connected() const; 129 bool connected() const;
130 bool goaway_received() const; 130 bool goaway_received() const;
131 131
132 void set_bind_to_address(IPAddressNumber address) { 132 void set_bind_to_address(IPAddressNumber address) {
133 bind_to_address_ = address; 133 bind_to_address_ = address;
134 } 134 }
135 135
136 IPAddressNumber bind_to_address() const { return bind_to_address_; } 136 IPAddressNumber bind_to_address() const { return bind_to_address_; }
137 137
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 // If initialized, the address to bind to. 231 // If initialized, the address to bind to.
232 IPAddressNumber bind_to_address_; 232 IPAddressNumber bind_to_address_;
233 // Local port to bind to. Initialize to 0. 233 // Local port to bind to. Initialize to 0.
234 int local_port_; 234 int local_port_;
235 235
236 // Writer used to actually send packets to the wire. Needs to outlive 236 // Writer used to actually send packets to the wire. Needs to outlive
237 // |session_|. 237 // |session_|.
238 scoped_ptr<QuicPacketWriter> writer_; 238 scoped_ptr<QuicPacketWriter> writer_;
239 239
240 // Session which manages streams. 240 // Session which manages streams.
241 scoped_ptr<QuicSimpleClientSession> session_; 241 scoped_ptr<QuicClientSession> session_;
242 242
243 // UDP socket connected to the server. 243 // UDP socket connected to the server.
244 scoped_ptr<UDPClientSocket> socket_; 244 scoped_ptr<UDPClientSocket> socket_;
245 245
246 // Connection on the socket. Owned by |session_|. 246 // Connection on the socket. Owned by |session_|.
247 QuicConnection* connection_; 247 QuicConnection* connection_;
248 248
249 // Helper to be used by created connections. 249 // Helper to be used by created connections.
250 scoped_ptr<QuicConnectionHelper> helper_; 250 scoped_ptr<QuicConnectionHelper> helper_;
251 251
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 base::WeakPtrFactory<QuicSimpleClient> weak_factory_; 287 base::WeakPtrFactory<QuicSimpleClient> weak_factory_;
288 288
289 DISALLOW_COPY_AND_ASSIGN(QuicSimpleClient); 289 DISALLOW_COPY_AND_ASSIGN(QuicSimpleClient);
290 }; 290 };
291 291
292 } // namespace tools 292 } // namespace tools
293 } // namespace net 293 } // namespace net
294 294
295 #endif // NET_TOOLS_QUIC_QUIC_SIMPLE_CLIENT_H_ 295 #endif // NET_TOOLS_QUIC_QUIC_SIMPLE_CLIENT_H_
OLDNEW
« no previous file with comments | « net/net.gypi ('k') | net/tools/quic/quic_simple_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698