1 // Copyright 2018 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "net/dns/public/dns_query_type.h" 6 7 #include "base/check.h" 8 9 namespace net { 10 IsAddressType(DnsQueryType dns_query_type)11bool IsAddressType(DnsQueryType dns_query_type) { 12 // HostResolver treats UNSPECIFIED as A and/or AAAA depending on IPv4/IPv6 13 // settings, so it is here considered an address type. 14 return dns_query_type == DnsQueryType::UNSPECIFIED || 15 dns_query_type == DnsQueryType::A || 16 dns_query_type == DnsQueryType::AAAA; 17 } 18 HasAddressType(DnsQueryTypeSet dns_query_types)19bool HasAddressType(DnsQueryTypeSet dns_query_types) { 20 DCHECK(!dns_query_types.Empty()); 21 DCHECK(!dns_query_types.Has(DnsQueryType::UNSPECIFIED)); 22 return dns_query_types.Has(DnsQueryType::A) || 23 dns_query_types.Has(DnsQueryType::AAAA); 24 } 25 26 } // namespace net 27