1# Copyright 2019 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import("//build_overrides/build.gni") 6import("../testing/libfuzzer/fuzzer_test.gni") 7 8source_set("common") { 9 sources = [ 10 "common/config.h", 11 "common/reporting_client.h", 12 ] 13 14 deps = [ "../util" ] 15 16 public_deps = [ 17 "../platform", 18 "../third_party/abseil", 19 ] 20} 21 22source_set("mdns") { 23 sources = [ 24 "mdns/mdns_domain_confirmed_provider.h", 25 "mdns/mdns_probe.cc", 26 "mdns/mdns_probe.h", 27 "mdns/mdns_probe_manager.cc", 28 "mdns/mdns_probe_manager.h", 29 "mdns/mdns_publisher.cc", 30 "mdns/mdns_publisher.h", 31 "mdns/mdns_querier.cc", 32 "mdns/mdns_querier.h", 33 "mdns/mdns_reader.cc", 34 "mdns/mdns_reader.h", 35 "mdns/mdns_receiver.cc", 36 "mdns/mdns_receiver.h", 37 "mdns/mdns_record_changed_callback.h", 38 "mdns/mdns_records.cc", 39 "mdns/mdns_records.h", 40 "mdns/mdns_responder.cc", 41 "mdns/mdns_responder.h", 42 "mdns/mdns_sender.cc", 43 "mdns/mdns_sender.h", 44 "mdns/mdns_service_impl.cc", 45 "mdns/mdns_service_impl.h", 46 "mdns/mdns_trackers.cc", 47 "mdns/mdns_trackers.h", 48 "mdns/mdns_writer.cc", 49 "mdns/mdns_writer.h", 50 "mdns/public/mdns_constants.h", 51 "mdns/public/mdns_service.cc", 52 "mdns/public/mdns_service.h", 53 ] 54 55 deps = [ "../util" ] 56 57 public_deps = [ 58 ":common", 59 "../platform", 60 "../third_party/abseil", 61 ] 62} 63 64# TODO(issuetracker.google.com/179705382): Separate out a public target. 65source_set("dnssd") { 66 sources = [ 67 "dnssd/impl/conversion_layer.cc", 68 "dnssd/impl/conversion_layer.h", 69 "dnssd/impl/dns_data_graph.cc", 70 "dnssd/impl/dns_data_graph.h", 71 "dnssd/impl/instance_key.cc", 72 "dnssd/impl/instance_key.h", 73 "dnssd/impl/network_interface_config.cc", 74 "dnssd/impl/network_interface_config.h", 75 "dnssd/impl/publisher_impl.cc", 76 "dnssd/impl/publisher_impl.h", 77 "dnssd/impl/querier_impl.cc", 78 "dnssd/impl/querier_impl.h", 79 "dnssd/impl/service_dispatcher.cc", 80 "dnssd/impl/service_dispatcher.h", 81 "dnssd/impl/service_instance.cc", 82 "dnssd/impl/service_instance.h", 83 "dnssd/impl/service_key.cc", 84 "dnssd/impl/service_key.h", 85 "dnssd/public/dns_sd_instance.cc", 86 "dnssd/public/dns_sd_instance.h", 87 "dnssd/public/dns_sd_instance_endpoint.cc", 88 "dnssd/public/dns_sd_instance_endpoint.h", 89 "dnssd/public/dns_sd_publisher.h", 90 "dnssd/public/dns_sd_querier.h", 91 "dnssd/public/dns_sd_service.h", 92 "dnssd/public/dns_sd_txt_record.cc", 93 "dnssd/public/dns_sd_txt_record.h", 94 ] 95 96 public_deps = [ 97 ":common", 98 ":mdns", 99 "../util", 100 ] 101} 102 103source_set("public") { 104 sources = [ 105 "public/dns_sd_service_factory.h", 106 "public/dns_sd_service_publisher.h", 107 "public/dns_sd_service_watcher.h", 108 ] 109 110 public_deps = [ 111 ":common", 112 ":dnssd", 113 "../util", 114 ] 115} 116 117source_set("testing") { 118 testonly = true 119 120 sources = [ 121 "common/testing/mock_reporting_client.h", 122 "dnssd/testing/fake_dns_record_factory.cc", 123 "mdns/testing/hash_test_util.h", 124 "mdns/testing/mdns_test_util.cc", 125 "mdns/testing/mdns_test_util.h", 126 ] 127 128 defines = [] 129 if (build_with_chromium) { 130 sources += [ "mdns/testing/hash_test_util_nop.h" ] 131 } else { 132 defines += [ "HASH_TEST_UTIL_USE_ABSL" ] 133 sources += [ "mdns/testing/hash_test_util_abseil.h" ] 134 } 135 136 public_deps = [ 137 ":mdns", 138 "../third_party/abseil", 139 "../third_party/googletest:gmock", 140 "../third_party/googletest:gtest", 141 ] 142} 143 144source_set("unittests") { 145 testonly = true 146 147 sources = [ 148 "dnssd/impl/conversion_layer_unittest.cc", 149 "dnssd/impl/dns_data_graph_unittest.cc", 150 "dnssd/impl/instance_key_unittest.cc", 151 "dnssd/impl/publisher_impl_unittest.cc", 152 "dnssd/impl/querier_impl_unittest.cc", 153 "dnssd/impl/service_key_unittest.cc", 154 "dnssd/public/dns_sd_instance_endpoint_unittest.cc", 155 "dnssd/public/dns_sd_instance_unittest.cc", 156 "dnssd/public/dns_sd_txt_record_unittest.cc", 157 "mdns/mdns_probe_manager_unittest.cc", 158 "mdns/mdns_probe_unittest.cc", 159 "mdns/mdns_publisher_unittest.cc", 160 "mdns/mdns_querier_unittest.cc", 161 "mdns/mdns_random_unittest.cc", 162 "mdns/mdns_reader_unittest.cc", 163 "mdns/mdns_receiver_unittest.cc", 164 "mdns/mdns_records_unittest.cc", 165 "mdns/mdns_responder_unittest.cc", 166 "mdns/mdns_sender_unittest.cc", 167 "mdns/mdns_trackers_unittest.cc", 168 "mdns/mdns_writer_unittest.cc", 169 "public/dns_sd_service_watcher_unittest.cc", 170 ] 171 172 deps = [ 173 ":dnssd", 174 ":mdns", 175 ":public", 176 ":testing", 177 "../platform:test", 178 "../third_party/abseil", 179 "../third_party/googletest:gmock", 180 "../third_party/googletest:gtest", 181 "../util", 182 ] 183} 184 185openscreen_fuzzer_test("mdns_fuzzer") { 186 sources = [ "mdns/mdns_reader_fuzztest.cc" ] 187 188 deps = [ ":mdns" ] 189 190 seed_corpus = "mdns/fuzzer_seeds" 191 192 # Note: 512 is the maximum size for a serialized mDNS packet. 193 libfuzzer_options = [ "max_len=512" ] 194} 195