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