blob: 818081b894795a9f0fffe182a25dc18544551098 [file] [log] [blame]
# Copyright 2016 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/components.gni")
import("//build/config.gni")
import("//build/fuzz.gni")
import("//build/test.gni")
declare_args() {
# Enables the tracing feature of mdns, which can be turned on using
# "mdns-util verbose".
enable_mdns_trace = false
}
group("service") {
testonly = true
deps = [
":mdns",
":source_set",
]
}
executable("bin") {
output_name = "mdns"
sources = [ "main.cc" ]
deps = [
":source_set",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
]
if (enable_mdns_trace) {
defines = [ "MDNS_TRACE" ]
}
}
source_set("source_set") {
sources = [
"agents/address_prober.cc",
"agents/address_prober.h",
"agents/address_responder.cc",
"agents/address_responder.h",
"agents/host_name_requestor.cc",
"agents/host_name_requestor.h",
"agents/host_name_resolver.cc",
"agents/host_name_resolver.h",
"agents/instance_prober.cc",
"agents/instance_prober.h",
"agents/instance_requestor.cc",
"agents/instance_requestor.h",
"agents/instance_responder.cc",
"agents/instance_responder.h",
"agents/mdns_agent.h",
"agents/prober.cc",
"agents/prober.h",
"agents/resource_renewer.cc",
"agents/resource_renewer.h",
"agents/service_instance_resolver.cc",
"agents/service_instance_resolver.h",
"common/formatters.cc",
"common/formatters.h",
"common/mdns_addresses.cc",
"common/mdns_addresses.h",
"common/mdns_fidl_util.cc",
"common/mdns_fidl_util.h",
"common/mdns_names.cc",
"common/mdns_names.h",
"common/reply_address.cc",
"common/reply_address.h",
"common/service_instance.cc",
"common/service_instance.h",
"common/type_converters.h",
"common/types.h",
"config.cc",
"config.h",
"encoding/dns_formatting.cc",
"encoding/dns_formatting.h",
"encoding/dns_message.cc",
"encoding/dns_message.h",
"encoding/dns_reading.cc",
"encoding/dns_reading.h",
"encoding/dns_writing.cc",
"encoding/dns_writing.h",
"encoding/packet_reader.cc",
"encoding/packet_reader.h",
"encoding/packet_writer.cc",
"encoding/packet_writer.h",
"mdns.cc",
"mdns.h",
"services/host_name_resolver_service_impl.cc",
"services/host_name_resolver_service_impl.h",
"services/host_name_subscriber_service_impl.cc",
"services/host_name_subscriber_service_impl.h",
"services/mdns_deprecated_service_impl.cc",
"services/mdns_deprecated_service_impl.h",
"services/mdns_service_impl.cc",
"services/mdns_service_impl.h",
"services/proxy_host_publisher_service_impl.cc",
"services/proxy_host_publisher_service_impl.h",
"services/service_impl_base.h",
"services/service_impl_manager.h",
"services/service_instance_publisher_service_impl.cc",
"services/service_instance_publisher_service_impl.h",
"services/service_instance_resolver_service_impl.cc",
"services/service_instance_resolver_service_impl.h",
"services/service_subscriber_service_impl.cc",
"services/service_subscriber_service_impl.h",
"transport/mdns_interface_transceiver.cc",
"transport/mdns_interface_transceiver.h",
"transport/mdns_interface_transceiver_v4.cc",
"transport/mdns_interface_transceiver_v4.h",
"transport/mdns_interface_transceiver_v6.cc",
"transport/mdns_interface_transceiver_v6.h",
"transport/mdns_transceiver.cc",
"transport/mdns_transceiver.h",
]
public_deps = [
"//sdk/fidl/fuchsia.device:fuchsia.device_hlcpp",
"//sdk/fidl/fuchsia.net:fuchsia.net_hlcpp",
"//sdk/fidl/fuchsia.net.interfaces:fuchsia.net.interfaces_hlcpp",
"//sdk/fidl/fuchsia.net.mdns:fuchsia.net.mdns_hlcpp",
"//sdk/lib/fit",
"//sdk/lib/sys/cpp",
"//sdk/lib/syslog/cpp",
"//src/connectivity/network/lib/net_interfaces/cpp",
"//src/lib/fostr",
"//src/lib/fsl",
"//src/lib/inet",
"//src/lib/json_parser",
"//src/lib/json_parser",
"//third_party/rapidjson",
]
if (enable_mdns_trace) {
defines = [ "MDNS_TRACE" ]
}
}
test("mdns_test") {
sources = [
"test/address_prober_test.cc",
"test/address_responder_test.cc",
"test/agent_test.cc",
"test/agent_test.h",
"test/config_test.cc",
"test/dns_names_test.cc",
"test/dns_reading_test.cc",
"test/dns_writing_test.cc",
"test/host_name_requestor_test.cc",
"test/host_name_resolver_test.cc",
"test/host_name_subscriber_service_impl_test.cc",
"test/instance_prober_test.cc",
"test/instance_requestor_test.cc",
"test/instance_responder_test.cc",
"test/interface_transceiver_test.cc",
"test/mdns_transceiver_test.cc",
"test/mdns_unit_tests.cc",
"test/resource_renewer_test.cc",
"test/responder_publisher_test.cc",
"test/service_impl_manager_test.cc",
"test/service_instance_publisher_service_impl_test.cc",
"test/service_instance_resolver_test.cc",
]
deps = [
":source_set",
"//src/lib/fxl/test:gtest_main",
"//src/lib/testing/loop_fixture",
"//src/lib/testing/predicates",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
]
if (enable_mdns_trace) {
defines = [ "MDNS_TRACE" ]
}
}
fuchsia_component("component") {
component_name = "mdns"
deps = [ ":bin" ]
manifest = "meta/mdns.cml"
}
fuchsia_package("mdns") {
deps = [ ":component" ]
}
config_data("mdns_fuchsia_udp_config") {
for_pkg = "mdns"
sources = [ rebase_path("config/fuchsia_udp.config") ]
# Ensure exclusion from production builds.
deps = [ "//build/validate:non_production_tag" ]
}
group("tests") {
testonly = true
deps = [
":mdns-fuzzers",
":mdns-netemul-tests",
":mdns-tests",
]
}
fuchsia_unittest_package("mdns-tests") {
deps = [ ":mdns_test" ]
manifest = "meta/mdns_test.cml"
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
}
fuchsia_library_fuzzer("packet_reader_fuzzer") {
sources = [
"encoding/dns_message.cc",
"encoding/dns_message.h",
"encoding/dns_reading.cc",
"encoding/dns_reading.h",
"encoding/packet_reader.cc",
"encoding/packet_reader.h",
"encoding/packet_reader_fuzzer.cc",
]
deps = [
"//sdk/lib/syslog/cpp",
"//src/lib/inet",
]
}
fuchsia_fuzzer_component("packet-reader-fuzzer-component") {
manifest = "meta/packet_reader_fuzzer.cml"
deps = [ ":packet_reader_fuzzer" ]
}
fuchsia_fuzzer_package("mdns-fuzzers") {
cpp_fuzzer_components = [ ":packet-reader-fuzzer-component" ]
}
executable("mdns_netemul_test_agent") {
testonly = true
sources = [ "test/mdns_netemul_test_agent.cc" ]
deps = [
"//sdk/fidl/fuchsia.net.mdns:fuchsia.net.mdns_hlcpp",
"//sdk/lib/sys/cpp",
"//sdk/lib/syslog/cpp",
"//src/lib/fostr/fidl/fuchsia.net",
"//src/lib/fostr/fidl/fuchsia.net.mdns",
"//src/lib/fsl",
"//zircon/system/ulib/async:async-cpp",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
]
}
fuchsia_test_component("test-driver") {
manifest = "meta/test-driver.cml"
deps = [ ":mdns_netemul_test_agent" ]
}
fuchsia_test_component("publisher") {
manifest = "meta/publisher.cml"
deps = [ ":mdns_netemul_test_agent" ]
}
fuchsia_test_component("device-name-provider-local") {
manifest = "meta/device-name-provider-local.cml"
deps = [ "//src/bringup/bin/device-name-provider" ]
}
fuchsia_test_component("device-name-provider-remote") {
manifest = "meta/device-name-provider-remote.cml"
deps = [ "//src/bringup/bin/device-name-provider" ]
}
fuchsia_test_component("mdns-netemul-test") {
manifest = "meta/mdns-netemul-test.cml"
deps = [
":component",
":device-name-provider-local",
":device-name-provider-remote",
":publisher",
":test-driver",
"//src/connectivity/network/testing/netemul/configurable-netstack",
]
}
fuchsia_test_component("mdns-netemul-v6-test") {
manifest = "meta/mdns-netemul-v6-test.cml"
deps = [
":component",
":device-name-provider-local",
":device-name-provider-remote",
":publisher",
":test-driver",
"//src/connectivity/network/testing/netemul/configurable-netstack",
]
}
executable("mdns_netemul_multi_network_test_agent") {
testonly = true
sources = [ "test/mdns_netemul_multi_network_test_agent.cc" ]
deps = [
":source_set",
"//sdk/fidl/fuchsia.net:fuchsia.net_hlcpp",
"//sdk/lib/sys/cpp",
"//src/connectivity/network/testing/netemul/sync-manager/fidl:sync_hlcpp",
"//zircon/system/ulib/async:async-cpp",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
]
if (enable_mdns_trace) {
defines = [ "MDNS_TRACE" ]
}
}
fuchsia_test_component("test-driver-multi-network") {
manifest = "meta/test-driver-multi-network.cml"
deps = [ ":mdns_netemul_multi_network_test_agent" ]
}
fuchsia_test_component("remote-multi-network") {
manifest = "meta/remote-multi-network.cml"
deps = [ ":mdns_netemul_multi_network_test_agent" ]
}
fuchsia_test_component("mdns-netemul-multi-network-test") {
manifest = "meta/mdns-netemul-multi-network-test.cml"
deps = [
":remote-multi-network",
":test-driver-multi-network",
"//src/connectivity/network/testing/netemul/configurable-netstack",
"//src/connectivity/network/testing/netemul/sync-manager",
]
}
fuchsia_test_package("mdns-netemul-tests") {
test_components = [
":mdns-netemul-test",
":mdns-netemul-v6-test",
":mdns-netemul-multi-network-test",
]
}