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} 49 50ohos_source_set("net_native_parcel") { 51 sanitize = { 52 cfi = true 53 cfi_cross_dso = true 54 debug = false 55 } 56 57 branch_protector_ret = "pac_ret" 58 59 sources = [ 60 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/dhcp_result_parcel.cpp", 61 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/uid_range.cpp", 62 ] 63 64 if (netmanager_base_enable_feature_net_firewall) { 65 sources += [ "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/netfirewall_parcel.cpp" ] 66 } 67 68 include_dirs = [ "$INNERKITS_ROOT/netmanagernative/include" ] 69 70 deps = [ "$NETMANAGER_BASE_ROOT/utils:net_manager_common" ] 71 external_deps = [ "c_utils:utils" ] 72 external_deps += [ "hilog:libhilog" ] 73 74 part_name = "netmanager_base" 75 subsystem_name = "communication" 76} 77 78ohos_shared_library("net_native_manager_if") { 79 sanitize = { 80 cfi = true 81 cfi_cross_dso = true 82 debug = false 83 } 84 85 branch_protector_ret = "pac_ret" 86 87 cflags = [ 88 "-fstack-protector-strong", 89 "-D_FORTIFY_SOURCE=2", 90 "-O2", 91 ] 92 93 cflags_cc = [ 94 "-fstack-protector-strong", 95 "-D_FORTIFY_SOURCE=2", 96 "-O2", 97 ] 98 sources = [ 99 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/net_diag_callback_stub.cpp", 100 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/netsys_native_service_proxy.cpp", 101 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/netsys_net_diag_data.cpp", 102 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/notify_callback_proxy.cpp", 103 ] 104 105 include_dirs = [ 106 "$NETMANAGER_BASE_ROOT/utils/log/include", 107 "$NETSYSCONTROLLER_ROOT_DIR/include/", 108 ] 109 110 public_configs = [ ":net_native_manager_if_config" ] 111 112 if (netmanager_base_enable_feature_net_firewall) { 113 sources += [ 114 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/netfirewall_callback_proxy.cpp", 115 "$NETSYSNATIVE_SOURCE_DIR/src/netfirewall_callback_stub.cpp", 116 ] 117 118 public_configs += [ "$NETMANAGER_BASE_ROOT/resource:coverage_flags" ] 119 } 120 121 deps = [ 122 ":net_native_parcel", 123 "$INNERKITS_ROOT/netstatsclient:net_stats_manager_if", 124 "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller", 125 ] 126 127 external_deps = [ 128 "bounds_checking_function:libsec_shared", 129 "c_utils:utils", 130 "ipc:ipc_single", 131 "samgr:samgr_proxy", 132 ] 133 134 defines = [ 135 "NETMGR_LOG_TAG = \"NetNativeMnager\"", 136 "LOG_DOMAIN = 0xD0015B0", 137 ] 138 139 if (enable_netmgr_debug) { 140 defines += [ "NETMGR_DEBUG" ] 141 } 142 143 external_deps += [ "hilog:libhilog" ] 144 145 innerapi_tags = [ "platformsdk" ] 146 part_name = "netmanager_base" 147 subsystem_name = "communication" 148} 149