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_config") {
18  include_dirs = [
19    "include",
20    "include/stub",
21    "$INNERKITS_ROOT/include",
22    "$INNERKITS_ROOT/netconnclient/include",
23    "$INNERKITS_ROOT/netconnclient/include/proxy",
24    "$INNERKITS_ROOT/netmanagernative/include",
25    "$INNERKITS_ROOT/netstatsclient/include",
26    "$NETCONNMANAGER_COMMON_DIR/include",
27    "$NETSYSNATIVE_SOURCE_DIR/include/netsys",
28    "$NETSYSCONTROLLER_ROOT_DIR/include",
29    "$NETMANAGER_BASE_ROOT/utils/common_utils/include",
30    "$NETMANAGER_BASE_ROOT/services/netmanagernative/fwmarkclient/include",
31    "$INNERKITS_ROOT/netmanagernative/include",
32  ]
33}
34
35ohos_shared_library("net_conn_manager") {
36  sanitize = {
37    cfi = true
38    cfi_cross_dso = true
39    debug = false
40  }
41
42  branch_protector_ret = "pac_ret"
43
44  sources = [
45    "$NETCONNMANAGER_COMMON_DIR/src/route_utils.cpp",
46    "src/dns_result_call_back.cpp",
47    "src/nat464_service.cpp",
48    "src/net_activate.cpp",
49    "src/net_caps.cpp",
50    "src/net_conn_event_handler.cpp",
51    "src/net_conn_service.cpp",
52    "src/net_conn_service_iface.cpp",
53    "src/net_datashare_utils.cpp",
54    "src/net_factoryreset_callback.cpp",
55    "src/net_http_probe.cpp",
56    "src/net_http_probe_result.cpp",
57    "src/net_http_proxy_tracker.cpp",
58    "src/net_monitor.cpp",
59    "src/net_proxy_userinfo.cpp",
60    "src/net_supplier.cpp",
61    "src/network.cpp",
62    "src/probe_thread.cpp",
63    "src/stub/net_conn_callback_proxy.cpp",
64    "src/stub/net_conn_service_stub.cpp",
65    "src/stub/net_detection_callback_proxy.cpp",
66    "src/stub/net_factoryreset_callback_proxy.cpp",
67    "src/stub/net_interface_callback_proxy.cpp",
68    "src/stub/net_supplier_callback_proxy.cpp",
69  ]
70
71  configs = [ ":net_conn_manager_config" ]
72
73  deps = [
74    "$INNERKITS_ROOT/netstatsclient:net_stats_manager_if",
75    "$NETCONNMANAGER_COMMON_DIR:net_service_common",
76    "$NETMANAGER_BASE_ROOT/services/netmanagernative:netsys_native_manager",
77    "$NETMANAGER_BASE_ROOT/services/netmanagernative/fwmarkclient:fwmark_client",
78    "$NETMANAGER_BASE_ROOT/utils:net_manager_common",
79    "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller",
80  ]
81
82  cflags = [
83    "-fvisibility=hidden",
84    "-fdata-sections",
85    "-ffunction-sections",
86    "-Os",
87    "-fstack-protector-strong",
88    "-D_FORTIFY_SOURCE=2",
89    "-O2",
90  ]
91
92  cflags_cc = [
93    "-fvisibility-inlines-hidden",
94    "-Os",
95    "-fstack-protector-strong",
96    "-D_FORTIFY_SOURCE=2",
97    "-O2",
98  ]
99
100  ldflags = [
101    "-Wl,--exclude-libs=ALL",
102    "-Wl,--gc-sections",
103  ]
104
105  external_deps = [
106    "ability_base:want",
107    "ability_base:zuri",
108    "ability_runtime:ability_manager",
109    "c_utils:utils",
110    "common_event_service:cesfwk_innerkits",
111    "curl:curl_shared",
112    "data_share:datashare_common",
113    "data_share:datashare_consumer",
114    "eventhandler:libeventhandler",
115    "ffrt:libffrt",
116    "hisysevent:libhisysevent",
117    "init:libbegetutil",
118    "ipc:ipc_core",
119    "os_account:os_account_innerkits",
120    "relational_store:native_rdb",
121    "safwk:system_ability_fwk",
122    "samgr:samgr_proxy",
123  ]
124
125  defines = [
126    "NETMGR_LOG_TAG = \"NetConnManager\"",
127    "LOG_DOMAIN = 0xD0015B0",
128  ]
129
130  if (enable_netmgr_debug) {
131    defines += [ "NETMGR_DEBUG" ]
132  }
133
134  if (enable_sys_func) {
135    defines += [ "SYS_FUNC" ]
136  }
137
138  external_deps += [ "hilog:libhilog" ]
139
140  part_name = "netmanager_base"
141  subsystem_name = "communication"
142}
143
144ohos_static_library("net_conn_manager_static") {
145  testonly = true
146  sanitize = {
147    cfi = true
148    cfi_cross_dso = true
149    debug = false
150  }
151
152  branch_protector_ret = "pac_ret"
153  use_exceptions = true
154  sources = [
155    "$NETCONNMANAGER_COMMON_DIR/src/route_utils.cpp",
156    "src/dns_result_call_back.cpp",
157    "src/nat464_service.cpp",
158    "src/net_activate.cpp",
159    "src/net_caps.cpp",
160    "src/net_conn_event_handler.cpp",
161    "src/net_conn_service.cpp",
162    "src/net_conn_service_iface.cpp",
163    "src/net_datashare_utils.cpp",
164    "src/net_factoryreset_callback.cpp",
165    "src/net_http_probe.cpp",
166    "src/net_http_probe_result.cpp",
167    "src/net_http_proxy_tracker.cpp",
168    "src/net_monitor.cpp",
169    "src/net_proxy_userinfo.cpp",
170    "src/net_supplier.cpp",
171    "src/network.cpp",
172    "src/probe_thread.cpp",
173    "src/stub/net_conn_callback_proxy.cpp",
174    "src/stub/net_conn_service_stub.cpp",
175    "src/stub/net_detection_callback_proxy.cpp",
176    "src/stub/net_factoryreset_callback_proxy.cpp",
177    "src/stub/net_interface_callback_proxy.cpp",
178    "src/stub/net_supplier_callback_proxy.cpp",
179  ]
180  use_exceptions = true
181
182  configs = [ ":net_conn_manager_config" ]
183
184  deps = [
185    "$INNERKITS_ROOT/netstatsclient:net_stats_manager_if",
186    "$NETCONNMANAGER_COMMON_DIR:net_service_common",
187    "$NETMANAGER_BASE_ROOT/services/netmanagernative:netsys_native_manager",
188    "$NETMANAGER_BASE_ROOT/services/netmanagernative/fwmarkclient:fwmark_client",
189    "$NETMANAGER_BASE_ROOT/utils:net_manager_common",
190    "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller",
191  ]
192
193  external_deps = [
194    "ability_base:zuri",
195    "ability_runtime:ability_manager",
196    "c_utils:utils",
197    "common_event_service:cesfwk_innerkits",
198    "curl:curl_shared",
199    "data_share:datashare_common",
200    "data_share:datashare_consumer",
201    "eventhandler:libeventhandler",
202    "ffrt:libffrt",
203    "hisysevent:libhisysevent",
204    "init:libbegetutil",
205    "ipc:ipc_core",
206    "os_account:os_account_innerkits",
207    "relational_store:native_rdb",
208    "safwk:system_ability_fwk",
209    "samgr:samgr_proxy",
210  ]
211
212  defines = [
213    "NETMGR_LOG_TAG = \"NetConnManager\"",
214    "LOG_DOMAIN = 0xD0015B0",
215  ]
216
217  if (enable_netmgr_debug) {
218    defines += [ "NETMGR_DEBUG" ]
219  }
220
221  if (enable_sys_func) {
222    defines += [ "SYS_FUNC" ]
223  }
224
225  external_deps += [ "hilog:libhilog" ]
226
227  part_name = "netmanager_base"
228  subsystem_name = "communication"
229}
230