1 /* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef HIVIEW_BASE_DEFINES_H 16 #define HIVIEW_BASE_DEFINES_H 17 18 #include <unordered_set> 19 #include <unordered_map> 20 21 #ifndef __UNUSED 22 23 #if defined(_MSC_VER) 24 #define __UNUSED // Note: actually gcc seems to also supports this syntax. 25 #else 26 #if defined(__GNUC__) 27 #define __UNUSED __attribute__ ((__unused__)) 28 #endif 29 #endif 30 31 #endif 32 #ifdef _WIN32 33 #define DllExport __declspec (dllexport) 34 #else 35 #define DllExport 36 #endif // _WIN32 37 38 // define your message type here 39 #define PRIVATE_MESSAGE_TYPE \ 40 PRIVATE_MESSAGE_TYPE, \ 41 ENGINE_UPLOAD_READY_MSG, \ 42 ENGINE_REFRESH_UE_STATE_MSG, \ 43 ENGINE_UPDATE_XML_MSG, \ 44 ENGINE_SET_TEST_TYPE_MSG, \ 45 ENGINE_RUNNING_LOG_TIMER_MSG, \ 46 ENGINE_RUNNING_LOG_NOTIFY_MSG, \ 47 ENGINE_RUNNING_LOG_UNPACK_MSG, \ 48 ENGINE_NOTIFY_FLUSH_OLD_INFO_MSG, \ 49 ENGINE_EVENTINFO_LOGGER_TIMER_MSG, \ 50 ENGINE_DESERIALIZE_MSG, \ 51 ENGINE_TIMER_TASK_NOTIFY_MSG, \ 52 ENGINE_APP_USAGE_STATICS_MSG, \ 53 ENGINE_RAW_EVENT_MSG, \ 54 ENGINE_CHECK_NATIVE_MSG, \ 55 ENGINE_CAPTURE_LOG_MSG, \ 56 ENGINE_CAPTURE_REMOTE_LOG_FINISH, \ 57 ENGINE_DISTRIBUTED_CAPTURE_REMOTE_LOG_FINISH, \ 58 ENGINE_CAPTURE_BETACLUB_LOG_FINISH, \ 59 ENGINE_CAPTURE_TEST_LOG_FINISH, \ 60 ENGINE_CAPTURE_REPAIR_LOG_FINISH, \ 61 ENGINE_POST_EXT_REMOTE_DATA, \ 62 ENGINE_CLOSE_REMOTE_DEBUG, \ 63 ENGINE_ROLLBACK_USED_TRAFFIC, \ 64 ENGINE_CAR_UPDATE_CONFIG, \ 65 ENGINE_CAPTURE_CAR_LOG, \ 66 ENGINE_CAPTURE_CAR_LOG_FINISH, \ 67 ENGINE_SYSEVENT_DEBUG_MODE, \ 68 ENGINE_ROLLBACK_TRAFFIC_BY_INFO, \ 69 TELEMETRY_EVENT, \ 70 ENGINE_UPDATE_PRIVACY_CFG_MSG 71 // define your audit event type here 72 #define PRIVATE_AUDIT_EVENT_TYPE \ 73 PRIVATE_AUDIT_EVENT_TYPE = 1000, 74 75 namespace OHOS { 76 namespace HiviewDFX { 77 struct DllExport DomainRule { 78 enum FilterType { 79 INCLUDE, 80 EXCLUDE 81 }; 82 uint8_t filterType; 83 std::unordered_set<std::string> eventlist; 84 bool FindEvent(const std::string& eventName) const; 85 }; 86 87 struct DllExport DispatchRule { 88 std::unordered_set<uint8_t> typeList; 89 std::unordered_set<std::string> tagList; 90 std::unordered_set<std::string> eventList; 91 std::unordered_map<std::string, DomainRule> domainRuleMap; 92 bool FindEvent(const std::string &domain, const std::string &eventName); 93 }; 94 } // namespace HiviewDFX 95 } // namespace OHOS 96 97 #endif // HIVIEW_BASE_DEFINES_H