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_if_config") { 18 # header file path 19 include_dirs = [ 20 "$INNERKITS_ROOT/include", 21 "$INNERKITS_ROOT/netpolicyclient/include", 22 "$INNERKITS_ROOT/netconnclient/include", 23 "$NETSYSNATIVE_SOURCE_DIR/include/netsys", 24 ] 25 26 cflags = [] 27 if (is_double_framework) { 28 cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] 29 } 30 if (target_cpu == "arm") { 31 cflags += [ "-DBINDER_IPC_32BIT" ] 32 } 33 if (is_standard_system) { 34 cflags += [ "-DCONFIG_STANDARD_SYSTEM" ] 35 } 36 if (defined(build_public_version) && build_public_version) { 37 cflags += [ "-DBUILD_PUBLIC_VERSION" ] 38 } 39 40 cflags += common_cflags 41 cflags_cc = common_cflags 42} 43 44ohos_source_set("net_policy_parcel") { 45 sources = [ 46 "$NETPOLICYMANAGER_INNERKITS_SOURCE_DIR/src/net_access_policy.cpp", 47 "$NETPOLICYMANAGER_INNERKITS_SOURCE_DIR/src/net_quota_policy.cpp", 48 ] 49 50 deps = [ "$NETMANAGER_BASE_ROOT/utils:net_manager_common" ] 51 52 sanitize = { 53 cfi = true 54 cfi_cross_dso = true 55 debug = false 56 } 57 58 branch_protector_ret = "pac_ret" 59 60 external_deps = [ "c_utils:utils" ] 61 external_deps += [ "hilog:libhilog" ] 62 63 part_name = "netmanager_base" 64 subsystem_name = "communication" 65} 66 67ohos_shared_library("net_policy_manager_if") { 68 sanitize = { 69 cfi = true 70 cfi_cross_dso = true 71 boundary_sanitize = true 72 all_ubsan = true 73 debug = false 74 } 75 76 branch_protector_ret = "pac_ret" 77 78 include_dirs = [ "$NETMANAGER_BASE_ROOT/utils/common_utils/include" ] 79 80 sources = [ 81 "$NETPOLICYMANAGER_INNERKITS_SOURCE_DIR/src/net_policy_callback_stub.cpp", 82 "$NETPOLICYMANAGER_INNERKITS_SOURCE_DIR/src/net_policy_client.cpp", 83 "$NETPOLICYMANAGER_INNERKITS_SOURCE_DIR/src/net_policy_service_proxy.cpp", 84 ] 85 86 version_script = "libnetpolicy_kits.map" 87 88 public_configs = [ ":net_policy_manager_if_config" ] 89 90 deps = [ ":net_policy_parcel" ] 91 92 external_deps = [ 93 "bounds_checking_function:libsec_shared", 94 "bundle_framework:appexecfwk_base", 95 "bundle_framework:appexecfwk_core", 96 "c_utils:utils", 97 "ipc:ipc_single", 98 "samgr:samgr_proxy", 99 ] 100 101 defines = [ 102 "NETMGR_LOG_TAG = \"NetPolicyManager\"", 103 "LOG_DOMAIN = 0xD0015B0", 104 ] 105 106 if (enable_netmgr_debug) { 107 defines += [ "NETMGR_DEBUG" ] 108 } 109 110 external_deps += [ "hilog:libhilog" ] 111 112 innerapi_tags = [ "platformsdk" ] 113 part_name = "netmanager_base" 114 subsystem_name = "communication" 115} 116