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 // |
11 // For example: | 11 // For example: |
12 // quic_client --address=127.0.0.1 --port=6122 --hostname=www.google.com | 12 // 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 | 13 // http://www.google.com/index.html http://www.google.com/favicon.ico |
14 | 14 |
15 #include <iostream> | 15 #include <iostream> |
16 | 16 |
17 #include "base/at_exit.h" | 17 #include "base/at_exit.h" |
18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
19 #include "base/logging.h" | 19 #include "base/logging.h" |
20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
21 #include "net/base/ip_endpoint.h" | 21 #include "net/base/ip_endpoint.h" |
22 #include "net/base/privacy_mode.h" | 22 #include "net/base/privacy_mode.h" |
23 #include "net/quic/quic_protocol.h" | 23 #include "net/quic/quic_protocol.h" |
24 #include "net/quic/quic_server_id.h" | 24 #include "net/quic/quic_server_id.h" |
| 25 #include "net/tools/epoll_server/epoll_server.h" |
25 #include "net/tools/quic/quic_client.h" | 26 #include "net/tools/quic/quic_client.h" |
26 | 27 |
27 // The port the quic client will connect to. | 28 // The port the quic client will connect to. |
28 int32 FLAGS_port = 6121; | 29 int32 FLAGS_port = 6121; |
29 std::string FLAGS_address = "127.0.0.1"; | 30 std::string FLAGS_address = "127.0.0.1"; |
30 // The hostname the quic client will connect to. | 31 // The hostname the quic client will connect to. |
31 std::string FLAGS_hostname = "localhost"; | 32 std::string FLAGS_hostname = "localhost"; |
32 // Size of the initial flow control receive window to advertise to server. | 33 // Size of the initial flow control receive window to advertise to server. |
33 int32 FLAGS_initial_flow_control_window = 100 * net::kMaxPacketSize; | 34 int32 FLAGS_initial_flow_control_window = 100 * net::kMaxPacketSize; |
34 // Check the certificates using proof verifier. | 35 // Check the certificates using proof verifier. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 78 |
78 base::AtExitManager exit_manager; | 79 base::AtExitManager exit_manager; |
79 | 80 |
80 net::IPAddressNumber addr; | 81 net::IPAddressNumber addr; |
81 CHECK(net::ParseIPLiteralToNumber(FLAGS_address, &addr)); | 82 CHECK(net::ParseIPLiteralToNumber(FLAGS_address, &addr)); |
82 | 83 |
83 net::QuicConfig config; | 84 net::QuicConfig config; |
84 config.SetInitialFlowControlWindowToSend(FLAGS_initial_flow_control_window); | 85 config.SetInitialFlowControlWindowToSend(FLAGS_initial_flow_control_window); |
85 | 86 |
86 // TODO(rjshade): Set version on command line. | 87 // TODO(rjshade): Set version on command line. |
| 88 net::EpollServer epoll_server; |
87 net::tools::QuicClient client( | 89 net::tools::QuicClient client( |
88 net::IPEndPoint(addr, FLAGS_port), | 90 net::IPEndPoint(addr, FLAGS_port), |
89 net::QuicServerId(FLAGS_hostname, FLAGS_port, FLAGS_secure, | 91 net::QuicServerId(FLAGS_hostname, FLAGS_port, FLAGS_secure, |
90 net::PRIVACY_MODE_DISABLED), | 92 net::PRIVACY_MODE_DISABLED), |
91 net::QuicSupportedVersions(), true, config); | 93 net::QuicSupportedVersions(), true, config, &epoll_server); |
92 | 94 |
93 client.Initialize(); | 95 client.Initialize(); |
94 | 96 |
95 if (!client.Connect()) return 1; | 97 if (!client.Connect()) return 1; |
96 | 98 |
97 client.SendRequestsAndWaitForResponse(line->GetArgs()); | 99 client.SendRequestsAndWaitForResponse(line->GetArgs()); |
98 return 0; | 100 return 0; |
99 } | 101 } |
OLD | NEW |