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("policy_config") {
18  visibility = [ ":policy" ]
19
20  include_dirs = [
21    "include",
22    "$INNERKITS_ROOT/include",
23    "$NETMANAGER_BASE_ROOT/utils/log/include",
24    "$NETMANAGER_BASE_ROOT/utils/common_utils/include",
25  ]
26
27  cflags = [
28    "-Wall",
29    "-Werror",
30    "-g3",
31    "-fstack-protector-strong",
32    "-D_FORTIFY_SOURCE=2",
33    "-O2",
34  ]
35
36  cflags_cc = [
37    "-fstack-protector-strong",
38    "-D_FORTIFY_SOURCE=2",
39    "-O2",
40  ]
41}
42
43ohos_shared_library("policy") {
44  sanitize = {
45    cfi = true
46    cfi_cross_dso = true
47    boundary_sanitize = true
48    all_ubsan = true
49    debug = false
50  }
51
52  branch_protector_ret = "pac_ret"
53
54  sources = [
55    "src/get_net_quota_policies_context.cpp",
56    "src/get_network_access_policy_context.cpp",
57    "src/get_policy_by_uid_context.cpp",
58    "src/get_uids_by_policy_context.cpp",
59    "src/is_uid_net_allowed_context.cpp",
60    "src/net_policy_callback_observer.cpp",
61    "src/netpolicy_async_work.cpp",
62    "src/netpolicy_exec.cpp",
63    "src/netpolicy_module.cpp",
64    "src/policy_observer_wrapper.cpp",
65    "src/restore_all_policies_context.cpp",
66    "src/set_bg_policy_context.cpp",
67    "src/set_device_idle_allow_list_context.cpp",
68    "src/set_net_quota_policies_context.cpp",
69    "src/set_network_access_policy_context.cpp",
70    "src/set_policy_by_uid_context.cpp",
71    "src/set_power_save_allow_list_context.cpp",
72    "src/update_remind_policy_context.cpp",
73  ]
74
75  configs = [ ":policy_config" ]
76
77  deps = [
78    "$INNERKITS_ROOT/netpolicyclient:net_policy_manager_if",
79    "$NETMANAGER_BASE_ROOT/utils:net_manager_common",
80    "$NETMANAGER_BASE_ROOT/utils/napi_utils:napi_utils",
81  ]
82
83  external_deps = [
84    "c_utils:utils",
85    "hilog:libhilog",
86    "ipc:ipc_core",
87    "napi:ace_napi",
88  ]
89  relative_install_dir = "module/net"
90  part_name = "netmanager_base"
91
92  subsystem_name = "communication"
93}
94