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  if (netmanager_ext_feature_sysvpn) {
56    cflags += sysvpn_flags
57    cflags_cc += sysvpn_flags
58  }
59}
60
61ohos_source_set("networkvpn_parcel") {
62  sanitize = {
63    cfi = true
64    cfi_cross_dso = true
65    debug = false
66  }
67
68  branch_protector_ret = "pac_ret"
69
70  sources = [ "$VPN_INNERKITS_SOURCE_DIR/src/vpn_config.cpp" ]
71
72  if (netmanager_ext_feature_sysvpn) {
73    sources += [
74      "$VPN_INNERKITS_SOURCE_DIR/src/ipsecvpn_config.cpp",
75      "$VPN_INNERKITS_SOURCE_DIR/src/l2tpvpn_config.cpp",
76      "$VPN_INNERKITS_SOURCE_DIR/src/openvpn_config.cpp",
77      "$VPN_INNERKITS_SOURCE_DIR/src/sysvpn_config.cpp",
78      "$VPN_INNERKITS_SOURCE_DIR/src/vpn_data_bean.cpp",
79    ]
80  }
81
82  include_dirs = [
83    "$BASE_INNERKITS_ROOT/include",
84    "$BASE_INNERKITS_ROOT/netconnclient/include",
85    "$EXT_INNERKITS_ROOT/include",
86    "$EXT_INNERKITS_ROOT/netvpnclient/include",
87    "$NETMANAGER_EXT_ROOT/utils/log/include",
88  ]
89
90  external_deps = [
91    "c_utils:utils",
92    "hilog:libhilog",
93    "netmanager_base:net_conn_parcel",
94    "netmanager_base:net_manager_common",
95  ]
96
97  part_name = "netmanager_ext"
98  subsystem_name = "communication"
99}
100
101ohos_shared_library("net_vpn_manager_if") {
102  sanitize = {
103    cfi = true
104    cfi_cross_dso = true
105    debug = false
106  }
107
108  branch_protector_ret = "pac_ret"
109
110  sources = [
111    "$VPN_INNERKITS_SOURCE_DIR/src/ipc/networkvpn_service_proxy.cpp",
112    "$VPN_INNERKITS_SOURCE_DIR/src/ipc/vpn_event_callback_stub.cpp",
113    "$VPN_INNERKITS_SOURCE_DIR/src/networkvpn_client.cpp",
114    "$VPN_INNERKITS_SOURCE_DIR/src/vpn_interface.cpp",
115  ]
116
117  public_configs = [ ":net_conn_manager_if_config" ]
118
119  deps = [ ":networkvpn_parcel" ]
120
121  external_deps = [
122    "bounds_checking_function:libsec_shared",
123    "hilog:libhilog",
124    "ipc:ipc_single",
125    "netmanager_base:fwmark_client",
126    "samgr:samgr_proxy",
127  ]
128
129  defines = [
130    "NETMGR_LOG_TAG = \"NetworkVpn\"",
131    "LOG_DOMAIN = 0xD0015B0",
132  ]
133
134  if (enable_netmgr_ext_debug) {
135    defines += [ "NETMGR_DEBUG" ]
136  }
137
138  part_name = "netmanager_ext"
139  subsystem_name = "communication"
140}
141