1# Copyright (c) 2021-2022 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_base/netmanager_base_config.gni") 16 17ohos_shared_library("netsys_native_manager") { 18 sources = [ 19 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/dhcp_result_parcel.cpp", 20 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/netsys_addr_info_parcel.cpp", 21 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/netsys_native_service_proxy.cpp", 22 "$NETSYSNATIVE_INNERKITS_SOURCE_DIR/notify_callback_proxy.cpp", 23 "src/dhcp_controller.cpp", 24 "src/manager/bandwidth_manager.cpp", 25 "src/manager/bpf/bpf_map_creator.cpp", 26 "src/manager/bpf/bpf_prog_loader.cpp", 27 "src/manager/conn_manager.cpp", 28 "src/manager/dns_manager.cpp", 29 "src/manager/firewall_manager.cpp", 30 "src/manager/interface_manager.cpp", 31 "src/manager/route_manager.cpp", 32 "src/manager/sharing_manager.cpp", 33 "src/manager/traffic_manager.cpp", 34 "src/netsys/dnsresolv/dns_getaddrinfo.cpp", 35 "src/netsys/dnsresolv/dns_lookup_name.cpp", 36 "src/netsys/dnsresolv/dns_lookup_parse.cpp", 37 "src/netsys/dnsresolv/dns_param_cache.cpp", 38 "src/netsys/dnsresolv/dns_proxy_listen.cpp", 39 "src/netsys/dnsresolv/dns_resolv_config.cpp", 40 "src/netsys/dnsresolv/dns_resolv_listen.cpp", 41 "src/netsys/fwmark_network.cpp", 42 "src/netsys/iptables_wrapper.cpp", 43 "src/netsys/local_network.cpp", 44 "src/netsys/net_manager_native.cpp", 45 "src/netsys/netlink_msg.cpp", 46 "src/netsys/netlink_socket.cpp", 47 "src/netsys/netsys_network.cpp", 48 "src/netsys/netsys_udp_transfer.cpp", 49 "src/netsys/physical_network.cpp", 50 "src/netsys/wrapper/data_receiver.cpp", 51 "src/netsys/wrapper/netlink_manager.cpp", 52 "src/netsys/wrapper/netsys_event_message.cpp", 53 "src/netsys/wrapper/wrapper_decoder.cpp", 54 "src/netsys/wrapper/wrapper_distributor.cpp", 55 "src/netsys/wrapper/wrapper_listener.cpp", 56 "src/netsys_native_service.cpp", 57 "src/netsys_native_service_stub.cpp", 58 "src/notify_callback_stub.cpp", 59 ] 60 61 include_dirs = [ 62 "$C_UTILS_ROOT/base/include", 63 "$DHCP_MANAGER_ROOT/interfaces/inner_api/include", 64 "$DHCP_MANAGER_ROOT/interfaces/inner_api/interfaces", 65 "$INNERKITS_ROOT/include", 66 "$NETMANAGER_BASE_ROOT/services/common/include", 67 "$NETMANAGER_BASE_ROOT/utils/common_utils/include", 68 "$INNERKITS_ROOT/netmanagernative/include", 69 "include", 70 "include/manager", 71 "include/netsys", 72 "include/netsys/wrapper", 73 "$C_UTILS_ROOT/base/include", 74 "$DHCP_MANAGER_ROOT/interfaces/inner_api/include", 75 "$DHCP_MANAGER_ROOT/interfaces/inner_api/interfaces", 76 "$SAMGR_MANAGER_ROOT/interfaces/innerkits/samgr_proxy/include", 77 "$FWMARK_CLIENT_DIR/include", 78 ] 79 80 if (build_selinux) { 81 include_dirs += [ "$THIRD_PARTY_ROOT/selinux/libselinux/include/selinux" ] 82 } 83 84 deps = [ 85 "$DHCP_MANAGER_ROOT/services/mgr_service:dhcp_manager_service", 86 "$FWMARK_CLIENT_DIR:fwmark_client", 87 "$NETMANAGERNATIVE_ROOT/netsys_client", 88 "$NETMANAGER_BASE_ROOT/utils:net_manager_common", 89 "$THIRD_PARTY_ROOT/iptables:iptables", 90 "$THIRD_PARTY_ROOT/iptables:iptables-restore", 91 "$THIRD_PARTY_ROOT/iptables:iptables-save", 92 ] 93 94 if (build_selinux) { 95 deps += [ "$THIRD_PARTY_ROOT/selinux:libselinux" ] 96 } 97 98 external_deps = [ 99 "c_utils:utils", 100 "eventhandler:libeventhandler", 101 "init:libbegetutil", 102 "ipc:ipc_core", 103 "safwk:system_ability_fwk", 104 "samgr:samgr_proxy", 105 ] 106 107 defines = [ 108 "NETMGRNATIVE_LOG_TAG = \"NetsysNativeService\"", 109 "LOG_DOMAIN = 0xD0015B0", 110 "NETSYS_CONFIG_DEBUG=0", 111 "DNS_CONFIG_DEBUG=0", 112 ] 113 114 if (build_selinux) { 115 defines += [ "USE_SELINUX" ] 116 } 117 118 public_configs = [ "$NETMANAGER_BASE_ROOT/utils:netmgr_common_config" ] 119 120 if (enable_sys_func) { 121 defines += [ "SYS_FUNC" ] 122 } 123 124 if (enable_server_support_ipv6) { 125 defines += [ "SERVER_SUPPORT_IPV6" ] 126 } 127 128 if (is_standard_system) { 129 external_deps += [ "hiviewdfx_hilog_native:libhilog" ] 130 } else { 131 external_deps += [ "hilog:libhilog" ] 132 } 133 134 part_name = "netmanager_base" 135 subsystem_name = "communication" 136} 137