• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-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/netstack/netstack_config.gni")
16
17TLS = "$NETSTACK_NATIVE_ROOT/tls_socket"
18TLS_NAPI = "$NETSTACK_DIR/frameworks/js/napi/tls"
19
20tls_sources = [
21  "$TLS/src/secure_data.cpp",
22  "$TLS/src/socket_error.cpp",
23  "$TLS/src/tls_certificate.cpp",
24  "$TLS/src/tls_configuration.cpp",
25  "$TLS/src/tls_context.cpp",
26  "$TLS/src/tls_context_server.cpp",
27  "$TLS/src/tls_key.cpp",
28  "$TLS/src/tls_socket.cpp",
29  "$TLS/src/tls_socket_server.cpp",
30  "$TLS/src/tls_utils.cpp",
31]
32
33tls_napi_sources = [
34  "$TLS_NAPI/src/context/tls_bind_context.cpp",
35  "$TLS_NAPI/src/context/tls_connect_context.cpp",
36  "$TLS_NAPI/src/context/tls_extra_context.cpp",
37  "$TLS_NAPI/src/context/tls_napi_context.cpp",
38  "$TLS_NAPI/src/context/tls_send_context.cpp",
39  "$TLS_NAPI/src/context/tls_server_close_context.cpp",
40  "$TLS_NAPI/src/context/tls_server_napi_context.cpp",
41  "$TLS_NAPI/src/context/tls_server_send_context.cpp",
42  "$TLS_NAPI/src/monitor.cpp",
43  "$TLS_NAPI/src/monitor_server.cpp",
44  "$TLS_NAPI/src/tlssocket_async_work.cpp",
45  "$TLS_NAPI/src/tlssocket_exec.cpp",
46  "$TLS_NAPI/src/tlssocket_module.cpp",
47  "$TLS_NAPI/src/tlssocketserver_async_work.cpp",
48  "$TLS_NAPI/src/tlssocketserver_exec.cpp",
49  "$TLS_NAPI/src/tlssocketserver_module.cpp",
50]
51
52ohos_shared_library("socket") {
53  include_dirs = [
54    "$TLS/include",
55    "$TLS_NAPI/include",
56    "$TLS_NAPI/include/context",
57    "$NETSTACK_INNERKITS_DIR/tls_socket/include",
58    "$NETSTACK_DIR/utils/napi_utils/include",
59    "async_context/include",
60    "async_work/include",
61    "constant/include",
62    "socket_exec/include",
63    "socket_module/include",
64    "options/include",
65    "task_queue/include",
66  ]
67
68  sources = [
69    "async_context/src/bind_context.cpp",
70    "async_context/src/common_context.cpp",
71    "async_context/src/connect_context.cpp",
72    "async_context/src/tcp_extra_context.cpp",
73    "async_context/src/tcp_send_context.cpp",
74    "async_context/src/tcp_server_common_context.cpp",
75    "async_context/src/tcp_server_extra_context.cpp",
76    "async_context/src/tcp_server_listen_context.cpp",
77    "async_context/src/tcp_server_send_context.cpp",
78    "async_context/src/udp_extra_context.cpp",
79    "async_context/src/udp_send_context.cpp",
80    "async_work/src/socket_async_work.cpp",
81    "options/src/extra_options_base.cpp",
82    "options/src/net_address.cpp",
83    "options/src/socket_remote_info.cpp",
84    "options/src/socket_state_base.cpp",
85    "options/src/tcp_connect_options.cpp",
86    "options/src/tcp_extra_options.cpp",
87    "options/src/tcp_send_options.cpp",
88    "options/src/udp_extra_options.cpp",
89    "options/src/udp_send_options.cpp",
90    "socket_exec/src/socket_exec.cpp",
91    "socket_module/src/socket_module.cpp",
92  ]
93  sources += tls_sources
94  sources += tls_napi_sources
95
96  deps = [
97    "$NETSTACK_DIR/utils/napi_utils:napi_utils",
98    "$THIRD_PARTY_ROOT/openssl:libcrypto_shared",
99    "$THIRD_PARTY_ROOT/openssl:libssl_shared",
100  ]
101
102  external_deps = [
103    "eventhandler:libeventhandler",
104    "hilog:libhilog",
105    "napi:ace_napi",
106  ]
107
108  relative_install_dir = "module/net"
109  part_name = "netstack"
110  subsystem_name = "communication"
111  defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ]
112}
113