1 /* 2 * Copyright (c) 2022-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 16 #ifndef OHOS_USERIAM_DFX_HISYSEVENT_ADAPTER_H 17 #define OHOS_USERIAM_DFX_HISYSEVENT_ADAPTER_H 18 19 #include <string> 20 21 namespace OHOS { 22 namespace UserIam { 23 namespace UserAuth { 24 struct UserAuthTrace { 25 std::string callerName; 26 uint32_t sdkVersion = 0; 27 uint32_t atl = 0; 28 int32_t authType = 0; 29 int32_t authResult = -1; 30 uint64_t authtimeSpan = 0; 31 uint32_t authWidgetType = 0; 32 int32_t userId = 0; 33 int32_t callerType = 0; 34 uint32_t reuseUnlockResultMode = 0; 35 uint64_t reuseUnlockResultDuration = 0; 36 bool isBackgroundApplication = false; 37 }; 38 39 struct UserAuthFwkTrace { 40 std::string callerName; 41 uint64_t requestContextId = 0; 42 uint64_t authContextId = 0; 43 uint32_t atl = 0; 44 int32_t authType = 0; 45 int32_t authResult = -1; 46 uint64_t authtimeSpan = 0; 47 }; 48 49 struct UserCredManagerTrace { 50 std::string callerName; 51 int32_t userId = 0; 52 int32_t authType = 0; 53 uint32_t operationType = 0; 54 int32_t operationResult = -1; 55 }; 56 57 struct UserCredChangeTrace { 58 std::string callerName; 59 uint64_t requestContextId = 0; 60 int32_t userId = 0; 61 int32_t authType = 0; 62 uint32_t operationType = 0; 63 int32_t operationResult = -1; 64 uint64_t timeSpan = 0; 65 }; 66 67 struct TemplateChangeTrace { 68 uint64_t scheduleId = 0; 69 int32_t executorType = 0; 70 uint32_t changeType = 0; 71 std::string reason; 72 }; 73 74 void ReportSystemFault(const std::string &timeString, const std::string &moudleName); 75 void ReportSecurityTemplateChange(const TemplateChangeTrace &info); 76 void ReportBehaviorCredManager(const UserCredManagerTrace &info); 77 void ReportSecurityCredChange(const UserCredChangeTrace &info); 78 void ReportUserAuth(const UserAuthTrace &info); 79 void ReportSecurityUserAuthFwk(const UserAuthFwkTrace &info); 80 } // namespace UserAuth 81 } // namespace UserIam 82 } // namespace OHOS 83 #endif // OHOS_USERIAM_DFX_HISYSEVENT_ADAPTER_H