• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022-2023 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
17ohos_bpf("netsys") {
18  sources = [ "src/netsys.c" ]
19
20  include_dirs = [
21    "include",
22    "//third_party/libbpf/src",
23  ]
24
25  subsystem_name = "communication"
26  part_name = "netmanager_base"
27}
28
29ohos_shared_library("netsys_bpf_utils") {
30  sanitize = {
31    cfi = true
32    cfi_cross_dso = true
33    boundary_sanitize = true
34    all_ubsan = true
35    debug = false
36  }
37
38  sources = [
39    "$NETSTATSMANAGER_INNERKITS_SOURCE_DIR/src/net_stats_info.cpp",
40    "src/bpf_loader.cpp",
41    "src/bpf_stats.cpp",
42  ]
43
44  include_dirs = [
45    "include",
46    "$NETMANAGER_BASE_ROOT/interfaces/innerkits/include",
47    "$NETMANAGER_BASE_ROOT/interfaces/innerkits/netmanagernative/include",
48    "$NETMANAGER_BASE_ROOT/interfaces/innerkits/netstatsclient/include",
49    "$NETMANAGER_BASE_ROOT/utils/log/include",
50    "//third_party/elfio",
51    "//third_party/elfio/elfio",
52  ]
53
54  cflags = [
55    "-fstack-protector-strong",
56    "-D_FORTIFY_SOURCE=2",
57    "-O2",
58  ]
59
60  cflags_cc = [
61    "-fstack-protector-strong",
62    "-D_FORTIFY_SOURCE=2",
63    "-O2",
64  ]
65
66  defines = [
67    "NETMGRNATIVE_LOG_TAG = \"NetSysBpf\"",
68    "LOG_DOMAIN = 0xD0015B0",
69  ]
70
71  external_deps = [
72    "c_utils:utils",
73    "hilog:libhilog",
74  ]
75
76  innerapi_tags = [ "platformsdk_indirect" ]
77  part_name = "netmanager_base"
78  subsystem_name = "communication"
79}
80