| OLD | NEW |
| 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_H_ |
| 6 #define NET_BASE_IP_ADDRESS_NET_H_ | 6 #define NET_BASE_IP_ADDRESS_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
| 16 #include "net/base/net_export.h" | 16 #include "net/base/net_export.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // to IPv4MappedIPv6 conversions and only checks against full bytes. | 198 // to IPv4MappedIPv6 conversions and only checks against full bytes. |
| 199 template <size_t N> | 199 template <size_t N> |
| 200 bool IPAddressStartsWith(const IPAddress& address, const uint8_t (&prefix)[N]) { | 200 bool IPAddressStartsWith(const IPAddress& address, const uint8_t (&prefix)[N]) { |
| 201 if (address.size() < N) | 201 if (address.size() < N) |
| 202 return false; | 202 return false; |
| 203 return std::equal(prefix, prefix + N, address.bytes().begin()); | 203 return std::equal(prefix, prefix + N, address.bytes().begin()); |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace net | 206 } // namespace net |
| 207 | 207 |
| 208 #endif // NET_BASE_IP_ADDRESS_NET_H_ | 208 #endif // NET_BASE_IP_ADDRESS_H_ |
| OLD | NEW |