1b1b8bc3fSopenharmony_ci# Copyright (c) 2021-2024 Huawei Device Co., Ltd. 2b1b8bc3fSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 3b1b8bc3fSopenharmony_ci# you may not use this file except in compliance with the License. 4b1b8bc3fSopenharmony_ci# You may obtain a copy of the License at 5b1b8bc3fSopenharmony_ci# 6b1b8bc3fSopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 7b1b8bc3fSopenharmony_ci# 8b1b8bc3fSopenharmony_ci# Unless required by applicable law or agreed to in writing, software 9b1b8bc3fSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 10b1b8bc3fSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11b1b8bc3fSopenharmony_ci# See the License for the specific language governing permissions and 12b1b8bc3fSopenharmony_ci# limitations under the License. 13b1b8bc3fSopenharmony_ci 14b1b8bc3fSopenharmony_ciimport("//build/ohos.gni") 15b1b8bc3fSopenharmony_ciimport("//foundation/communication/netmanager_base/netmanager_base_config.gni") 16b1b8bc3fSopenharmony_ciconfig("netsys_controller_include") { 17b1b8bc3fSopenharmony_ci include_dirs = [ 18b1b8bc3fSopenharmony_ci "include", 19b1b8bc3fSopenharmony_ci "$NETSYSNATIVE_SOURCE_DIR/include/netsys", 20b1b8bc3fSopenharmony_ci "$INNERKITS_ROOT/netstatsclient/include", 21b1b8bc3fSopenharmony_ci ] 22b1b8bc3fSopenharmony_ci 23b1b8bc3fSopenharmony_ci cflags = [ 24b1b8bc3fSopenharmony_ci "-fstack-protector-strong", 25b1b8bc3fSopenharmony_ci "-D_FORTIFY_SOURCE=2", 26b1b8bc3fSopenharmony_ci "-O2", 27b1b8bc3fSopenharmony_ci ] 28b1b8bc3fSopenharmony_ci 29b1b8bc3fSopenharmony_ci cflags_cc = [ 30b1b8bc3fSopenharmony_ci "-fstack-protector-strong", 31b1b8bc3fSopenharmony_ci "-D_FORTIFY_SOURCE=2", 32b1b8bc3fSopenharmony_ci "-O2", 33b1b8bc3fSopenharmony_ci ] 34b1b8bc3fSopenharmony_ci 35b1b8bc3fSopenharmony_ci if (netmanager_base_enable_feature_sysvpn) { 36b1b8bc3fSopenharmony_ci cflags += [ "-DSUPPORT_SYSVPN" ] 37b1b8bc3fSopenharmony_ci cflags_cc += [ "-DSUPPORT_SYSVPN" ] 38b1b8bc3fSopenharmony_ci } 39b1b8bc3fSopenharmony_ci} 40b1b8bc3fSopenharmony_ci 41b1b8bc3fSopenharmony_ciohos_shared_library("netsys_controller") { 42b1b8bc3fSopenharmony_ci sanitize = { 43b1b8bc3fSopenharmony_ci cfi = true 44b1b8bc3fSopenharmony_ci cfi_cross_dso = true 45b1b8bc3fSopenharmony_ci boundary_sanitize = true 46b1b8bc3fSopenharmony_ci ubsan = true 47b1b8bc3fSopenharmony_ci debug = false 48b1b8bc3fSopenharmony_ci } 49b1b8bc3fSopenharmony_ci 50b1b8bc3fSopenharmony_ci branch_protector_ret = "pac_ret" 51b1b8bc3fSopenharmony_ci 52b1b8bc3fSopenharmony_ci public_configs = [ ":netsys_controller_include" ] 53b1b8bc3fSopenharmony_ci sources = [ 54b1b8bc3fSopenharmony_ci "src/mock_netsys_native_client.cpp", 55b1b8bc3fSopenharmony_ci "src/netsys_controller.cpp", 56b1b8bc3fSopenharmony_ci "src/netsys_controller_service_impl.cpp", 57b1b8bc3fSopenharmony_ci "src/netsys_native_client.cpp", 58b1b8bc3fSopenharmony_ci ] 59b1b8bc3fSopenharmony_ci 60b1b8bc3fSopenharmony_ci include_dirs = [ 61b1b8bc3fSopenharmony_ci "include", 62b1b8bc3fSopenharmony_ci "$NETCONNMANAGER_SOURCE_DIR/include", 63b1b8bc3fSopenharmony_ci "$NETCONNMANAGER_COMMON_DIR/include", 64b1b8bc3fSopenharmony_ci "$NETMANAGER_BASE_ROOT/utils/log/include", 65b1b8bc3fSopenharmony_ci "$NETSYSNATIVE_INNERKITS_SOURCE_DIR", 66b1b8bc3fSopenharmony_ci "$INNERKITS_ROOT/netmanagernative/include", 67b1b8bc3fSopenharmony_ci "$INNERKITS_ROOT/netconnclient/include", 68b1b8bc3fSopenharmony_ci "$NETMANAGER_BASE_ROOT/utils/common_utils/include", 69b1b8bc3fSopenharmony_ci "$NETSYSNATIVE_SOURCE_DIR/include/netsys", 70b1b8bc3fSopenharmony_ci "$NETSYSNATIVE_SOURCE_DIR/include/manager", 71b1b8bc3fSopenharmony_ci ] 72b1b8bc3fSopenharmony_ci 73b1b8bc3fSopenharmony_ci deps = [ 74b1b8bc3fSopenharmony_ci "$NETMANAGER_BASE_ROOT/services/netmanagernative:netsys_native_manager", 75b1b8bc3fSopenharmony_ci "$NETMANAGER_BASE_ROOT/utils:net_manager_common", 76b1b8bc3fSopenharmony_ci ] 77b1b8bc3fSopenharmony_ci 78b1b8bc3fSopenharmony_ci external_deps = [ 79b1b8bc3fSopenharmony_ci "c_utils:utils", 80b1b8bc3fSopenharmony_ci "ipc:ipc_core", 81b1b8bc3fSopenharmony_ci "samgr:samgr_proxy", 82b1b8bc3fSopenharmony_ci ] 83b1b8bc3fSopenharmony_ci 84b1b8bc3fSopenharmony_ci defines = [ 85b1b8bc3fSopenharmony_ci "NETMGR_LOG_TAG = \"NetConnManager\"", 86b1b8bc3fSopenharmony_ci "LOG_DOMAIN = 0xD0015B0", 87b1b8bc3fSopenharmony_ci ] 88b1b8bc3fSopenharmony_ci 89b1b8bc3fSopenharmony_ci if (enable_netmgr_debug) { 90b1b8bc3fSopenharmony_ci defines += [ "NETMGR_DEBUG" ] 91b1b8bc3fSopenharmony_ci } 92b1b8bc3fSopenharmony_ci 93b1b8bc3fSopenharmony_ci if (enable_sys_func) { 94b1b8bc3fSopenharmony_ci defines += [ "SYS_FUNC" ] 95b1b8bc3fSopenharmony_ci } 96b1b8bc3fSopenharmony_ci 97b1b8bc3fSopenharmony_ci if (netmanager_base_enable_feature_wearable_distributed_net) { 98b1b8bc3fSopenharmony_ci defines += [ "FEATURE_WEARABLE_DISTRIBUTED_NET_ENABLE" ] 99b1b8bc3fSopenharmony_ci } 100b1b8bc3fSopenharmony_ci 101b1b8bc3fSopenharmony_ci if (netmanager_base_enable_feature_net_firewall) { 102b1b8bc3fSopenharmony_ci defines += [ "FEATURE_NET_FIREWALL_ENABLE" ] 103b1b8bc3fSopenharmony_ci } 104b1b8bc3fSopenharmony_ci 105b1b8bc3fSopenharmony_ci external_deps += [ "hilog:libhilog" ] 106b1b8bc3fSopenharmony_ci 107b1b8bc3fSopenharmony_ci innerapi_tags = [ "platformsdk_indirect" ] 108b1b8bc3fSopenharmony_ci part_name = "netmanager_base" 109b1b8bc3fSopenharmony_ci subsystem_name = "communication" 110b1b8bc3fSopenharmony_ci} 111