1# Copyright (c) 2022-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("statistics_config") {
18  visibility = [ ":statistics" ]
19
20  include_dirs = [
21    "include",
22    "include/context",
23    "$NETMANAGER_BASE_ROOT/utils/log/include",
24  ]
25
26  cflags = [
27    "-fstack-protector-strong",
28    "-D_FORTIFY_SOURCE=2",
29    "-O2",
30  ]
31
32  cflags_cc = [
33    "-fstack-protector-strong",
34    "-D_FORTIFY_SOURCE=2",
35    "-O2",
36  ]
37}
38
39ohos_shared_library("statistics") {
40  sanitize = {
41    cfi = true
42    cfi_cross_dso = true
43    boundary_sanitize = true
44    all_ubsan = true
45    debug = false
46  }
47
48  branch_protector_ret = "pac_ret"
49
50  sources = [
51    "src/context/get_cellular_rxbytes_context.cpp",
52    "src/context/get_iface_rxbytes_context.cpp",
53    "src/context/get_iface_stats_context.cpp",
54    "src/context/get_iface_uid_stats_context.cpp",
55    "src/context/get_sockfd_rxbytes_context.cpp",
56    "src/context/get_traffic_stats_by_network_context.cpp",
57    "src/context/get_traffic_stats_by_uid_network_context.cpp",
58    "src/context/get_uid_rxbytes_context.cpp",
59    "src/context/update_iface_stats_context.cpp",
60    "src/statistics_async_work.cpp",
61    "src/statistics_callback_observer.cpp",
62    "src/statistics_exec.cpp",
63    "src/statistics_module.cpp",
64    "src/statistics_observer_wrapper.cpp",
65  ]
66
67  configs = [ ":statistics_config" ]
68
69  deps = [
70    "$INNERKITS_ROOT/netstatsclient:net_stats_manager_if",
71    "$NETMANAGER_BASE_ROOT/utils:net_manager_common",
72    "$NETMANAGER_BASE_ROOT/utils/napi_utils:napi_utils",
73  ]
74
75  external_deps = [
76    "c_utils:utils",
77    "hilog:libhilog",
78    "ipc:ipc_core",
79    "napi:ace_napi",
80  ]
81
82  relative_install_dir = "module/net"
83  part_name = "netmanager_base"
84  subsystem_name = "communication"
85}
86