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 #ifndef NET_BASE_IP_ADDRESS_NUMBER_H_ | 5 #ifndef NET_BASE_IP_ADDRESS_NUMBER_H_ |
6 #define NET_BASE_IP_ADDRESS_NUMBER_H_ | 6 #define NET_BASE_IP_ADDRESS_NUMBER_H_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include <string> | 11 #include <string> |
9 #include <vector> | 12 #include <vector> |
10 | 13 |
11 #include "base/basictypes.h" | |
12 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
13 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
14 | 16 |
15 namespace net { | 17 namespace net { |
16 | 18 |
17 // IPAddressNumber is used to represent an IP address's numeric value as an | 19 // IPAddressNumber is used to represent an IP address's numeric value as an |
18 // array of bytes, from most significant to least significant. This is the | 20 // array of bytes, from most significant to least significant. This is the |
19 // network byte ordering. | 21 // network byte ordering. |
20 // | 22 // |
21 // IPv4 addresses will have length 4, whereas IPv6 address will have length 16. | 23 // IPv4 addresses will have length 4, whereas IPv6 address will have length 16. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // Returns number of matching initial bits between the addresses |a1| and |a2|. | 111 // Returns number of matching initial bits between the addresses |a1| and |a2|. |
110 unsigned CommonPrefixLength(const IPAddressNumber& a1, | 112 unsigned CommonPrefixLength(const IPAddressNumber& a1, |
111 const IPAddressNumber& a2); | 113 const IPAddressNumber& a2); |
112 | 114 |
113 // Computes the number of leading 1-bits in |mask|. | 115 // Computes the number of leading 1-bits in |mask|. |
114 unsigned MaskPrefixLength(const IPAddressNumber& mask); | 116 unsigned MaskPrefixLength(const IPAddressNumber& mask); |
115 | 117 |
116 } // namespace net | 118 } // namespace net |
117 | 119 |
118 #endif // NET_BASE_IP_ADDRESS_NUMBER_H_ | 120 #endif // NET_BASE_IP_ADDRESS_NUMBER_H_ |
OLD | NEW |