| 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 #include <stdio.h> | 5 #include <stdio.h> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/bind.h" | 9 #include "base/bind.h" |
| 11 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
| 12 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 13 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 14 #include "base/location.h" | 13 #include "base/location.h" |
| 15 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 17 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 18 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 50 int port; | 49 int port; |
| 51 if (!ParseHostAndPort(ip_address_and_port, &ip, &port)) | 50 if (!ParseHostAndPort(ip_address_and_port, &ip, &port)) |
| 52 return false; | 51 return false; |
| 53 if (port == -1) | 52 if (port == -1) |
| 54 port = dns_protocol::kDefaultPort; | 53 port = dns_protocol::kDefaultPort; |
| 55 | 54 |
| 56 net::IPAddressNumber ip_number; | 55 net::IPAddressNumber ip_number; |
| 57 if (!net::ParseIPLiteralToNumber(ip, &ip_number)) | 56 if (!net::ParseIPLiteralToNumber(ip, &ip_number)) |
| 58 return false; | 57 return false; |
| 59 | 58 |
| 60 *ip_end_point = net::IPEndPoint(ip_number, static_cast<uint16>(port)); | 59 *ip_end_point = net::IPEndPoint(ip_number, static_cast<uint16_t>(port)); |
| 61 return true; | 60 return true; |
| 62 } | 61 } |
| 63 | 62 |
| 64 // Convert DnsConfig to human readable text omitting the hosts member. | 63 // Convert DnsConfig to human readable text omitting the hosts member. |
| 65 std::string DnsConfigToString(const DnsConfig& dns_config) { | 64 std::string DnsConfigToString(const DnsConfig& dns_config) { |
| 66 std::string output; | 65 std::string output; |
| 67 output.append("search "); | 66 output.append("search "); |
| 68 for (size_t i = 0; i < dns_config.search.size(); ++i) { | 67 for (size_t i = 0; i < dns_config.search.size(); ++i) { |
| 69 output.append(dns_config.search[i] + " "); | 68 output.append(dns_config.search[i] + " "); |
| 70 } | 69 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 if (time_and_name.size() != 2) { | 144 if (time_and_name.size() != 2) { |
| 146 fprintf( | 145 fprintf( |
| 147 stderr, | 146 stderr, |
| 148 "[%s %u] replay log should have format 'timestamp domain_name\\n'\n", | 147 "[%s %u] replay log should have format 'timestamp domain_name\\n'\n", |
| 149 file_path.MaybeAsASCII().c_str(), | 148 file_path.MaybeAsASCII().c_str(), |
| 150 i + 1); | 149 i + 1); |
| 151 bad_parse = true; | 150 bad_parse = true; |
| 152 continue; | 151 continue; |
| 153 } | 152 } |
| 154 | 153 |
| 155 int64 delta_in_milliseconds; | 154 int64_t delta_in_milliseconds; |
| 156 if (!base::StringToInt64(time_and_name[0], &delta_in_milliseconds)) { | 155 if (!base::StringToInt64(time_and_name[0], &delta_in_milliseconds)) { |
| 157 fprintf( | 156 fprintf( |
| 158 stderr, | 157 stderr, |
| 159 "[%s %u] replay log should have format 'timestamp domain_name\\n'\n", | 158 "[%s %u] replay log should have format 'timestamp domain_name\\n'\n", |
| 160 file_path.MaybeAsASCII().c_str(), | 159 file_path.MaybeAsASCII().c_str(), |
| 161 i + 1); | 160 i + 1); |
| 162 bad_parse = true; | 161 bad_parse = true; |
| 163 continue; | 162 continue; |
| 164 } | 163 } |
| 165 | 164 |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 } | 511 } |
| 513 | 512 |
| 514 } // empty namespace | 513 } // empty namespace |
| 515 | 514 |
| 516 } // namespace net | 515 } // namespace net |
| 517 | 516 |
| 518 int main(int argc, const char* argv[]) { | 517 int main(int argc, const char* argv[]) { |
| 519 net::GDig dig; | 518 net::GDig dig; |
| 520 return dig.Main(argc, argv); | 519 return dig.Main(argc, argv); |
| 521 } | 520 } |
| OLD | NEW |