# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/sanitizers/sanitizers.gni")
import("//testing/test.gni")
import("//net/features.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//third_party/protobuf/proto_library.gni")

enable_built_in_dns = use_blink || use_cobalt_customizations

source_set("dns") {
  # Due to circular dependencies, should only be depended on through //net.
  visibility = [
    "//net",
    "//net/http:transport_security_state_generated_files",
  ]

  # Internals only intended for use inside network stack (and tests).
  friend = [
    "//chrome/browser:test_support",
    "//chrome/test/*",
    "//components/certificate_transparency:unit_tests",
    "//components/cronet/*",

    # Needed for brokering system DNS resolution out of the network service.
    "//content/browser/system_dns_resolution",
    "//content/test/*",
    "//net/*",
    "//services/network/*",
  ]

  public = []
  sources = [
    "address_info.cc",
    "address_info.h",
    "address_sorter.h",
    "context_host_resolver.cc",
    "context_host_resolver.h",
    "dns_alias_utility.cc",
    "dns_alias_utility.h",
    "dns_config.cc",
    "dns_config_service.cc",
    "dns_config_service.h",
    "dns_hosts.cc",
    "dns_hosts.h",
    "dns_names_util.cc",
    "dns_names_util.h",
    "dns_query.cc",
    "dns_query.h",
    "dns_reloader.cc",
    "dns_reloader.h",
    "dns_response.cc",
    "dns_response_result_extractor.cc",
    "dns_response_result_extractor.h",
    "dns_server_iterator.cc",
    "dns_server_iterator.h",
    "dns_session.cc",
    "dns_session.h",
    "dns_transaction.cc",
    "dns_udp_tracker.cc",
    "dns_udp_tracker.h",
    "dns_util.cc",
    "dns_util.h",
    "host_cache.cc",
    "host_resolver.cc",
    "host_resolver_internal_result.cc",
    "host_resolver_internal_result.h",
    "host_resolver_manager.cc",
    "host_resolver_mdns_listener_impl.cc",
    "host_resolver_mdns_listener_impl.h",
    "host_resolver_mdns_task.cc",
    "host_resolver_mdns_task.h",
    "host_resolver_nat64_task.cc",
    "host_resolver_nat64_task.h",
    "host_resolver_proc.cc",
    "host_resolver_proc.h",
    "host_resolver_system_task.cc",
    "host_resolver_system_task.h",
    "https_record_rdata.cc",
    "httpssvc_metrics.cc",
    "httpssvc_metrics.h",
    "mapped_host_resolver.cc",
    "nsswitch_reader.cc",
    "nsswitch_reader.h",
    "opt_record_rdata.cc",
    "record_parsed.cc",
    "record_rdata.cc",
    "resolve_context.cc",
    "resolve_context.h",
    "serial_worker.cc",
    "serial_worker.h",
    "system_dns_config_change_notifier.cc",
    "system_dns_config_change_notifier.h",
    "test_dns_config_service.cc",
    "test_dns_config_service.h",
  ]

  if (is_win && !is_starboard) {
    sources += [
      "address_sorter_win.cc",
      "dns_config_service_win.cc",
      "dns_config_service_win.h",
    ]
  }

  if (is_mac && !is_starboard) {
    sources += [
      "dns_config_watcher_mac.cc",
      "dns_config_watcher_mac.h",
      "notify_watcher_mac.cc",
      "notify_watcher_mac.h",
    ]
  }

  if (is_fuchsia) {
    sources += [
      "dns_config_service_fuchsia.cc",
      "dns_config_service_fuchsia.h",
    ]
  }

  if (is_starboard) {
    sources += [ "dns_config_service_starboard.cc" ]
  } else if (is_android) {
    sources += [
      "dns_config_service_android.cc",
      "dns_config_service_android.h",
    ]
  } else if (is_linux) {
    sources += [
      "dns_config_service_linux.cc",
      "dns_config_service_linux.h",
    ]
  } else if (is_posix) {
    sources += [
      "dns_config_service_posix.cc",
      "dns_config_service_posix.h",
    ]
  }

  if (enable_built_in_dns) {
    sources += [ "dns_client.cc" ]

    if (is_posix || is_fuchsia || is_starboard) {
      sources += [
        "address_sorter_posix.cc",
        "address_sorter_posix.h",
      ]
    }
  }

  if (enable_mdns) {
    sources += [
      "mdns_cache.cc",
      "mdns_cache.h",
      "mdns_client.cc",
      "mdns_client_impl.cc",
      "mdns_client_impl.h",
    ]
  }

  deps = [ "//net:net_deps" ]

  public_deps = [
    ":dns_client",
    ":host_resolver",
    ":host_resolver_manager",
    ":mdns_client",
    "//net:net_public_deps",
  ]

  allow_circular_includes_from = [
    ":dns_client",
    ":host_resolver",
    ":host_resolver_manager",
    ":mdns_client",
  ]
}

