1# Copyright (c) 2021-2023 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/ohos.gni") 15import("//foundation/communication/netmanager_base/netmanager_base_config.gni") 16 17config("net_policy_manager_config") { 18 include_dirs = [ 19 "$INNERKITS_ROOT/include", 20 "$INNERKITS_ROOT/netpolicyclient/include", 21 "$INNERKITS_ROOT/netpolicyclient/include/proxy", 22 "$INNERKITS_ROOT/netconnclient/include", 23 "$NETCONNMANAGER_COMMON_DIR/include", 24 "$NETMANAGER_BASE_ROOT/utils/log/include", 25 "include", 26 "include/stub", 27 "$NETSYSCONTROLLER_ROOT_DIR/include", 28 "$NETSYSNATIVE_SOURCE_DIR/include/netsys", 29 "$SAMGR_MANAGER_ROOT/interfaces/innerkits/samgr_proxy/include", 30 ] 31} 32 33ohos_shared_library("net_policy_manager") { 34 sanitize = { 35 cfi = true 36 cfi_cross_dso = true 37 boundary_sanitize = true 38 all_ubsan = true 39 blocklist = "./policy_blocklist.txt" 40 debug = false 41 } 42 43 sources = [ 44 "src/common/net_policy_event_handler.cpp", 45 "src/common/net_policy_file_event_handler.cpp", 46 "src/common/net_policy_service_common.cpp", 47 "src/common/netsys_policy_wrapper.cpp", 48 "src/core/net_policy_base.cpp", 49 "src/core/net_policy_callback.cpp", 50 "src/core/net_policy_core.cpp", 51 "src/core/net_policy_file.cpp", 52 "src/core/net_policy_firewall.cpp", 53 "src/core/net_policy_rule.cpp", 54 "src/core/net_policy_traffic.cpp", 55 "src/firewall_rule/device_idle_firewall_rule.cpp", 56 "src/firewall_rule/firewall_rule.cpp", 57 "src/firewall_rule/power_save_firewall_rule.cpp", 58 "src/net_policy_service.cpp", 59 "src/stub/net_policy_callback_proxy.cpp", 60 "src/stub/net_policy_service_stub.cpp", 61 ] 62 63 configs = [ ":net_policy_manager_config" ] 64 65 deps = [ 66 "$INNERKITS_ROOT/netpolicyclient:net_policy_parcel", 67 "$INNERKITS_ROOT/netstatsclient:net_stats_manager_if", 68 "$NETCONNMANAGER_COMMON_DIR:net_service_common", 69 "$NETMANAGER_BASE_ROOT/utils:net_manager_common", 70 "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller", 71 "$THIRD_PARTY_ROOT/jsoncpp:jsoncpp", 72 ] 73 74 cflags = [ 75 "-fvisibility=hidden", 76 "-fdata-sections", 77 "-ffunction-sections", 78 "-Os", 79 ] 80 81 cflags_cc = [ 82 "-fvisibility-inlines-hidden", 83 "-Os", 84 ] 85 86 ldflags = [ 87 "-Wl,--exclude-libs=ALL", 88 "-Wl,--gc-sections", 89 ] 90 91 external_deps = [ 92 "ability_base:want", 93 "ability_runtime:app_manager", 94 "common_event_service:cesfwk_innerkits", 95 "eventhandler:libeventhandler", 96 "hitrace:hitrace_meter", 97 "ipc:ipc_core", 98 "safwk:system_ability_fwk", 99 ] 100 101 defines = [ 102 "NETMGR_LOG_TAG = \"NetPolicyService\"", 103 "LOG_DOMAIN = 0xD0015B0", 104 ] 105 106 if (enable_netmgr_debug) { 107 defines += [ "NETMGR_DEBUG" ] 108 } 109 110 external_deps += [ "hilog:libhilog" ] 111 112 part_name = "netmanager_base" 113 subsystem_name = "communication" 114} 115 116ohos_static_library("net_policy_manager_static") { 117 testonly = true 118 sanitize = { 119 cfi = true 120 cfi_cross_dso = true 121 debug = false 122 } 123 sources = [ 124 "src/common/net_policy_event_handler.cpp", 125 "src/common/net_policy_file_event_handler.cpp", 126 "src/common/net_policy_service_common.cpp", 127 "src/common/netsys_policy_wrapper.cpp", 128 "src/core/net_policy_base.cpp", 129 "src/core/net_policy_callback.cpp", 130 "src/core/net_policy_core.cpp", 131 "src/core/net_policy_file.cpp", 132 "src/core/net_policy_firewall.cpp", 133 "src/core/net_policy_rule.cpp", 134 "src/core/net_policy_traffic.cpp", 135 "src/firewall_rule/device_idle_firewall_rule.cpp", 136 "src/firewall_rule/firewall_rule.cpp", 137 "src/firewall_rule/power_save_firewall_rule.cpp", 138 "src/net_policy_service.cpp", 139 "src/stub/net_policy_callback_proxy.cpp", 140 "src/stub/net_policy_service_stub.cpp", 141 ] 142 143 configs = [ ":net_policy_manager_config" ] 144 145 deps = [ 146 "$INNERKITS_ROOT/netpolicyclient:net_policy_parcel", 147 "$INNERKITS_ROOT/netstatsclient:net_stats_manager_if", 148 "$NETCONNMANAGER_COMMON_DIR:net_service_common", 149 "$NETMANAGER_BASE_ROOT/utils:net_manager_common", 150 "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller", 151 "$THIRD_PARTY_ROOT/jsoncpp:jsoncpp", 152 ] 153 154 external_deps = [ 155 "ability_base:want", 156 "ability_runtime:app_manager", 157 "c_utils:utils", 158 "common_event_service:cesfwk_innerkits", 159 "eventhandler:libeventhandler", 160 "hitrace:hitrace_meter", 161 "ipc:ipc_core", 162 "safwk:system_ability_fwk", 163 ] 164 165 defines = [ 166 "NETMGR_LOG_TAG = \"NetPolicyService\"", 167 "LOG_DOMAIN = 0xD0015B0", 168 ] 169 170 if (enable_netmgr_debug) { 171 defines += [ "NETMGR_DEBUG" ] 172 } 173 174 external_deps += [ "hilog:libhilog" ] 175 176 part_name = "netmanager_base" 177 subsystem_name = "communication" 178} 179