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")
16config("netsys_controller_include") {
17  include_dirs = [
18    "include",
19    "$NETSYSNATIVE_SOURCE_DIR/include/netsys",
20    "$INNERKITS_ROOT/netstatsclient/include",
21  ]
22
23  cflags = [
24    "-fstack-protector-strong",
25    "-D_FORTIFY_SOURCE=2",
26    "-O2",
27  ]
28
29  cflags_cc = [
30    "-fstack-protector-strong",
31    "-D_FORTIFY_SOURCE=2",
32    "-O2",
33  ]
34}
35
36ohos_shared_library("netsys_controller") {
37  sanitize = {
38    cfi = true
39    cfi_cross_dso = true
40    boundary_sanitize = true
41    ubsan = true
42    debug = false
43  }
44
45  branch_protector_ret = "pac_ret"
46
47  public_configs = [ ":netsys_controller_include" ]
48  sources = [
49    "src/mock_netsys_native_client.cpp",
50    "src/netsys_controller.cpp",
51    "src/netsys_controller_service_impl.cpp",
52    "src/netsys_native_client.cpp",
53  ]
54
55  include_dirs = [
56    "include",
57    "$NETCONNMANAGER_SOURCE_DIR/include",
58    "$NETCONNMANAGER_COMMON_DIR/include",
59    "$NETMANAGER_BASE_ROOT/utils/log/include",
60    "$NETSYSNATIVE_INNERKITS_SOURCE_DIR",
61    "$INNERKITS_ROOT/netmanagernative/include",
62    "$INNERKITS_ROOT/netconnclient/include",
63    "$NETMANAGER_BASE_ROOT/utils/common_utils/include",
64    "$NETSYSNATIVE_SOURCE_DIR/include/netsys",
65    "$NETSYSNATIVE_SOURCE_DIR/include/manager",
66  ]
67
68  deps = [
69    "$NETMANAGER_BASE_ROOT/services/netmanagernative:netsys_native_manager",
70    "$NETMANAGER_BASE_ROOT/utils:net_manager_common",
71  ]
72
73  external_deps = [
74    "c_utils:utils",
75    "ipc:ipc_core",
76    "samgr:samgr_proxy",
77  ]
78
79  defines = [
80    "NETMGR_LOG_TAG = \"NetConnManager\"",
81    "LOG_DOMAIN = 0xD0015B0",
82  ]
83
84  if (enable_netmgr_debug) {
85    defines += [ "NETMGR_DEBUG" ]
86  }
87
88  if (enable_sys_func) {
89    defines += [ "SYS_FUNC" ]
90  }
91
92  if (netmanager_base_enable_feature_net_firewall) {
93    defines += [ "FEATURE_NET_FIREWALL_ENABLE" ]
94  }
95
96  external_deps += [ "hilog:libhilog" ]
97
98  innerapi_tags = [ "platformsdk_indirect" ]
99  part_name = "netmanager_base"
100  subsystem_name = "communication"
101}
102