# The standard API of net/dns.
#
# Should typically only be used within the network service. Usage external to
# the network service should instead use network service Mojo IPCs for host
# resolution. See ResolveHost() in
# /services/network/public/mojom/network_context.mojom and
# /services/network/public/mojom/host_resolver.mojom.
source_set("host_resolver") {
  # Due to circular dependencies, should only be depended on through //net.
  # Limit visibility to //net and other source_sets with the same access
  # restriction.
  visibility = [
    ":dns",
    ":dns_client",
    ":host_resolver_manager",
    ":mdns_client",
    "//net",
  ]

  # Restricted access so we can keep track of all usage external to the
  # network stack and network service.
  friend = [
    # chromecast/browser/url_request_context_factory.cc
    # URLRequestContext creation for chromecast.
    "//chromecast/browser",

    # URLRequestContext and HttpNetworkSession::Context creation for iOS.
    "//ios/components/io_thread",
    "//ios/web/shell",
    "//ios/web_view:*",

    # Tests and test support.
    "//chrome/browser:test_support",
    "//chrome/test/*",
    "//components/grpc_support/test:unit_tests",
    "//content/shell:content_shell_lib",
    "//content/test:*",

    # Stand-alone tools.
    "//google_apis/gcm:mcs_probe",

    # Network stack/service.
    "//components/certificate_transparency/*",
    "//components/cronet/*",
    "//net/*",
    "//services/network/*",
  ]

  if (use_cobalt_customizations) {
    visibility += [ "//cobalt/network" ]
    friend += [ "//cobalt/network" ]
  }

  sources = [
    "dns_config.h",
    "host_cache.h",
    "host_resolver.h",
    "mapped_host_resolver.h",
  ]
  public = []

  deps = [
    "//net:net_deps",
    "//net/dns/public",
  ]
  public_deps = [ "//net:net_public_deps" ]

  allow_circular_includes_from = [ "//net/dns/public" ]
}

# Shared mostly-global handler of HostResolver requests.
#
# Typically should only be directly interacted with by NetworkService (or other
# mostly-global creators of request contexts), standalone tools, and tests. Host
# resolution should generally instead go through HostResolvers received from
# URLRequestContext or network service Mojo IPCs.
source_set("host_resolver_manager") {
  # Due to circular dependencies, should only be depended on through //net.
  # Limit visibility to //net and other source_sets with the same access
  # restriction.
  visibility = [
    ":dns",
    ":host_resolver",
    "//net",
  ]

  # Restricted access so we can keep track of all usage external to the
  # network stack and network service.
  friend = [
    # chromecast/browser/url_request_context_factory.cc
    # URLRequestContext creation for chromecast.
    "//chromecast/browser",

    # Tests and test support.
    "//components/cronet:cronet_common_unittests",

    # Network stack/service.
    "//net/*",
    "//services/network/*",
  ]

  sources = [ "host_resolver_manager.h" ]
  public = []

  deps = [
    ":host_resolver",
    "//net:net_deps",
    "//net/dns/public",
  ]
  public_deps = [ "//net:net_public_deps" ]
}

# DnsClient interfaces. Primarily intended as part of the implementation of the
# standard HostResolver interface, but can be used as an alternative external
# interface for advanced usage.
source_set("dns_client") {
  # Due to circular dependencies, should only be depended on through //net.
  # Limit visibility to //net and other source_sets with the same access
  # restriction.
  visibility = [
    ":dns",
    ":mdns_client",
    "//net",
  ]

  # Restricted access so we can keep track of all usage external to the
  # network stack.
  friend = [
    # chrome/browser/local_discovery/service_discovery_client_impl.cc
    # Result parsing utilities for parsing results read through MdnsClient.
    # TODO(crbug.com/874662): Remove once migrated to network service.
    "//chrome/browser",

    # chrome/browser/ash/smb_client/discovery/mdns_host_locator.cc
    # Result parsing for results read through MdnsClient.
    # TODO(crbug.com/902531): Remove once migrated to network service.
    "//chrome/browser/ash",

    # Tests and test support
    "//chrome/browser:test_support",
    "//chrome/test/*",

    # Network stack/service
    "//components/certificate_transparency/*",
    "//net/*",
    "//services/network/*",
  ]

  sources = [
    "dns_client.h",
    "dns_response.h",
    "dns_transaction.h",
    "https_record_rdata.h",
    "opt_record_rdata.h",
    "record_parsed.h",
    "record_rdata.h",
  ]
  public = []

  deps = [
    ":host_resolver",
    "//net:net_deps",
  ]
  public_deps = [
    "//net:net_public_deps",
    "//net/dns/public",
  ]
}

