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_stats_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  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_source_set("net_stats_parcel") {
44  sources = [
45    "$NETSTATSMANAGER_INNERKITS_SOURCE_DIR/src/net_push_stats_info.cpp",
46    "$NETSTATSMANAGER_INNERKITS_SOURCE_DIR/src/net_stats_info.cpp",
47    "$NETSTATSMANAGER_INNERKITS_SOURCE_DIR/src/net_stats_info_sequence.cpp",
48    "$NETSTATSMANAGER_INNERKITS_SOURCE_DIR/src/net_stats_network.cpp",
49  ]
50  sanitize = {
51    cfi = true
52    cfi_cross_dso = true
53    debug = false
54  }
55
56  branch_protector_ret = "pac_ret"
57
58  include_dirs = [ "$INNERKITS_ROOT/netstatsclient/include" ]
59
60  deps = [ "$NETMANAGER_BASE_ROOT/utils:net_manager_common" ]
61  external_deps = [ "c_utils:utils" ]
62  external_deps += [ "hilog:libhilog" ]
63
64  part_name = "netmanager_base"
65  subsystem_name = "communication"
66}
67
68ohos_shared_library("net_stats_manager_if") {
69  sanitize = {
70    cfi = true
71    cfi_cross_dso = true
72    boundary_sanitize = true
73    all_ubsan = true
74    debug = false
75  }
76
77  branch_protector_ret = "pac_ret"
78
79  sources = [
80    "$NETSTATSMANAGER_INNERKITS_SOURCE_DIR/src/data_flow_statistics.cpp",
81    "$NETSTATSMANAGER_INNERKITS_SOURCE_DIR/src/net_stats_client.cpp",
82    "$NETSTATSMANAGER_INNERKITS_SOURCE_DIR/src/proxy/net_stats_callback_stub.cpp",
83    "$NETSTATSMANAGER_INNERKITS_SOURCE_DIR/src/proxy/net_stats_service_proxy.cpp",
84  ]
85
86  include_dirs = [
87    "$NETMANAGER_BASE_ROOT/utils/log/include",
88    "$NETSYSCONTROLLER_ROOT_DIR/include/",
89  ]
90
91  version_script = "libnetstats_kits.map"
92
93  public_configs = [ ":net_stats_manager_if_config" ]
94
95  cflags = [
96    "-fstack-protector-strong",
97    "-D_FORTIFY_SOURCE=2",
98    "-O2",
99  ]
100
101  cflags_cc = [
102    "-fstack-protector-strong",
103    "-D_FORTIFY_SOURCE=2",
104    "-O2",
105  ]
106
107  deps = [
108    ":net_stats_parcel",
109    "$NETSYSCONTROLLER_ROOT_DIR:netsys_controller",
110  ]
111
112  external_deps = [
113    "bounds_checking_function:libsec_shared",
114    "c_utils:utils",
115    "ipc:ipc_single",
116    "samgr:samgr_proxy",
117  ]
118
119  defines = [
120    "NETMGR_LOG_TAG = \"NetStatsClient\"",
121    "LOG_DOMAIN = 0xD0015B0",
122  ]
123
124  if (enable_netmgr_debug) {
125    defines += [ "NETMGR_DEBUG" ]
126  }
127
128  external_deps += [ "hilog:libhilog" ]
129
130  innerapi_tags = [ "platformsdk" ]
131  part_name = "netmanager_base"
132  subsystem_name = "communication"
133}
134