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 namespace OHOS { 39 namespace HiviewDFX { 40 struct DllExport DomainRule { 41 enum FilterType { 42 INCLUDE, 43 EXCLUDE 44 }; 45 uint8_t filterType; 46 std::unordered_set<std::string> eventlist; 47 bool FindEvent(const std::string& eventName) const; 48 }; 49 50 struct DllExport DispatchRule { 51 std::unordered_set<uint8_t> typeList; 52 std::unordered_set<std::string> tagList; 53 std::unordered_set<std::string> eventList; 54 std::unordered_map<std::string, DomainRule> domainRuleMap; 55 bool FindEvent(const std::string &domain, const std::string &eventName); 56 }; 57 } // namespace HiviewDFX 58 } // namespace OHOS 59 60 #endif // HIVIEW_BASE_DEFINES_H