1# Copyright (c) 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("netfirewall_manager_config") { 18 include_dirs = [ 19 "$EXT_INNERKITS_ROOT/include", 20 "$EXT_INNERKITS_ROOT/netfirewallclient/include", 21 "$NETFIREWALLMANAGER_SOURCE_DIR/include", 22 "$NETWORKSHAREMANAGER_UTILS_DIR/event_report/include", 23 ] 24 25 defines = [ 26 "NETMGR_EXT_LOG_TAG = \"NetFirewallManager\"", 27 "LOG_DOMAIN = 0xD0015B0", 28 "DEFAULT_RULE_FILE = \"/system/etc/communication/netmanager_ext/default_firewall_rule.json\"", 29 ] 30 31 if (enable_netmgr_ext_debug) { 32 defines += [ "NETMGR_DEBUG" ] 33 } 34} 35 36netfirewall_manager_sources = [ 37 "$NETFIREWALLMANAGER_SOURCE_DIR/src/netfirewall_database.cpp", 38 "$NETFIREWALLMANAGER_SOURCE_DIR/src/netfirewall_db_helper.cpp", 39 "$NETFIREWALLMANAGER_SOURCE_DIR/src/netfirewall_default_rule_parser.cpp", 40 "$NETFIREWALLMANAGER_SOURCE_DIR/src/netfirewall_hisysevent.cpp", 41 "$NETFIREWALLMANAGER_SOURCE_DIR/src/netfirewall_intercept_recorder.cpp", 42 "$NETFIREWALLMANAGER_SOURCE_DIR/src/netfirewall_policy_manager.cpp", 43 "$NETFIREWALLMANAGER_SOURCE_DIR/src/netfirewall_preference_helper.cpp", 44 "$NETFIREWALLMANAGER_SOURCE_DIR/src/netfirewall_rule_manager.cpp", 45 "$NETFIREWALLMANAGER_SOURCE_DIR/src/netfirewall_rule_native_helper.cpp", 46 "$NETFIREWALLMANAGER_SOURCE_DIR/src/netfirewall_service.cpp", 47 "$NETFIREWALLMANAGER_SOURCE_DIR/src/netfirewall_stub.cpp", 48] 49 50netfirewall_manager_deps = [ "$NETMANAGER_EXT_ROOT/utils:net_event_report" ] 51 52netfirewall_manager_external_deps = [ 53 "ability_base:want", 54 "ability_base:zuri", 55 "bundle_framework:appexecfwk_base", 56 "bundle_framework:appexecfwk_core", 57 "cJSON:cjson", 58 "c_utils:utils", 59 "common_event_service:cesfwk_innerkits", 60 "ffrt:libffrt", 61 "hilog:libhilog", 62 "hisysevent:libhisysevent", 63 "hitrace:hitrace_meter", 64 "ipc:ipc_core", 65 "netmanager_base:net_conn_manager_if", 66 "netmanager_base:net_data_share", 67 "netmanager_base:net_manager_common", 68 "netmanager_base:net_native_manager_if", 69 "netmanager_base:netsys_controller", 70 "os_account:os_account_innerkits", 71 "preferences:native_preferences", 72 "relational_store:native_rdb", 73 "safwk:system_ability_fwk", 74 "samgr:samgr_proxy", 75] 76 77ohos_shared_library("netfirewall_manager") { 78 sanitize = { 79 cfi = true 80 cfi_cross_dso = true 81 debug = false 82 } 83 84 configs = [ 85 ":netfirewall_manager_config", 86 "$NETMANAGER_EXT_ROOT/resource:coverage_flags", 87 ] 88 89 sources = netfirewall_manager_sources 90 deps = netfirewall_manager_deps 91 external_deps = netfirewall_manager_external_deps 92 93 cflags = common_cflags + memory_optimization_cflags 94 95 cflags_cc = common_cflags + memory_optimization_cflags_cc 96 97 deps += [ "$EXT_INNERKITS_ROOT/netfirewallclient:netfirewall_parcel" ] 98 99 ldflags = memory_optimization_ldflags 100 101 part_name = "netmanager_ext" 102 subsystem_name = "communication" 103} 104 105ohos_static_library("netfirewall_manager_static") { 106 sanitize = { 107 cfi = true 108 cfi_cross_dso = true 109 debug = false 110 } 111 112 configs = [ 113 ":netfirewall_manager_config", 114 "$NETMANAGER_EXT_ROOT/resource:coverage_flags", 115 ] 116 117 sources = netfirewall_manager_sources 118 deps = netfirewall_manager_deps 119 external_deps = netfirewall_manager_external_deps 120 121 part_name = "netmanager_ext" 122 subsystem_name = "communication" 123} 124 125ohos_prebuilt_etc("netfirewall_default_rule") { 126 source = "$NETMANAGER_EXT_ROOT/services/netfirewallmanager/config/default_firewall_rule.json" 127 install_enable = true 128 relative_install_dir = "communication/netmanager_ext" 129 part_name = "netmanager_ext" 130 subsystem_name = "communication" 131} 132