1# Copyright (c) 2023-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_ext/netmanager_ext_config.gni")
16
17config("net_conn_manager_if_config") {
18  include_dirs = [
19    "include",
20    "include/ipc",
21    "$BASE_INNERKITS_ROOT/include",
22    "$BASE_INNERKITS_ROOT/netconnclient/include",
23    "$BASE_INNERKITS_ROOT/netmanagernative/include",
24    "$NETMANAGERNATIVE_ROOT/fwmarkclient/include",
25    "$EXT_INNERKITS_ROOT/include",
26    "$NETMANAGER_EXT_ROOT/utils/log/include",
27  ]
28
29  defines = []
30  if (is_double_framework) {
31    defines += [ "CONFIG_DUAL_FRAMEWORK" ]
32  }
33  if (target_cpu == "arm") {
34    defines += [ "BINDER_IPC_32BIT" ]
35  }
36  if (is_standard_system) {
37    defines += [ "CONFIG_STANDARD_SYSTEM" ]
38  }
39  if (defined(build_public_version) && build_public_version) {
40    defines += [ "BUILD_PUBLIC_VERSION" ]
41  }
42
43  cflags = [
44    "-fstack-protector-strong",
45    "-D_FORTIFY_SOURCE=2",
46    "-O2",
47  ]
48
49  cflags_cc = [
50    "-fstack-protector-strong",
51    "-D_FORTIFY_SOURCE=2",
52    "-O2",
53  ]
54}
55
56ohos_source_set("networkvpn_parcel") {
57  sanitize = {
58    cfi = true
59    cfi_cross_dso = true
60    debug = false
61  }
62
63  branch_protector_ret = "pac_ret"
64
65  sources = [ "$VPN_INNERKITS_SOURCE_DIR/src/vpn_config.cpp" ]
66
67  include_dirs = [
68    "$BASE_INNERKITS_ROOT/include",
69    "$BASE_INNERKITS_ROOT/netconnclient/include",
70    "$EXT_INNERKITS_ROOT/include",
71    "$EXT_INNERKITS_ROOT/netvpnclient/include",
72    "$NETMANAGER_EXT_ROOT/utils/log/include",
73  ]
74
75  external_deps = [
76    "c_utils:utils",
77    "hilog:libhilog",
78    "netmanager_base:net_conn_parcel",
79    "netmanager_base:net_manager_common",
80  ]
81
82  part_name = "netmanager_ext"
83  subsystem_name = "communication"
84}
85
86ohos_shared_library("net_vpn_manager_if") {
87  sanitize = {
88    cfi = true
89    cfi_cross_dso = true
90    debug = false
91  }
92
93  branch_protector_ret = "pac_ret"
94
95  sources = [
96    "$VPN_INNERKITS_SOURCE_DIR/src/ipc/networkvpn_service_proxy.cpp",
97    "$VPN_INNERKITS_SOURCE_DIR/src/ipc/vpn_event_callback_stub.cpp",
98    "$VPN_INNERKITS_SOURCE_DIR/src/networkvpn_client.cpp",
99    "$VPN_INNERKITS_SOURCE_DIR/src/vpn_interface.cpp",
100  ]
101
102  public_configs = [ ":net_conn_manager_if_config" ]
103
104  deps = [ ":networkvpn_parcel" ]
105
106  external_deps = [
107    "bounds_checking_function:libsec_shared",
108    "hilog:libhilog",
109    "ipc:ipc_single",
110    "netmanager_base:fwmark_client",
111    "samgr:samgr_proxy",
112  ]
113
114  defines = [
115    "NETMGR_LOG_TAG = \"NetworkVpn\"",
116    "LOG_DOMAIN = 0xD0015B0",
117  ]
118
119  if (enable_netmgr_ext_debug) {
120    defines += [ "NETMGR_DEBUG" ]
121  }
122
123  part_name = "netmanager_ext"
124  subsystem_name = "communication"
125}
126