1# Copyright (c) 2021-2024 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 ] 30} 31 32ohos_shared_library("net_policy_manager") { 33 sanitize = { 34 cfi = true 35 cfi_cross_dso = true 36 debug = false 37 } 38 39 branch_protector_ret = "pac_ret" 40 41 sources = [ 42 "src/common/net_policy_event_handler.cpp", 43 "src/common/net_policy_file_event_handler.cpp", 44 "src/common/net_policy_service_common.cpp", 45 "src/common/netsys_policy_wrapper.cpp", 46 "src/core/net_policy_base.cpp", 47 "src/core/net_policy_callback.cpp", 48 "src/core/net_policy_core.cpp", 49 "src/core/net_policy_file.cpp", 50 "src/core/net_policy_firewall.cpp", 51 "src/core/net_policy_rule.cpp", 52 "src/core/net_policy_traffic.cpp", 53 "src/firewall_rule/device_idle_firewall_rule.cpp", 54 "src/firewall_rule/firewall_rule.cpp", 55 "src/firewall_rule/power_save_firewall_rule.cpp", 56 "src/net_access_policy_database.cpp", 57 "src/net_policy_listener.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 ] 72 73 cflags = [ 74 "-fvisibility=hidden", 75 "-fdata-sections", 76 "-ffunction-sections", 77 "-Os", 78 "-fstack-protector-strong", 79 "-D_FORTIFY_SOURCE=2", 80 "-O2", 81 ] 82 83 cflags_cc = [ 84 "-fvisibility-inlines-hidden", 85 "-Os", 86 "-fstack-protector-strong", 87 "-D_FORTIFY_SOURCE=2", 88 "-O2", 89 ] 90 91 ldflags = [ 92 "-Wl,--exclude-libs=ALL", 93 "-Wl,--gc-sections", 94 ] 95 96 external_deps = [ 97 "ability_base:want", 98 "ability_runtime:app_manager", 99 "bundle_framework:appexecfwk_base", 100 "bundle_framework:appexecfwk_core", 101 "cJSON:cjson", 102 "c_utils:utils", 103 "common_event_service:cesfwk_innerkits", 104 "eventhandler:libeventhandler", 105 "ffrt:libffrt", 106 "hitrace:hitrace_meter", 107 "ipc:ipc_core", 108 "relational_store:native_rdb", 109 "safwk:system_ability_fwk", 110 "samgr:samgr_proxy", 111 ] 112 113 defines = [ 114 "NETMGR_LOG_TAG = \"NetPolicyService\"", 115 "LOG_DOMAIN = 0xD0015B0", 116 ] 117 118 if (enable_netmgr_debug) { 119 defines += [ "NETMGR_DEBUG" ] 120 } 121 122 external_deps += [ "hilog:libhilog" ] 123 124 part_name = "netmanager_base" 125 subsystem_name = "communication" 126} 127 128ohos_static_library("net_policy_manager_static") { 129 testonly = true 130 sanitize = { 131 cfi = true 132 cfi_cross_dso = true 133 debug = false 134 } 135 136 branch_protector_ret = "pac_ret" 137 138 sources = [ 139 "src/common/net_policy_event_handler.cpp", 140 "src/common/net_policy_file_event_handler.cpp", 141 "src/common/net_policy_service_common.cpp", 142 "src/common/netsys_policy_wrapper.cpp", 143 "src/core/net_policy_base.cpp", 144 "src/core/net_policy_callback.cpp", 145 "src/core/net_policy_core.cpp", 146 "src/core/net_policy_file.cpp", 147 "src/core/net_policy_firewall.cpp", 148 "src/core/net_policy_rule.cpp", 149 "src/core/net_policy_traffic.cpp", 150 "src/firewall_rule/device_idle_firewall_rule.cpp", 151 "src/firewall_rule/firewall_rule.cpp", 152 "src/firewall_rule/power_save_firewall_rule.cpp", 153 "src/net_access_policy_database.cpp", 154 "src/net_policy_listener.cpp", 155 "src/net_policy_service.cpp", 156 "src/stub/net_policy_callback_proxy.cpp", 157 "src/stub/net_policy_service_stub.cpp", 158 ] 159 160 configs = [ ":net_policy_manager_config" ] 161 162 deps = [ 163 "$INNERKITS_ROOT/netpolicyclient:net_policy_parcel", 164 "$INNERKITS_ROOT/netstatsclient:net_stats_manager_if", 165 "$NETCONNMANAGER_COMMON_DIR:net_service_common", 166 "$NETMANAGER_BASE_ROOT/utils:net_manager_common", 167 "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller", 168 ] 169 170 external_deps = [ 171 "ability_base:want", 172 "ability_runtime:ability_connect_callback_stub", 173 "ability_runtime:app_manager", 174 "bundle_framework:appexecfwk_base", 175 "bundle_framework:appexecfwk_core", 176 "cJSON:cjson", 177 "c_utils:utils", 178 "common_event_service:cesfwk_innerkits", 179 "eventhandler:libeventhandler", 180 "ffrt:libffrt", 181 "hitrace:hitrace_meter", 182 "ipc:ipc_core", 183 "relational_store:native_rdb", 184 "safwk:system_ability_fwk", 185 "samgr:samgr_proxy", 186 ] 187 188 defines = [ 189 "NETMGR_LOG_TAG = \"NetPolicyService\"", 190 "LOG_DOMAIN = 0xD0015B0", 191 ] 192 193 if (enable_netmgr_debug) { 194 defines += [ "NETMGR_DEBUG" ] 195 } 196 197 external_deps += [ "hilog:libhilog" ] 198 199 part_name = "netmanager_base" 200 subsystem_name = "communication" 201} 202 203ohos_shared_library("net_access_policy_dialog") { 204 sanitize = { 205 cfi = true 206 cfi_cross_dso = true 207 debug = false 208 } 209 210 include_dirs = [ 211 "$NETMANAGER_BASE_ROOT/utils/log/include", 212 "include", 213 "include/stub", 214 ] 215 216 sources = [ "src/net_access_policy_dialog_impl.cpp" ] 217 218 defines = [ 219 "NETMGR_LOG_TAG = \"NetPolicyService\"", 220 "LOG_DOMAIN = 0xD0015B0", 221 ] 222 223 if (enable_netmgr_debug) { 224 defines += [ "NETMGR_DEBUG" ] 225 } 226 227 if (is_standard_system) { 228 defines += [ "STANDARD_SYSTEM_ENABLE" ] 229 } 230 231 external_deps = [ 232 "ability_base:base", 233 "ability_base:session_info", 234 "ability_base:want", 235 "ability_runtime:ability_manager", 236 "ability_runtime:abilitykit_native", 237 "ability_runtime:wantagent_innerkits", 238 "c_utils:utils", 239 "hilog:libhilog", 240 "ipc:ipc_core", 241 ] 242 243 part_name = "netmanager_base" 244 subsystem_name = "communication" 245} 246