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_flow_control_window to specify the size of the initial flow |
9 // control receive window to advertise to server. | 9 // control receive window to advertise to server. |
10 // | 10 // |
(...skipping 16 matching lines...) Expand all Loading... |
27 // The port the quic client will connect to. | 27 // The port the quic client will connect to. |
28 int32 FLAGS_port = 6121; | 28 int32 FLAGS_port = 6121; |
29 std::string FLAGS_address = "127.0.0.1"; | 29 std::string FLAGS_address = "127.0.0.1"; |
30 // The hostname the quic client will connect to. | 30 // The hostname the quic client will connect to. |
31 std::string FLAGS_hostname = "localhost"; | 31 std::string FLAGS_hostname = "localhost"; |
32 // Size of the initial flow control receive window to advertise to server. | 32 // Size of the initial flow control receive window to advertise to server. |
33 int32 FLAGS_initial_flow_control_window = 100 * net::kMaxPacketSize; | 33 int32 FLAGS_initial_flow_control_window = 100 * net::kMaxPacketSize; |
34 // Check the certificates using proof verifier. | 34 // Check the certificates using proof verifier. |
35 bool FLAGS_secure = false; | 35 bool FLAGS_secure = false; |
36 | 36 |
37 int main(int argc, char *argv[]) { | 37 int main(int argc, char* argv[]) { |
38 CommandLine::Init(argc, argv); | 38 CommandLine::Init(argc, argv); |
39 CommandLine* line = CommandLine::ForCurrentProcess(); | 39 CommandLine* line = CommandLine::ForCurrentProcess(); |
40 | 40 |
41 logging::LoggingSettings settings; | 41 logging::LoggingSettings settings; |
42 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 42 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
43 CHECK(logging::InitLogging(settings)); | 43 CHECK(logging::InitLogging(settings)); |
44 | 44 |
45 if (line->HasSwitch("h") || line->HasSwitch("help")) { | 45 if (line->HasSwitch("h") || line->HasSwitch("help")) { |
46 const char* help_str = | 46 const char* help_str = |
47 "Usage: quic_client [options]\n" | 47 "Usage: quic_client [options]\n" |
(...skipping 15 matching lines...) Expand all Loading... |
63 } | 63 } |
64 if (line->HasSwitch("address")) { | 64 if (line->HasSwitch("address")) { |
65 FLAGS_address = line->GetSwitchValueASCII("address"); | 65 FLAGS_address = line->GetSwitchValueASCII("address"); |
66 } | 66 } |
67 if (line->HasSwitch("hostname")) { | 67 if (line->HasSwitch("hostname")) { |
68 FLAGS_hostname = line->GetSwitchValueASCII("hostname"); | 68 FLAGS_hostname = line->GetSwitchValueASCII("hostname"); |
69 } | 69 } |
70 if (line->HasSwitch("secure")) { | 70 if (line->HasSwitch("secure")) { |
71 FLAGS_secure = true; | 71 FLAGS_secure = true; |
72 } | 72 } |
73 VLOG(1) << "server port: " << FLAGS_port | 73 VLOG(1) << "server port: " << FLAGS_port << " address: " << FLAGS_address |
74 << " address: " << FLAGS_address | 74 << " hostname: " << FLAGS_hostname << " secure: " << FLAGS_secure; |
75 << " hostname: " << FLAGS_hostname | |
76 << " secure: " << FLAGS_secure; | |
77 | 75 |
78 base::AtExitManager exit_manager; | 76 base::AtExitManager exit_manager; |
79 | 77 |
80 net::IPAddressNumber addr; | 78 net::IPAddressNumber addr; |
81 CHECK(net::ParseIPLiteralToNumber(FLAGS_address, &addr)); | 79 CHECK(net::ParseIPLiteralToNumber(FLAGS_address, &addr)); |
82 // TODO(rjshade): Set version on command line. | 80 // TODO(rjshade): Set version on command line. |
83 net::tools::QuicClient client( | 81 net::tools::QuicClient client( |
84 net::IPEndPoint(addr, FLAGS_port), | 82 net::IPEndPoint(addr, FLAGS_port), |
85 net::QuicServerId(FLAGS_hostname, FLAGS_port, FLAGS_secure, | 83 net::QuicServerId( |
86 net::PRIVACY_MODE_DISABLED), | 84 FLAGS_hostname, FLAGS_port, FLAGS_secure, net::PRIVACY_MODE_DISABLED), |
87 net::QuicSupportedVersions(), true, FLAGS_initial_flow_control_window); | 85 net::QuicSupportedVersions(), |
| 86 true, |
| 87 FLAGS_initial_flow_control_window); |
88 | 88 |
89 client.Initialize(); | 89 client.Initialize(); |
90 | 90 |
91 if (!client.Connect()) return 1; | 91 if (!client.Connect()) |
| 92 return 1; |
92 | 93 |
93 client.SendRequestsAndWaitForResponse(line->GetArgs()); | 94 client.SendRequestsAndWaitForResponse(line->GetArgs()); |
94 return 0; | 95 return 0; |
95 } | 96 } |
OLD | NEW |