# MdnsClient interfaces.
source_set("mdns_client") {
  # Due to circular dependencies, should only be depended on through //net.
  # Limit visibility to //net and other source_sets with the same access
  # restriction.
  visibility = [
    ":dns",
    "//net",
  ]

  # Restricted access so we can keep track of all usage external to the
  # network stack.
  friend = [
    # chrome/browser/local_discovery/service_discovery_client_mdns.h
    # chrome/browser/local_discovery/service_discovery_client_impl.h
    # Makes MDNS queries using MDnsClient.
    # TODO(crbug.com/874662): Remove once migrated to network service.
    "//chrome/browser",

    # chrome/tools/service_discovery_sniffer/service_discovery_sniffer.cc
    # Creates MDnsClient instance and passes to ServiceDiscoveryClientImpl.
    # TODO(crbug.com/874662): Remove once discovery client migrated.
    "//chrome/tools/service_discovery_sniffer",

    # chrome/browser/ash/smb_client/discovery/mdns_host_locator.h
    # chrome/browser/ash/smb_client/discovery/mdns_host_locator.cc
    # Makes MDNS queries using MDnsClient.
    # TODO(crbug.com/902531): Remove once migrated to network service.
    "//chrome/browser/ash",

    # Tests and test support
    "//chrome/browser:test_support",

    # Network stack/service
    "//net/*",
    "//services/network/*",
  ]

  public = []
  sources = []

  if (enable_mdns) {
    sources += [ "mdns_client.h" ]
  }

  deps = [
    ":dns_client",
    ":host_resolver",
    "//net:net_deps",
  ]
  public_deps = [ "//net:net_public_deps" ]
}

source_set("tests") {
  testonly = true
  sources = [
    "address_info_unittest.cc",
    "context_host_resolver_unittest.cc",
    "dns_alias_utility_unittest.cc",
    "dns_config_service_unittest.cc",
    "dns_hosts_unittest.cc",
    "dns_names_util_unittest.cc",
    "dns_query_unittest.cc",
    "dns_response_result_extractor_unittest.cc",
    "dns_response_unittest.cc",
    "dns_transaction_unittest.cc",
    "dns_udp_tracker_unittest.cc",
    "dns_util_unittest.cc",
    "host_cache_unittest.cc",
    "host_resolver_internal_result_unittest.cc",
    "host_resolver_manager_unittest.cc",
    "https_record_rdata_unittest.cc",
    "httpssvc_metrics_unittest.cc",
    "mapped_host_resolver_unittest.cc",
    "nsswitch_reader_unittest.cc",
    "opt_record_rdata_unittest.cc",
    "record_parsed_unittest.cc",
    "record_rdata_unittest.cc",
    "resolve_context_unittest.cc",
    "serial_worker_unittest.cc",
    "system_dns_config_change_notifier_unittest.cc",
  ]

  if (is_win && !is_starboard) {
    sources += [ "dns_config_service_win_unittest.cc" ]
  }

  if (!is_starboard) {
  if (is_android) {
    sources += [ "dns_config_service_android_unittest.cc" ]
  } else if (is_linux) {
    sources += [ "dns_config_service_linux_unittest.cc" ]
  } else if (is_posix) {
    sources += [ "dns_config_service_posix_unittest.cc" ]
  }
  }

  if (enable_built_in_dns) {
    sources += [
      "address_sorter_unittest.cc",
      "dns_client_unittest.cc",
    ]
    if (is_posix || is_fuchsia) {
      sources += [ "address_sorter_posix_unittest.cc" ]
    }
  }

  if (enable_mdns) {
    sources += [
      "mdns_cache_unittest.cc",
      "mdns_client_unittest.cc",
    ]
  }

  deps = [
    "//base",
    "//net",
    "//net:test_support",
    "//testing/gmock",
    "//testing/gtest",
  ]
}

source_set("test_support") {
  visibility = [ "//net:test_support" ]
  testonly = true
  sources = [
    "dns_test_util.cc",
    "host_resolver_internal_result_test_util.cc",
    "host_resolver_results_test_util.cc",
    "mock_host_resolver.cc",
  ]
  public = [
    "dns_test_util.h",
    "host_resolver_internal_result_test_util.h",
    "host_resolver_results_test_util.h",
    "mock_host_resolver.h",
  ]

  if (enable_mdns) {
    sources += [
      "mock_mdns_client.cc",
      "mock_mdns_socket_factory.cc",
    ]
    public += [
      "mock_mdns_client.h",
      "mock_mdns_socket_factory.h",
    ]
  }

  deps = [
    "//base",
    "//net",
    "//testing/gmock",
    "//testing/gtest",
  ]
}

