1# Copyright (c) 2022-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("policy_config") { 18 visibility = [ ":policy" ] 19 20 include_dirs = [ 21 "include", 22 ] 23 24 cflags = [ 25 "-Wall", 26 "-Werror", 27 "-g3", 28 "-fstack-protector-strong", 29 "-D_FORTIFY_SOURCE=2", 30 "-O2", 31 ] 32 33 cflags_cc = [ 34 "-fstack-protector-strong", 35 "-D_FORTIFY_SOURCE=2", 36 "-O2", 37 ] 38} 39 40ohos_shared_library("policy") { 41 sanitize = { 42 cfi = true 43 cfi_cross_dso = true 44 boundary_sanitize = true 45 all_ubsan = true 46 debug = false 47 } 48 49 branch_protector_ret = "pac_ret" 50 51 sources = [ 52 "src/get_net_quota_policies_context.cpp", 53 "src/get_network_access_policy_context.cpp", 54 "src/get_policy_by_uid_context.cpp", 55 "src/get_uids_by_policy_context.cpp", 56 "src/is_uid_net_allowed_context.cpp", 57 "src/net_policy_callback_observer.cpp", 58 "src/netpolicy_async_work.cpp", 59 "src/netpolicy_exec.cpp", 60 "src/netpolicy_module.cpp", 61 "src/policy_observer_wrapper.cpp", 62 "src/restore_all_policies_context.cpp", 63 "src/set_bg_policy_context.cpp", 64 "src/set_device_idle_allow_list_context.cpp", 65 "src/set_net_quota_policies_context.cpp", 66 "src/set_network_access_policy_context.cpp", 67 "src/set_policy_by_uid_context.cpp", 68 "src/set_power_save_allow_list_context.cpp", 69 "src/update_remind_policy_context.cpp", 70 ] 71 72 configs = [ ":policy_config" ] 73 74 deps = [ 75 "$INNERKITS_ROOT/netpolicyclient:net_policy_manager_if", 76 "$NETMANAGER_BASE_ROOT/utils:net_manager_common", 77 "$NETMANAGER_BASE_ROOT/utils/napi_utils:napi_utils", 78 ] 79 80 external_deps = [ 81 "c_utils:utils", 82 "hilog:libhilog", 83 "ipc:ipc_core", 84 "napi:ace_napi", 85 ] 86 relative_install_dir = "module/net" 87 part_name = "netmanager_base" 88 89 subsystem_name = "communication" 90} 91