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 binary wrapper for QuicClient. Connects to --hostname via --address | 5 // A binary wrapper for QuicClient. Connects to --hostname via --address |
6 // on --port and requests URLs specified on the command line. | 6 // on --port and requests URLs specified on the command line. |
7 // Pass --secure to check the certificates using proof verifier. | 7 // Pass --secure to check the certificates using proof verifier. |
8 // Pass --initial_flow_control_window to specify the size of the initial flow | 8 // Pass --initial_stream_flow_control_window to specify the size of the initial |
9 // control receive window to advertise to server. | 9 // stream flow control receive window to advertise to server. |
| 10 // Pass --initial_session_flow_control_window to specify the size of the initial |
| 11 // session flow control receive window to advertise to server. |
10 // | 12 // |
11 // For example: | 13 // For example: |
12 // quic_client --address=127.0.0.1 --port=6122 --hostname=www.google.com | 14 // quic_client --address=127.0.0.1 --port=6122 --hostname=www.google.com |
13 // http://www.google.com/index.html http://www.google.com/favicon.ico | 15 // http://www.google.com/index.html http://www.google.com/favicon.ico |
14 | 16 |
15 #include <iostream> | 17 #include <iostream> |
16 | 18 |
17 #include "base/at_exit.h" | 19 #include "base/at_exit.h" |
18 #include "base/command_line.h" | 20 #include "base/command_line.h" |
19 #include "base/logging.h" | 21 #include "base/logging.h" |
20 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
21 #include "net/base/ip_endpoint.h" | 23 #include "net/base/ip_endpoint.h" |
22 #include "net/base/privacy_mode.h" | 24 #include "net/base/privacy_mode.h" |
23 #include "net/quic/quic_protocol.h" | 25 #include "net/quic/quic_protocol.h" |
24 #include "net/quic/quic_server_id.h" | 26 #include "net/quic/quic_server_id.h" |
| 27 #include "net/tools/epoll_server/epoll_server.h" |
25 #include "net/tools/quic/quic_client.h" | 28 #include "net/tools/quic/quic_client.h" |
26 | 29 |
27 // The port the quic client will connect to. | 30 // The port the quic client will connect to. |
28 int32 FLAGS_port = 6121; | 31 int32 FLAGS_port = 6121; |
29 std::string FLAGS_address = "127.0.0.1"; | 32 std::string FLAGS_address = "127.0.0.1"; |
30 // The hostname the quic client will connect to. | 33 // The hostname the quic client will connect to. |
31 std::string FLAGS_hostname = "localhost"; | 34 std::string FLAGS_hostname = "localhost"; |
32 // Size of the initial flow control receive window to advertise to server. | 35 // Size of the initial stream flow control receive window to advertise to |
33 int32 FLAGS_initial_flow_control_window = 100 * net::kMaxPacketSize; | 36 // server. |
| 37 int32 FLAGS_initial_stream_flow_control_window = 100 * net::kMaxPacketSize; |
| 38 // Size of the initial session flow control receive window to advertise to |
| 39 // server. |
| 40 int32 FLAGS_initial_session_flow_control_window = 200 * net::kMaxPacketSize; |
34 // Check the certificates using proof verifier. | 41 // Check the certificates using proof verifier. |
35 bool FLAGS_secure = false; | 42 bool FLAGS_secure = false; |
36 | 43 |
37 int main(int argc, char *argv[]) { | 44 int main(int argc, char *argv[]) { |
38 base::CommandLine::Init(argc, argv); | 45 base::CommandLine::Init(argc, argv); |
39 base::CommandLine* line = base::CommandLine::ForCurrentProcess(); | 46 base::CommandLine* line = base::CommandLine::ForCurrentProcess(); |
40 | 47 |
41 logging::LoggingSettings settings; | 48 logging::LoggingSettings settings; |
42 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 49 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
43 CHECK(logging::InitLogging(settings)); | 50 CHECK(logging::InitLogging(settings)); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 << " hostname: " << FLAGS_hostname | 82 << " hostname: " << FLAGS_hostname |
76 << " secure: " << FLAGS_secure; | 83 << " secure: " << FLAGS_secure; |
77 | 84 |
78 base::AtExitManager exit_manager; | 85 base::AtExitManager exit_manager; |
79 | 86 |
80 net::IPAddressNumber addr; | 87 net::IPAddressNumber addr; |
81 CHECK(net::ParseIPLiteralToNumber(FLAGS_address, &addr)); | 88 CHECK(net::ParseIPLiteralToNumber(FLAGS_address, &addr)); |
82 | 89 |
83 net::QuicConfig config; | 90 net::QuicConfig config; |
84 config.SetDefaults(); | 91 config.SetDefaults(); |
85 config.SetInitialFlowControlWindowToSend(FLAGS_initial_flow_control_window); | 92 config.SetInitialFlowControlWindowToSend( |
| 93 FLAGS_initial_session_flow_control_window); |
| 94 config.SetInitialStreamFlowControlWindowToSend( |
| 95 FLAGS_initial_stream_flow_control_window); |
| 96 config.SetInitialSessionFlowControlWindowToSend( |
| 97 FLAGS_initial_session_flow_control_window); |
86 | 98 |
87 // TODO(rjshade): Set version on command line. | 99 // TODO(rjshade): Set version on command line. |
| 100 net::EpollServer epoll_server; |
88 net::tools::QuicClient client( | 101 net::tools::QuicClient client( |
89 net::IPEndPoint(addr, FLAGS_port), | 102 net::IPEndPoint(addr, FLAGS_port), |
90 net::QuicServerId(FLAGS_hostname, FLAGS_port, FLAGS_secure, | 103 net::QuicServerId(FLAGS_hostname, FLAGS_port, FLAGS_secure, |
91 net::PRIVACY_MODE_DISABLED), | 104 net::PRIVACY_MODE_DISABLED), |
92 net::QuicSupportedVersions(), true, config); | 105 net::QuicSupportedVersions(), true, config, &epoll_server); |
93 | 106 |
94 client.Initialize(); | 107 client.Initialize(); |
95 | 108 |
96 if (!client.Connect()) return 1; | 109 if (!client.Connect()) return 1; |
97 | 110 |
98 client.SendRequestsAndWaitForResponse(line->GetArgs()); | 111 client.SendRequestsAndWaitForResponse(line->GetArgs()); |
99 return 0; | 112 return 0; |
100 } | 113 } |
OLD | NEW |