summaryrefslogtreecommitdiffstats
path: root/net/dns
diff options
context:
space:
mode:
authorAvi Drissman <avi@chromium.org>2015-12-19 23:40:46 -0500
committerAvi Drissman <avi@chromium.org>2015-12-20 04:42:28 +0000
commit13fc893acb88fdd82ad7eea72f9499d123bf5a89 (patch)
tree76aa2bdaa56cb2d05bbf2a6af57e440f9661c7f0 /net/dns
parente40cbca89ebc83b5bef0f892d80604b00a98abc8 (diff)
downloadchromium_src-13fc893acb88fdd82ad7eea72f9499d123bf5a89.zip
chromium_src-13fc893acb88fdd82ad7eea72f9499d123bf5a89.tar.gz
chromium_src-13fc893acb88fdd82ad7eea72f9499d123bf5a89.tar.bz2
Switch to standard integer types in net/.
BUG=488550 TBR=mmenke@chromium.org Review URL: https://codereview.chromium.org/1535363003 . Cr-Commit-Position: refs/heads/master@{#366297}
Diffstat (limited to 'net/dns')
-rw-r--r--net/dns/address_sorter.h2
-rw-r--r--net/dns/address_sorter_posix.h1
-rw-r--r--net/dns/address_sorter_posix_unittest.cc5
-rw-r--r--net/dns/address_sorter_win.cc1
-rw-r--r--net/dns/dns_config_service.h1
-rw-r--r--net/dns/dns_config_service_posix.cc2
-rw-r--r--net/dns/dns_config_service_posix.h1
-rw-r--r--net/dns/dns_config_service_unittest.cc1
-rw-r--r--net/dns/dns_config_service_win.cc3
-rw-r--r--net/dns/dns_config_service_win.h1
-rw-r--r--net/dns/dns_config_service_win_unittest.cc7
-rw-r--r--net/dns/dns_hosts.cc5
-rw-r--r--net/dns/dns_hosts.h3
-rw-r--r--net/dns/dns_protocol.h72
-rw-r--r--net/dns/dns_query.cc20
-rw-r--r--net/dns/dns_query.h17
-rw-r--r--net/dns/dns_query_unittest.cc31
-rw-r--r--net/dns/dns_reloader.cc2
-rw-r--r--net/dns/dns_response.h1
-rw-r--r--net/dns/dns_response_unittest.cc356
-rw-r--r--net/dns/dns_session.cc1
-rw-r--r--net/dns/dns_session.h3
-rw-r--r--net/dns/dns_socket_pool.cc1
-rw-r--r--net/dns/dns_socket_pool.h1
-rw-r--r--net/dns/dns_test_util.cc16
-rw-r--r--net/dns/dns_test_util.h156
-rw-r--r--net/dns/dns_transaction.cc43
-rw-r--r--net/dns/dns_transaction.h7
-rw-r--r--net/dns/dns_transaction_unittest.cc1
-rw-r--r--net/dns/host_cache.h3
-rw-r--r--net/dns/host_resolver.h7
-rw-r--r--net/dns/host_resolver_impl.cc18
-rw-r--r--net/dns/host_resolver_impl.h7
-rw-r--r--net/dns/host_resolver_impl_unittest.cc12
-rw-r--r--net/dns/host_resolver_mojo.h1
-rw-r--r--net/dns/host_resolver_proc.h1
-rw-r--r--net/dns/mdns_cache.h1
-rw-r--r--net/dns/mdns_cache_unittest.cc170
-rw-r--r--net/dns/mdns_client.cc4
-rw-r--r--net/dns/mdns_client.h15
-rw-r--r--net/dns/mdns_client_impl.cc28
-rw-r--r--net/dns/mdns_client_impl.h28
-rw-r--r--net/dns/mdns_client_unittest.cc583
-rw-r--r--net/dns/mock_host_resolver.h3
-rw-r--r--net/dns/mock_mdns_socket_factory.cc2
-rw-r--r--net/dns/mock_mdns_socket_factory.h10
-rw-r--r--net/dns/mojo_host_resolver_impl.cc1
-rw-r--r--net/dns/notify_watcher_mac.h1
-rw-r--r--net/dns/record_parsed.cc20
-rw-r--r--net/dns/record_parsed.h21
-rw-r--r--net/dns/record_parsed_unittest.cc27
-rw-r--r--net/dns/record_rdata.cc20
-rw-r--r--net/dns/record_rdata.h48
-rw-r--r--net/dns/record_rdata_unittest.cc70
-rw-r--r--net/dns/serial_worker.h1
-rw-r--r--net/dns/single_request_host_resolver.h3
-rw-r--r--net/dns/single_request_host_resolver_unittest.cc1
57 files changed, 880 insertions, 987 deletions
diff --git a/net/dns/address_sorter.h b/net/dns/address_sorter.h
index 6ac9430..31115a6 100644
--- a/net/dns/address_sorter.h
+++ b/net/dns/address_sorter.h
@@ -5,8 +5,8 @@
#ifndef NET_DNS_ADDRESS_SORTER_H_
#define NET_DNS_ADDRESS_SORTER_H_
-#include "base/basictypes.h"
#include "base/callback.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "net/base/net_export.h"
diff --git a/net/dns/address_sorter_posix.h b/net/dns/address_sorter_posix.h
index d23f049..06d2dd8 100644
--- a/net/dns/address_sorter_posix.h
+++ b/net/dns/address_sorter_posix.h
@@ -8,6 +8,7 @@
#include <map>
#include <vector>
+#include "base/macros.h"
#include "base/threading/non_thread_safe.h"
#include "net/base/address_list.h"
#include "net/base/ip_address_number.h"
diff --git a/net/dns/address_sorter_posix_unittest.cc b/net/dns/address_sorter_posix_unittest.cc
index 9d7916d..e71bb21 100644
--- a/net/dns/address_sorter_posix_unittest.cc
+++ b/net/dns/address_sorter_posix_unittest.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/logging.h"
+#include "base/macros.h"
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
#include "net/base/test_completion_callback.h"
@@ -43,8 +44,8 @@ class TestUDPClientSocket : public DatagramClientSocket {
NOTIMPLEMENTED();
return OK;
}
- int SetReceiveBufferSize(int32) override { return OK; }
- int SetSendBufferSize(int32) override { return OK; }
+ int SetReceiveBufferSize(int32_t) override { return OK; }
+ int SetSendBufferSize(int32_t) override { return OK; }
void Close() override {}
int GetPeerAddress(IPEndPoint* address) const override {
diff --git a/net/dns/address_sorter_win.cc b/net/dns/address_sorter_win.cc
index f469dae..816b42d 100644
--- a/net/dns/address_sorter_win.cc
+++ b/net/dns/address_sorter_win.cc
@@ -11,6 +11,7 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
+#include "base/macros.h"
#include "base/threading/worker_pool.h"
#include "base/win/windows_version.h"
#include "net/base/address_list.h"
diff --git a/net/dns/dns_config_service.h b/net/dns/dns_config_service.h
index 10d93ac..d552da4 100644
--- a/net/dns/dns_config_service.h
+++ b/net/dns/dns_config_service.h
@@ -9,6 +9,7 @@
#include <string>
#include <vector>
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/threading/non_thread_safe.h"
diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc
index c189951..31a4061 100644
--- a/net/dns/dns_config_service_posix.cc
+++ b/net/dns/dns_config_service_posix.cc
@@ -6,13 +6,13 @@
#include <string>
-#include "base/basictypes.h"
#include "base/bind.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/file_path_watcher.h"
#include "base/lazy_instance.h"
#include "base/location.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/single_thread_task_runner.h"
diff --git a/net/dns/dns_config_service_posix.h b/net/dns/dns_config_service_posix.h
index b9f5fb7..18cb5a0 100644
--- a/net/dns/dns_config_service_posix.h
+++ b/net/dns/dns_config_service_posix.h
@@ -13,6 +13,7 @@
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
+#include "base/macros.h"
#include "net/base/net_export.h"
#include "net/base/network_change_notifier.h"
#include "net/dns/dns_config_service.h"
diff --git a/net/dns/dns_config_service_unittest.cc b/net/dns/dns_config_service_unittest.cc
index 028024d..40796ad 100644
--- a/net/dns/dns_config_service_unittest.cc
+++ b/net/dns/dns_config_service_unittest.cc
@@ -4,7 +4,6 @@
#include "net/dns/dns_config_service.h"
-#include "base/basictypes.h"
#include "base/bind.h"
#include "base/cancelable_callback.h"
#include "base/location.h"
diff --git a/net/dns/dns_config_service_win.cc b/net/dns/dns_config_service_win.cc
index 443ee27..8c3192d 100644
--- a/net/dns/dns_config_service_win.cc
+++ b/net/dns/dns_config_service_win.cc
@@ -13,6 +13,7 @@
#include "base/files/file_path.h"
#include "base/files/file_path_watcher.h"
#include "base/logging.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_split.h"
@@ -333,7 +334,7 @@ class RegistryWatcher : public base::NonThreadSafe {
bool IsStatelessDiscoveryAddress(const IPAddressNumber& address) {
if (address.size() != kIPv6AddressSize)
return false;
- const uint8 kPrefix[] = {
+ const uint8_t kPrefix[] = {
0xfe, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
diff --git a/net/dns/dns_config_service_win.h b/net/dns/dns_config_service_win.h
index 5b6f22b..96d4713 100644
--- a/net/dns/dns_config_service_win.h
+++ b/net/dns/dns_config_service_win.h
@@ -13,6 +13,7 @@
#include <string>
#include <vector>
+#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
diff --git a/net/dns/dns_config_service_win_unittest.cc b/net/dns/dns_config_service_win_unittest.cc
index dc521ec..3a452bc 100644
--- a/net/dns/dns_config_service_win_unittest.cc
+++ b/net/dns/dns_config_service_win_unittest.cc
@@ -4,7 +4,6 @@
#include "net/dns/dns_config_service_win.h"
-#include "base/basictypes.h"
#include "base/logging.h"
#include "base/win/windows_version.h"
#include "net/dns/dns_protocol.h"
@@ -52,7 +51,7 @@ struct AdapterInfo {
IF_OPER_STATUS oper_status;
const WCHAR* dns_suffix;
std::string dns_server_addresses[4]; // Empty string indicates end.
- uint16 ports[4];
+ uint16_t ports[4];
};
scoped_ptr<IP_ADAPTER_ADDRESSES, base::FreeDeleter> CreateAdapterAddresses(
@@ -117,7 +116,7 @@ TEST(DnsConfigServiceWinTest, ConvertAdapterAddresses) {
AdapterInfo input_adapters[4]; // |if_type| == 0 indicates end.
std::string expected_nameservers[4]; // Empty string indicates end.
std::string expected_suffix;
- uint16 expected_ports[4];
+ uint16_t expected_ports[4];
} cases[] = {
{ // Ignore loopback and inactive adapters.
{
@@ -176,7 +175,7 @@ TEST(DnsConfigServiceWinTest, ConvertAdapterAddresses) {
for (size_t j = 0; !t.expected_nameservers[j].empty(); ++j) {
IPAddressNumber ip;
ASSERT_TRUE(ParseIPLiteralToNumber(t.expected_nameservers[j], &ip));
- uint16 port = t.expected_ports[j];
+ uint16_t port = t.expected_ports[j];
if (!port)
port = dns_protocol::kDefaultPort;
expected_nameservers.push_back(IPEndPoint(ip, port));
diff --git a/net/dns/dns_hosts.cc b/net/dns/dns_hosts.cc
index 9e641b6..a4f293f 100644
--- a/net/dns/dns_hosts.cc
+++ b/net/dns/dns_hosts.cc
@@ -6,6 +6,7 @@
#include "base/files/file_util.h"
#include "base/logging.h"
+#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
@@ -190,7 +191,7 @@ bool ParseHostsFile(const base::FilePath& path, DnsHosts* dns_hosts) {
if (!base::PathExists(path))
return true;
- int64 size;
+ int64_t size;
if (!base::GetFileSize(path, &size))
return false;
@@ -198,7 +199,7 @@ bool ParseHostsFile(const base::FilePath& path, DnsHosts* dns_hosts) {
static_cast<base::HistogramBase::Sample>(size));
// Reject HOSTS files larger than |kMaxHostsSize| bytes.
- const int64 kMaxHostsSize = 1 << 25; // 32MB
+ const int64_t kMaxHostsSize = 1 << 25; // 32MB
if (size > kMaxHostsSize)
return false;
diff --git a/net/dns/dns_hosts.h b/net/dns/dns_hosts.h
index c35857e..d8ece2c 100644
--- a/net/dns/dns_hosts.h
+++ b/net/dns/dns_hosts.h
@@ -5,12 +5,13 @@
#ifndef NET_DNS_DNS_HOSTS_H_
#define NET_DNS_DNS_HOSTS_H_
+#include <stddef.h>
+
#include <map>
#include <string>
#include <utility>
#include <vector>
-#include "base/basictypes.h"
#include "base/containers/hash_tables.h"
#include "base/files/file_path.h"
#include "net/base/address_family.h"
diff --git a/net/dns/dns_protocol.h b/net/dns/dns_protocol.h
index f3f9292..3b421ae 100644
--- a/net/dns/dns_protocol.h
+++ b/net/dns/dns_protocol.h
@@ -5,15 +5,16 @@
#ifndef NET_DNS_DNS_PROTOCOL_H_
#define NET_DNS_DNS_PROTOCOL_H_
-#include "base/basictypes.h"
+#include <stdint.h>
+
#include "net/base/net_export.h"
namespace net {
namespace dns_protocol {
-static const uint16 kDefaultPort = 53;
-static const uint16 kDefaultPortMulticast = 5353;
+static const uint16_t kDefaultPort = 53;
+static const uint16_t kDefaultPortMulticast = 5353;
// DNS packet consists of a header followed by questions and/or answers.
// For the meaning of specific fields, please see RFC 1035 and 2535
@@ -73,28 +74,28 @@ static const uint16 kDefaultPortMulticast = 5353;
#pragma pack(push)
#pragma pack(1)
-// On-the-wire header. All uint16 are in network order.
+// On-the-wire header. All uint16_t are in network order.
// Used internally in DnsQuery and DnsResponse.
struct NET_EXPORT_PRIVATE Header {
- uint16 id;
- uint16 flags;
- uint16 qdcount;
- uint16 ancount;
- uint16 nscount;
- uint16 arcount;
+ uint16_t id;
+ uint16_t flags;
+ uint16_t qdcount;
+ uint16_t ancount;
+ uint16_t nscount;
+ uint16_t arcount;
};
#pragma pack(pop)
-static const uint8 kLabelMask = 0xc0;
-static const uint8 kLabelPointer = 0xc0;
-static const uint8 kLabelDirect = 0x0;
-static const uint16 kOffsetMask = 0x3fff;
+static const uint8_t kLabelMask = 0xc0;
+static const uint8_t kLabelPointer = 0xc0;
+static const uint8_t kLabelDirect = 0x0;
+static const uint16_t kOffsetMask = 0x3fff;
// In MDns the most significant bit of the rrclass is designated as the
// "cache-flush bit", as described in http://www.rfc-editor.org/rfc/rfc6762.txt
// section 10.2.
-static const uint16 kMDnsClassMask = 0x7FFF;
+static const uint16_t kMDnsClassMask = 0x7FFF;
static const int kMaxNameLength = 255;
@@ -107,34 +108,33 @@ static const int kMaxUDPSize = 512;
static const int kMaxMulticastSize = 9000;
// DNS class types.
-static const uint16 kClassIN = 1;
+static const uint16_t kClassIN = 1;
// DNS resource record types. See
// http://www.iana.org/assignments/dns-parameters
-static const uint16 kTypeA = 1;
-static const uint16 kTypeCNAME = 5;
-static const uint16 kTypePTR = 12;
-static const uint16 kTypeTXT = 16;
-static const uint16 kTypeAAAA = 28;
-static const uint16 kTypeSRV = 33;
-static const uint16 kTypeNSEC = 47;
-
+static const uint16_t kTypeA = 1;
+static const uint16_t kTypeCNAME = 5;
+static const uint16_t kTypePTR = 12;
+static const uint16_t kTypeTXT = 16;
+static const uint16_t kTypeAAAA = 28;
+static const uint16_t kTypeSRV = 33;
+static const uint16_t kTypeNSEC = 47;
// DNS rcode values.
-static const uint8 kRcodeMask = 0xf;
-static const uint8 kRcodeNOERROR = 0;
-static const uint8 kRcodeFORMERR = 1;
-static const uint8 kRcodeSERVFAIL = 2;
-static const uint8 kRcodeNXDOMAIN = 3;
-static const uint8 kRcodeNOTIMP = 4;
-static const uint8 kRcodeREFUSED = 5;
+static const uint8_t kRcodeMask = 0xf;
+static const uint8_t kRcodeNOERROR = 0;
+static const uint8_t kRcodeFORMERR = 1;
+static const uint8_t kRcodeSERVFAIL = 2;
+static const uint8_t kRcodeNXDOMAIN = 3;
+static const uint8_t kRcodeNOTIMP = 4;
+static const uint8_t kRcodeREFUSED = 5;
// DNS flags.
-static const uint16 kFlagResponse = 0x8000;
-static const uint16 kFlagRA = 0x80;
-static const uint16 kFlagRD = 0x100;
-static const uint16 kFlagTC = 0x200;
-static const uint16 kFlagAA = 0x400;
+static const uint16_t kFlagResponse = 0x8000;
+static const uint16_t kFlagRA = 0x80;
+static const uint16_t kFlagRD = 0x100;
+static const uint16_t kFlagTC = 0x200;
+static const uint16_t kFlagAA = 0x400;
} // namespace dns_protocol
diff --git a/net/dns/dns_query.cc b/net/dns/dns_query.cc
index 5154b54..0966def 100644
--- a/net/dns/dns_query.cc
+++ b/net/dns/dns_query.cc
@@ -18,11 +18,11 @@ namespace net {
// For details, see RFC 1035 section 4.1.1. This header template sets RD
// bit, which directs the name server to pursue query recursively, and sets
// the QDCOUNT to 1, meaning the question section has a single entry.
-DnsQuery::DnsQuery(uint16 id, const base::StringPiece& qname, uint16 qtype)
+DnsQuery::DnsQuery(uint16_t id, const base::StringPiece& qname, uint16_t qtype)
: qname_size_(qname.size()) {
DCHECK(!DNSDomainToString(qname).empty());
// QNAME + QTYPE + QCLASS
- size_t question_size = qname_size_ + sizeof(uint16) + sizeof(uint16);
+ size_t question_size = qname_size_ + sizeof(uint16_t) + sizeof(uint16_t);
io_buffer_ = new IOBufferWithSize(sizeof(dns_protocol::Header) +
question_size);
dns_protocol::Header* header =
@@ -43,11 +43,11 @@ DnsQuery::DnsQuery(uint16 id, const base::StringPiece& qname, uint16 qtype)
DnsQuery::~DnsQuery() {
}
-scoped_ptr<DnsQuery> DnsQuery::CloneWithNewId(uint16 id) const {
+scoped_ptr<DnsQuery> DnsQuery::CloneWithNewId(uint16_t id) const {
return make_scoped_ptr(new DnsQuery(*this, id));
}
-uint16 DnsQuery::id() const {
+uint16_t DnsQuery::id() const {
const dns_protocol::Header* header =
reinterpret_cast<const dns_protocol::Header*>(io_buffer_->data());
return base::NetToHost16(header->id);
@@ -58,19 +58,19 @@ base::StringPiece DnsQuery::qname() const {
qname_size_);
}
-uint16 DnsQuery::qtype() const {
- uint16 type;
- base::ReadBigEndian<uint16>(
+uint16_t DnsQuery::qtype() const {
+ uint16_t type;
+ base::ReadBigEndian<uint16_t>(
io_buffer_->data() + sizeof(dns_protocol::Header) + qname_size_, &type);
return type;
}
base::StringPiece DnsQuery::question() const {
return base::StringPiece(io_buffer_->data() + sizeof(dns_protocol::Header),
- qname_size_ + sizeof(uint16) + sizeof(uint16));
+ qname_size_ + sizeof(uint16_t) + sizeof(uint16_t));
}
-DnsQuery::DnsQuery(const DnsQuery& orig, uint16 id) {
+DnsQuery::DnsQuery(const DnsQuery& orig, uint16_t id) {
qname_size_ = orig.qname_size_;
io_buffer_ = new IOBufferWithSize(orig.io_buffer()->size());
memcpy(io_buffer_.get()->data(), orig.io_buffer()->data(),
@@ -80,7 +80,7 @@ DnsQuery::DnsQuery(const DnsQuery& orig, uint16 id) {
header->id = base::HostToNet16(id);
}
-void DnsQuery::set_flags(uint16 flags) {
+void DnsQuery::set_flags(uint16_t flags) {
dns_protocol::Header* header =
reinterpret_cast<dns_protocol::Header*>(io_buffer_->data());
header->flags = flags;
diff --git a/net/dns/dns_query.h b/net/dns/dns_query.h
index c3104c3..14c5b5b 100644
--- a/net/dns/dns_query.h
+++ b/net/dns/dns_query.h
@@ -5,7 +5,10 @@
#ifndef NET_DNS_DNS_QUERY_H_
#define NET_DNS_DNS_QUERY_H_
-#include "base/basictypes.h"
+#include <stddef.h>
+#include <stdint.h>
+
+#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string_piece.h"
@@ -21,16 +24,16 @@ class NET_EXPORT_PRIVATE DnsQuery {
public:
// Constructs a query message from |qname| which *MUST* be in a valid
// DNS name format, and |qtype|. The qclass is set to IN.
- DnsQuery(uint16 id, const base::StringPiece& qname, uint16 qtype);
+ DnsQuery(uint16_t id, const base::StringPiece& qname, uint16_t qtype);
~DnsQuery();
// Clones |this| verbatim, with ID field of the header set to |id|.
- scoped_ptr<DnsQuery> CloneWithNewId(uint16 id) const;
+ scoped_ptr<DnsQuery> CloneWithNewId(uint16_t id) const;
// DnsQuery field accessors.
- uint16 id() const;
+ uint16_t id() const;
base::StringPiece qname() const;
- uint16 qtype() const;
+ uint16_t qtype() const;
// Returns the Question section of the query. Used when matching the
// response.
@@ -39,10 +42,10 @@ class NET_EXPORT_PRIVATE DnsQuery {
// IOBuffer accessor to be used for writing out the query.
IOBufferWithSize* io_buffer() const { return io_buffer_.get(); }
- void set_flags(uint16 flags);
+ void set_flags(uint16_t flags);
private:
- DnsQuery(const DnsQuery& orig, uint16 id);
+ DnsQuery(const DnsQuery& orig, uint16_t id);
// Size of the DNS name (*NOT* hostname) we are trying to resolve; used
// to calculate offsets.
diff --git a/net/dns/dns_query_unittest.cc b/net/dns/dns_query_unittest.cc
index bd8bf3a..2a4648e 100644
--- a/net/dns/dns_query_unittest.cc
+++ b/net/dns/dns_query_unittest.cc
@@ -15,24 +15,19 @@ namespace {
TEST(DnsQueryTest, Constructor) {
// This includes \0 at the end.
const char qname_data[] = "\x03""www""\x07""example""\x03""com";
- const uint8 query_data[] = {
- // Header
- 0xbe, 0xef,
- 0x01, 0x00, // Flags -- set RD (recursion desired) bit.
- 0x00, 0x01, // Set QDCOUNT (question count) to 1, all the
- // rest are 0 for a query.
- 0x00, 0x00,
- 0x00, 0x00,
- 0x00, 0x00,
-
- // Question
- 0x03, 'w', 'w', 'w', // QNAME: www.example.com in DNS format.
- 0x07, 'e', 'x', 'a', 'm', 'p', 'l', 'e',
- 0x03, 'c', 'o', 'm',
- 0x00,
-
- 0x00, 0x01, // QTYPE: A query.
- 0x00, 0x01, // QCLASS: IN class.
+ const uint8_t query_data[] = {
+ // Header
+ 0xbe, 0xef, 0x01, 0x00, // Flags -- set RD (recursion desired) bit.
+ 0x00, 0x01, // Set QDCOUNT (question count) to 1, all the
+ // rest are 0 for a query.
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
+ // Question
+ 0x03, 'w', 'w', 'w', // QNAME: www.example.com in DNS format.
+ 0x07, 'e', 'x', 'a', 'm', 'p', 'l', 'e', 0x03, 'c', 'o', 'm', 0x00,
+
+ 0x00, 0x01, // QTYPE: A query.
+ 0x00, 0x01, // QCLASS: IN class.
};
base::StringPiece qname(qname_data, sizeof(qname_data));
diff --git a/net/dns/dns_reloader.cc b/net/dns/dns_reloader.cc
index 8298c78..74534e6 100644
--- a/net/dns/dns_reloader.cc
+++ b/net/dns/dns_reloader.cc
@@ -9,9 +9,9 @@
#include <resolv.h>
-#include "base/basictypes.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/synchronization/lock.h"
#include "base/threading/thread_local_storage.h"
diff --git a/net/dns/dns_response.h b/net/dns/dns_response.h
index 24071ca..4d5e6b7 100644
--- a/net/dns/dns_response.h
+++ b/net/dns/dns_response.h
@@ -5,6 +5,7 @@
#ifndef NET_DNS_DNS_RESPONSE_H_
#define NET_DNS_DNS_RESPONSE_H_
+#include <stddef.h>
#include <stdint.h>
#include <string>
diff --git a/net/dns/dns_response_unittest.cc b/net/dns/dns_response_unittest.cc
index 9cb98ce..e701c9a 100644
--- a/net/dns/dns_response_unittest.cc
+++ b/net/dns/dns_response_unittest.cc
@@ -29,17 +29,15 @@ TEST(DnsRecordParserTest, Constructor) {
}
TEST(DnsRecordParserTest, ReadName) {
- const uint8 data[] = {
+ const uint8_t data[] = {
// all labels "foo.example.com"
- 0x03, 'f', 'o', 'o',
- 0x07, 'e', 'x', 'a', 'm', 'p', 'l', 'e',
- 0x03, 'c', 'o', 'm',
+ 0x03, 'f', 'o', 'o', 0x07, 'e', 'x', 'a', 'm', 'p', 'l', 'e', 0x03, 'c',
+ 'o', 'm',
// byte 0x10
0x00,
// byte 0x11
// part label, part pointer, "bar.example.com"
- 0x03, 'b', 'a', 'r',
- 0xc0, 0x04,
+ 0x03, 'b', 'a', 'r', 0xc0, 0x04,
// byte 0x17
// all pointer to "bar.example.com", 2 jumps
0xc0, 0x11,
@@ -75,15 +73,13 @@ TEST(DnsRecordParserTest, ReadName) {
}
TEST(DnsRecordParserTest, ReadNameFail) {
- const uint8 data[] = {
+ const uint8_t data[] = {
// label length beyond packet
- 0x30, 'x', 'x',
- 0x00,
+ 0x30, 'x', 'x', 0x00,
// pointer offset beyond packet
0xc0, 0x20,
// pointer loop
- 0xc0, 0x08,
- 0xc0, 0x06,
+ 0xc0, 0x08, 0xc0, 0x06,
// incorrect label type (currently supports only direct and pointer)
0x80, 0x00,
// truncated name (missing root label)
@@ -103,12 +99,10 @@ TEST(DnsRecordParserTest, ReadNameFail) {
}
TEST(DnsRecordParserTest, ReadRecord) {
- const uint8 data[] = {
+ const uint8_t data[] = {
// Type CNAME record.
- 0x07, 'e', 'x', 'a', 'm', 'p', 'l', 'e',
- 0x03, 'c', 'o', 'm',
- 0x00,
- 0x00, 0x05, // TYPE is CNAME.
+ 0x07, 'e', 'x', 'a', 'm', 'p', 'l', 'e', 0x03, 'c', 'o', 'm', 0x00, 0x00,
+ 0x05, // TYPE is CNAME.
0x00, 0x01, // CLASS is IN.
0x00, 0x01, 0x24, 0x74, // TTL is 0x00012474.
0x00, 0x06, // RDLENGTH is 6 bytes.
@@ -116,8 +110,7 @@ TEST(DnsRecordParserTest, ReadRecord) {
0xc0, 0x00,
// Type A record.
0x03, 'b', 'a', 'r', // compressed owner name
- 0xc0, 0x00,
- 0x00, 0x01, // TYPE is A.
+ 0xc0, 0x00, 0x00, 0x01, // TYPE is A.
0x00, 0x01, // CLASS is IN.
0x00, 0x20, 0x13, 0x55, // TTL is 0x00201355.
0x00, 0x04, // RDLENGTH is 4 bytes.
@@ -161,47 +154,40 @@ TEST(DnsResponseTest, InitParse) {
// Compilers want to copy when binding temporary to const &, so must use heap.
scoped_ptr<DnsQuery> query(new DnsQuery(0xcafe, qname, dns_protocol::kTypeA));
- const uint8 response_data[] = {
- // Header
- 0xca, 0xfe, // ID
- 0x81, 0x80, // Standard query response, RA, no error
- 0x00, 0x01, // 1 question
- 0x00, 0x02, // 2 RRs (answers)
- 0x00, 0x00, // 0 authority RRs
- 0x00, 0x00, // 0 additional RRs
-
- // Question
- // This part is echoed back from the respective query.
- 0x0a, 'c', 'o', 'd', 'e', 'r', 'e', 'v', 'i', 'e', 'w',
- 0x08, 'c', 'h', 'r', 'o', 'm', 'i', 'u', 'm',
- 0x03, 'o', 'r', 'g',
- 0x00,
- 0x00, 0x01, // TYPE is A.
- 0x00, 0x01, // CLASS is IN.
-
- // Answer 1
- 0xc0, 0x0c, // NAME is a pointer to name in Question section.
- 0x00, 0x05, // TYPE is CNAME.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
- 0x24, 0x74,
- 0x00, 0x12, // RDLENGTH is 18 bytes.
- // ghs.l.google.com in DNS format.
- 0x03, 'g', 'h', 's',
- 0x01, 'l',
- 0x06, 'g', 'o', 'o', 'g', 'l', 'e',
- 0x03, 'c', 'o', 'm',
- 0x00,
-
- // Answer 2
- 0xc0, 0x35, // NAME is a pointer to name in Answer 1.
- 0x00, 0x01, // TYPE is A.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x00, // TTL (4 bytes) is 53 seconds.
- 0x00, 0x35,
- 0x00, 0x04, // RDLENGTH is 4 bytes.
- 0x4a, 0x7d, // RDATA is the IP: 74.125.95.121
- 0x5f, 0x79,
+ const uint8_t response_data[] = {
+ // Header
+ 0xca, 0xfe, // ID
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x01, // 1 question
+ 0x00, 0x02, // 2 RRs (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
+
+ // Question
+ // This part is echoed back from the respective query.
+ 0x0a, 'c', 'o', 'd', 'e', 'r', 'e', 'v', 'i', 'e', 'w', 0x08, 'c', 'h',
+ 'r', 'o', 'm', 'i', 'u', 'm', 0x03, 'o', 'r', 'g', 0x00, 0x00,
+ 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
+
+ // Answer 1
+ 0xc0, 0x0c, // NAME is a pointer to name in Question section.
+ 0x00, 0x05, // TYPE is CNAME.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
+ 0x24, 0x74, 0x00, 0x12, // RDLENGTH is 18 bytes.
+ // ghs.l.google.com in DNS format.
+ 0x03, 'g', 'h', 's', 0x01, 'l', 0x06, 'g', 'o', 'o', 'g', 'l', 'e', 0x03,
+ 'c', 'o', 'm', 0x00,
+
+ // Answer 2
+ 0xc0, 0x35, // NAME is a pointer to name in Answer 1.
+ 0x00, 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x00, // TTL (4 bytes) is 53 seconds.
+ 0x00, 0x35, 0x00, 0x04, // RDLENGTH is 4 bytes.
+ 0x4a, 0x7d, // RDATA is the IP: 74.125.95.121
+ 0x5f, 0x79,
};
DnsResponse resp;
@@ -274,27 +260,24 @@ TEST(DnsResponseTest, InitParseWithoutQuery) {
}
TEST(DnsResponseTest, InitParseWithoutQueryNoQuestions) {
- const uint8 response_data[] = {
- // Header
- 0xca, 0xfe, // ID
- 0x81, 0x80, // Standard query response, RA, no error
- 0x00, 0x00, // No question
- 0x00, 0x01, // 2 RRs (answers)
- 0x00, 0x00, // 0 authority RRs
- 0x00, 0x00, // 0 additional RRs
-
- // Answer 1
- 0x0a, 'c', 'o', 'd', 'e', 'r', 'e', 'v', 'i', 'e', 'w',
- 0x08, 'c', 'h', 'r', 'o', 'm', 'i', 'u', 'm',
- 0x03, 'o', 'r', 'g',
- 0x00,
- 0x00, 0x01, // TYPE is A.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x00, // TTL (4 bytes) is 53 seconds.
- 0x00, 0x35,
- 0x00, 0x04, // RDLENGTH is 4 bytes.
- 0x4a, 0x7d, // RDATA is the IP: 74.125.95.121
- 0x5f, 0x79,
+ const uint8_t response_data[] = {
+ // Header
+ 0xca, 0xfe, // ID
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x00, // No question
+ 0x00, 0x01, // 2 RRs (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
+
+ // Answer 1
+ 0x0a, 'c', 'o', 'd', 'e', 'r', 'e', 'v', 'i', 'e', 'w', 0x08, 'c', 'h',
+ 'r', 'o', 'm', 'i', 'u', 'm', 0x03, 'o', 'r', 'g', 0x00, 0x00,
+ 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x00, // TTL (4 bytes) is 53 seconds.
+ 0x00, 0x35, 0x00, 0x04, // RDLENGTH is 4 bytes.
+ 0x4a, 0x7d, // RDATA is the IP: 74.125.95.121
+ 0x5f, 0x79,
};
DnsResponse resp;
@@ -321,38 +304,35 @@ TEST(DnsResponseTest, InitParseWithoutQueryNoQuestions) {
}
TEST(DnsResponseTest, InitParseWithoutQueryTwoQuestions) {
- const uint8 response_data[] = {
- // Header
- 0xca, 0xfe, // ID
- 0x81, 0x80, // Standard query response, RA, no error
- 0x00, 0x02, // 2 questions
- 0x00, 0x01, // 2 RRs (answers)
- 0x00, 0x00, // 0 authority RRs
- 0x00, 0x00, // 0 additional RRs
-
- // Question 1
- 0x0a, 'c', 'o', 'd', 'e', 'r', 'e', 'v', 'i', 'e', 'w',
- 0x08, 'c', 'h', 'r', 'o', 'm', 'i', 'u', 'm',
- 0x03, 'o', 'r', 'g',
- 0x00,
- 0x00, 0x01, // TYPE is A.
- 0x00, 0x01, // CLASS is IN.
-
- // Question 2
- 0x0b, 'c', 'o', 'd', 'e', 'r', 'e', 'v', 'i', 'e', 'w', '2',
- 0xc0, 0x18, // pointer to "chromium.org"
- 0x00, 0x01, // TYPE is A.
- 0x00, 0x01, // CLASS is IN.
-
- // Answer 1
- 0xc0, 0x0c, // NAME is a pointer to name in Question section.
- 0x00, 0x01, // TYPE is A.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x00, // TTL (4 bytes) is 53 seconds.
- 0x00, 0x35,
- 0x00, 0x04, // RDLENGTH is 4 bytes.
- 0x4a, 0x7d, // RDATA is the IP: 74.125.95.121
- 0x5f, 0x79,
+ const uint8_t response_data[] = {
+ // Header
+ 0xca, 0xfe, // ID
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x02, // 2 questions
+ 0x00, 0x01, // 2 RRs (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
+
+ // Question 1
+ 0x0a, 'c', 'o', 'd', 'e', 'r', 'e', 'v', 'i', 'e', 'w', 0x08, 'c', 'h',
+ 'r', 'o', 'm', 'i', 'u', 'm', 0x03, 'o', 'r', 'g', 0x00, 0x00,
+ 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
+
+ // Question 2
+ 0x0b, 'c', 'o', 'd', 'e', 'r', 'e', 'v', 'i', 'e', 'w', '2', 0xc0,
+ 0x18, // pointer to "chromium.org"
+ 0x00, 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
+
+ // Answer 1
+ 0xc0, 0x0c, // NAME is a pointer to name in Question section.
+ 0x00, 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x00, // TTL (4 bytes) is 53 seconds.
+ 0x00, 0x35, 0x00, 0x04, // RDLENGTH is 4 bytes.
+ 0x4a, 0x7d, // RDATA is the IP: 74.125.95.121
+ 0x5f, 0x79,
};
DnsResponse resp;
@@ -379,11 +359,11 @@ TEST(DnsResponseTest, InitParseWithoutQueryTwoQuestions) {
}
TEST(DnsResponseTest, InitParseWithoutQueryPacketTooShort) {
- const uint8 response_data[] = {
- // Header
- 0xca, 0xfe, // ID
- 0x81, 0x80, // Standard query response, RA, no error
- 0x00, 0x00, // No question
+ const uint8_t response_data[] = {
+ // Header
+ 0xca, 0xfe, // ID
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x00, // No question
};
DnsResponse resp;
@@ -404,7 +384,7 @@ void VerifyAddressList(const std::vector<const char*>& ip_addresses,
TEST(DnsResponseTest, ParseToAddressList) {
const struct TestCase {
size_t query_size;
- const uint8* response_data;
+ const uint8_t* response_data;
size_t response_size;
const char* const* expected_addresses;
size_t num_expected_addresses;
@@ -457,92 +437,92 @@ TEST(DnsResponseTest, ParseToAddressList) {
}
}
-const uint8 kResponseTruncatedRecord[] = {
- // Header: 1 question, 1 answer RR
- 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
- // Question: name = 'a', type = A (0x1)
- 0x01, 'a', 0x00, 0x00, 0x01, 0x00, 0x01,
- // Answer: name = 'a', type = A, TTL = 0xFF, RDATA = 10.10.10.10
- 0x01, 'a', 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF,
- 0x00, 0x04, 0x0A, 0x0A, 0x0A, // Truncated RDATA.
+const uint8_t kResponseTruncatedRecord[] = {
+ // Header: 1 question, 1 answer RR
+ 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ // Question: name = 'a', type = A (0x1)
+ 0x01, 'a', 0x00, 0x00, 0x01, 0x00, 0x01,
+ // Answer: name = 'a', type = A, TTL = 0xFF, RDATA = 10.10.10.10
+ 0x01, 'a', 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x04,
+ 0x0A, 0x0A, 0x0A, // Truncated RDATA.
};
-const uint8 kResponseTruncatedCNAME[] = {
- // Header: 1 question, 1 answer RR
- 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
- // Question: name = 'a', type = A (0x1)
- 0x01, 'a', 0x00, 0x00, 0x01, 0x00, 0x01,
- // Answer: name = 'a', type = CNAME, TTL = 0xFF, RDATA = 'foo' (truncated)
- 0x01, 'a', 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF,
- 0x00, 0x03, 0x03, 'f', 'o', // Truncated name.
+const uint8_t kResponseTruncatedCNAME[] = {
+ // Header: 1 question, 1 answer RR
+ 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ // Question: name = 'a', type = A (0x1)
+ 0x01, 'a', 0x00, 0x00, 0x01, 0x00, 0x01,
+ // Answer: name = 'a', type = CNAME, TTL = 0xFF, RDATA = 'foo' (truncated)
+ 0x01, 'a', 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x03,
+ 0x03, 'f', 'o', // Truncated name.
};
-const uint8 kResponseNameMismatch[] = {
- // Header: 1 question, 1 answer RR
- 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
- // Question: name = 'a', type = A (0x1)
- 0x01, 'a', 0x00, 0x00, 0x01, 0x00, 0x01,
- // Answer: name = 'b', type = A, TTL = 0xFF, RDATA = 10.10.10.10
- 0x01, 'b', 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF,
- 0x00, 0x04, 0x0A, 0x0A, 0x0A, 0x0A,
+const uint8_t kResponseNameMismatch[] = {
+ // Header: 1 question, 1 answer RR
+ 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ // Question: name = 'a', type = A (0x1)
+ 0x01, 'a', 0x00, 0x00, 0x01, 0x00, 0x01,
+ // Answer: name = 'b', type = A, TTL = 0xFF, RDATA = 10.10.10.10
+ 0x01, 'b', 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x04,
+ 0x0A, 0x0A, 0x0A, 0x0A,
};
-const uint8 kResponseNameMismatchInChain[] = {
- // Header: 1 question, 3 answer RR
- 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
- // Question: name = 'a', type = A (0x1)
- 0x01, 'a', 0x00, 0x00, 0x01, 0x00, 0x01,
- // Answer: name = 'a', type = CNAME, TTL = 0xFF, RDATA = 'b'
- 0x01, 'a', 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF,
- 0x00, 0x03, 0x01, 'b', 0x00,
- // Answer: name = 'b', type = A, TTL = 0xFF, RDATA = 10.10.10.10
- 0x01, 'b', 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF,
- 0x00, 0x04, 0x0A, 0x0A, 0x0A, 0x0A,
- // Answer: name = 'c', type = A, TTL = 0xFF, RDATA = 10.10.10.11
- 0x01, 'c', 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF,
- 0x00, 0x04, 0x0A, 0x0A, 0x0A, 0x0B,
+const uint8_t kResponseNameMismatchInChain[] = {
+ // Header: 1 question, 3 answer RR
+ 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
+ // Question: name = 'a', type = A (0x1)
+ 0x01, 'a', 0x00, 0x00, 0x01, 0x00, 0x01,
+ // Answer: name = 'a', type = CNAME, TTL = 0xFF, RDATA = 'b'
+ 0x01, 'a', 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x03,
+ 0x01, 'b', 0x00,
+ // Answer: name = 'b', type = A, TTL = 0xFF, RDATA = 10.10.10.10
+ 0x01, 'b', 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x04,
+ 0x0A, 0x0A, 0x0A, 0x0A,
+ // Answer: name = 'c', type = A, TTL = 0xFF, RDATA = 10.10.10.11
+ 0x01, 'c', 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x04,
+ 0x0A, 0x0A, 0x0A, 0x0B,
};
-const uint8 kResponseSizeMismatch[] = {
- // Header: 1 answer RR
- 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
- // Question: name = 'a', type = AAAA (0x1c)
- 0x01, 'a', 0x00, 0x00, 0x1c, 0x00, 0x01,
- // Answer: name = 'a', type = AAAA, TTL = 0xFF, RDATA = 10.10.10.10
- 0x01, 'a', 0x00, 0x00, 0x1c, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF,
- 0x00, 0x04, 0x0A, 0x0A, 0x0A, 0x0A,
+const uint8_t kResponseSizeMismatch[] = {
+ // Header: 1 answer RR
+ 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ // Question: name = 'a', type = AAAA (0x1c)
+ 0x01, 'a', 0x00, 0x00, 0x1c, 0x00, 0x01,
+ // Answer: name = 'a', type = AAAA, TTL = 0xFF, RDATA = 10.10.10.10
+ 0x01, 'a', 0x00, 0x00, 0x1c, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x04,
+ 0x0A, 0x0A, 0x0A, 0x0A,
};
-const uint8 kResponseCNAMEAfterAddress[] = {
- // Header: 2 answer RR
- 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
- // Question: name = 'a', type = A (0x1)
- 0x01, 'a', 0x00, 0x00, 0x01, 0x00, 0x01,
- // Answer: name = 'a', type = A, TTL = 0xFF, RDATA = 10.10.10.10.
- 0x01, 'a', 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF,
- 0x00, 0x04, 0x0A, 0x0A, 0x0A, 0x0A,
- // Answer: name = 'a', type = CNAME, TTL = 0xFF, RDATA = 'b'
- 0x01, 'a', 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF,
- 0x00, 0x03, 0x01, 'b', 0x00,
+const uint8_t kResponseCNAMEAfterAddress[] = {
+ // Header: 2 answer RR
+ 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ // Question: name = 'a', type = A (0x1)
+ 0x01, 'a', 0x00, 0x00, 0x01, 0x00, 0x01,
+ // Answer: name = 'a', type = A, TTL = 0xFF, RDATA = 10.10.10.10.
+ 0x01, 'a', 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x04,
+ 0x0A, 0x0A, 0x0A, 0x0A,
+ // Answer: name = 'a', type = CNAME, TTL = 0xFF, RDATA = 'b'
+ 0x01, 'a', 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x03,
+ 0x01, 'b', 0x00,
};
-const uint8 kResponseNoAddresses[] = {
- // Header: 1 question, 1 answer RR, 1 authority RR
- 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
- // Question: name = 'a', type = A (0x1)
- 0x01, 'a', 0x00, 0x00, 0x01, 0x00, 0x01,
- // Answer: name = 'a', type = CNAME, TTL = 0xFF, RDATA = 'b'
- 0x01, 'a', 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF,
- 0x00, 0x03, 0x01, 'b', 0x00,
- // Authority section
- // Answer: name = 'b', type = A, TTL = 0xFF, RDATA = 10.10.10.10
- 0x01, 'b', 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF,
- 0x00, 0x04, 0x0A, 0x0A, 0x0A, 0x0A,
+const uint8_t kResponseNoAddresses[] = {
+ // Header: 1 question, 1 answer RR, 1 authority RR
+ 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ // Question: name = 'a', type = A (0x1)
+ 0x01, 'a', 0x00, 0x00, 0x01, 0x00, 0x01,
+ // Answer: name = 'a', type = CNAME, TTL = 0xFF, RDATA = 'b'
+ 0x01, 'a', 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x03,
+ 0x01, 'b', 0x00,
+ // Authority section
+ // Answer: name = 'b', type = A, TTL = 0xFF, RDATA = 10.10.10.10
+ 0x01, 'b', 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x04,
+ 0x0A, 0x0A, 0x0A, 0x0A,
};
TEST(DnsResponseTest, ParseToAddressListFail) {
const struct TestCase {
- const uint8* data;
+ const uint8_t* data;
size_t size;
DnsResponse::Result expected_result;
} cases[] = {
diff --git a/net/dns/dns_session.cc b/net/dns/dns_session.cc
index 3a6c4d4..b200ea3 100644
--- a/net/dns/dns_session.cc
+++ b/net/dns/dns_session.cc
@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/lazy_instance.h"
+#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/sample_vector.h"
#include "base/rand_util.h"
diff --git a/net/dns/dns_session.h b/net/dns/dns_session.h
index ce1a917..106493e 100644
--- a/net/dns/dns_session.h
+++ b/net/dns/dns_session.h
@@ -5,9 +5,12 @@
#ifndef NET_DNS_DNS_SESSION_H_
#define NET_DNS_DNS_SESSION_H_
+#include <stdint.h>
+
#include <vector>
#include "base/lazy_instance.h"
+#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/metrics/bucket_ranges.h"
diff --git a/net/dns/dns_socket_pool.cc b/net/dns/dns_socket_pool.cc
index 2c3c8c2..e937f9c 100644
--- a/net/dns/dns_socket_pool.cc
+++ b/net/dns/dns_socket_pool.cc
@@ -5,6 +5,7 @@
#include "net/dns/dns_socket_pool.h"
#include "base/logging.h"
+#include "base/macros.h"
#include "base/rand_util.h"
#include "base/stl_util.h"
#include "net/base/address_list.h"
diff --git a/net/dns/dns_socket_pool.h b/net/dns/dns_socket_pool.h
index 68d9a9c..1953938 100644
--- a/net/dns/dns_socket_pool.h
+++ b/net/dns/dns_socket_pool.h
@@ -7,6 +7,7 @@
#include <vector>
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "net/base/net_export.h"
#include "net/log/net_log.h"
diff --git a/net/dns/dns_test_util.cc b/net/dns/dns_test_util.cc
index 6b2bdfb..de91048 100644
--- a/net/dns/dns_test_util.cc
+++ b/net/dns/dns_test_util.cc
@@ -41,7 +41,7 @@ class MockTransaction : public DnsTransaction,
public:
MockTransaction(const MockDnsClientRuleList& rules,
const std::string& hostname,
- uint16 qtype,
+ uint16_t qtype,
const DnsTransactionFactory::CallbackType& callback)
: result_(MockDnsClientRule::FAIL),
hostname_(hostname),
@@ -64,7 +64,7 @@ class MockTransaction : public DnsTransaction,
const std::string& GetHostname() const override { return hostname_; }
- uint16 GetType() const override { return qtype_; }
+ uint16_t GetType() const override { return qtype_; }
void Start() override {
EXPECT_FALSE(started_);
@@ -102,10 +102,10 @@ class MockTransaction : public DnsTransaction,
header->flags |= dns_protocol::kFlagResponse;
if (MockDnsClientRule::OK == result_) {
- const uint16 kPointerToQueryName =
- static_cast<uint16>(0xc000 | sizeof(*header));
+ const uint16_t kPointerToQueryName =
+ static_cast<uint16_t>(0xc000 | sizeof(*header));
- const uint32 kTTL = 86400; // One day.
+ const uint32_t kTTL = 86400; // One day.
// Size of RDATA which is a IPv4 or IPv6 address.
size_t rdata_size = qtype_ == dns_protocol::kTypeA ? kIPv4AddressSize
@@ -122,7 +122,7 @@ class MockTransaction : public DnsTransaction,
writer.WriteU16(qtype_);
writer.WriteU16(dns_protocol::kClassIN);
writer.WriteU32(kTTL);
- writer.WriteU16(static_cast<uint16>(rdata_size));
+ writer.WriteU16(static_cast<uint16_t>(rdata_size));
if (qtype_ == dns_protocol::kTypeA) {
char kIPv4Loopback[] = { 0x7f, 0, 0, 1 };
writer.WriteBytes(kIPv4Loopback, sizeof(kIPv4Loopback));
@@ -150,7 +150,7 @@ class MockTransaction : public DnsTransaction,
MockDnsClientRule::Result result_;
const std::string hostname_;
- const uint16 qtype_;
+ const uint16_t qtype_;
DnsTransactionFactory::CallbackType callback_;
bool started_;
bool delayed_;
@@ -168,7 +168,7 @@ class MockTransactionFactory : public DnsTransactionFactory {
scoped_ptr<DnsTransaction> CreateTransaction(
const std::string& hostname,
- uint16 qtype,
+ uint16_t qtype,
const DnsTransactionFactory::CallbackType& callback,
const BoundNetLog&) override {
MockTransaction* transaction =
diff --git a/net/dns/dns_test_util.h b/net/dns/dns_test_util.h
index e168afc..fc32500 100644
--- a/net/dns/dns_test_util.h
+++ b/net/dns/dns_test_util.h
@@ -5,10 +5,12 @@
#ifndef NET_DNS_DNS_TEST_UTIL_H_
#define NET_DNS_DNS_TEST_UTIL_H_
+#include <stddef.h>
+#include <stdint.h>
+
#include <string>
#include <vector>
-#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "net/dns/dns_client.h"
#include "net/dns/dns_config_service.h"
@@ -19,7 +21,7 @@ namespace net {
//-----------------------------------------------------------------------------
// Query/response set for www.google.com, ID is fixed to 0.
static const char kT0HostName[] = "www.google.com";
-static const uint16 kT0Qtype = dns_protocol::kTypeA;
+static const uint16_t kT0Qtype = dns_protocol::kTypeA;
static const char kT0DnsName[] = {
0x03, 'w', 'w', 'w',
0x06, 'g', 'o', 'o', 'g', 'l', 'e',
@@ -27,27 +29,20 @@ static const char kT0DnsName[] = {
0x00
};
static const size_t kT0QuerySize = 32;
-static const uint8 kT0ResponseDatagram[] = {
- // response contains one CNAME for www.l.google.com and the following
- // IP addresses: 74.125.226.{179,180,176,177,178}
- 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x06,
- 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77,
- 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x03,
- 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01,
- 0xc0, 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01,
- 0x4d, 0x13, 0x00, 0x08, 0x03, 0x77, 0x77, 0x77,
- 0x01, 0x6c, 0xc0, 0x10, 0xc0, 0x2c, 0x00, 0x01,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04,
- 0x4a, 0x7d, 0xe2, 0xb3, 0xc0, 0x2c, 0x00, 0x01,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04,
- 0x4a, 0x7d, 0xe2, 0xb4, 0xc0, 0x2c, 0x00, 0x01,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04,
- 0x4a, 0x7d, 0xe2, 0xb0, 0xc0, 0x2c, 0x00, 0x01,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04,
- 0x4a, 0x7d, 0xe2, 0xb1, 0xc0, 0x2c, 0x00, 0x01,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04,
- 0x4a, 0x7d, 0xe2, 0xb2
-};
+static const uint8_t kT0ResponseDatagram[] = {
+ // response contains one CNAME for www.l.google.com and the following
+ // IP addresses: 74.125.226.{179,180,176,177,178}
+ 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x77, 0x77, 0x77, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x03,
+ 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x05,
+ 0x00, 0x01, 0x00, 0x01, 0x4d, 0x13, 0x00, 0x08, 0x03, 0x77, 0x77, 0x77,
+ 0x01, 0x6c, 0xc0, 0x10, 0xc0, 0x2c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0xe4, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb3, 0xc0, 0x2c, 0x00, 0x01,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb4,
+ 0xc0, 0x2c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04,
+ 0x4a, 0x7d, 0xe2, 0xb0, 0xc0, 0x2c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0xe4, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb1, 0xc0, 0x2c, 0x00, 0x01,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb2};
static const char* const kT0IpAddresses[] = {
"74.125.226.179", "74.125.226.180", "74.125.226.176",
"74.125.226.177", "74.125.226.178"
@@ -60,7 +55,7 @@ static const unsigned kT0RecordCount = arraysize(kT0IpAddresses) + 1;
//-----------------------------------------------------------------------------
// Query/response set for codereview.chromium.org, ID is fixed to 1.
static const char kT1HostName[] = "codereview.chromium.org";
-static const uint16 kT1Qtype = dns_protocol::kTypeA;
+static const uint16_t kT1Qtype = dns_protocol::kTypeA;
static const char kT1DnsName[] = {
0x0a, 'c', 'o', 'd', 'e', 'r', 'e', 'v', 'i', 'e', 'w',
0x08, 'c', 'h', 'r', 'o', 'm', 'i', 'u', 'm',
@@ -68,21 +63,17 @@ static const char kT1DnsName[] = {
0x00
};
static const size_t kT1QuerySize = 41;
-static const uint8 kT1ResponseDatagram[] = {
- // response contains one CNAME for ghs.l.google.com and the following
- // IP address: 64.233.169.121
- 0x00, 0x01, 0x81, 0x80, 0x00, 0x01, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x0a, 0x63, 0x6f, 0x64,
- 0x65, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x08,
- 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x75, 0x6d,
- 0x03, 0x6f, 0x72, 0x67, 0x00, 0x00, 0x01, 0x00,
- 0x01, 0xc0, 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00,
- 0x01, 0x41, 0x75, 0x00, 0x12, 0x03, 0x67, 0x68,
- 0x73, 0x01, 0x6c, 0x06, 0x67, 0x6f, 0x6f, 0x67,
- 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0xc0,
- 0x35, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01,
- 0x0b, 0x00, 0x04, 0x40, 0xe9, 0xa9, 0x79
-};
+static const uint8_t kT1ResponseDatagram[] = {
+ // response contains one CNAME for ghs.l.google.com and the following
+ // IP address: 64.233.169.121
+ 0x00, 0x01, 0x81, 0x80, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x0a, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x65, 0x76, 0x69, 0x65,
+ 0x77, 0x08, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x75, 0x6d, 0x03,
+ 0x6f, 0x72, 0x67, 0x00, 0x00, 0x01, 0x00, 0x01, 0xc0, 0x0c, 0x00,
+ 0x05, 0x00, 0x01, 0x00, 0x01, 0x41, 0x75, 0x00, 0x12, 0x03, 0x67,
+ 0x68, 0x73, 0x01, 0x6c, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
+ 0x03, 0x63, 0x6f, 0x6d, 0x00, 0xc0, 0x35, 0x00, 0x01, 0x00, 0x01,
+ 0x00, 0x00, 0x01, 0x0b, 0x00, 0x04, 0x40, 0xe9, 0xa9, 0x79};
static const char* const kT1IpAddresses[] = {
"64.233.169.121"
};
@@ -94,7 +85,7 @@ static const unsigned kT1RecordCount = arraysize(kT1IpAddresses) + 1;
//-----------------------------------------------------------------------------
// Query/response set for www.ccs.neu.edu, ID is fixed to 2.
static const char kT2HostName[] = "www.ccs.neu.edu";
-static const uint16 kT2Qtype = dns_protocol::kTypeA;
+static const uint16_t kT2Qtype = dns_protocol::kTypeA;
static const char kT2DnsName[] = {
0x03, 'w', 'w', 'w',
0x03, 'c', 'c', 's',
@@ -103,19 +94,15 @@ static const char kT2DnsName[] = {
0x00
};
static const size_t kT2QuerySize = 33;
-static const uint8 kT2ResponseDatagram[] = {
- // response contains one CNAME for vulcan.ccs.neu.edu and the following
- // IP address: 129.10.116.81
- 0x00, 0x02, 0x81, 0x80, 0x00, 0x01, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77,
- 0x03, 0x63, 0x63, 0x73, 0x03, 0x6e, 0x65, 0x75,
- 0x03, 0x65, 0x64, 0x75, 0x00, 0x00, 0x01, 0x00,
- 0x01, 0xc0, 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00,
- 0x00, 0x01, 0x2c, 0x00, 0x09, 0x06, 0x76, 0x75,
- 0x6c, 0x63, 0x61, 0x6e, 0xc0, 0x10, 0xc0, 0x2d,
- 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x2c,
- 0x00, 0x04, 0x81, 0x0a, 0x74, 0x51
-};
+static const uint8_t kT2ResponseDatagram[] = {
+ // response contains one CNAME for vulcan.ccs.neu.edu and the following
+ // IP address: 129.10.116.81
+ 0x00, 0x02, 0x81, 0x80, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x77, 0x77, 0x77, 0x03, 0x63, 0x63, 0x73, 0x03, 0x6e, 0x65, 0x75,
+ 0x03, 0x65, 0x64, 0x75, 0x00, 0x00, 0x01, 0x00, 0x01, 0xc0, 0x0c, 0x00,
+ 0x05, 0x00, 0x01, 0x00, 0x00, 0x01, 0x2c, 0x00, 0x09, 0x06, 0x76, 0x75,
+ 0x6c, 0x63, 0x61, 0x6e, 0xc0, 0x10, 0xc0, 0x2d, 0x00, 0x01, 0x00, 0x01,
+ 0x00, 0x00, 0x01, 0x2c, 0x00, 0x04, 0x81, 0x0a, 0x74, 0x51};
static const char* const kT2IpAddresses[] = {
"129.10.116.81"
};
@@ -127,7 +114,7 @@ static const unsigned kT2RecordCount = arraysize(kT2IpAddresses) + 1;
//-----------------------------------------------------------------------------
// Query/response set for www.google.az, ID is fixed to 3.
static const char kT3HostName[] = "www.google.az";
-static const uint16 kT3Qtype = dns_protocol::kTypeA;
+static const uint16_t kT3Qtype = dns_protocol::kTypeA;
static const char kT3DnsName[] = {
0x03, 'w', 'w', 'w',
0x06, 'g', 'o', 'o', 'g', 'l', 'e',
@@ -135,37 +122,28 @@ static const char kT3DnsName[] = {
0x00
};
static const size_t kT3QuerySize = 31;
-static const uint8 kT3ResponseDatagram[] = {
- // response contains www.google.com as CNAME for www.google.az and
- // www.l.google.com as CNAME for www.google.com and the following
- // IP addresses: 74.125.226.{178,179,180,176,177}
- // The TTLs on the records are: 0x00015099, 0x00025099, 0x00000415,
- // 0x00003015, 0x00002015, 0x00000015, 0x00001015.
- // The last record is an imaginary TXT record for t.google.com.
- 0x00, 0x03, 0x81, 0x80, 0x00, 0x01, 0x00, 0x08,
- 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77,
- 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x02,
- 0x61, 0x7a, 0x00, 0x00, 0x01, 0x00, 0x01, 0xc0,
- 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x50,
- 0x99, 0x00, 0x10, 0x03, 0x77, 0x77, 0x77, 0x06,
- 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x03, 0x63,
- 0x6f, 0x6d, 0x00, 0xc0, 0x2b, 0x00, 0x05, 0x00,
- 0x01, 0x00, 0x02, 0x50, 0x99, 0x00, 0x08, 0x03,
- 0x77, 0x77, 0x77, 0x01, 0x6c, 0xc0, 0x2f, 0xc0,
- 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x04,
- 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb2, 0xc0,
- 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x30,
- 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb3, 0xc0,
- 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x20,
- 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb4, 0xc0,
- 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb0, 0xc0,
- 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x10,
- 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb1, 0x01,
- 0x74, 0xc0, 0x2f, 0x00, 0x10, 0x00, 0x01, 0x00,
- 0x00, 0x00, 0x01, 0x00, 0x04, 0xde, 0xad, 0xfe,
- 0xed
-};
+static const uint8_t kT3ResponseDatagram[] = {
+ // response contains www.google.com as CNAME for www.google.az and
+ // www.l.google.com as CNAME for www.google.com and the following
+ // IP addresses: 74.125.226.{178,179,180,176,177}
+ // The TTLs on the records are: 0x00015099, 0x00025099, 0x00000415,
+ // 0x00003015, 0x00002015, 0x00000015, 0x00001015.
+ // The last record is an imaginary TXT record for t.google.com.
+ 0x00, 0x03, 0x81, 0x80, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x77, 0x77, 0x77, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x02,
+ 0x61, 0x7a, 0x00, 0x00, 0x01, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x05, 0x00,
+ 0x01, 0x00, 0x01, 0x50, 0x99, 0x00, 0x10, 0x03, 0x77, 0x77, 0x77, 0x06,
+ 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0xc0,
+ 0x2b, 0x00, 0x05, 0x00, 0x01, 0x00, 0x02, 0x50, 0x99, 0x00, 0x08, 0x03,
+ 0x77, 0x77, 0x77, 0x01, 0x6c, 0xc0, 0x2f, 0xc0, 0x47, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x00, 0x04, 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb2, 0xc0,
+ 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x30, 0x15, 0x00, 0x04, 0x4a,
+ 0x7d, 0xe2, 0xb3, 0xc0, 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x20,
+ 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb4, 0xc0, 0x47, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb0, 0xc0,
+ 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x10, 0x15, 0x00, 0x04, 0x4a,
+ 0x7d, 0xe2, 0xb1, 0x01, 0x74, 0xc0, 0x2f, 0x00, 0x10, 0x00, 0x01, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x04, 0xde, 0xad, 0xfe, 0xed};
static const char* const kT3IpAddresses[] = {
"74.125.226.178", "74.125.226.179", "74.125.226.180",
"74.125.226.176", "74.125.226.177"
@@ -190,15 +168,17 @@ struct MockDnsClientRule {
// If |delay| is true, matching transactions will be delayed until triggered
// by the consumer.
MockDnsClientRule(const std::string& prefix_arg,
- uint16 qtype_arg,
+ uint16_t qtype_arg,
Result result_arg,
bool delay)
- : result(result_arg), prefix(prefix_arg), qtype(qtype_arg),
+ : result(result_arg),
+ prefix(prefix_arg),
+ qtype(qtype_arg),
delay(delay) {}
Result result;
std::string prefix;
- uint16 qtype;
+ uint16_t qtype;
bool delay;
};
diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc
index bc4a127..52d5470 100644
--- a/net/dns/dns_transaction.cc
+++ b/net/dns/dns_transaction.cc
@@ -11,6 +11,7 @@
#include "base/big_endian.h"
#include "base/bind.h"
#include "base/location.h"
+#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
@@ -61,7 +62,7 @@ bool IsIPLiteral(const std::string& hostname) {
scoped_ptr<base::Value> NetLogStartCallback(
const std::string* hostname,
- uint16 qtype,
+ uint16_t qtype,
NetLogCaptureMode /* capture_mode */) {
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString("hostname", *hostname);
@@ -304,7 +305,7 @@ class DnsTCPAttempt : public DnsAttempt {
next_state_(STATE_NONE),
socket_(socket.Pass()),
query_(query.Pass()),
- length_buffer_(new IOBufferWithSize(sizeof(uint16))),
+ length_buffer_(new IOBufferWithSize(sizeof(uint16_t))),
response_length_(0) {}
// DnsAttempt:
@@ -401,10 +402,10 @@ class DnsTCPAttempt : public DnsAttempt {
if (rv < 0)
return rv;
- uint16 query_size = static_cast<uint16>(query_->io_buffer()->size());
+ uint16_t query_size = static_cast<uint16_t>(query_->io_buffer()->size());
if (static_cast<int>(query_size) != query_->io_buffer()->size())
return ERR_FAILED;
- base::WriteBigEndian<uint16>(length_buffer_->data(), query_size);
+ base::WriteBigEndian<uint16_t>(length_buffer_->data(), query_size);
buffer_ =
new DrainableIOBuffer(length_buffer_.get(), length_buffer_->size());
next_state_ = STATE_SEND_LENGTH;
@@ -469,7 +470,7 @@ class DnsTCPAttempt : public DnsAttempt {
return OK;
}
- base::ReadBigEndian<uint16>(length_buffer_->data(), &response_length_);
+ base::ReadBigEndian<uint16_t>(length_buffer_->data(), &response_length_);
// Check if advertised response is too short. (Optimization only.)
if (response_length_ < query_->io_buffer()->size())
return ERR_DNS_MALFORMED_RESPONSE;
@@ -534,7 +535,7 @@ class DnsTCPAttempt : public DnsAttempt {
scoped_refptr<IOBufferWithSize> length_buffer_;
scoped_refptr<DrainableIOBuffer> buffer_;
- uint16 response_length_;
+ uint16_t response_length_;
scoped_ptr<DnsResponse> response_;
CompletionCallback callback_;
@@ -556,18 +557,18 @@ class DnsTransactionImpl : public DnsTransaction,
public:
DnsTransactionImpl(DnsSession* session,
const std::string& hostname,
- uint16 qtype,
+ uint16_t qtype,
const DnsTransactionFactory::CallbackType& callback,
const BoundNetLog& net_log)
- : session_(session),
- hostname_(hostname),
- qtype_(qtype),
- callback_(callback),
- net_log_(net_log),
- qnames_initial_size_(0),
- attempts_count_(0),
- had_tcp_attempt_(false),
- first_server_index_(0) {
+ : session_(session),
+ hostname_(hostname),
+ qtype_(qtype),
+ callback_(callback),
+ net_log_(net_log),
+ qnames_initial_size_(0),
+ attempts_count_(0),
+ had_tcp_attempt_(false),
+ first_server_index_(0) {
DCHECK(session_.get());
DCHECK(!hostname_.empty());
DCHECK(!callback_.is_null());
@@ -586,7 +587,7 @@ class DnsTransactionImpl : public DnsTransaction,
return hostname_;
}
- uint16 GetType() const override {
+ uint16_t GetType() const override {
DCHECK(CalledOnValidThread());
return qtype_;
}
@@ -702,7 +703,7 @@ class DnsTransactionImpl : public DnsTransaction,
AttemptResult MakeAttempt() {
unsigned attempt_number = attempts_.size();
- uint16 id = session_->NextQueryId();
+ uint16_t id = session_->NextQueryId();
scoped_ptr<DnsQuery> query;
if (attempts_.empty()) {
query.reset(new DnsQuery(id, qnames_.front(), qtype_));
@@ -757,7 +758,7 @@ class DnsTransactionImpl : public DnsTransaction,
session_->CreateTCPSocket(server_index, net_log_.source()));
// TODO(szym): Reuse the same id to help the server?
- uint16 id = session_->NextQueryId();
+ uint16_t id = session_->NextQueryId();
scoped_ptr<DnsQuery> query =
previous_attempt->GetQuery()->CloneWithNewId(id);
@@ -941,7 +942,7 @@ class DnsTransactionImpl : public DnsTransaction,
scoped_refptr<DnsSession> session_;
std::string hostname_;
- uint16 qtype_;
+ uint16_t qtype_;
// Cleared in DoCallback.
DnsTransactionFactory::CallbackType callback_;
@@ -977,7 +978,7 @@ class DnsTransactionFactoryImpl : public DnsTransactionFactory {
scoped_ptr<DnsTransaction> CreateTransaction(
const std::string& hostname,
- uint16 qtype,
+ uint16_t qtype,
const CallbackType& callback,
const BoundNetLog& net_log) override {
return scoped_ptr<DnsTransaction>(new DnsTransactionImpl(
diff --git a/net/dns/dns_transaction.h b/net/dns/dns_transaction.h
index faf4f64..e338cb9 100644
--- a/net/dns/dns_transaction.h
+++ b/net/dns/dns_transaction.h
@@ -5,9 +5,10 @@
#ifndef NET_DNS_DNS_TRANSACTION_H_
#define NET_DNS_DNS_TRANSACTION_H_
+#include <stdint.h>
+
#include <string>
-#include "base/basictypes.h"
#include "base/callback_forward.h"
#include "base/memory/scoped_ptr.h"
#include "net/base/net_export.h"
@@ -32,7 +33,7 @@ class NET_EXPORT_PRIVATE DnsTransaction {
virtual const std::string& GetHostname() const = 0;
// Returns the |qtype|.
- virtual uint16 GetType() const = 0;
+ virtual uint16_t GetType() const = 0;
// Starts the transaction. Always completes asynchronously.
virtual void Start() = 0;
@@ -62,7 +63,7 @@ class NET_EXPORT_PRIVATE DnsTransactionFactory {
// The |net_log| is used as the parent log.
virtual scoped_ptr<DnsTransaction> CreateTransaction(
const std::string& hostname,
- uint16 qtype,
+ uint16_t qtype,
const CallbackType& callback,
const BoundNetLog& net_log) WARN_UNUSED_RESULT = 0;
diff --git a/net/dns/dns_transaction_unittest.cc b/net/dns/dns_transaction_unittest.cc
index 7190ed8..38c070c 100644
--- a/net/dns/dns_transaction_unittest.cc
+++ b/net/dns/dns_transaction_unittest.cc
@@ -9,6 +9,7 @@
#include <limits>
#include "base/bind.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/rand_util.h"
#include "base/sys_byteorder.h"
diff --git a/net/dns/host_cache.h b/net/dns/host_cache.h
index d9108c0..70b1893 100644
--- a/net/dns/host_cache.h
+++ b/net/dns/host_cache.h
@@ -5,11 +5,14 @@
#ifndef NET_DNS_HOST_CACHE_H_
#define NET_DNS_HOST_CACHE_H_
+#include <stddef.h>
+
#include <functional>
#include <string>
#include <tuple>
#include "base/gtest_prod_util.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "base/time/time.h"
diff --git a/net/dns/host_resolver.h b/net/dns/host_resolver.h
index 76ee8e2..57fc7c2 100644
--- a/net/dns/host_resolver.h
+++ b/net/dns/host_resolver.h
@@ -5,9 +5,12 @@
#ifndef NET_DNS_HOST_RESOLVER_H_
#define NET_DNS_HOST_RESOLVER_H_
+#include <stddef.h>
+#include <stdint.h>
+
#include <string>
-#include "base/basictypes.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "net/base/address_family.h"
#include "net/base/completion_callback.h"
@@ -67,7 +70,7 @@ class NET_EXPORT HostResolver {
host_port_pair_ = host_port_pair;
}
- uint16 port() const { return host_port_pair_.port(); }
+ uint16_t port() const { return host_port_pair_.port(); }
const std::string& hostname() const { return host_port_pair_.host(); }
AddressFamily address_family() const { return address_family_; }
diff --git a/net/dns/host_resolver_impl.cc b/net/dns/host_resolver_impl.cc
index 2d2a06b..a4af057 100644
--- a/net/dns/host_resolver_impl.cc
+++ b/net/dns/host_resolver_impl.cc
@@ -14,13 +14,13 @@
#include <utility>
#include <vector>
-#include "base/basictypes.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/debug/debugger.h"
#include "base/debug/stack_trace.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram_macros.h"
@@ -217,7 +217,7 @@ bool IsGloballyReachable(const IPAddressNumber& dest,
bool is_link_local = (address[0] == 0xFE) && ((address[1] & 0xC0) == 0x80);
if (is_link_local)
return false;
- const uint8 kTeredoPrefix[] = { 0x20, 0x01, 0, 0 };
+ const uint8_t kTeredoPrefix[] = {0x20, 0x01, 0, 0};
bool is_teredo = std::equal(kTeredoPrefix,
kTeredoPrefix + arraysize(kTeredoPrefix),
address.begin());
@@ -288,7 +288,7 @@ bool ConfigureAsyncDnsNoFallbackFieldTrial() {
//-----------------------------------------------------------------------------
-AddressList EnsurePortOnAddressList(const AddressList& list, uint16 port) {
+AddressList EnsurePortOnAddressList(const AddressList& list, uint16_t port) {
if (list.empty() || list.front().port() == port)
return list;
return AddressList::CopyWithPort(list, port);
@@ -315,7 +315,7 @@ bool IsAllIPv4Loopback(const AddressList& addresses) {
// Creates NetLog parameters when the resolve failed.
scoped_ptr<base::Value> NetLogProcTaskFailedCallback(
- uint32 attempt_number,
+ uint32_t attempt_number,
int net_error,
int os_error,
NetLogCaptureMode /* capture_mode */) {
@@ -696,7 +696,7 @@ class HostResolverImpl::ProcTask
// may no longer exist. Multiple DoLookups() could be running in parallel, so
// any state inside of |this| must not mutate .
void DoLookup(const base::TimeTicks& start_time,
- const uint32 attempt_number) {
+ const uint32_t attempt_number) {
AddressList results;
int os_error = 0;
// Running on the worker thread
@@ -742,7 +742,7 @@ class HostResolverImpl::ProcTask
// Callback for when DoLookup() completes (runs on task runner thread).
void OnLookupComplete(const AddressList& results,
const base::TimeTicks& start_time,
- const uint32 attempt_number,
+ const uint32_t attempt_number,
int error,
const int os_error) {
DCHECK(task_runner_->BelongsToCurrentThread());
@@ -875,7 +875,7 @@ class HostResolverImpl::ProcTask
}
void RecordAttemptHistograms(const base::TimeTicks& start_time,
- const uint32 attempt_number,
+ const uint32_t attempt_number,
const int error,
const int os_error) const {
DCHECK(task_runner_->BelongsToCurrentThread());
@@ -943,11 +943,11 @@ class HostResolverImpl::ProcTask
// Keeps track of the number of attempts we have made so far to resolve the
// host. Whenever we start an attempt to resolve the host, we increase this
// number.
- uint32 attempt_number_;
+ uint32_t attempt_number_;
// The index of the attempt which finished first (or 0 if the job is still in
// progress).
- uint32 completed_attempt_number_;
+ uint32_t completed_attempt_number_;
// The result (a net error code) from the first attempt to complete.
int completed_attempt_error_;
diff --git a/net/dns/host_resolver_impl.h b/net/dns/host_resolver_impl.h
index 9e1b714..9d833d6 100644
--- a/net/dns/host_resolver_impl.h
+++ b/net/dns/host_resolver_impl.h
@@ -5,9 +5,12 @@
#ifndef NET_DNS_HOST_RESOLVER_IMPL_H_
#define NET_DNS_HOST_RESOLVER_IMPL_H_
+#include <stddef.h>
+#include <stdint.h>
+
#include <map>
-#include "base/basictypes.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/non_thread_safe.h"
@@ -92,7 +95,7 @@ class NET_EXPORT HostResolverImpl
base::TimeDelta unresponsive_delay;
// Factor to grow |unresponsive_delay| when we re-re-try.
- uint32 retry_factor;
+ uint32_t retry_factor;
};
// Creates a HostResolver as specified by |options|.
diff --git a/net/dns/host_resolver_impl_unittest.cc b/net/dns/host_resolver_impl_unittest.cc
index aa379a0..569d1ab 100644
--- a/net/dns/host_resolver_impl_unittest.cc
+++ b/net/dns/host_resolver_impl_unittest.cc
@@ -12,6 +12,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/location.h"
+#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
@@ -186,8 +187,9 @@ class MockHostResolverProc : public HostResolverProc {
DISALLOW_COPY_AND_ASSIGN(MockHostResolverProc);
};
-bool AddressListContains(const AddressList& list, const std::string& address,
- uint16 port) {
+bool AddressListContains(const AddressList& list,
+ const std::string& address,
+ uint16_t port) {
IPAddressNumber ip;
bool rv = ParseIPLiteralToNumber(address, &ip);
DCHECK(rv);
@@ -255,7 +257,7 @@ class Request {
bool completed() const { return result_ != ERR_IO_PENDING; }
bool pending() const { return handle_ != NULL; }
- bool HasAddress(const std::string& address, uint16 port) const {
+ bool HasAddress(const std::string& address, uint16_t port) const {
return AddressListContains(list_, address, port);
}
@@ -264,7 +266,7 @@ class Request {
return list_.size();
}
- bool HasOneAddress(const std::string& address, uint16 port) const {
+ bool HasOneAddress(const std::string& address, uint16_t port) const {
return HasAddress(address, port) && (NumberOfAddresses() == 1u);
}
@@ -1474,7 +1476,7 @@ class HostResolverImplDnsTest : public HostResolverImplTest {
// Adds a rule to |dns_rules_|. Must be followed by |CreateResolver| to apply.
void AddDnsRule(const std::string& prefix,
- uint16 qtype,
+ uint16_t qtype,
MockDnsClientRule::Result result,
bool delay) {
dns_rules_.push_back(MockDnsClientRule(prefix, qtype, result, delay));
diff --git a/net/dns/host_resolver_mojo.h b/net/dns/host_resolver_mojo.h
index 23fb0ff..905d6c9 100644
--- a/net/dns/host_resolver_mojo.h
+++ b/net/dns/host_resolver_mojo.h
@@ -5,6 +5,7 @@
#ifndef NET_DNS_HOST_RESOLVER_MOJO_H_
#define NET_DNS_HOST_RESOLVER_MOJO_H_
+#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
#include "net/dns/host_cache.h"
diff --git a/net/dns/host_resolver_proc.h b/net/dns/host_resolver_proc.h
index cb61e19..182298b 100644
--- a/net/dns/host_resolver_proc.h
+++ b/net/dns/host_resolver_proc.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "net/base/address_family.h"
#include "net/base/net_export.h"
diff --git a/net/dns/mdns_cache.h b/net/dns/mdns_cache.h
index 6a38fc8..e8f9153 100644
--- a/net/dns/mdns_cache.h
+++ b/net/dns/mdns_cache.h
@@ -10,6 +10,7 @@
#include <vector>
#include "base/callback.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "net/base/net_export.h"
diff --git a/net/dns/mdns_cache_unittest.cc b/net/dns/mdns_cache_unittest.cc
index c12ad6b..8e6bd4a 100644
--- a/net/dns/mdns_cache_unittest.cc
+++ b/net/dns/mdns_cache_unittest.cc
@@ -18,111 +18,83 @@ using ::testing::StrictMock;
namespace net {
-static const uint8 kTestResponsesDifferentAnswers[] = {
- // Answer 1
- // ghs.l.google.com in DNS format.
- 3, 'g', 'h', 's',
- 1, 'l',
- 6, 'g', 'o', 'o', 'g', 'l', 'e',
- 3, 'c', 'o', 'm',
- 0x00,
- 0x00, 0x01, // TYPE is A.
- 0x00, 0x01, // CLASS is IN.
- 0, 0, 0, 53, // TTL (4 bytes) is 53 seconds.
- 0, 4, // RDLENGTH is 4 bytes.
- 74, 125, 95, 121, // RDATA is the IP: 74.125.95.121
-
- // Answer 2
- // Pointer to answer 1
- 0xc0, 0x00,
- 0x00, 0x01, // TYPE is A.
- 0x00, 0x01, // CLASS is IN.
- 0, 0, 0, 53, // TTL (4 bytes) is 53 seconds.
- 0, 4, // RDLENGTH is 4 bytes.
- 74, 125, 95, 122, // RDATA is the IP: 74.125.95.122
+static const uint8_t kTestResponsesDifferentAnswers[] = {
+ // Answer 1
+ // ghs.l.google.com in DNS format.
+ 3, 'g', 'h', 's', 1, 'l', 6, 'g', 'o', 'o', 'g', 'l', 'e', 3, 'c', 'o', 'm',
+ 0x00, 0x00, 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
+ 0, 0, 0, 53, // TTL (4 bytes) is 53 seconds.
+ 0, 4, // RDLENGTH is 4 bytes.
+ 74, 125, 95, 121, // RDATA is the IP: 74.125.95.121
+
+ // Answer 2
+ // Pointer to answer 1
+ 0xc0, 0x00, 0x00, 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
+ 0, 0, 0, 53, // TTL (4 bytes) is 53 seconds.
+ 0, 4, // RDLENGTH is 4 bytes.
+ 74, 125, 95, 122, // RDATA is the IP: 74.125.95.122
};
-static const uint8 kTestResponsesSameAnswers[] = {
- // Answer 1
- // ghs.l.google.com in DNS format.
- 3, 'g', 'h', 's',
- 1, 'l',
- 6, 'g', 'o', 'o', 'g', 'l', 'e',
- 3, 'c', 'o', 'm',
- 0x00,
- 0x00, 0x01, // TYPE is A.
- 0x00, 0x01, // CLASS is IN.
- 0, 0, 0, 53, // TTL (4 bytes) is 53 seconds.
- 0, 4, // RDLENGTH is 4 bytes.
- 74, 125, 95, 121, // RDATA is the IP: 74.125.95.121
-
- // Answer 2
- // Pointer to answer 1
- 0xc0, 0x00,
- 0x00, 0x01, // TYPE is A.
- 0x00, 0x01, // CLASS is IN.
- 0, 0, 0, 112, // TTL (4 bytes) is 112 seconds.
- 0, 4, // RDLENGTH is 4 bytes.
- 74, 125, 95, 121, // RDATA is the IP: 74.125.95.121
+static const uint8_t kTestResponsesSameAnswers[] = {
+ // Answer 1
+ // ghs.l.google.com in DNS format.
+ 3, 'g', 'h', 's', 1, 'l', 6, 'g', 'o', 'o', 'g', 'l', 'e', 3, 'c', 'o', 'm',
+ 0x00, 0x00, 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
+ 0, 0, 0, 53, // TTL (4 bytes) is 53 seconds.
+ 0, 4, // RDLENGTH is 4 bytes.
+ 74, 125, 95, 121, // RDATA is the IP: 74.125.95.121
+
+ // Answer 2
+ // Pointer to answer 1
+ 0xc0, 0x00, 0x00, 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
+ 0, 0, 0, 112, // TTL (4 bytes) is 112 seconds.
+ 0, 4, // RDLENGTH is 4 bytes.
+ 74, 125, 95, 121, // RDATA is the IP: 74.125.95.121
};
-static const uint8 kTestResponseTwoRecords[] = {
- // Answer 1
- // ghs.l.google.com in DNS format. (A)
- 3, 'g', 'h', 's',
- 1, 'l',
- 6, 'g', 'o', 'o', 'g', 'l', 'e',
- 3, 'c', 'o', 'm',
- 0x00,
- 0x00, 0x01, // TYPE is A.
- 0x00, 0x01, // CLASS is IN.
- 0, 0, 0, 53, // TTL (4 bytes) is 53 seconds.
- 0, 4, // RDLENGTH is 4 bytes.
- 74, 125, 95, 121, // RDATA is the IP: 74.125.95.121
-
- // Answer 2
- // ghs.l.google.com in DNS format. (AAAA)
- 3, 'g', 'h', 's',
- 1, 'l',
- 6, 'g', 'o', 'o', 'g', 'l', 'e',
- 3, 'c', 'o', 'm',
- 0x00,
- 0x00, 0x1c, // TYPE is AAA.
- 0x00, 0x01, // CLASS is IN.
- 0, 0, 0, 53, // TTL (4 bytes) is 53 seconds.
- 0, 16, // RDLENGTH is 16 bytes.
- 0x4a, 0x7d, 0x4a, 0x7d,
- 0x5f, 0x79, 0x5f, 0x79,
- 0x5f, 0x79, 0x5f, 0x79,
- 0x5f, 0x79, 0x5f, 0x79,
+static const uint8_t kTestResponseTwoRecords[] = {
+ // Answer 1
+ // ghs.l.google.com in DNS format. (A)
+ 3, 'g', 'h', 's', 1, 'l', 6, 'g', 'o', 'o', 'g', 'l', 'e', 3, 'c', 'o', 'm',
+ 0x00, 0x00, 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
+ 0, 0, 0, 53, // TTL (4 bytes) is 53 seconds.
+ 0, 4, // RDLENGTH is 4 bytes.
+ 74, 125, 95, 121, // RDATA is the IP: 74.125.95.121
+
+ // Answer 2
+ // ghs.l.google.com in DNS format. (AAAA)
+ 3, 'g', 'h', 's', 1, 'l', 6, 'g', 'o', 'o', 'g', 'l', 'e', 3, 'c', 'o', 'm',
+ 0x00, 0x00, 0x1c, // TYPE is AAA.
+ 0x00, 0x01, // CLASS is IN.
+ 0, 0, 0, 53, // TTL (4 bytes) is 53 seconds.
+ 0, 16, // RDLENGTH is 16 bytes.
+ 0x4a, 0x7d, 0x4a, 0x7d, 0x5f, 0x79, 0x5f, 0x79, 0x5f, 0x79, 0x5f, 0x79,
+ 0x5f, 0x79, 0x5f, 0x79,
};
-static const uint8 kTestResponsesGoodbyePacket[] = {
- // Answer 1
- // ghs.l.google.com in DNS format. (Goodbye packet)
- 3, 'g', 'h', 's',
- 1, 'l',
- 6, 'g', 'o', 'o', 'g', 'l', 'e',
- 3, 'c', 'o', 'm',
- 0x00,
- 0x00, 0x01, // TYPE is A.
- 0x00, 0x01, // CLASS is IN.
- 0, 0, 0, 0, // TTL (4 bytes) is zero.
- 0, 4, // RDLENGTH is 4 bytes.
- 74, 125, 95, 121, // RDATA is the IP: 74.125.95.121
-
- // Answer 2
- // ghs.l.google.com in DNS format.
- 3, 'g', 'h', 's',
- 1, 'l',
- 6, 'g', 'o', 'o', 'g', 'l', 'e',
- 3, 'c', 'o', 'm',
- 0x00,
- 0x00, 0x01, // TYPE is A.
- 0x00, 0x01, // CLASS is IN.
- 0, 0, 0, 53, // TTL (4 bytes) is 53 seconds.
- 0, 4, // RDLENGTH is 4 bytes.
- 74, 125, 95, 121, // RDATA is the IP: 74.125.95.121
+static const uint8_t kTestResponsesGoodbyePacket[] = {
+ // Answer 1
+ // ghs.l.google.com in DNS format. (Goodbye packet)
+ 3, 'g', 'h', 's', 1, 'l', 6, 'g', 'o', 'o', 'g', 'l', 'e', 3, 'c', 'o', 'm',
+ 0x00, 0x00, 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
+ 0, 0, 0, 0, // TTL (4 bytes) is zero.
+ 0, 4, // RDLENGTH is 4 bytes.
+ 74, 125, 95, 121, // RDATA is the IP: 74.125.95.121
+
+ // Answer 2
+ // ghs.l.google.com in DNS format.
+ 3, 'g', 'h', 's', 1, 'l', 6, 'g', 'o', 'o', 'g', 'l', 'e', 3, 'c', 'o', 'm',
+ 0x00, 0x00, 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
+ 0, 0, 0, 53, // TTL (4 bytes) is 53 seconds.
+ 0, 4, // RDLENGTH is 4 bytes.
+ 74, 125, 95, 121, // RDATA is the IP: 74.125.95.121
};
class RecordRemovalMock {
diff --git a/net/dns/mdns_client.cc b/net/dns/mdns_client.cc
index 4d52d73..f2b3f03 100644
--- a/net/dns/mdns_client.cc
+++ b/net/dns/mdns_client.cc
@@ -27,7 +27,7 @@ IPEndPoint GetMDnsIPEndPoint(const char* address) {
}
int Bind(const IPEndPoint& multicast_addr,
- uint32 interface_index,
+ uint32_t interface_index,
DatagramServerSocket* socket) {
IPAddressNumber address_any(multicast_addr.address().size());
IPEndPoint bind_endpoint(address_any, multicast_addr.port());
@@ -87,7 +87,7 @@ InterfaceIndexFamilyList GetMDnsInterfacesToBind() {
scoped_ptr<DatagramServerSocket> CreateAndBindMDnsSocket(
AddressFamily address_family,
- uint32 interface_index) {
+ uint32_t interface_index) {
scoped_ptr<DatagramServerSocket> socket(
new UDPServerSocket(NULL, NetLog::Source()));
diff --git a/net/dns/mdns_client.h b/net/dns/mdns_client.h
index 42da7e0..279aa6d 100644
--- a/net/dns/mdns_client.h
+++ b/net/dns/mdns_client.h
@@ -5,6 +5,8 @@
#ifndef NET_DNS_MDNS_CLIENT_H_
#define NET_DNS_MDNS_CLIENT_H_
+#include <stdint.h>
+
#include <string>
#include <vector>
@@ -76,7 +78,7 @@ class NET_EXPORT MDnsTransaction {
virtual const std::string& GetName() const = 0;
// Get the type for this transaction (SRV, TXT, A, AAA, etc)
- virtual uint16 GetType() const = 0;
+ virtual uint16_t GetType() const = 0;
};
// A listener listens for updates regarding a specific record or set of records.
@@ -122,7 +124,7 @@ class NET_EXPORT MDnsListener {
virtual const std::string& GetName() const = 0;
// Get the type for this query (SRV, TXT, A, AAA, etc)
- virtual uint16 GetType() const = 0;
+ virtual uint16_t GetType() const = 0;
};
// Creates bound datagram sockets ready to use by MDnsClient.
@@ -146,7 +148,7 @@ class NET_EXPORT MDnsClient {
// Create listener object for RRType |rrtype| and name |name|.
virtual scoped_ptr<MDnsListener> CreateListener(
- uint16 rrtype,
+ uint16_t rrtype,
const std::string& name,
MDnsListener::Delegate* delegate) = 0;
@@ -154,7 +156,7 @@ class NET_EXPORT MDnsClient {
// network, or both for records of type |rrtype| and name |name|. |flags| is
// defined by MDnsTransactionFlags.
virtual scoped_ptr<MDnsTransaction> CreateTransaction(
- uint16 rrtype,
+ uint16_t rrtype,
const std::string& name,
int flags,
const MDnsTransaction::ResultCallback& callback) = 0;
@@ -172,7 +174,8 @@ class NET_EXPORT MDnsClient {
NET_EXPORT IPEndPoint GetMDnsIPEndPoint(AddressFamily address_family);
-typedef std::vector<std::pair<uint32, AddressFamily> > InterfaceIndexFamilyList;
+typedef std::vector<std::pair<uint32_t, AddressFamily>>
+ InterfaceIndexFamilyList;
// Returns pairs of interface and address family to bind. Current
// implementation returns unique list of all available interfaces.
NET_EXPORT InterfaceIndexFamilyList GetMDnsInterfacesToBind();
@@ -182,7 +185,7 @@ NET_EXPORT InterfaceIndexFamilyList GetMDnsInterfacesToBind();
// Returns NULL if failed.
NET_EXPORT scoped_ptr<DatagramServerSocket> CreateAndBindMDnsSocket(
AddressFamily address_family,
- uint32 interface_index);
+ uint32_t interface_index);
} // namespace net
diff --git a/net/dns/mdns_client_impl.cc b/net/dns/mdns_client_impl.cc
index 73e8de4..9782ddd 100644
--- a/net/dns/mdns_client_impl.cc
+++ b/net/dns/mdns_client_impl.cc
@@ -215,7 +215,7 @@ bool MDnsClientImpl::Core::Init(MDnsSocketFactory* socket_factory) {
return connection_->Init(socket_factory);
}
-bool MDnsClientImpl::Core::SendQuery(uint16 rrtype, const std::string& name) {
+bool MDnsClientImpl::Core::SendQuery(uint16_t rrtype, const std::string& name) {
std::string name_dns;
if (!DNSDomainFromDot(name, &name_dns))
return false;
@@ -421,7 +421,8 @@ void MDnsClientImpl::Core::OnRecordRemoved(
}
void MDnsClientImpl::Core::QueryCache(
- uint16 rrtype, const std::string& name,
+ uint16_t rrtype,
+ const std::string& name,
std::vector<const RecordParsed*>* records) const {
cache_.FindDnsRecords(rrtype, name, records, clock_->Now());
}
@@ -458,7 +459,7 @@ bool MDnsClientImpl::IsListening() const {
}
scoped_ptr<MDnsListener> MDnsClientImpl::CreateListener(
- uint16 rrtype,
+ uint16_t rrtype,
const std::string& name,
MDnsListener::Delegate* delegate) {
return scoped_ptr<MDnsListener>(
@@ -466,7 +467,7 @@ scoped_ptr<MDnsListener> MDnsClientImpl::CreateListener(
}
scoped_ptr<MDnsTransaction> MDnsClientImpl::CreateTransaction(
- uint16 rrtype,
+ uint16_t rrtype,
const std::string& name,
int flags,
const MDnsTransaction::ResultCallback& callback) {
@@ -474,7 +475,7 @@ scoped_ptr<MDnsTransaction> MDnsClientImpl::CreateTransaction(
new MDnsTransactionImpl(rrtype, name, flags, callback, this));
}
-MDnsListenerImpl::MDnsListenerImpl(uint16 rrtype,
+MDnsListenerImpl::MDnsListenerImpl(uint16_t rrtype,
const std::string& name,
base::Clock* clock,
MDnsListener::Delegate* delegate,
@@ -485,8 +486,7 @@ MDnsListenerImpl::MDnsListenerImpl(uint16 rrtype,
client_(client),
delegate_(delegate),
started_(false),
- active_refresh_(false) {
-}
+ active_refresh_(false) {}
MDnsListenerImpl::~MDnsListenerImpl() {
if (started_) {
@@ -522,7 +522,7 @@ const std::string& MDnsListenerImpl::GetName() const {
return name_;
}
-uint16 MDnsListenerImpl::GetType() const {
+uint16_t MDnsListenerImpl::GetType() const {
return rrtype_;
}
@@ -605,13 +605,17 @@ void MDnsListenerImpl::DoRefresh() {
}
MDnsTransactionImpl::MDnsTransactionImpl(
- uint16 rrtype,
+ uint16_t rrtype,
const std::string& name,
int flags,
const MDnsTransaction::ResultCallback& callback,
MDnsClientImpl* client)
- : rrtype_(rrtype), name_(name), callback_(callback), client_(client),
- started_(false), flags_(flags) {
+ : rrtype_(rrtype),
+ name_(name),
+ callback_(callback),
+ client_(client),
+ started_(false),
+ flags_(flags) {
DCHECK((flags_ & MDnsTransaction::FLAG_MASK) == flags_);
DCHECK(flags_ & MDnsTransaction::QUERY_CACHE ||
flags_ & MDnsTransaction::QUERY_NETWORK);
@@ -646,7 +650,7 @@ const std::string& MDnsTransactionImpl::GetName() const {
return name_;
}
-uint16 MDnsTransactionImpl::GetType() const {
+uint16_t MDnsTransactionImpl::GetType() const {
return rrtype_;
}
diff --git a/net/dns/mdns_client_impl.h b/net/dns/mdns_client_impl.h
index f33839f..16a216e 100644
--- a/net/dns/mdns_client_impl.h
+++ b/net/dns/mdns_client_impl.h
@@ -5,6 +5,8 @@
#ifndef NET_DNS_MDNS_CLIENT_IMPL_H_
#define NET_DNS_MDNS_CLIENT_IMPL_H_
+#include <stdint.h>
+
#include <map>
#include <queue>
#include <string>
@@ -13,6 +15,7 @@
#include "base/cancelable_callback.h"
#include "base/gtest_prod_util.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "net/base/io_buffer.h"
@@ -124,14 +127,15 @@ class NET_EXPORT_PRIVATE MDnsClientImpl : public MDnsClient {
bool Init(MDnsSocketFactory* socket_factory);
// Send a query with a specific rrtype and name. Returns true on success.
- bool SendQuery(uint16 rrtype, const std::string& name);
+ bool SendQuery(uint16_t rrtype, const std::string& name);
// Add/remove a listener to the list of listeners.
void AddListener(MDnsListenerImpl* listener);
void RemoveListener(MDnsListenerImpl* listener);
// Query the cache for records of a specific type and name.
- void QueryCache(uint16 rrtype, const std::string& name,
+ void QueryCache(uint16_t rrtype,
+ const std::string& name,
std::vector<const RecordParsed*>* records) const;
// Parse the response and alert relevant listeners.
@@ -142,7 +146,7 @@ class NET_EXPORT_PRIVATE MDnsClientImpl : public MDnsClient {
private:
FRIEND_TEST_ALL_PREFIXES(MDnsTest, CacheCleanupWithShortTTL);
- typedef std::pair<std::string, uint16> ListenerKey;
+ typedef std::pair<std::string, uint16_t> ListenerKey;
typedef std::map<ListenerKey, base::ObserverList<MDnsListenerImpl>*>
ListenerMap;
@@ -183,12 +187,12 @@ class NET_EXPORT_PRIVATE MDnsClientImpl : public MDnsClient {
// MDnsClient implementation:
scoped_ptr<MDnsListener> CreateListener(
- uint16 rrtype,
+ uint16_t rrtype,
const std::string& name,
MDnsListener::Delegate* delegate) override;
scoped_ptr<MDnsTransaction> CreateTransaction(
- uint16 rrtype,
+ uint16_t rrtype,
const std::string& name,
int flags,
const MDnsTransaction::ResultCallback& callback) override;
@@ -216,7 +220,7 @@ class NET_EXPORT_PRIVATE MDnsClientImpl : public MDnsClient {
class MDnsListenerImpl : public MDnsListener,
public base::SupportsWeakPtr<MDnsListenerImpl> {
public:
- MDnsListenerImpl(uint16 rrtype,
+ MDnsListenerImpl(uint16_t rrtype,
const std::string& name,
base::Clock* clock,
MDnsListener::Delegate* delegate,
@@ -232,7 +236,7 @@ class MDnsListenerImpl : public MDnsListener,
const std::string& GetName() const override;
- uint16 GetType() const override;
+ uint16_t GetType() const override;
MDnsListener::Delegate* delegate() { return delegate_; }
@@ -247,14 +251,14 @@ class MDnsListenerImpl : public MDnsListener,
void ScheduleNextRefresh();
void DoRefresh();
- uint16 rrtype_;
+ uint16_t rrtype_;
std::string name_;
base::Clock* clock_;
MDnsClientImpl* client_;
MDnsListener::Delegate* delegate_;
base::Time last_update_;
- uint32 ttl_;
+ uint32_t ttl_;
bool started_;
bool active_refresh_;
@@ -266,7 +270,7 @@ class MDnsTransactionImpl : public base::SupportsWeakPtr<MDnsTransactionImpl>,
public MDnsTransaction,
public MDnsListener::Delegate {
public:
- MDnsTransactionImpl(uint16 rrtype,
+ MDnsTransactionImpl(uint16_t rrtype,
const std::string& name,
int flags,
const MDnsTransaction::ResultCallback& callback,
@@ -277,7 +281,7 @@ class MDnsTransactionImpl : public base::SupportsWeakPtr<MDnsTransactionImpl>,
bool Start() override;
const std::string& GetName() const override;
- uint16 GetType() const override;
+ uint16_t GetType() const override;
// MDnsListener::Delegate implementation:
void OnRecordUpdate(MDnsListener::UpdateType update,
@@ -310,7 +314,7 @@ class MDnsTransactionImpl : public base::SupportsWeakPtr<MDnsTransactionImpl>,
// or if it fails to send a query.
bool QueryAndListen();
- uint16 rrtype_;
+ uint16_t rrtype_;
std::string name_;
MDnsTransaction::ResultCallback callback_;
diff --git a/net/dns/mdns_client_unittest.cc b/net/dns/mdns_client_unittest.cc
index e002bbe..ae1a8d9 100644
--- a/net/dns/mdns_client_unittest.cc
+++ b/net/dns/mdns_client_unittest.cc
@@ -6,6 +6,7 @@
#include <vector>
#include "base/location.h"
+#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
@@ -36,201 +37,104 @@ namespace net {
namespace {
-const uint8 kSamplePacket1[] = {
- // Header
- 0x00, 0x00, // ID is zeroed out
- 0x81, 0x80, // Standard query response, RA, no error
- 0x00, 0x00, // No questions (for simplicity)
- 0x00, 0x02, // 2 RRs (answers)
- 0x00, 0x00, // 0 authority RRs
- 0x00, 0x00, // 0 additional RRs
-
- // Answer 1
- 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't',
- 0x04, '_', 't', 'c', 'p',
- 0x05, 'l', 'o', 'c', 'a', 'l',
- 0x00,
- 0x00, 0x0c, // TYPE is PTR.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x00, // TTL (4 bytes) is 1 second;
- 0x00, 0x01,
- 0x00, 0x08, // RDLENGTH is 8 bytes.
- 0x05, 'h', 'e', 'l', 'l', 'o',
- 0xc0, 0x0c,
-
- // Answer 2
- 0x08, '_', 'p', 'r', 'i', 'n', 't', 'e', 'r',
- 0xc0, 0x14, // Pointer to "._tcp.local"
- 0x00, 0x0c, // TYPE is PTR.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 49 seconds.
- 0x24, 0x75,
- 0x00, 0x08, // RDLENGTH is 8 bytes.
- 0x05, 'h', 'e', 'l', 'l', 'o',
- 0xc0, 0x32
-};
+const uint8_t kSamplePacket1[] = {
+ // Header
+ 0x00, 0x00, // ID is zeroed out
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x00, // No questions (for simplicity)
+ 0x00, 0x02, // 2 RRs (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
-const uint8 kCorruptedPacketBadQuestion[] = {
- // Header
- 0x00, 0x00, // ID is zeroed out
- 0x81, 0x80, // Standard query response, RA, no error
- 0x00, 0x01, // One question
- 0x00, 0x02, // 2 RRs (answers)
- 0x00, 0x00, // 0 authority RRs
- 0x00, 0x00, // 0 additional RRs
-
- // Question is corrupted and cannot be read.
- 0x99, 'h', 'e', 'l', 'l', 'o',
- 0x00,
- 0x00, 0x00,
- 0x00, 0x00,
-
- // Answer 1
- 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't',
- 0x04, '_', 't', 'c', 'p',
- 0x05, 'l', 'o', 'c', 'a', 'l',
- 0x00,
- 0x00, 0x0c, // TYPE is PTR.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
- 0x24, 0x74,
- 0x00, 0x99, // RDLENGTH is impossible
- 0x05, 'h', 'e', 'l', 'l', 'o',
- 0xc0, 0x0c,
-
- // Answer 2
- 0x08, '_', 'p', 'r', // Useless trailing data.
-};
+ // Answer 1
+ 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't', 0x04, '_', 't', 'c', 'p', 0x05,
+ 'l', 'o', 'c', 'a', 'l', 0x00, 0x00, 0x0c, // TYPE is PTR.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x00, // TTL (4 bytes) is 1 second;
+ 0x00, 0x01, 0x00, 0x08, // RDLENGTH is 8 bytes.
+ 0x05, 'h', 'e', 'l', 'l', 'o', 0xc0, 0x0c,
-const uint8 kCorruptedPacketUnsalvagable[] = {
- // Header
- 0x00, 0x00, // ID is zeroed out
- 0x81, 0x80, // Standard query response, RA, no error
- 0x00, 0x00, // No questions (for simplicity)
- 0x00, 0x02, // 2 RRs (answers)
- 0x00, 0x00, // 0 authority RRs
- 0x00, 0x00, // 0 additional RRs
-
- // Answer 1
- 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't',
- 0x04, '_', 't', 'c', 'p',
- 0x05, 'l', 'o', 'c', 'a', 'l',
- 0x00,
- 0x00, 0x0c, // TYPE is PTR.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
- 0x24, 0x74,
- 0x00, 0x99, // RDLENGTH is impossible
- 0x05, 'h', 'e', 'l', 'l', 'o',
- 0xc0, 0x0c,
-
- // Answer 2
- 0x08, '_', 'p', 'r', // Useless trailing data.
-};
+ // Answer 2
+ 0x08, '_', 'p', 'r', 'i', 'n', 't', 'e', 'r', 0xc0,
+ 0x14, // Pointer to "._tcp.local"
+ 0x00, 0x0c, // TYPE is PTR.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 49 seconds.
+ 0x24, 0x75, 0x00, 0x08, // RDLENGTH is 8 bytes.
+ 0x05, 'h', 'e', 'l', 'l', 'o', 0xc0, 0x32};
+
+const uint8_t kCorruptedPacketBadQuestion[] = {
+ // Header
+ 0x00, 0x00, // ID is zeroed out
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x01, // One question
+ 0x00, 0x02, // 2 RRs (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
+
+ // Question is corrupted and cannot be read.
+ 0x99, 'h', 'e', 'l', 'l', 'o', 0x00, 0x00, 0x00, 0x00, 0x00,
-const uint8 kCorruptedPacketDoubleRecord[] = {
- // Header
- 0x00, 0x00, // ID is zeroed out
- 0x81, 0x80, // Standard query response, RA, no error
- 0x00, 0x00, // No questions (for simplicity)
- 0x00, 0x02, // 2 RRs (answers)
- 0x00, 0x00, // 0 authority RRs
- 0x00, 0x00, // 0 additional RRs
-
- // Answer 1
- 0x06, 'p', 'r', 'i', 'v', 'e', 't',
- 0x05, 'l', 'o', 'c', 'a', 'l',
- 0x00,
- 0x00, 0x01, // TYPE is A.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
- 0x24, 0x74,
- 0x00, 0x04, // RDLENGTH is 4
- 0x05, 0x03,
- 0xc0, 0x0c,
-
- // Answer 2 -- Same key
- 0x06, 'p', 'r', 'i', 'v', 'e', 't',
- 0x05, 'l', 'o', 'c', 'a', 'l',
- 0x00,
- 0x00, 0x01, // TYPE is A.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
- 0x24, 0x74,
- 0x00, 0x04, // RDLENGTH is 4
- 0x02, 0x03,
- 0x04, 0x05,
+ // Answer 1
+ 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't', 0x04, '_', 't', 'c', 'p', 0x05,
+ 'l', 'o', 'c', 'a', 'l', 0x00, 0x00, 0x0c, // TYPE is PTR.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
+ 0x24, 0x74, 0x00, 0x99, // RDLENGTH is impossible
+ 0x05, 'h', 'e', 'l', 'l', 'o', 0xc0, 0x0c,
+
+ // Answer 2
+ 0x08, '_', 'p', 'r', // Useless trailing data.
};
-const uint8 kCorruptedPacketSalvagable[] = {
- // Header
- 0x00, 0x00, // ID is zeroed out
- 0x81, 0x80, // Standard query response, RA, no error
- 0x00, 0x00, // No questions (for simplicity)
- 0x00, 0x02, // 2 RRs (answers)
- 0x00, 0x00, // 0 authority RRs
- 0x00, 0x00, // 0 additional RRs
-
- // Answer 1
- 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't',
- 0x04, '_', 't', 'c', 'p',
- 0x05, 'l', 'o', 'c', 'a', 'l',
- 0x00,
- 0x00, 0x0c, // TYPE is PTR.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
- 0x24, 0x74,
- 0x00, 0x08, // RDLENGTH is 8 bytes.
- 0x99, 'h', 'e', 'l', 'l', 'o', // Bad RDATA format.
- 0xc0, 0x0c,
-
- // Answer 2
- 0x08, '_', 'p', 'r', 'i', 'n', 't', 'e', 'r',
- 0xc0, 0x14, // Pointer to "._tcp.local"
- 0x00, 0x0c, // TYPE is PTR.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 49 seconds.
- 0x24, 0x75,
- 0x00, 0x08, // RDLENGTH is 8 bytes.
- 0x05, 'h', 'e', 'l', 'l', 'o',
- 0xc0, 0x32
+const uint8_t kCorruptedPacketUnsalvagable[] = {
+ // Header
+ 0x00, 0x00, // ID is zeroed out
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x00, // No questions (for simplicity)
+ 0x00, 0x02, // 2 RRs (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
+
+ // Answer 1
+ 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't', 0x04, '_', 't', 'c', 'p', 0x05,
+ 'l', 'o', 'c', 'a', 'l', 0x00, 0x00, 0x0c, // TYPE is PTR.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
+ 0x24, 0x74, 0x00, 0x99, // RDLENGTH is impossible
+ 0x05, 'h', 'e', 'l', 'l', 'o', 0xc0, 0x0c,
+
+ // Answer 2
+ 0x08, '_', 'p', 'r', // Useless trailing data.
};
-const uint8 kSamplePacket2[] = {
- // Header
- 0x00, 0x00, // ID is zeroed out
- 0x81, 0x80, // Standard query response, RA, no error
- 0x00, 0x00, // No questions (for simplicity)
- 0x00, 0x02, // 2 RRs (answers)
- 0x00, 0x00, // 0 authority RRs
- 0x00, 0x00, // 0 additional RRs
-
- // Answer 1
- 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't',
- 0x04, '_', 't', 'c', 'p',
- 0x05, 'l', 'o', 'c', 'a', 'l',
- 0x00,
- 0x00, 0x0c, // TYPE is PTR.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
- 0x24, 0x74,
- 0x00, 0x08, // RDLENGTH is 8 bytes.
- 0x05, 'z', 'z', 'z', 'z', 'z',
- 0xc0, 0x0c,
-
- // Answer 2
- 0x08, '_', 'p', 'r', 'i', 'n', 't', 'e', 'r',
- 0xc0, 0x14, // Pointer to "._tcp.local"
- 0x00, 0x0c, // TYPE is PTR.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
- 0x24, 0x74,
- 0x00, 0x08, // RDLENGTH is 8 bytes.
- 0x05, 'z', 'z', 'z', 'z', 'z',
- 0xc0, 0x32
+const uint8_t kCorruptedPacketDoubleRecord[] = {
+ // Header
+ 0x00, 0x00, // ID is zeroed out
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x00, // No questions (for simplicity)
+ 0x00, 0x02, // 2 RRs (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
+
+ // Answer 1
+ 0x06, 'p', 'r', 'i', 'v', 'e', 't', 0x05, 'l', 'o', 'c', 'a', 'l', 0x00,
+ 0x00, 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
+ 0x24, 0x74, 0x00, 0x04, // RDLENGTH is 4
+ 0x05, 0x03, 0xc0, 0x0c,
+
+ // Answer 2 -- Same key
+ 0x06, 'p', 'r', 'i', 'v', 'e', 't', 0x05, 'l', 'o', 'c', 'a', 'l', 0x00,
+ 0x00, 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
+ 0x24, 0x74, 0x00, 0x04, // RDLENGTH is 4
+ 0x02, 0x03, 0x04, 0x05,
};
-const uint8 kSamplePacket3[] = {
+const uint8_t kCorruptedPacketSalvagable[] = {
// Header
0x00, 0x00, // ID is zeroed out
0x81, 0x80, // Standard query response, RA, no error
@@ -240,159 +144,186 @@ const uint8 kSamplePacket3[] = {
0x00, 0x00, // 0 additional RRs
// Answer 1
- 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't', //
- 0x04, '_', 't', 'c', 'p', //
- 0x05, 'l', 'o', 'c', 'a', 'l', //
- 0x00, 0x00, 0x0c, // TYPE is PTR.
+ 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't', 0x04, '_', 't', 'c', 'p', 0x05,
+ 'l', 'o', 'c', 'a', 'l', 0x00, 0x00, 0x0c, // TYPE is PTR.
0x00, 0x01, // CLASS is IN.
- 0x00, 0x00, // TTL (4 bytes) is 1 second;
- 0x00, 0x01, //
- 0x00, 0x08, // RDLENGTH is 8 bytes.
- 0x05, 'h', 'e', 'l', 'l', 'o', //
- 0xc0, 0x0c, //
+ 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
+ 0x24, 0x74, 0x00, 0x08, // RDLENGTH is 8 bytes.
+ 0x99, 'h', 'e', 'l', 'l', 'o', // Bad RDATA format.
+ 0xc0, 0x0c,
+
+ // Answer 2
+ 0x08, '_', 'p', 'r', 'i', 'n', 't', 'e', 'r', 0xc0,
+ 0x14, // Pointer to "._tcp.local"
+ 0x00, 0x0c, // TYPE is PTR.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 49 seconds.
+ 0x24, 0x75, 0x00, 0x08, // RDLENGTH is 8 bytes.
+ 0x05, 'h', 'e', 'l', 'l', 'o', 0xc0, 0x32};
+
+const uint8_t kSamplePacket2[] = {
+ // Header
+ 0x00, 0x00, // ID is zeroed out
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x00, // No questions (for simplicity)
+ 0x00, 0x02, // 2 RRs (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
+
+ // Answer 1
+ 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't', 0x04, '_', 't', 'c', 'p', 0x05,
+ 'l', 'o', 'c', 'a', 'l', 0x00, 0x00, 0x0c, // TYPE is PTR.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
+ 0x24, 0x74, 0x00, 0x08, // RDLENGTH is 8 bytes.
+ 0x05, 'z', 'z', 'z', 'z', 'z', 0xc0, 0x0c,
// Answer 2
- 0x08, '_', 'p', 'r', 'i', 'n', 't', 'e', 'r', //
- 0xc0, 0x14, // Pointer to "._tcp.local"
- 0x00, 0x0c, // TYPE is PTR.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x00, // TTL (4 bytes) is 3 seconds.
- 0x00, 0x03, //
- 0x00, 0x08, // RDLENGTH is 8 bytes.
- 0x05, 'h', 'e', 'l', 'l', 'o', //
+ 0x08, '_', 'p', 'r', 'i', 'n', 't', 'e', 'r', 0xc0,
+ 0x14, // Pointer to "._tcp.local"
+ 0x00, 0x0c, // TYPE is PTR.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
+ 0x24, 0x74, 0x00, 0x08, // RDLENGTH is 8 bytes.
+ 0x05, 'z', 'z', 'z', 'z', 'z', 0xc0, 0x32};
+
+const uint8_t kSamplePacket3[] = {
+ // Header
+ 0x00, 0x00, // ID is zeroed out
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x00, // No questions (for simplicity)
+ 0x00, 0x02, // 2 RRs (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
+
+ // Answer 1
+ 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't', //
+ 0x04, '_', 't', 'c', 'p', //
+ 0x05, 'l', 'o', 'c', 'a', 'l', //
+ 0x00, 0x00, 0x0c, // TYPE is PTR.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x00, // TTL (4 bytes) is 1 second;
+ 0x00, 0x01, //
+ 0x00, 0x08, // RDLENGTH is 8 bytes.
+ 0x05, 'h', 'e', 'l', 'l', 'o', //
+ 0xc0, 0x0c, //
+
+ // Answer 2
+ 0x08, '_', 'p', 'r', 'i', 'n', 't', 'e', 'r', //
+ 0xc0, 0x14, // Pointer to "._tcp.local"
+ 0x00, 0x0c, // TYPE is PTR.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x00, // TTL (4 bytes) is 3 seconds.
+ 0x00, 0x03, //
+ 0x00, 0x08, // RDLENGTH is 8 bytes.
+ 0x05, 'h', 'e', 'l', 'l', 'o', //
0xc0, 0x32};
-const uint8 kQueryPacketPrivet[] = {
- // Header
- 0x00, 0x00, // ID is zeroed out
- 0x00, 0x00, // No flags.
- 0x00, 0x01, // One question.
- 0x00, 0x00, // 0 RRs (answers)
- 0x00, 0x00, // 0 authority RRs
- 0x00, 0x00, // 0 additional RRs
-
- // Question
- // This part is echoed back from the respective query.
- 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't',
- 0x04, '_', 't', 'c', 'p',
- 0x05, 'l', 'o', 'c', 'a', 'l',
- 0x00,
- 0x00, 0x0c, // TYPE is PTR.
- 0x00, 0x01, // CLASS is IN.
+const uint8_t kQueryPacketPrivet[] = {
+ // Header
+ 0x00, 0x00, // ID is zeroed out
+ 0x00, 0x00, // No flags.
+ 0x00, 0x01, // One question.
+ 0x00, 0x00, // 0 RRs (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
+
+ // Question
+ // This part is echoed back from the respective query.
+ 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't', 0x04, '_', 't', 'c', 'p', 0x05,
+ 'l', 'o', 'c', 'a', 'l', 0x00, 0x00, 0x0c, // TYPE is PTR.
+ 0x00, 0x01, // CLASS is IN.
};
-const uint8 kQueryPacketPrivetA[] = {
- // Header
- 0x00, 0x00, // ID is zeroed out
- 0x00, 0x00, // No flags.
- 0x00, 0x01, // One question.
- 0x00, 0x00, // 0 RRs (answers)
- 0x00, 0x00, // 0 authority RRs
- 0x00, 0x00, // 0 additional RRs
-
- // Question
- // This part is echoed back from the respective query.
- 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't',
- 0x04, '_', 't', 'c', 'p',
- 0x05, 'l', 'o', 'c', 'a', 'l',
- 0x00,
- 0x00, 0x01, // TYPE is A.
- 0x00, 0x01, // CLASS is IN.
+const uint8_t kQueryPacketPrivetA[] = {
+ // Header
+ 0x00, 0x00, // ID is zeroed out
+ 0x00, 0x00, // No flags.
+ 0x00, 0x01, // One question.
+ 0x00, 0x00, // 0 RRs (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
+
+ // Question
+ // This part is echoed back from the respective query.
+ 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't', 0x04, '_', 't', 'c', 'p', 0x05,
+ 'l', 'o', 'c', 'a', 'l', 0x00, 0x00, 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
};
-const uint8 kSamplePacketAdditionalOnly[] = {
- // Header
- 0x00, 0x00, // ID is zeroed out
- 0x81, 0x80, // Standard query response, RA, no error
- 0x00, 0x00, // No questions (for simplicity)
- 0x00, 0x00, // 2 RRs (answers)
- 0x00, 0x00, // 0 authority RRs
- 0x00, 0x01, // 0 additional RRs
-
- // Answer 1
- 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't',
- 0x04, '_', 't', 'c', 'p',
- 0x05, 'l', 'o', 'c', 'a', 'l',
- 0x00,
- 0x00, 0x0c, // TYPE is PTR.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
- 0x24, 0x74,
- 0x00, 0x08, // RDLENGTH is 8 bytes.
- 0x05, 'h', 'e', 'l', 'l', 'o',
- 0xc0, 0x0c,
+const uint8_t kSamplePacketAdditionalOnly[] = {
+ // Header
+ 0x00, 0x00, // ID is zeroed out
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x00, // No questions (for simplicity)
+ 0x00, 0x00, // 2 RRs (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x01, // 0 additional RRs
+
+ // Answer 1
+ 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't', 0x04, '_', 't', 'c', 'p', 0x05,
+ 'l', 'o', 'c', 'a', 'l', 0x00, 0x00, 0x0c, // TYPE is PTR.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
+ 0x24, 0x74, 0x00, 0x08, // RDLENGTH is 8 bytes.
+ 0x05, 'h', 'e', 'l', 'l', 'o', 0xc0, 0x0c,
};
-const uint8 kSamplePacketNsec[] = {
- // Header
- 0x00, 0x00, // ID is zeroed out
- 0x81, 0x80, // Standard query response, RA, no error
- 0x00, 0x00, // No questions (for simplicity)
- 0x00, 0x01, // 1 RR (answers)
- 0x00, 0x00, // 0 authority RRs
- 0x00, 0x00, // 0 additional RRs
-
- // Answer 1
- 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't',
- 0x04, '_', 't', 'c', 'p',
- 0x05, 'l', 'o', 'c', 'a', 'l',
- 0x00,
- 0x00, 0x2f, // TYPE is NSEC.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
- 0x24, 0x74,
- 0x00, 0x06, // RDLENGTH is 6 bytes.
- 0xc0, 0x0c,
- 0x00, 0x02, 0x00, 0x08 // Only A record present
+const uint8_t kSamplePacketNsec[] = {
+ // Header
+ 0x00, 0x00, // ID is zeroed out
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x00, // No questions (for simplicity)
+ 0x00, 0x01, // 1 RR (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
+
+ // Answer 1
+ 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't', 0x04, '_', 't', 'c', 'p', 0x05,
+ 'l', 'o', 'c', 'a', 'l', 0x00, 0x00, 0x2f, // TYPE is NSEC.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
+ 0x24, 0x74, 0x00, 0x06, // RDLENGTH is 6 bytes.
+ 0xc0, 0x0c, 0x00, 0x02, 0x00, 0x08 // Only A record present
};
-const uint8 kSamplePacketAPrivet[] = {
- // Header
- 0x00, 0x00, // ID is zeroed out
- 0x81, 0x80, // Standard query response, RA, no error
- 0x00, 0x00, // No questions (for simplicity)
- 0x00, 0x01, // 1 RR (answers)
- 0x00, 0x00, // 0 authority RRs
- 0x00, 0x00, // 0 additional RRs
-
- // Answer 1
- 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't',
- 0x04, '_', 't', 'c', 'p',
- 0x05, 'l', 'o', 'c', 'a', 'l',
- 0x00,
- 0x00, 0x01, // TYPE is A.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x00, // TTL (4 bytes) is 5 seconds
- 0x00, 0x05,
- 0x00, 0x04, // RDLENGTH is 4 bytes.
- 0xc0, 0x0c,
- 0x00, 0x02,
+const uint8_t kSamplePacketAPrivet[] = {
+ // Header
+ 0x00, 0x00, // ID is zeroed out
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x00, // No questions (for simplicity)
+ 0x00, 0x01, // 1 RR (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
+
+ // Answer 1
+ 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't', 0x04, '_', 't', 'c', 'p', 0x05,
+ 'l', 'o', 'c', 'a', 'l', 0x00, 0x00, 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x00, // TTL (4 bytes) is 5 seconds
+ 0x00, 0x05, 0x00, 0x04, // RDLENGTH is 4 bytes.
+ 0xc0, 0x0c, 0x00, 0x02,
};
-const uint8 kSamplePacketGoodbye[] = {
- // Header
- 0x00, 0x00, // ID is zeroed out
- 0x81, 0x80, // Standard query response, RA, no error
- 0x00, 0x00, // No questions (for simplicity)
- 0x00, 0x01, // 2 RRs (answers)
- 0x00, 0x00, // 0 authority RRs
- 0x00, 0x00, // 0 additional RRs
-
- // Answer 1
- 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't',
- 0x04, '_', 't', 'c', 'p',
- 0x05, 'l', 'o', 'c', 'a', 'l',
- 0x00,
- 0x00, 0x0c, // TYPE is PTR.
- 0x00, 0x01, // CLASS is IN.
- 0x00, 0x00, // TTL (4 bytes) is zero;
- 0x00, 0x00,
- 0x00, 0x08, // RDLENGTH is 8 bytes.
- 0x05, 'z', 'z', 'z', 'z', 'z',
- 0xc0, 0x0c,
+const uint8_t kSamplePacketGoodbye[] = {
+ // Header
+ 0x00, 0x00, // ID is zeroed out
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x00, // No questions (for simplicity)
+ 0x00, 0x01, // 2 RRs (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
+
+ // Answer 1
+ 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't', 0x04, '_', 't', 'c', 'p', 0x05,
+ 'l', 'o', 'c', 'a', 'l', 0x00, 0x00, 0x0c, // TYPE is PTR.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x00, // TTL (4 bytes) is zero;
+ 0x00, 0x00, 0x00, 0x08, // RDLENGTH is 8 bytes.
+ 0x05, 'z', 'z', 'z', 'z', 'z', 0xc0, 0x0c,
};
-std::string MakeString(const uint8* data, unsigned size) {
+std::string MakeString(const uint8_t* data, unsigned size) {
return std::string(reinterpret_cast<const char*>(data), size);
}
@@ -480,8 +411,8 @@ class MDnsTest : public ::testing::Test {
const RecordParsed* record));
protected:
- void ExpectPacket(const uint8* packet, unsigned size);
- void SimulatePacketReceive(const uint8* packet, unsigned size);
+ void ExpectPacket(const uint8_t* packet, unsigned size);
+ void SimulatePacketReceive(const uint8_t* packet, unsigned size);
scoped_ptr<MDnsClientImpl> test_client_;
IPEndPoint mdns_ipv4_endpoint_;
@@ -508,11 +439,11 @@ void MDnsTest::SetUp() {
test_client_->StartListening(&socket_factory_);
}
-void MDnsTest::SimulatePacketReceive(const uint8* packet, unsigned size) {
+void MDnsTest::SimulatePacketReceive(const uint8_t* packet, unsigned size) {
socket_factory_.SimulateReceive(packet, size);
}
-void MDnsTest::ExpectPacket(const uint8* packet, unsigned size) {
+void MDnsTest::ExpectPacket(const uint8_t* packet, unsigned size) {
EXPECT_CALL(socket_factory_, OnSendTo(MakeString(packet, size)))
.Times(2);
}
diff --git a/net/dns/mock_host_resolver.h b/net/dns/mock_host_resolver.h
index 6920ae7..71f557e 100644
--- a/net/dns/mock_host_resolver.h
+++ b/net/dns/mock_host_resolver.h
@@ -5,9 +5,12 @@
#ifndef NET_DNS_MOCK_HOST_RESOLVER_H_
#define NET_DNS_MOCK_HOST_RESOLVER_H_
+#include <stddef.h>
+
#include <list>
#include <map>
+#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event.h"
diff --git a/net/dns/mock_mdns_socket_factory.cc b/net/dns/mock_mdns_socket_factory.cc
index 84359a4..354992b 100644
--- a/net/dns/mock_mdns_socket_factory.cc
+++ b/net/dns/mock_mdns_socket_factory.cc
@@ -89,7 +89,7 @@ void MockMDnsSocketFactory::CreateSocket(
sockets->push_back(new_socket.Pass());
}
-void MockMDnsSocketFactory::SimulateReceive(const uint8* packet, int size) {
+void MockMDnsSocketFactory::SimulateReceive(const uint8_t* packet, int size) {
DCHECK(recv_buffer_size_ >= size);
DCHECK(recv_buffer_.get());
DCHECK(!recv_callback_.is_null());
diff --git a/net/dns/mock_mdns_socket_factory.h b/net/dns/mock_mdns_socket_factory.h
index 9d9c682..a5b1422 100644
--- a/net/dns/mock_mdns_socket_factory.h
+++ b/net/dns/mock_mdns_socket_factory.h
@@ -5,6 +5,8 @@
#ifndef NET_DNS_MOCK_MDNS_SOCKET_FACTORY_H_
#define NET_DNS_MOCK_MDNS_SOCKET_FACTORY_H_
+#include <stdint.h>
+
#include <string>
#include <vector>
@@ -37,8 +39,8 @@ class MockMDnsDatagramServerSocket : public DatagramServerSocket {
const std::string address,
const CompletionCallback& callback));
- MOCK_METHOD1(SetReceiveBufferSize, int(int32 size));
- MOCK_METHOD1(SetSendBufferSize, int(int32 size));
+ MOCK_METHOD1(SetReceiveBufferSize, int(int32_t size));
+ MOCK_METHOD1(SetSendBufferSize, int(int32_t size));
MOCK_METHOD0(Close, void());
@@ -52,7 +54,7 @@ class MockMDnsDatagramServerSocket : public DatagramServerSocket {
MOCK_CONST_METHOD1(JoinGroup, int(const IPAddressNumber& group_address));
MOCK_CONST_METHOD1(LeaveGroup, int(const IPAddressNumber& address));
- MOCK_METHOD1(SetMulticastInterface, int(uint32 interface_index));
+ MOCK_METHOD1(SetMulticastInterface, int(uint32_t interface_index));
MOCK_METHOD1(SetMulticastTimeToLive, int(int ttl));
MOCK_METHOD1(SetMulticastLoopbackMode, int(bool loopback));
@@ -81,7 +83,7 @@ class MockMDnsSocketFactory : public MDnsSocketFactory {
void CreateSockets(
std::vector<scoped_ptr<DatagramServerSocket>>* sockets) override;
- void SimulateReceive(const uint8* packet, int size);
+ void SimulateReceive(const uint8_t* packet, int size);
MOCK_METHOD1(OnSendTo, void(const std::string&));
diff --git a/net/dns/mojo_host_resolver_impl.cc b/net/dns/mojo_host_resolver_impl.cc
index c39079c..ac2fe8bc 100644
--- a/net/dns/mojo_host_resolver_impl.cc
+++ b/net/dns/mojo_host_resolver_impl.cc
@@ -4,7 +4,6 @@
#include "net/dns/mojo_host_resolver_impl.h"
-#include "base/basictypes.h"
#include "base/stl_util.h"
#include "net/base/address_list.h"
#include "net/base/net_errors.h"
diff --git a/net/dns/notify_watcher_mac.h b/net/dns/notify_watcher_mac.h
index ded752c..5a87343 100644
--- a/net/dns/notify_watcher_mac.h
+++ b/net/dns/notify_watcher_mac.h
@@ -6,6 +6,7 @@
#define NET_DNS_NOTIFY_WATCHER_MAC_H_
#include "base/callback.h"
+#include "base/macros.h"
#include "base/message_loop/message_loop.h"
namespace net {
diff --git a/net/dns/record_parsed.cc b/net/dns/record_parsed.cc
index 4ae6ed2..a5fcf19 100644
--- a/net/dns/record_parsed.cc
+++ b/net/dns/record_parsed.cc
@@ -10,12 +10,18 @@
namespace net {
-RecordParsed::RecordParsed(const std::string& name, uint16 type, uint16 klass,
- uint32 ttl, scoped_ptr<const RecordRdata> rdata,
+RecordParsed::RecordParsed(const std::string& name,
+ uint16_t type,
+ uint16_t klass,
+ uint32_t ttl,
+ scoped_ptr<const RecordRdata> rdata,
base::Time time_created)
- : name_(name), type_(type), klass_(klass), ttl_(ttl), rdata_(rdata.Pass()),
- time_created_(time_created) {
-}
+ : name_(name),
+ type_(type),
+ klass_(klass),
+ ttl_(ttl),
+ rdata_(rdata.Pass()),
+ time_created_(time_created) {}
RecordParsed::~RecordParsed() {
}
@@ -70,8 +76,8 @@ scoped_ptr<const RecordParsed> RecordParsed::CreateFrom(
bool RecordParsed::IsEqual(const RecordParsed* other, bool is_mdns) const {
DCHECK(other);
- uint16 klass = klass_;
- uint16 other_klass = other->klass_;
+ uint16_t klass = klass_;
+ uint16_t other_klass = other->klass_;
if (is_mdns) {
klass &= dns_protocol::kMDnsClassMask;
diff --git a/net/dns/record_parsed.h b/net/dns/record_parsed.h
index 016c491..654574c 100644
--- a/net/dns/record_parsed.h
+++ b/net/dns/record_parsed.h
@@ -5,6 +5,8 @@
#ifndef NET_DNS_RECORD_PARSED_H_
#define NET_DNS_RECORD_PARSED_H_
+#include <stdint.h>
+
#include <string>
#include "base/memory/scoped_ptr.h"
@@ -27,9 +29,9 @@ class NET_EXPORT_PRIVATE RecordParsed {
base::Time time_created);
const std::string& name() const { return name_; }
- uint16 type() const { return type_; }
- uint16 klass() const { return klass_; }
- uint32 ttl() const { return ttl_; }
+ uint16_t type() const { return type_; }
+ uint16_t klass() const { return klass_; }
+ uint32_t ttl() const { return ttl_; }
base::Time time_created() const { return time_created_; }
@@ -45,14 +47,17 @@ class NET_EXPORT_PRIVATE RecordParsed {
bool IsEqual(const RecordParsed* other, bool is_mdns) const;
private:
- RecordParsed(const std::string& name, uint16 type, uint16 klass,
- uint32 ttl, scoped_ptr<const RecordRdata> rdata,
+ RecordParsed(const std::string& name,
+ uint16_t type,
+ uint16_t klass,
+ uint32_t ttl,
+ scoped_ptr<const RecordRdata> rdata,
base::Time time_created);
std::string name_; // in dotted form
- const uint16 type_;
- const uint16 klass_;
- const uint32 ttl_;
+ const uint16_t type_;
+ const uint16_t klass_;
+ const uint32_t ttl_;
const scoped_ptr<const RecordRdata> rdata_;
diff --git a/net/dns/record_parsed_unittest.cc b/net/dns/record_parsed_unittest.cc
index 2864dcb..cfaac31 100644
--- a/net/dns/record_parsed_unittest.cc
+++ b/net/dns/record_parsed_unittest.cc
@@ -12,23 +12,16 @@
namespace net {
-static const uint8 kT1ResponseWithCacheFlushBit[] = {
- 0x0a, 'c', 'o', 'd', 'e', 'r', 'e', 'v', 'i', 'e', 'w',
- 0x08, 'c', 'h', 'r', 'o', 'm', 'i', 'u', 'm',
- 0x03, 'o', 'r', 'g',
- 0x00,
- 0x00, 0x05, // TYPE is CNAME.
- 0x80, 0x01, // CLASS is IN with cache flush bit set.
- 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
- 0x24, 0x74,
- 0x00, 0x12, // RDLENGTH is 18 bytes.
- // ghs.l.google.com in DNS format.
- 0x03, 'g', 'h', 's',
- 0x01, 'l',
- 0x06, 'g', 'o', 'o', 'g', 'l', 'e',
- 0x03, 'c', 'o', 'm',
- 0x00
-};
+static const uint8_t kT1ResponseWithCacheFlushBit[] = {
+ 0x0a, 'c', 'o', 'd', 'e', 'r', 'e', 'v', 'i', 'e', 'w', 0x08, 'c', 'h', 'r',
+ 'o', 'm', 'i', 'u', 'm', 0x03, 'o', 'r', 'g', 0x00, 0x00,
+ 0x05, // TYPE is CNAME.
+ 0x80, 0x01, // CLASS is IN with cache flush bit set.
+ 0x00, 0x01, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
+ 0x24, 0x74, 0x00, 0x12, // RDLENGTH is 18 bytes.
+ // ghs.l.google.com in DNS format.
+ 0x03, 'g', 'h', 's', 0x01, 'l', 0x06, 'g', 'o', 'o', 'g', 'l', 'e', 0x03,
+ 'c', 'o', 'm', 0x00};
TEST(RecordParsedTest, ParseSingleRecord) {
DnsRecordParser parser(kT1ResponseDatagram, sizeof(kT1ResponseDatagram),
diff --git a/net/dns/record_rdata.cc b/net/dns/record_rdata.cc
index 4503b68..fbe7c65 100644
--- a/net/dns/record_rdata.cc
+++ b/net/dns/record_rdata.cc
@@ -42,7 +42,7 @@ scoped_ptr<SrvRecordRdata> SrvRecordRdata::Create(
return rdata.Pass();
}
-uint16 SrvRecordRdata::Type() const {
+uint16_t SrvRecordRdata::Type() const {
return SrvRecordRdata::kType;
}
@@ -78,7 +78,7 @@ scoped_ptr<ARecordRdata> ARecordRdata::Create(
return rdata.Pass();
}
-uint16 ARecordRdata::Type() const {
+uint16_t ARecordRdata::Type() const {
return ARecordRdata::kType;
}
@@ -111,7 +111,7 @@ scoped_ptr<AAAARecordRdata> AAAARecordRdata::Create(
return rdata.Pass();
}
-uint16 AAAARecordRdata::Type() const {
+uint16_t AAAARecordRdata::Type() const {
return AAAARecordRdata::kType;
}
@@ -139,7 +139,7 @@ scoped_ptr<CnameRecordRdata> CnameRecordRdata::Create(
return rdata.Pass();
}
-uint16 CnameRecordRdata::Type() const {
+uint16_t CnameRecordRdata::Type() const {
return CnameRecordRdata::kType;
}
@@ -168,7 +168,7 @@ scoped_ptr<PtrRecordRdata> PtrRecordRdata::Create(
return rdata.Pass();
}
-uint16 PtrRecordRdata::Type() const {
+uint16_t PtrRecordRdata::Type() const {
return PtrRecordRdata::kType;
}
@@ -191,7 +191,7 @@ scoped_ptr<TxtRecordRdata> TxtRecordRdata::Create(
scoped_ptr<TxtRecordRdata> rdata(new TxtRecordRdata);
for (size_t i = 0; i < data.size(); ) {
- uint8 length = data[i];
+ uint8_t length = data[i];
if (i + length >= data.size())
return scoped_ptr<TxtRecordRdata>();
@@ -205,7 +205,7 @@ scoped_ptr<TxtRecordRdata> TxtRecordRdata::Create(
return rdata.Pass();
}
-uint16 TxtRecordRdata::Type() const {
+uint16_t TxtRecordRdata::Type() const {
return TxtRecordRdata::kType;
}
@@ -237,8 +237,8 @@ scoped_ptr<NsecRecordRdata> NsecRecordRdata::Create(
return scoped_ptr<NsecRecordRdata>();
struct BitmapHeader {
- uint8 block_number; // The block number should be zero.
- uint8 length; // Bitmap length in bytes. Between 1 and 32.
+ uint8_t block_number; // The block number should be zero.
+ uint8_t length; // Bitmap length in bytes. Between 1 and 32.
};
const BitmapHeader* header = reinterpret_cast<const BitmapHeader*>(
@@ -263,7 +263,7 @@ scoped_ptr<NsecRecordRdata> NsecRecordRdata::Create(
return rdata.Pass();
}
-uint16 NsecRecordRdata::Type() const {
+uint16_t NsecRecordRdata::Type() const {
return NsecRecordRdata::kType;
}
diff --git a/net/dns/record_rdata.h b/net/dns/record_rdata.h
index a94d628..8184edd 100644
--- a/net/dns/record_rdata.h
+++ b/net/dns/record_rdata.h
@@ -5,11 +5,13 @@
#ifndef NET_DNS_RECORD_RDATA_H_
#define NET_DNS_RECORD_RDATA_H_
+#include <stdint.h>
+
#include <string>
#include <vector>
-#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string_piece.h"
#include "net/base/ip_address_number.h"
@@ -27,7 +29,7 @@ class NET_EXPORT_PRIVATE RecordRdata {
virtual ~RecordRdata() {}
virtual bool IsEqual(const RecordRdata* other) const = 0;
- virtual uint16 Type() const = 0;
+ virtual uint16_t Type() const = 0;
protected:
RecordRdata();
@@ -42,27 +44,27 @@ class NET_EXPORT_PRIVATE RecordRdata {
// target: domain name (on-the-wire representation)
class NET_EXPORT_PRIVATE SrvRecordRdata : public RecordRdata {
public:
- static const uint16 kType = dns_protocol::kTypeSRV;
+ static const uint16_t kType = dns_protocol::kTypeSRV;
~SrvRecordRdata() override;
static scoped_ptr<SrvRecordRdata> Create(const base::StringPiece& data,
const DnsRecordParser& parser);
bool IsEqual(const RecordRdata* other) const override;
- uint16 Type() const override;
+ uint16_t Type() const override;
- uint16 priority() const { return priority_; }
- uint16 weight() const { return weight_; }
- uint16 port() const { return port_; }
+ uint16_t priority() const { return priority_; }
+ uint16_t weight() const { return weight_; }
+ uint16_t port() const { return port_; }
const std::string& target() const { return target_; }
private:
SrvRecordRdata();
- uint16 priority_;
- uint16 weight_;
- uint16 port_;
+ uint16_t priority_;
+ uint16_t weight_;
+ uint16_t port_;
std::string target_;
@@ -73,13 +75,13 @@ class NET_EXPORT_PRIVATE SrvRecordRdata : public RecordRdata {
// 4 bytes for IP address.
class NET_EXPORT_PRIVATE ARecordRdata : public RecordRdata {
public:
- static const uint16 kType = dns_protocol::kTypeA;
+ static const uint16_t kType = dns_protocol::kTypeA;
~ARecordRdata() override;
static scoped_ptr<ARecordRdata> Create(const base::StringPiece& data,
const DnsRecordParser& parser);
bool IsEqual(const RecordRdata* other) const override;
- uint16 Type() const override;
+ uint16_t Type() const override;
const IPAddressNumber& address() const { return address_; }
@@ -95,13 +97,13 @@ class NET_EXPORT_PRIVATE ARecordRdata : public RecordRdata {
// 16 bytes for IP address.
class NET_EXPORT_PRIVATE AAAARecordRdata : public RecordRdata {
public:
- static const uint16 kType = dns_protocol::kTypeAAAA;
+ static const uint16_t kType = dns_protocol::kTypeAAAA;
~AAAARecordRdata() override;
static scoped_ptr<AAAARecordRdata> Create(const base::StringPiece& data,
const DnsRecordParser& parser);
bool IsEqual(const RecordRdata* other) const override;
- uint16 Type() const override;
+ uint16_t Type() const override;
const IPAddressNumber& address() const { return address_; }
@@ -117,13 +119,13 @@ class NET_EXPORT_PRIVATE AAAARecordRdata : public RecordRdata {
// cname: On the wire representation of domain name.
class NET_EXPORT_PRIVATE CnameRecordRdata : public RecordRdata {
public:
- static const uint16 kType = dns_protocol::kTypeCNAME;
+ static const uint16_t kType = dns_protocol::kTypeCNAME;
~CnameRecordRdata() override;
static scoped_ptr<CnameRecordRdata> Create(const base::StringPiece& data,
const DnsRecordParser& parser);
bool IsEqual(const RecordRdata* other) const override;
- uint16 Type() const override;
+ uint16_t Type() const override;
std::string cname() const { return cname_; }
@@ -139,13 +141,13 @@ class NET_EXPORT_PRIVATE CnameRecordRdata : public RecordRdata {
// domain: On the wire representation of domain name.
class NET_EXPORT_PRIVATE PtrRecordRdata : public RecordRdata {
public:
- static const uint16 kType = dns_protocol::kTypePTR;
+ static const uint16_t kType = dns_protocol::kTypePTR;
~PtrRecordRdata() override;
static scoped_ptr<PtrRecordRdata> Create(const base::StringPiece& data,
const DnsRecordParser& parser);
bool IsEqual(const RecordRdata* other) const override;
- uint16 Type() const override;
+ uint16_t Type() const override;
std::string ptrdomain() const { return ptrdomain_; }
@@ -162,13 +164,13 @@ class NET_EXPORT_PRIVATE PtrRecordRdata : public RecordRdata {
// a <character-string> is a length octet followed by as many characters.
class NET_EXPORT_PRIVATE TxtRecordRdata : public RecordRdata {
public:
- static const uint16 kType = dns_protocol::kTypeTXT;
+ static const uint16_t kType = dns_protocol::kTypeTXT;
~TxtRecordRdata() override;
static scoped_ptr<TxtRecordRdata> Create(const base::StringPiece& data,
const DnsRecordParser& parser);
bool IsEqual(const RecordRdata* other) const override;
- uint16 Type() const override;
+ uint16_t Type() const override;
const std::vector<std::string>& texts() const { return texts_; }
@@ -186,13 +188,13 @@ class NET_EXPORT_PRIVATE TxtRecordRdata : public RecordRdata {
// http://www.rfc-editor.org/rfc/rfc6762.txt Section 6.1.
class NET_EXPORT_PRIVATE NsecRecordRdata : public RecordRdata {
public:
- static const uint16 kType = dns_protocol::kTypeNSEC;
+ static const uint16_t kType = dns_protocol::kTypeNSEC;
~NsecRecordRdata() override;
static scoped_ptr<NsecRecordRdata> Create(const base::StringPiece& data,
const DnsRecordParser& parser);
bool IsEqual(const RecordRdata* other) const override;
- uint16 Type() const override;
+ uint16_t Type() const override;
// Length of the bitmap in bits.
unsigned bitmap_length() const { return bitmap_.size() * 8; }
@@ -205,7 +207,7 @@ class NET_EXPORT_PRIVATE NsecRecordRdata : public RecordRdata {
private:
NsecRecordRdata();
- std::vector<uint8> bitmap_;
+ std::vector<uint8_t> bitmap_;
DISALLOW_COPY_AND_ASSIGN(NsecRecordRdata);
};
diff --git a/net/dns/record_rdata_unittest.cc b/net/dns/record_rdata_unittest.cc
index d5306d8..d83f497 100644
--- a/net/dns/record_rdata_unittest.cc
+++ b/net/dns/record_rdata_unittest.cc
@@ -11,7 +11,7 @@
namespace net {
-base::StringPiece MakeStringPiece(const uint8* data, unsigned size) {
+base::StringPiece MakeStringPiece(const uint8_t* data, unsigned size) {
const char* data_cc = reinterpret_cast<const char*>(data);
return base::StringPiece(data_cc, size);
}
@@ -23,20 +23,15 @@ TEST(RecordRdataTest, ParseSrvRecord) {
// These are just the rdata portions of the DNS records, rather than complete
// records, but it works well enough for this test.
- const uint8 record[] = {
- 0x00, 0x01,
- 0x00, 0x02,
- 0x00, 0x50,
- 0x03, 'w', 'w', 'w',
- 0x06, 'g', 'o', 'o', 'g', 'l', 'e',
- 0x03, 'c', 'o', 'm',
- 0x00,
- 0x01, 0x01,
- 0x01, 0x02,
- 0x01, 0x03,
- 0x04, 'w', 'w', 'w', '2',
- 0xc0, 0x0a, // Pointer to "google.com"
- };
+ const uint8_t
+ record[] =
+ {
+ 0x00, 0x01, 0x00, 0x02, 0x00, 0x50, 0x03, 'w', 'w',
+ 'w', 0x06, 'g', 'o', 'o', 'g', 'l', 'e', 0x03,
+ 'c', 'o', 'm', 0x00, 0x01, 0x01, 0x01, 0x02, 0x01,
+ 0x03, 0x04, 'w', 'w', 'w', '2', 0xc0, 0x0a, // Pointer to
+ // "google.com"
+ };
DnsRecordParser parser(record, sizeof(record), 0);
const unsigned first_record_len = 22;
@@ -71,8 +66,8 @@ TEST(RecordRdataTest, ParseARecord) {
// These are just the rdata portions of the DNS records, rather than complete
// records, but it works well enough for this test.
- const uint8 record[] = {
- 0x7F, 0x00, 0x00, 0x01 // 127.0.0.1
+ const uint8_t record[] = {
+ 0x7F, 0x00, 0x00, 0x01 // 127.0.0.1
};
DnsRecordParser parser(record, sizeof(record), 0);
@@ -92,11 +87,9 @@ TEST(RecordRdataTest, ParseAAAARecord) {
// These are just the rdata portions of the DNS records, rather than complete
// records, but it works well enough for this test.
- const uint8 record[] = {
- 0x12, 0x34, 0x56, 0x78,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x09 // 1234:5678::9A
+ const uint8_t record[] = {
+ 0x12, 0x34, 0x56, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09 // 1234:5678::9A
};
DnsRecordParser parser(record, sizeof(record), 0);
@@ -117,12 +110,8 @@ TEST(RecordRdataTest, ParseCnameRecord) {
// These are just the rdata portions of the DNS records, rather than complete
// records, but it works well enough for this test.
- const uint8 record[] = {
- 0x03, 'w', 'w', 'w',
- 0x06, 'g', 'o', 'o', 'g', 'l', 'e',
- 0x03, 'c', 'o', 'm',
- 0x00
- };
+ const uint8_t record[] = {0x03, 'w', 'w', 'w', 0x06, 'g', 'o', 'o',
+ 'g', 'l', 'e', 0x03, 'c', 'o', 'm', 0x00};
DnsRecordParser parser(record, sizeof(record), 0);
base::StringPiece record_strpiece = MakeStringPiece(record, sizeof(record));
@@ -141,12 +130,8 @@ TEST(RecordRdataTest, ParsePtrRecord) {
// These are just the rdata portions of the DNS records, rather than complete
// records, but it works well enough for this test.
- const uint8 record[] = {
- 0x03, 'w', 'w', 'w',
- 0x06, 'g', 'o', 'o', 'g', 'l', 'e',
- 0x03, 'c', 'o', 'm',
- 0x00
- };
+ const uint8_t record[] = {0x03, 'w', 'w', 'w', 0x06, 'g', 'o', 'o',
+ 'g', 'l', 'e', 0x03, 'c', 'o', 'm', 0x00};
DnsRecordParser parser(record, sizeof(record), 0);
base::StringPiece record_strpiece = MakeStringPiece(record, sizeof(record));
@@ -165,11 +150,8 @@ TEST(RecordRdataTest, ParseTxtRecord) {
// These are just the rdata portions of the DNS records, rather than complete
// records, but it works well enough for this test.
- const uint8 record[] = {
- 0x03, 'w', 'w', 'w',
- 0x06, 'g', 'o', 'o', 'g', 'l', 'e',
- 0x03, 'c', 'o', 'm'
- };
+ const uint8_t record[] = {0x03, 'w', 'w', 'w', 0x06, 'g', 'o', 'o',
+ 'g', 'l', 'e', 0x03, 'c', 'o', 'm'};
DnsRecordParser parser(record, sizeof(record), 0);
base::StringPiece record_strpiece = MakeStringPiece(record, sizeof(record));
@@ -193,13 +175,9 @@ TEST(RecordRdataTest, ParseNsecRecord) {
// These are just the rdata portions of the DNS records, rather than complete
// records, but it works well enough for this test.
- const uint8 record[] = {
- 0x03, 'w', 'w', 'w',
- 0x06, 'g', 'o', 'o', 'g', 'l', 'e',
- 0x03, 'c', 'o', 'm',
- 0x00,
- 0x00, 0x02, 0x40, 0x01
- };
+ const uint8_t record[] = {0x03, 'w', 'w', 'w', 0x06, 'g', 'o',
+ 'o', 'g', 'l', 'e', 0x03, 'c', 'o',
+ 'm', 0x00, 0x00, 0x02, 0x40, 0x01};
DnsRecordParser parser(record, sizeof(record), 0);
base::StringPiece record_strpiece = MakeStringPiece(record, sizeof(record));
diff --git a/net/dns/serial_worker.h b/net/dns/serial_worker.h
index f63178a..c48a61b 100644
--- a/net/dns/serial_worker.h
+++ b/net/dns/serial_worker.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/compiler_specific.h"
+#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "net/base/net_export.h"
diff --git a/net/dns/single_request_host_resolver.h b/net/dns/single_request_host_resolver.h
index 3c8ef02..f284309 100644
--- a/net/dns/single_request_host_resolver.h
+++ b/net/dns/single_request_host_resolver.h
@@ -5,8 +5,7 @@
#ifndef NET_DNS_SINGLE_REQUEST_HOST_RESOLVER_H_
#define NET_DNS_SINGLE_REQUEST_HOST_RESOLVER_H_
-#include "base/basictypes.h"
-
+#include "base/macros.h"
#include "net/base/completion_callback.h"
#include "net/base/net_export.h"
#include "net/base/request_priority.h"
diff --git a/net/dns/single_request_host_resolver_unittest.cc b/net/dns/single_request_host_resolver_unittest.cc
index 8bd285f..c5bb9f1 100644
--- a/net/dns/single_request_host_resolver_unittest.cc
+++ b/net/dns/single_request_host_resolver_unittest.cc
@@ -4,6 +4,7 @@
#include "net/dns/single_request_host_resolver.h"
+#include "base/macros.h"
#include "net/base/address_list.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"