OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/dns/dns_config_service_win.h" | 5 #include "net/dns/dns_config_service_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 for (const IP_ADAPTER_UNICAST_ADDRESS* address = | 256 for (const IP_ADAPTER_UNICAST_ADDRESS* address = |
257 adapter->FirstUnicastAddress; | 257 adapter->FirstUnicastAddress; |
258 address != NULL; | 258 address != NULL; |
259 address = address->Next) { | 259 address = address->Next) { |
260 IPEndPoint ipe; | 260 IPEndPoint ipe; |
261 if (!ipe.FromSockAddr(address->Address.lpSockaddr, | 261 if (!ipe.FromSockAddr(address->Address.lpSockaddr, |
262 address->Address.iSockaddrLength)) { | 262 address->Address.iSockaddrLength)) { |
263 return HOSTS_PARSE_WIN_BAD_ADDRESS; | 263 return HOSTS_PARSE_WIN_BAD_ADDRESS; |
264 } | 264 } |
265 if (!have_ipv4 && (ipe.GetFamily() == AF_INET)) { | 265 if (!have_ipv4 && (ipe.GetFamily() == ADDRESS_FAMILY_IPV4)) { |
266 have_ipv4 = true; | 266 have_ipv4 = true; |
267 (*hosts)[DnsHostsKey(localname, ADDRESS_FAMILY_IPV4)] = ipe.address(); | 267 (*hosts)[DnsHostsKey(localname, ADDRESS_FAMILY_IPV4)] = ipe.address(); |
268 } else if (!have_ipv6 && (ipe.GetFamily() == AF_INET6)) { | 268 } else if (!have_ipv6 && (ipe.GetFamily() == ADDRESS_FAMILY_IPV6)) { |
269 have_ipv6 = true; | 269 have_ipv6 = true; |
270 (*hosts)[DnsHostsKey(localname, ADDRESS_FAMILY_IPV6)] = ipe.address(); | 270 (*hosts)[DnsHostsKey(localname, ADDRESS_FAMILY_IPV6)] = ipe.address(); |
271 } | 271 } |
272 } | 272 } |
273 } | 273 } |
274 return HOSTS_PARSE_WIN_OK; | 274 return HOSTS_PARSE_WIN_OK; |
275 } | 275 } |
276 | 276 |
277 // Watches a single registry key for changes. | 277 // Watches a single registry key for changes. |
278 class RegistryWatcher : public base::win::ObjectWatcher::Delegate, | 278 class RegistryWatcher : public base::win::ObjectWatcher::Delegate, |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 } | 696 } |
697 | 697 |
698 } // namespace internal | 698 } // namespace internal |
699 | 699 |
700 // static | 700 // static |
701 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { | 701 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { |
702 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServiceWin()); | 702 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServiceWin()); |
703 } | 703 } |
704 | 704 |
705 } // namespace net | 705 } // namespace net |
OLD | NEW |