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_policy_manager_if_config") {
18  # header file path
19  include_dirs = [
20    "$INNERKITS_ROOT/include",
21    "$INNERKITS_ROOT/netpolicyclient/include",
22    "$INNERKITS_ROOT/netconnclient/include",
23    "$NETSYSNATIVE_SOURCE_DIR/include/netsys",
24  ]
25
26  cflags = []
27  if (is_double_framework) {
28    cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ]
29  }
30  if (target_cpu == "arm") {
31    cflags += [ "-DBINDER_IPC_32BIT" ]
32  }
33  if (is_standard_system) {
34    cflags += [ "-DCONFIG_STANDARD_SYSTEM" ]
35  }
36  if (defined(build_public_version) && build_public_version) {
37    cflags += [ "-DBUILD_PUBLIC_VERSION" ]
38  }
39
40  cflags += [
41    "-fstack-protector-strong",
42    "-D_FORTIFY_SOURCE=2",
43    "-O2",
44  ]
45
46  cflags_cc = [
47    "-fstack-protector-strong",
48    "-D_FORTIFY_SOURCE=2",
49    "-O2",
50  ]
51}
52
53ohos_source_set("net_policy_parcel") {
54  sources = [
55    "$NETPOLICYMANAGER_INNERKITS_SOURCE_DIR/src/net_access_policy.cpp",
56    "$NETPOLICYMANAGER_INNERKITS_SOURCE_DIR/src/net_quota_policy.cpp",
57  ]
58
59  include_dirs = [
60    "$INNERKITS_ROOT/include",
61    "$INNERKITS_ROOT/netpolicyclient/include",
62    "$INNERKITS_ROOT/netconnclient/include",
63    "$NETMANAGER_BASE_ROOT/utils/log/include",
64  ]
65
66  deps = [ "$NETMANAGER_BASE_ROOT/utils:net_manager_common" ]
67
68  sanitize = {
69    cfi = true
70    cfi_cross_dso = true
71    debug = false
72  }
73
74  branch_protector_ret = "pac_ret"
75
76  external_deps = [ "c_utils:utils" ]
77  external_deps += [ "hilog:libhilog" ]
78
79  part_name = "netmanager_base"
80  subsystem_name = "communication"
81}
82
83ohos_shared_library("net_policy_manager_if") {
84  sanitize = {
85    cfi = true
86    cfi_cross_dso = true
87    boundary_sanitize = true
88    all_ubsan = true
89    debug = false
90  }
91
92  branch_protector_ret = "pac_ret"
93
94  include_dirs = [ "$NETMANAGER_BASE_ROOT/utils/log/include" ]
95
96  sources = [
97    "$NETPOLICYMANAGER_INNERKITS_SOURCE_DIR/src/net_policy_callback_stub.cpp",
98    "$NETPOLICYMANAGER_INNERKITS_SOURCE_DIR/src/net_policy_client.cpp",
99    "$NETPOLICYMANAGER_INNERKITS_SOURCE_DIR/src/net_policy_service_proxy.cpp",
100  ]
101
102  version_script = "libnetpolicy_kits.map"
103
104  public_configs = [ ":net_policy_manager_if_config" ]
105
106  deps = [ ":net_policy_parcel" ]
107
108  external_deps = [
109    "bounds_checking_function:libsec_shared",
110    "bundle_framework:appexecfwk_base",
111    "bundle_framework:appexecfwk_core",
112    "c_utils:utils",
113    "ipc:ipc_single",
114    "samgr:samgr_proxy",
115  ]
116
117  defines = [
118    "NETMGR_LOG_TAG = \"NetPolicyManager\"",
119    "LOG_DOMAIN = 0xD0015B0",
120  ]
121
122  if (enable_netmgr_debug) {
123    defines += [ "NETMGR_DEBUG" ]
124  }
125
126  external_deps += [ "hilog:libhilog" ]
127
128  innerapi_tags = [ "platformsdk" ]
129  part_name = "netmanager_base"
130  subsystem_name = "communication"
131}
132