arc: Move platform2/arc/network/ to platform2/patchpanel
Next step in the arc-networkd -> patchpanel rename, this patch moves the
location of the code.
BUG=b:151879931
TEST=units,flashed image to atlas
TEST=tasts arc.PlayStore, crostini.LaunchTerminal.download
Change-Id: I1b5cf8d670e1631d46f6449b725395157bf88dde
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2115863
Tested-by: Garrick Evans <garrick@chromium.org>
Commit-Queue: Garrick Evans <garrick@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Hugo Benichi <hugobenichi@google.com>
diff --git a/patchpanel/BUILD.gn b/patchpanel/BUILD.gn
new file mode 100644
index 0000000..12e7b80
--- /dev/null
+++ b/patchpanel/BUILD.gn
@@ -0,0 +1,203 @@
+# Copyright 2018 The Chromium OS 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("//common-mk/pkg_config.gni")
+import("//common-mk/proto_library.gni")
+
+group("all") {
+ deps = [
+ ":arc-networkd",
+ ":libarcnetwork",
+ ":libarcnetwork-util",
+ ":libpatchpanel-client",
+ ]
+ if (use.fuzzer) {
+ deps += [
+ ":datapath_fuzzer",
+ ":multicast_forwarder_fuzzer",
+ ":ndproxy_fuzzer",
+ ]
+ }
+ if (use.test) {
+ deps += [ ":arc_network_testrunner" ]
+ }
+}
+
+pkg_config("target_defaults") {
+ pkg_deps = [
+ "libbrillo",
+ "libchrome-${libbase_ver}",
+ "libpermission_broker-client",
+ "libshill-client",
+ "libshill-net-${libbase_ver}",
+ "protobuf-lite",
+ "system_api",
+ ]
+ if (use.fuzzer) {
+ pkg_deps += [ "protobuf" ]
+ } else {
+ pkg_deps += [ "protobuf-lite" ]
+ }
+}
+
+proto_library("protos") {
+ configs = [ ":target_defaults" ]
+ proto_in_dir = "."
+ proto_out_dir = "include/patchpanel"
+ sources = [
+ "${proto_in_dir}/ipc.proto",
+ ]
+}
+
+util_sources = [
+ "address_manager.cc",
+ "mac_address_generator.cc",
+ "net_util.cc",
+ "socket.cc",
+ "socket_forwarder.cc",
+ "subnet.cc",
+ "subnet_pool.cc",
+]
+
+shared_library("libarcnetwork-util") {
+ sources = util_sources
+ configs += [ ":target_defaults" ]
+}
+
+static_library("libarcnetwork") {
+ configs += [ ":target_defaults" ]
+ all_dependent_pkg_deps = [
+ "protobuf",
+ "system_api",
+ ]
+ sources = [
+ "adb_proxy.cc",
+ "arc_service.cc",
+ "broadcast_forwarder.cc",
+ "crostini_service.cc",
+ "datapath.cc",
+ "device.cc",
+ "dns/big_endian.cc",
+ "dns/dns_response.cc",
+ "dns/io_buffer.cc",
+ "helper_process.cc",
+ "manager.cc",
+ "message_dispatcher.cc",
+ "minijailed_process_runner.cc",
+ "multicast_forwarder.cc",
+ "multicast_proxy.cc",
+ "ndproxy.cc",
+ "routing_service.cc",
+ "scoped_ns.cc",
+ "shill_client.cc",
+ ]
+ sources += util_sources
+ deps = [
+ ":protos",
+ ]
+}
+
+shared_library("libpatchpanel-client") {
+ configs += [ ":target_defaults" ]
+ all_dependent_pkg_deps = [
+ "protobuf",
+ "system_api",
+ ]
+ sources = [
+ "client.cc",
+ ]
+ sources += util_sources
+}
+
+executable("arc-networkd") {
+ sources = [
+ "main.cc",
+ ]
+ configs += [ ":target_defaults" ]
+ deps = [
+ ":libarcnetwork",
+ ]
+}
+
+if (use.fuzzer) {
+ pkg_config("fuzzing_config") {
+ pkg_deps = [ "libchrome-test-${libbase_ver}" ]
+ }
+
+ executable("multicast_forwarder_fuzzer") {
+ configs += [
+ "//common-mk/common_fuzzer",
+ ":target_defaults",
+ ":fuzzing_config",
+ ]
+ sources = [
+ "multicast_forwarder_fuzzer.cc",
+ ]
+ deps = [
+ ":libarcnetwork",
+ ]
+ }
+
+ executable("ndproxy_fuzzer") {
+ configs += [
+ "//common-mk/common_fuzzer",
+ ":target_defaults",
+ ":fuzzing_config",
+ ]
+ sources = [
+ "ndproxy_fuzzer.cc",
+ ]
+ deps = [
+ ":libarcnetwork",
+ ]
+ }
+
+ executable("datapath_fuzzer") {
+ configs += [
+ "//common-mk/common_fuzzer",
+ ":target_defaults",
+ ":fuzzing_config",
+ ]
+ sources = [
+ "datapath_fuzzer.cc",
+ ]
+ deps = [
+ ":libarcnetwork",
+ ]
+ }
+}
+
+if (use.test) {
+ pkg_config("test_config") {
+ pkg_deps = [ "libchrome-test-${libbase_ver}" ]
+ }
+
+ executable("arc_network_testrunner") {
+ sources = [
+ "address_manager_test.cc",
+ "arc_service_test.cc",
+ "client_test.cc",
+ "datapath_test.cc",
+ "mac_address_generator_test.cc",
+ "minijailed_process_runner_test.cc",
+ "ndproxy_test.cc",
+ "net_util_test.cc",
+ "routing_service_test.cc",
+ "shill_client_test.cc",
+ "subnet_pool_test.cc",
+ "subnet_test.cc",
+ ]
+ configs += [
+ "//common-mk:test",
+ ":target_defaults",
+ ":test_config",
+ ]
+ defines = [ "UNIT_TEST" ]
+ deps = [
+ ":libarcnetwork",
+ ":libpatchpanel-client",
+ "//common-mk/testrunner",
+ ]
+ }
+}