Chromium Code Reviews| Index: net/base/ip_address.h |
| diff --git a/net/base/ip_address.h b/net/base/ip_address.h |
| index f1f244e7fbf5877e06fa87b88d90d8a3107d9509..70da125ab3879de636ba89618aef5ccd5e1e031c 100644 |
| --- a/net/base/ip_address.h |
| +++ b/net/base/ip_address.h |
| @@ -149,6 +149,20 @@ NET_EXPORT bool IPAddressMatchesPrefix(const IPAddress& ip_address, |
| const IPAddress& ip_prefix, |
| size_t prefix_length_in_bits); |
| +// Parses an IP block specifier from CIDR notation to an |
| +// (IP address, prefix length) pair. Returns true on success and fills |
| +// |ip_address| with the numeric value of the IP address and sets |
| +// |prefix_length_in_bits| with the length of the prefix. |
| +// |
| +// CIDR notation literals can use either IPv4 or IPv6 literals. Some examples: |
| +// |
| +// 10.10.3.1/20 |
| +// a:b:c::/46 |
| +// ::1/128 |
| +NET_EXPORT bool ParseCIDRBlock(const std::string& cidr_literal, |
| + IPAddress& ip_address, |
|
eroman
2016/03/18 19:59:45
Why was the signature changed?
Google C++ style r
martijnc
2016/03/18 21:41:11
Changed.
Wanted to avoid passing a pointer and wa
|
| + size_t& prefix_length_in_bits); |
| + |
| // Returns number of matching initial bits between the addresses |a1| and |a2|. |
| unsigned CommonPrefixLength(const IPAddress& a1, const IPAddress& a2); |