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/base/net_util.h" | 5 #include "net/base/net_util.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 | 1008 |
1009 default: | 1009 default: |
1010 NOTREACHED(); | 1010 NOTREACHED(); |
1011 } | 1011 } |
1012 } | 1012 } |
1013 | 1013 |
1014 return false; | 1014 return false; |
1015 } | 1015 } |
1016 | 1016 |
1017 NetworkInterface::NetworkInterface() | 1017 NetworkInterface::NetworkInterface() |
1018 : type(NetworkChangeNotifier::CONNECTION_UNKNOWN), | 1018 : type(NetworkChangeNotifier::CONNECTION_UNKNOWN), prefix_length(0) { |
1019 network_prefix(0) { | |
1020 } | 1019 } |
1021 | 1020 |
1022 NetworkInterface::NetworkInterface(const std::string& name, | 1021 NetworkInterface::NetworkInterface(const std::string& name, |
1023 const std::string& friendly_name, | 1022 const std::string& friendly_name, |
1024 uint32 interface_index, | 1023 uint32 interface_index, |
1025 NetworkChangeNotifier::ConnectionType type, | 1024 NetworkChangeNotifier::ConnectionType type, |
1026 const IPAddressNumber& address, | 1025 const IPAddressNumber& address, |
1027 uint32 network_prefix, | 1026 uint32 prefix_length, |
1028 int ip_address_attributes) | 1027 int ip_address_attributes) |
1029 : name(name), | 1028 : name(name), |
1030 friendly_name(friendly_name), | 1029 friendly_name(friendly_name), |
1031 interface_index(interface_index), | 1030 interface_index(interface_index), |
1032 type(type), | 1031 type(type), |
1033 address(address), | 1032 address(address), |
1034 network_prefix(network_prefix), | 1033 prefix_length(prefix_length), |
1035 ip_address_attributes(ip_address_attributes) { | 1034 ip_address_attributes(ip_address_attributes) { |
1036 } | 1035 } |
1037 | 1036 |
1038 NetworkInterface::~NetworkInterface() { | 1037 NetworkInterface::~NetworkInterface() { |
1039 } | 1038 } |
1040 | 1039 |
1041 unsigned CommonPrefixLength(const IPAddressNumber& a1, | 1040 unsigned CommonPrefixLength(const IPAddressNumber& a1, |
1042 const IPAddressNumber& a2) { | 1041 const IPAddressNumber& a2) { |
1043 DCHECK_EQ(a1.size(), a2.size()); | 1042 DCHECK_EQ(a1.size(), a2.size()); |
1044 for (size_t i = 0; i < a1.size(); ++i) { | 1043 for (size_t i = 0; i < a1.size(); ++i) { |
(...skipping 12 matching lines...) Expand all Loading... |
1057 | 1056 |
1058 unsigned MaskPrefixLength(const IPAddressNumber& mask) { | 1057 unsigned MaskPrefixLength(const IPAddressNumber& mask) { |
1059 IPAddressNumber all_ones(mask.size(), 0xFF); | 1058 IPAddressNumber all_ones(mask.size(), 0xFF); |
1060 return CommonPrefixLength(mask, all_ones); | 1059 return CommonPrefixLength(mask, all_ones); |
1061 } | 1060 } |
1062 | 1061 |
1063 ScopedWifiOptions::~ScopedWifiOptions() { | 1062 ScopedWifiOptions::~ScopedWifiOptions() { |
1064 } | 1063 } |
1065 | 1064 |
1066 } // namespace net | 1065 } // namespace net |
OLD | NEW |