1# Copyright (c) 2021-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
17ohos_shared_library("ethernet_manager") {
18  sanitize = {
19    cfi = true
20    cfi_cross_dso = true
21    debug = false
22  }
23
24  branch_protector_ret = "pac_ret"
25
26  sources = [
27    "$ETHERNETMANAGER_INNERKITS_SOURCE_DIR/src/proxy/interface_state_callback_proxy.cpp",
28    "$ETHERNETMANAGER_INNERKITS_SOURCE_DIR/src/proxy/interface_state_callback_stub.cpp",
29    "src/dev_interface_state.cpp",
30    "src/ethernet_configuration.cpp",
31    "src/ethernet_dhcp_controller.cpp",
32    "src/ethernet_lan_management.cpp",
33    "src/ethernet_management.cpp",
34    "src/ethernet_service.cpp",
35    "src/ethernet_service_common.cpp",
36    "src/stub/ethernet_service_stub.cpp",
37  ]
38
39  include_dirs = [
40    "$BASE_INNERKITS_ROOT/ethernetclient/include/proxy",
41    "$BASE_INNERKITS_ROOT/netstatsclient/include",
42    "$NETCONNMANAGER_UTILS_DIR/common_utils/include",
43    "$NETCONNMANAGER_COMMON_DIR/include",
44    "include",
45    "include/stub",
46    "$EXT_INNERKITS_ROOT/include",
47    "$EXT_INNERKITS_ROOT/ethernetclient/include",
48    "$EXT_INNERKITS_ROOT/ethernetclient/include/proxy",
49    "$BASE_INNERKITS_ROOT/include",
50    "$BASE_INNERKITS_ROOT/netconnclient/include",
51    "$BASE_INNERKITS_ROOT/dnsresolverclient/include",
52    "$BASE_INNERKITS_ROOT/ethernetclient/include",
53    "$NETSYSCONTROLLER_ROOT_DIR/include",
54    "$SAMGR_MANAGER_ROOT/interfaces/innerkits/samgr_proxy/include",
55    "$BASE_INNERKITS_ROOT/netmanagernative/include",
56    "$NETMANAGER_EXT_ROOT/utils/log/include",
57    "$NETMANAGER_BASE_ROOT/services/netmanagernative/include/netsys",
58  ]
59
60  cflags = [
61    "-fstack-protector-strong",
62    "-D_FORTIFY_SOURCE=2",
63    "-O2",
64  ]
65
66  cflags_cc = [
67    "-fstack-protector-strong",
68    "-D_FORTIFY_SOURCE=2",
69    "-O2",
70  ]
71
72  deps = [ "$EXT_INNERKITS_ROOT/ethernetclient:ethernet_parcel" ]
73
74  external_deps = [
75    "bounds_checking_function:libsec_shared",
76    "cJSON:cjson",
77    "dhcp:dhcp_sdk",
78    "eventhandler:libeventhandler",
79    "ffrt:libffrt",
80    "ipc:ipc_core",
81    "netmanager_base:net_conn_manager_if",
82    "netmanager_base:net_service_common",
83    "netmanager_base:netsys_controller",
84    "safwk:system_ability_fwk",
85  ]
86
87  defines = [
88    "NETMGR_LOG_TAG = \"EthernetManager\"",
89    "LOG_DOMAIN = 0xD0015B0",
90    "USER_CONFIG_DIR = \"/data/service/el1/public/netmanager/ethernet\"",
91    "NETWORK_CONFIG_PATH = \"/system/etc/communication/netmanager_ext/ethernet_interfaces.json\"",
92  ]
93
94  if (enable_netmgr_ext_debug) {
95    defines += [ "NETMGR_DEBUG" ]
96  }
97
98  external_deps += [ "hilog:libhilog" ]
99
100  part_name = "netmanager_ext"
101  subsystem_name = "communication"
102}
103
104ohos_prebuilt_etc("ethernet_interfaces") {
105  source = "$NETMANAGER_EXT_ROOT/services/ethernetmanager/config/ethernet_interfaces.json"
106  install_enable = true
107  relative_install_dir = "communication/netmanager_ext"
108  part_name = "netmanager_ext"
109}
110