1# Copyright (c) 2023-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_native_manager_if_config") { 18 # header file path 19 include_dirs = [ 20 "$INNERKITS_ROOT/include", 21 "$INNERKITS_ROOT/netstatsclient/include/proxy", 22 "$INNERKITS_ROOT/netstatsclient/include", 23 "$INNERKITS_ROOT/netmanagernative/include", 24 "$INNERKITS_ROOT/netconnclient/include", 25 "$NETSYSNATIVE_SOURCE_DIR/include/netsys", 26 ] 27 28 cflags = [] 29 defines = [] 30 if (is_double_framework) { 31 cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] 32 } 33 if (target_cpu == "arm") { 34 cflags += [ "-DBINDER_IPC_32BIT" ] 35 } 36 if (is_standard_system) { 37 cflags += [ "-DCONFIG_STANDARD_SYSTEM" ] 38 } 39 if (defined(build_public_version) && build_public_version) { 40 cflags += [ "-DBUILD_PUBLIC_VERSION" ] 41 } 42 if (netmanager_base_enable_feature_net_firewall) { 43 defines += [ "FEATURE_NET_FIREWALL_ENABLE" ] 44 } 45 if (netmanager_base_enable_feature_wearable_distributed_net) { 46 defines += [ "FEATURE_WEARABLE_DISTRIBUTED_NET_ENABLE" ] 47 } 48 if (netmanager_base_feature_enterprise_route_custom) { 49 defines += [ "FEATURE_ENTERPRISE_ROUTE_CUSTOM" ] 50 } 51} 52 53ohos_source_set("net_native_parcel") { 54 sanitize = { 55 cfi = true 56 cfi_cross_dso = true 57 debug = false 58 } 59 60 branch_protector_ret = "pac_ret" 61 62 sources = [ 63 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/dhcp_result_parcel.cpp", 64 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/uid_range.cpp", 65 ] 66 67 if (netmanager_base_enable_feature_net_firewall) { 68 sources += [ "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/netfirewall_parcel.cpp" ] 69 } 70 71 include_dirs = [ "$INNERKITS_ROOT/netmanagernative/include" ] 72 73 deps = [ "$NETMANAGER_BASE_ROOT/utils:net_manager_common" ] 74 external_deps = [ "c_utils:utils" ] 75 external_deps += [ "hilog:libhilog" ] 76 77 part_name = "netmanager_base" 78 subsystem_name = "communication" 79} 80 81ohos_shared_library("net_native_manager_if") { 82 sanitize = { 83 cfi = true 84 cfi_cross_dso = true 85 debug = false 86 } 87 88 branch_protector_ret = "pac_ret" 89 90 cflags = common_cflags 91 92 cflags_cc = common_cflags 93 sources = [ 94 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/net_diag_callback_stub.cpp", 95 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/netsys_native_service_proxy.cpp", 96 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/netsys_net_diag_data.cpp", 97 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/notify_callback_proxy.cpp", 98 ] 99 100 include_dirs = [ 101 "$NETMANAGER_BASE_ROOT/utils/common_utils/include", 102 "$NETSYSCONTROLLER_ROOT_DIR/include/", 103 ] 104 105 public_configs = [ ":net_native_manager_if_config" ] 106 107 if (netmanager_base_enable_feature_net_firewall) { 108 sources += [ 109 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/netfirewall_callback_proxy.cpp", 110 "$NETSYSNATIVE_SOURCE_DIR/src/netfirewall_callback_stub.cpp", 111 ] 112 113 public_configs += [ "$NETMANAGER_BASE_ROOT/resource:coverage_flags" ] 114 } 115 116 deps = [ 117 ":net_native_parcel", 118 "$INNERKITS_ROOT/netstatsclient:net_stats_manager_if", 119 "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller", 120 ] 121 122 external_deps = [ 123 "bounds_checking_function:libsec_shared", 124 "c_utils:utils", 125 "ipc:ipc_single", 126 "samgr:samgr_proxy", 127 ] 128 129 defines = [ 130 "NETMGR_LOG_TAG = \"NetNativeMnager\"", 131 "LOG_DOMAIN = 0xD0015B0", 132 ] 133 134 if (enable_netmgr_debug) { 135 defines += [ "NETMGR_DEBUG" ] 136 } 137 138 external_deps += [ "hilog:libhilog" ] 139 140 innerapi_tags = [ "platformsdk" ] 141 part_name = "netmanager_base" 142 subsystem_name = "communication" 143} 144