1b1b8bc3fSopenharmony_ci# Copyright (c) 2023-2024 Huawei Device Co., Ltd.
2b1b8bc3fSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3b1b8bc3fSopenharmony_ci# you may not use this file except in compliance with the License.
4b1b8bc3fSopenharmony_ci# You may obtain a copy of the License at
5b1b8bc3fSopenharmony_ci#
6b1b8bc3fSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7b1b8bc3fSopenharmony_ci#
8b1b8bc3fSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9b1b8bc3fSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10b1b8bc3fSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11b1b8bc3fSopenharmony_ci# See the License for the specific language governing permissions and
12b1b8bc3fSopenharmony_ci# limitations under the License.
13b1b8bc3fSopenharmony_ci
14b1b8bc3fSopenharmony_ciimport("//build/ohos.gni")
15b1b8bc3fSopenharmony_ciimport("//foundation/communication/netmanager_base/netmanager_base_config.gni")
16b1b8bc3fSopenharmony_ci
17b1b8bc3fSopenharmony_ciconfig("net_native_manager_if_config") {
18b1b8bc3fSopenharmony_ci  # header file path
19b1b8bc3fSopenharmony_ci  include_dirs = [
20b1b8bc3fSopenharmony_ci    "$INNERKITS_ROOT/include",
21b1b8bc3fSopenharmony_ci    "$INNERKITS_ROOT/netstatsclient/include/proxy",
22b1b8bc3fSopenharmony_ci    "$INNERKITS_ROOT/netstatsclient/include",
23b1b8bc3fSopenharmony_ci    "$INNERKITS_ROOT/netmanagernative/include",
24b1b8bc3fSopenharmony_ci    "$INNERKITS_ROOT/netconnclient/include",
25b1b8bc3fSopenharmony_ci    "$NETSYSNATIVE_SOURCE_DIR/include/netsys",
26b1b8bc3fSopenharmony_ci  ]
27b1b8bc3fSopenharmony_ci
28b1b8bc3fSopenharmony_ci  cflags = []
29b1b8bc3fSopenharmony_ci  defines = []
30b1b8bc3fSopenharmony_ci  if (is_double_framework) {
31b1b8bc3fSopenharmony_ci    cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ]
32b1b8bc3fSopenharmony_ci  }
33b1b8bc3fSopenharmony_ci  if (target_cpu == "arm") {
34b1b8bc3fSopenharmony_ci    cflags += [ "-DBINDER_IPC_32BIT" ]
35b1b8bc3fSopenharmony_ci  }
36b1b8bc3fSopenharmony_ci  if (is_standard_system) {
37b1b8bc3fSopenharmony_ci    cflags += [ "-DCONFIG_STANDARD_SYSTEM" ]
38b1b8bc3fSopenharmony_ci  }
39b1b8bc3fSopenharmony_ci  if (defined(build_public_version) && build_public_version) {
40b1b8bc3fSopenharmony_ci    cflags += [ "-DBUILD_PUBLIC_VERSION" ]
41b1b8bc3fSopenharmony_ci  }
42b1b8bc3fSopenharmony_ci  if (netmanager_base_enable_feature_net_firewall) {
43b1b8bc3fSopenharmony_ci    defines += [ "FEATURE_NET_FIREWALL_ENABLE" ]
44b1b8bc3fSopenharmony_ci  }
45b1b8bc3fSopenharmony_ci  if (netmanager_base_enable_feature_wearable_distributed_net) {
46b1b8bc3fSopenharmony_ci    defines += [ "FEATURE_WEARABLE_DISTRIBUTED_NET_ENABLE" ]
47b1b8bc3fSopenharmony_ci  }
48b1b8bc3fSopenharmony_ci}
49b1b8bc3fSopenharmony_ci
50b1b8bc3fSopenharmony_ciohos_source_set("net_native_parcel") {
51b1b8bc3fSopenharmony_ci  sanitize = {
52b1b8bc3fSopenharmony_ci    cfi = true
53b1b8bc3fSopenharmony_ci    cfi_cross_dso = true
54b1b8bc3fSopenharmony_ci    debug = false
55b1b8bc3fSopenharmony_ci  }
56b1b8bc3fSopenharmony_ci
57b1b8bc3fSopenharmony_ci  branch_protector_ret = "pac_ret"
58b1b8bc3fSopenharmony_ci
59b1b8bc3fSopenharmony_ci  sources = [
60b1b8bc3fSopenharmony_ci    "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/dhcp_result_parcel.cpp",
61b1b8bc3fSopenharmony_ci    "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/uid_range.cpp",
62b1b8bc3fSopenharmony_ci  ]
63b1b8bc3fSopenharmony_ci
64b1b8bc3fSopenharmony_ci  if (netmanager_base_enable_feature_net_firewall) {
65b1b8bc3fSopenharmony_ci    sources += [ "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/netfirewall_parcel.cpp" ]
66b1b8bc3fSopenharmony_ci  }
67b1b8bc3fSopenharmony_ci
68b1b8bc3fSopenharmony_ci  include_dirs = [ "$INNERKITS_ROOT/netmanagernative/include" ]
69b1b8bc3fSopenharmony_ci
70b1b8bc3fSopenharmony_ci  deps = [ "$NETMANAGER_BASE_ROOT/utils:net_manager_common" ]
71b1b8bc3fSopenharmony_ci  external_deps = [ "c_utils:utils" ]
72b1b8bc3fSopenharmony_ci  external_deps += [ "hilog:libhilog" ]
73b1b8bc3fSopenharmony_ci
74b1b8bc3fSopenharmony_ci  part_name = "netmanager_base"
75b1b8bc3fSopenharmony_ci  subsystem_name = "communication"
76b1b8bc3fSopenharmony_ci}
77b1b8bc3fSopenharmony_ci
78b1b8bc3fSopenharmony_ciohos_shared_library("net_native_manager_if") {
79b1b8bc3fSopenharmony_ci  sanitize = {
80b1b8bc3fSopenharmony_ci    cfi = true
81b1b8bc3fSopenharmony_ci    cfi_cross_dso = true
82b1b8bc3fSopenharmony_ci    debug = false
83b1b8bc3fSopenharmony_ci  }
84b1b8bc3fSopenharmony_ci
85b1b8bc3fSopenharmony_ci  branch_protector_ret = "pac_ret"
86b1b8bc3fSopenharmony_ci
87b1b8bc3fSopenharmony_ci  cflags = [
88b1b8bc3fSopenharmony_ci    "-fstack-protector-strong",
89b1b8bc3fSopenharmony_ci    "-D_FORTIFY_SOURCE=2",
90b1b8bc3fSopenharmony_ci    "-O2",
91b1b8bc3fSopenharmony_ci  ]
92b1b8bc3fSopenharmony_ci
93b1b8bc3fSopenharmony_ci  cflags_cc = [
94b1b8bc3fSopenharmony_ci    "-fstack-protector-strong",
95b1b8bc3fSopenharmony_ci    "-D_FORTIFY_SOURCE=2",
96b1b8bc3fSopenharmony_ci    "-O2",
97b1b8bc3fSopenharmony_ci  ]
98b1b8bc3fSopenharmony_ci  sources = [
99b1b8bc3fSopenharmony_ci    "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/net_diag_callback_stub.cpp",
100b1b8bc3fSopenharmony_ci    "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/netsys_native_service_proxy.cpp",
101b1b8bc3fSopenharmony_ci    "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/netsys_net_diag_data.cpp",
102b1b8bc3fSopenharmony_ci    "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/notify_callback_proxy.cpp",
103b1b8bc3fSopenharmony_ci  ]
104b1b8bc3fSopenharmony_ci
105b1b8bc3fSopenharmony_ci  include_dirs = [
106b1b8bc3fSopenharmony_ci    "$NETMANAGER_BASE_ROOT/utils/log/include",
107b1b8bc3fSopenharmony_ci    "$NETSYSCONTROLLER_ROOT_DIR/include/",
108b1b8bc3fSopenharmony_ci  ]
109b1b8bc3fSopenharmony_ci
110b1b8bc3fSopenharmony_ci  public_configs = [ ":net_native_manager_if_config" ]
111b1b8bc3fSopenharmony_ci
112b1b8bc3fSopenharmony_ci  if (netmanager_base_enable_feature_net_firewall) {
113b1b8bc3fSopenharmony_ci    sources += [
114b1b8bc3fSopenharmony_ci      "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/netfirewall_callback_proxy.cpp",
115b1b8bc3fSopenharmony_ci      "$NETSYSNATIVE_SOURCE_DIR/src/netfirewall_callback_stub.cpp",
116b1b8bc3fSopenharmony_ci    ]
117b1b8bc3fSopenharmony_ci
118b1b8bc3fSopenharmony_ci    public_configs += [ "$NETMANAGER_BASE_ROOT/resource:coverage_flags" ]
119b1b8bc3fSopenharmony_ci  }
120b1b8bc3fSopenharmony_ci
121b1b8bc3fSopenharmony_ci  deps = [
122b1b8bc3fSopenharmony_ci    ":net_native_parcel",
123b1b8bc3fSopenharmony_ci    "$INNERKITS_ROOT/netstatsclient:net_stats_manager_if",
124b1b8bc3fSopenharmony_ci    "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller",
125b1b8bc3fSopenharmony_ci  ]
126b1b8bc3fSopenharmony_ci
127b1b8bc3fSopenharmony_ci  external_deps = [
128b1b8bc3fSopenharmony_ci    "bounds_checking_function:libsec_shared",
129b1b8bc3fSopenharmony_ci    "c_utils:utils",
130b1b8bc3fSopenharmony_ci    "ipc:ipc_single",
131b1b8bc3fSopenharmony_ci    "samgr:samgr_proxy",
132b1b8bc3fSopenharmony_ci  ]
133b1b8bc3fSopenharmony_ci
134b1b8bc3fSopenharmony_ci  defines = [
135b1b8bc3fSopenharmony_ci    "NETMGR_LOG_TAG = \"NetNativeMnager\"",
136b1b8bc3fSopenharmony_ci    "LOG_DOMAIN = 0xD0015B0",
137b1b8bc3fSopenharmony_ci  ]
138b1b8bc3fSopenharmony_ci
139b1b8bc3fSopenharmony_ci  if (enable_netmgr_debug) {
140b1b8bc3fSopenharmony_ci    defines += [ "NETMGR_DEBUG" ]
141b1b8bc3fSopenharmony_ci  }
142b1b8bc3fSopenharmony_ci
143b1b8bc3fSopenharmony_ci  external_deps += [ "hilog:libhilog" ]
144b1b8bc3fSopenharmony_ci
145b1b8bc3fSopenharmony_ci  innerapi_tags = [ "platformsdk" ]
146b1b8bc3fSopenharmony_ci  part_name = "netmanager_base"
147b1b8bc3fSopenharmony_ci  subsystem_name = "communication"
148b1b8bc3fSopenharmony_ci}
149