• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/config/components/idl_tool/idl.gni")
15import("//build/ohos.gni")
16import("//foundation/communication/netmanager_ext/netmanager_ext_config.gni")
17
18config("net_conn_manager_if_config") {
19  include_dirs = [
20    "include",
21    "include/ipc",
22    "${target_gen_dir}",
23    "$EXT_INNERKITS_ROOT/include",
24  ]
25
26  defines = []
27  if (is_double_framework) {
28    defines += [ "CONFIG_DUAL_FRAMEWORK" ]
29  }
30  if (target_cpu == "arm") {
31    defines += [ "BINDER_IPC_32BIT" ]
32  }
33  if (is_standard_system) {
34    defines += [ "CONFIG_STANDARD_SYSTEM" ]
35  }
36  if (defined(build_public_version) && build_public_version) {
37    defines += [ "BUILD_PUBLIC_VERSION" ]
38  }
39
40  cflags = common_cflags
41
42  cflags_cc = common_cflags
43
44  if (netmanager_ext_feature_sysvpn) {
45    cflags += sysvpn_flags
46    cflags_cc += sysvpn_flags
47    defines += [ "SUPPORT_SYSVPN" ]
48  }
49}
50
51ohos_static_library("networkvpn_parcel") {
52  sanitize = {
53    cfi = true
54    cfi_cross_dso = true
55    debug = false
56  }
57
58  branch_protector_ret = "pac_ret"
59
60  sources = [ "$VPN_INNERKITS_SOURCE_DIR/src/vpn_config.cpp" ]
61
62  if (netmanager_ext_feature_sysvpn) {
63    sources += [
64      "$VPN_INNERKITS_SOURCE_DIR/src/ipsecvpn_config.cpp",
65      "$VPN_INNERKITS_SOURCE_DIR/src/l2tpvpn_config.cpp",
66      "$VPN_INNERKITS_SOURCE_DIR/src/openvpn_config.cpp",
67      "$VPN_INNERKITS_SOURCE_DIR/src/sysvpn_config.cpp",
68      "$VPN_INNERKITS_SOURCE_DIR/src/vpn_data_bean.cpp",
69    ]
70  }
71
72  include_dirs = [
73    "$EXT_INNERKITS_ROOT/include",
74    "$EXT_INNERKITS_ROOT/netvpnclient/include",
75  ]
76
77  external_deps = [
78    "c_utils:utils",
79    "hilog:libhilog",
80    "netmanager_base:net_conn_manager_if",
81    "netmanager_base:net_manager_common",
82  ]
83
84  part_name = "netmanager_ext"
85  subsystem_name = "communication"
86}
87
88idl_gen_interface("networkvpn_interface") {
89  sources = [ "INetworkVpnService.idl" ]
90  sources_callback = [ "IVpnEventCallback.idl" ]
91}
92
93config("networkvpn_interface_stub_config") {
94  include_dirs = [
95    "include",
96    "${target_gen_dir}",
97  ]
98  if (netmanager_ext_feature_sysvpn) {
99    cflags = sysvpn_flags
100    cflags_cc = sysvpn_flags
101    defines = [ "SUPPORT_SYSVPN" ]
102  }
103}
104
105ohos_source_set("networkvpn_interface_stub") {
106  sanitize = {
107    cfi = true
108    cfi_cross_dso = true
109    debug = false
110  }
111  public_configs = [ ":networkvpn_interface_stub_config" ]
112  output_values = get_target_outputs(":networkvpn_interface")
113  sources = []
114  sources += filter_include(output_values, [ "*ice_stub.cpp" ])
115  sources += filter_include(output_values, [ "*ack_proxy.cpp" ])
116  deps = [ ":networkvpn_interface" ]
117  external_deps = [
118    "hilog:libhilog",
119    "ipc:ipc_single",
120    "samgr:samgr_proxy",
121    "netmanager_base:net_native_manager_if",
122    "c_utils:utils",
123  ]
124  part_name = "netmanager_ext"
125  subsystem_name = "communication"
126}
127
128ohos_shared_library("net_vpn_manager_if") {
129  sanitize = {
130    cfi = true
131    cfi_cross_dso = true
132    debug = false
133  }
134
135  branch_protector_ret = "pac_ret"
136
137  sources = [
138    "$VPN_INNERKITS_SOURCE_DIR/src/networkvpn_client.cpp",
139    "$VPN_INNERKITS_SOURCE_DIR/src/vpn_interface.cpp",
140  ]
141
142  output_values = get_target_outputs(":networkvpn_interface")
143  sources += filter_include(output_values, [ "*ice_proxy.cpp" ])
144  sources += filter_include(output_values, [ "*ack_stub.cpp" ])
145
146  public_configs = [ ":net_conn_manager_if_config" ]
147
148  deps = [ ":networkvpn_parcel" ]
149  deps += [ ":networkvpn_interface" ]
150
151  external_deps = [
152    "bounds_checking_function:libsec_shared",
153    "hilog:libhilog",
154    "ipc:ipc_single",
155    "netmanager_base:fwmark_client",
156    "samgr:samgr_proxy",
157  ]
158
159  public_external_deps = [
160    "netmanager_base:net_manager_common",
161    "netmanager_base:net_native_manager_if",
162  ]
163
164  defines = [
165    "NETMGR_LOG_TAG = \"NetworkVpn\"",
166    "LOG_DOMAIN = 0xD0015B0",
167  ]
168
169  if (enable_netmgr_ext_debug) {
170    defines += [ "NETMGR_DEBUG" ]
171  }
172
173  part_name = "netmanager_ext"
174  subsystem_name = "communication"
175}
176