1# Copyright (c) 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_ext/netmanager_ext_config.gni")
16
17config("net_conn_manager_if_config") {
18  include_dirs = [
19    "include",
20    "include/ipc",
21    "$EXT_INNERKITS_ROOT/include",
22    "$NETMANAGER_EXT_ROOT/utils/log/include",
23  ]
24
25  defines = []
26  if (is_double_framework) {
27    defines += [ "CONFIG_DUAL_FRAMEWORK" ]
28  }
29  if (target_cpu == "arm") {
30    defines += [ "BINDER_IPC_32BIT" ]
31  }
32  if (is_standard_system) {
33    defines += [ "CONFIG_STANDARD_SYSTEM" ]
34  }
35  if (defined(build_public_version) && build_public_version) {
36    defines += [ "BUILD_PUBLIC_VERSION" ]
37  }
38
39  cflags = [
40    "-fstack-protector-strong",
41    "-D_FORTIFY_SOURCE=2",
42    "-O2",
43  ]
44
45  cflags_cc = [
46    "-fstack-protector-strong",
47    "-D_FORTIFY_SOURCE=2",
48    "-O2",
49  ]
50}
51
52ohos_source_set("netfirewall_parcel") {
53  sources = [ "$NETFIREWALL_EXTENSION_SOURCE_DIR/src/netfirewall_common.cpp" ]
54
55  include_dirs = [
56    "$EXT_INNERKITS_ROOT/include",
57    "$EXT_INNERKITS_ROOT/netfirewallclient/include",
58    "$NETMANAGER_EXT_ROOT/utils/log/include",
59  ]
60
61  external_deps = [
62    "c_utils:utils",
63    "hilog:libhilog",
64    "netmanager_base:net_conn_parcel",
65    "netmanager_base:net_native_manager_if",
66  ]
67
68  part_name = "netmanager_ext"
69  subsystem_name = "communication"
70}
71
72ohos_shared_library("netfirewall_manager_if") {
73  if (netmanager_ext_feature_net_firewall) {
74    sources = [
75      "$NETFIREWALL_EXTENSION_SOURCE_DIR/src/netfirewall_client.cpp",
76      "$NETFIREWALL_EXTENSION_SOURCE_DIR/src/netfirewall_proxy.cpp",
77    ]
78
79    public_configs = [
80      ":net_conn_manager_if_config",
81      "$NETMANAGER_EXT_ROOT/resource:coverage_flags",
82    ]
83
84    deps = [ ":netfirewall_parcel" ]
85
86    external_deps = [
87      "hilog:libhilog",
88      "ipc:ipc_single",
89      "netmanager_base:net_native_manager_if",
90      "samgr:samgr_proxy",
91    ]
92
93    defines = [
94      "NETMGR_LOG_TAG = \"NetFirewallManager\"",
95      "LOG_DOMAIN = 0xD0015B0",
96    ]
97
98    if (enable_netmgr_ext_debug) {
99      defines += [ "NETMGR_DEBUG" ]
100    }
101
102    part_name = "netmanager_ext"
103    subsystem_name = "communication"
104  }
105}
106