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_conn_manager_if_config") { 18 # header file path 19 include_dirs = [ 20 "$INNERKITS_ROOT/netconnclient/include", 21 "$INNERKITS_ROOT/netconnclient/include/proxy", 22 "$INNERKITS_ROOT/include", 23 "$NETMANAGER_BASE_ROOT/services/netsyscontroller/include", 24 "$NETMANAGER_BASE_ROOT/services/netmanagernative/include/netsys", 25 "$NETMANAGER_BASE_ROOT/interfaces/innerkits/netstatsclient/include", 26 ] 27 28 cflags = [] 29 if (is_double_framework) { 30 cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] 31 } 32 if (target_cpu == "arm") { 33 cflags += [ "-DBINDER_IPC_32BIT" ] 34 } 35 if (is_standard_system) { 36 cflags += [ "-DCONFIG_STANDARD_SYSTEM" ] 37 } 38 if (defined(build_public_version) && build_public_version) { 39 cflags += [ "-DBUILD_PUBLIC_VERSION" ] 40 } 41} 42 43ohos_static_library("net_conn_parcel") { 44 sources = [ 45 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/http_proxy.cpp", 46 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/inet_addr.cpp", 47 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/net_all_capabilities.cpp", 48 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/net_interface_config.cpp", 49 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/net_link_info.cpp", 50 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/net_specifier.cpp", 51 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/net_supplier_info.cpp", 52 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/route.cpp", 53 ] 54 sanitize = { 55 cfi = true 56 cfi_cross_dso = true 57 debug = false 58 } 59 60 branch_protector_ret = "pac_ret" 61 62 include_dirs = [ 63 "$INNERKITS_ROOT/netmanagernative/include", 64 "$NETSYSNATIVE_SOURCE_DIR/include/netsys", 65 ] 66 67 if (netmanager_base_enable_feature_wearable_distributed_net) { 68 defines = [ "FEATURE_WEARABLE_DISTRIBUTED_NET_ENABLE" ] 69 } 70 71 deps = [ "$NETMANAGER_BASE_ROOT/utils:net_manager_common" ] 72 73 external_deps = [ "c_utils:utils" ] 74 external_deps += [ "hilog:libhilog" ] 75 76 part_name = "netmanager_base" 77 subsystem_name = "communication" 78} 79 80ohos_shared_library("net_conn_manager_if") { 81 cflags = common_cflags 82 83 cflags_cc = common_cflags 84 85 branch_protector_ret = "pac_ret" 86 87 sources = [ 88 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/net_conn_client.cpp", 89 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/net_handle.cpp", 90 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/net_supplier_callback_base.cpp", 91 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/proxy/net_conn_callback_stub.cpp", 92 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/proxy/net_conn_service_proxy.cpp", 93 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/proxy/net_conn_service_pac_proxy_helper.cpp", 94 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/proxy/net_detection_callback_stub.cpp", 95 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/proxy/net_factoryreset_callback_stub.cpp", 96 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/proxy/net_interface_callback_stub.cpp", 97 "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/proxy/net_supplier_callback_stub.cpp", 98 ] 99 100 include_dirs = [ 101 "$INNERKITS_ROOT/netmanagernative/include", 102 "$NETMANAGERNATIVE_ROOT/fwmarkclient/include", 103 "$NETMANAGER_BASE_ROOT/utils/bundle_utils/include", 104 "$NETMANAGER_BASE_ROOT/utils/common_utils/include", 105 ] 106 107 version_script = "libnetconn_kits.map" 108 109 public_configs = [ ":net_conn_manager_if_config" ] 110 111 deps = [ 112 ":net_conn_parcel", 113 "$NETMANAGER_BASE_ROOT/services/netmanagernative/fwmarkclient:fwmark_client", 114 ] 115 116 external_deps = [ 117 "bounds_checking_function:libsec_shared", 118 "c_utils:utils", 119 "samgr:samgr_proxy", 120 ] 121 public_external_deps = [ "ipc:ipc_core" ] 122 123 defines = [ 124 "NETMGR_LOG_TAG = \"NetConnManager\"", 125 "LOG_DOMAIN = 0xD0015B0", 126 ] 127 128 if (netmanager_base_enable_feature_wearable_distributed_net) { 129 defines += [ "FEATURE_WEARABLE_DISTRIBUTED_NET_ENABLE" ] 130 } 131 if (enable_netmgr_debug) { 132 defines += [ "NETMGR_DEBUG" ] 133 } 134 135 external_deps += [ "hilog:libhilog" ] 136 137 innerapi_tags = [ 138 "platformsdk", 139 "sasdk", 140 ] 141 part_name = "netmanager_base" 142 subsystem_name = "communication" 143} 144 145config("socket_permission_config") { 146 include_dirs = [ "$INNERKITS_ROOT/netconnclient/include" ] 147} 148 149ohos_shared_library("socket_permission") { 150 cflags = common_cflags 151 152 cflags_cc = common_cflags 153 154 branch_protector_ret = "pac_ret" 155 156 sources = [ "$NETCONNMANAGER_INNERKITS_SOURCE_DIR/src/socket_permission.cpp" ] 157 deps = [ "$INNERKITS_ROOT/netconnclient:net_conn_manager_if" ] 158 public_configs = [ ":socket_permission_config" ] 159 external_deps = [ 160 "c_utils:utils", 161 "ipc:ipc_core", 162 "samgr:samgr_proxy", 163 ] 164 part_name = "netmanager_base" 165 subsystem_name = "communication" 166} 167 168config("net_security_config_if_config") { 169 include_dirs = [ 170 "include", 171 ] 172} 173 174ohos_shared_library("net_security_config_if") { 175 cflags = common_cflags 176 cflags_cc = common_cflags 177 sanitize = { 178 cfi = true 179 cfi_cross_dso = true 180 debug = false 181 } 182 183 sources = [ 184 "$NETMANAGER_BASE_ROOT/frameworks/js/napi/netpolicy/src/network_security_config.cpp", 185 ] 186 187 public_configs = [ 188 ":net_security_config_if_config", 189 ] 190 191 deps = [ "$NETMANAGER_BASE_ROOT/utils:net_manager_common" ] 192 193 external_deps = [ 194 "bounds_checking_function:libsec_shared", 195 "cJSON:cjson", 196 "openssl:libcrypto_shared", 197 "openssl:libssl_shared", 198 "hilog:libhilog", 199 ] 200 201 defines = [ 202 "NETMGR_LOG_TAG = \"NetConnManager\"", 203 "LOG_DOMAIN = 0xD0015B0", 204 ] 205 206 innerapi_tags = [ 207 "platformsdk", 208 "sasdk", 209 ] 210 if (enable_netmgr_debug) { 211 defines += [ "NETMGR_DEBUG" ] 212 } 213 part_name = "netmanager_base" 214 subsystem_name = "communication" 215}