if (use_fuzzing_engine) {
  # fuzzer_test targets are no-op when |use_fuzzing_engine| is false. Fuzzer
  # support targets should be disabled too.
  source_set("fuzzer_test_support") {
    testonly = true
    sources = [
      "fuzzed_host_resolver_util.cc",
      "fuzzed_host_resolver_util.h",
    ]
    deps = [
      "//base",
      "//base/test:test_support",
      "//net",
    ]
  }
}

if (!use_cobalt_customizations) {
proto_library("host_cache_fuzzer_proto") {
  proto_in_dir = "//"
  sources = [ "host_cache_fuzzer.proto" ]
  deps = [ "//testing/libfuzzer/proto:json_proto" ]
}

fuzzer_test("net_dns_host_cache_fuzzer") {
  sources = [ "host_cache_fuzzer.cc" ]
  deps = [
    ":host_cache_fuzzer_proto",
    "//base",
    "//net",
    "//net:net_fuzzer_test_support",
    "//testing/libfuzzer/proto:json_proto",
    "//testing/libfuzzer/proto:json_proto_converter",
    "//third_party/libprotobuf-mutator",
  ]
  dict = "//testing/libfuzzer/fuzzers/dicts/json.dict"
}
}

fuzzer_test("net_dns_hosts_parse_fuzzer") {
  sources = [ "dns_hosts_parse_fuzzer.cc" ]
  deps = [
    "//base",
    "//net",
    "//net:net_fuzzer_test_support",
  ]
  dict = "//net/data/fuzzer_dictionaries/net_dns_hosts_parse_fuzzer.dict"
}

fuzzer_test("net_dns_https_record_rdata_fuzzer") {
  sources = [ "https_record_rdata_fuzzer.cc" ]
  deps = [
    "//base",
    "//net",
    "//net:net_fuzzer_test_support",
  ]
  dict = "//net/data/fuzzer_dictionaries/net_dns_record_fuzzer.dict"
}

fuzzer_test("net_dns_nsswitch_reader_fuzzer") {
  sources = [ "nsswitch_reader_fuzzer.cc" ]
  deps = [
    "//base",
    "//net",
    "//net:net_fuzzer_test_support",
  ]
  dict = "//net/data/fuzzer_dictionaries/net_dns_nsswitch_reader_fuzzer.dict"
}

fuzzer_test("net_dns_record_fuzzer") {
  sources = [ "dns_record_fuzzer.cc" ]
  deps = [
    "//base",
    "//net",
    "//net:net_fuzzer_test_support",
  ]
  dict = "//net/data/fuzzer_dictionaries/net_dns_record_fuzzer.dict"
}

fuzzer_test("net_dns_query_parse_fuzzer") {
  sources = [ "dns_query_parse_fuzzer.cc" ]
  deps = [
    "//base",
    "//net",
    "//net:net_fuzzer_test_support",
  ]
  dict = "//net/data/fuzzer_dictionaries/net_dns_record_fuzzer.dict"
}

fuzzer_test("net_dns_response_fuzzer") {
  sources = [ "dns_response_fuzzer.cc" ]
  deps = [
    "//base",
    "//net",
    "//net:net_fuzzer_test_support",
  ]
  dict = "//net/data/fuzzer_dictionaries/net_dns_record_fuzzer.dict"
}

fuzzer_test("net_host_resolver_manager_fuzzer") {
  sources = [ "host_resolver_manager_fuzzer.cc" ]
  deps = [
    "//base",
    "//net",
    "//net:net_fuzzer_test_support",
    "//net:test_support",
  ]
  dict = "//net/data/fuzzer_dictionaries/net_host_resolver_manager_fuzzer.dict"
}

if (is_win) {
  fuzzer_test("net_dns_parse_domain_ascii_win_fuzzer") {
    sources = [ "dns_parse_domain_ascii_win_fuzzer.cc" ]
    deps = [
      "//base",
      "//net",
      "//net:net_fuzzer_test_support",
    ]
    dict = "//net/data/fuzzer_dictionaries/net_dns_hosts_parse_fuzzer.dict"
    seed_corpus = "//net/data/fuzzer_data/dns_parse_domain_ascii_win_fuzzer"
  }
}
