Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: net/base/ip_address.h

Issue 1860823005: Move some net::IPAddressNumber implementations to net::IPAddress. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/base/ip_address.cc » ('j') | net/base/ip_address.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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_NET_H_ 5 #ifndef NET_BASE_IP_ADDRESS_NET_H_
6 #define NET_BASE_IP_ADDRESS_NET_H_ 6 #define NET_BASE_IP_ADDRESS_NET_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // Returns true if the IP has |kIPv4AddressSize| elements. 68 // Returns true if the IP has |kIPv4AddressSize| elements.
69 bool IsIPv4() const; 69 bool IsIPv4() const;
70 70
71 // Returns true if the IP has |kIPv6AddressSize| elements. 71 // Returns true if the IP has |kIPv6AddressSize| elements.
72 bool IsIPv6() const; 72 bool IsIPv6() const;
73 73
74 // Returns true if the IP is either an IPv4 or IPv6 address. This function 74 // Returns true if the IP is either an IPv4 or IPv6 address. This function
75 // only checks the address length. 75 // only checks the address length.
76 bool IsValid() const; 76 bool IsValid() const;
77 77
78 // Returns true if an IP address hostname is in a range reserved by the IANA. 78 // Returns true if the IP is in a range reserved by the IANA.
79 // Works with both IPv4 and IPv6 addresses, and only compares against a given 79 // Works with both IPv4 and IPv6 addresses, and only compares against a given
80 // protocols's reserved ranges. 80 // protocols's reserved ranges.
81 bool IsReserved() const; 81 bool IsReserved() const;
82 82
83 // Returns true if the IP is "zero" (e.g. the 0.0.0.0 IPv4 address). 83 // Returns true if the IP is "zero" (e.g. the 0.0.0.0 IPv4 address).
84 bool IsZero() const; 84 bool IsZero() const;
85 85
86 // Returns true if |ip_address_| is an IPv4-mapped IPv6 address. 86 // Returns true if |ip_address_| is an IPv4-mapped IPv6 address.
87 bool IsIPv4MappedIPv6() const; 87 bool IsIPv4MappedIPv6() const;
88 88
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 template <size_t N> 202 template <size_t N>
203 bool IPAddressStartsWith(const IPAddress& address, const uint8_t (&prefix)[N]) { 203 bool IPAddressStartsWith(const IPAddress& address, const uint8_t (&prefix)[N]) {
204 if (address.size() < N) 204 if (address.size() < N)
205 return false; 205 return false;
206 return std::equal(prefix, prefix + N, address.bytes().begin()); 206 return std::equal(prefix, prefix + N, address.bytes().begin());
207 } 207 }
208 208
209 } // namespace net 209 } // namespace net
210 210
211 #endif // NET_BASE_IP_ADDRESS_NET_H_ 211 #endif // NET_BASE_IP_ADDRESS_NET_H_
OLDNEW
« no previous file with comments | « no previous file | net/base/ip_address.cc » ('j') | net/base/ip_address.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698