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 isRemoteAuth = false; 37 std::string localUdid; 38 std::string remoteUdid; 39 std::string connectionName; 40 std::string authFinishReason; 41 bool isBackgroundApplication = false; 42 }; 43 44 struct UserAuthFwkTrace { 45 std::string callerName; 46 uint64_t requestContextId = 0; 47 uint64_t authContextId = 0; 48 uint32_t atl = 0; 49 int32_t authType = 0; 50 int32_t authResult = -1; 51 uint64_t authtimeSpan = 0; 52 bool isRemoteAuth = false; 53 std::string localUdid; 54 std::string remoteUdid; 55 std::string connectionName; 56 std::string authFinishReason; 57 }; 58 59 struct UserCredManagerTrace { 60 std::string callerName; 61 int32_t userId = 0; 62 int32_t authType = 0; 63 uint32_t operationType = 0; 64 int32_t operationResult = -1; 65 }; 66 67 struct UserCredChangeTrace { 68 std::string callerName; 69 uint64_t requestContextId = 0; 70 int32_t userId = 0; 71 int32_t authType = 0; 72 uint32_t operationType = 0; 73 int32_t operationResult = -1; 74 uint64_t timeSpan = 0; 75 }; 76 77 struct TemplateChangeTrace { 78 uint64_t scheduleId = 0; 79 int32_t executorType = 0; 80 uint32_t changeType = 0; 81 std::string reason; 82 }; 83 84 struct RemoteExecuteTrace { 85 uint64_t scheduleId = 0; 86 std::string connectionName; 87 int32_t operationResult = -1; 88 }; 89 90 struct RemoteConnectOpenTrace { 91 std::string connectionName; 92 int32_t operationResult = -1; 93 uint64_t timeSpan = 0; 94 std::string networkId; 95 int32_t socketId = -1; 96 }; 97 98 struct RemoteConnectFaultTrace { 99 std::string reason; 100 int32_t socketId = -1; 101 std::string connectionName; 102 int32_t msgType = -1; 103 uint32_t messageSeq = 0; 104 bool ack = false; 105 }; 106 107 struct SaLoadDriverFailureTrace { 108 int32_t errCode = -1; 109 }; 110 111 struct IsCredentialEnrolledMismatchTrace { 112 int32_t authType = 0; 113 bool preStatus = false; 114 bool updatedStatus = false; 115 }; 116 117 struct ScreenLockStrongAuthTrace { 118 int32_t userId = 0; 119 int32_t strongAuthReason = 0; 120 }; 121 122 void ReportSystemFault(const std::string &timeString, const std::string &moduleName); 123 void ReportSecurityTemplateChange(const TemplateChangeTrace &info); 124 void ReportBehaviorCredManager(const UserCredManagerTrace &info); 125 void ReportSecurityCredChange(const UserCredChangeTrace &info); 126 void ReportUserAuth(const UserAuthTrace &info); 127 void ReportSecurityUserAuthFwk(const UserAuthFwkTrace &info); 128 void ReportRemoteExecuteProc(const RemoteExecuteTrace &info); 129 void ReportRemoteConnectOpen(const RemoteConnectOpenTrace &info); 130 void ReportConnectFaultTrace(const RemoteConnectFaultTrace &info); 131 void ReportSaLoadDriverFailure(const SaLoadDriverFailureTrace &info); 132 void ReportIsCredentialEnrolledMismatch(const IsCredentialEnrolledMismatchTrace &info); 133 void ReportScreenLockStrongAuth(const ScreenLockStrongAuthTrace &info); 134 } // namespace UserAuth 135 } // namespace UserIam 136 } // namespace OHOS 137 #endif // OHOS_USERIAM_DFX_HISYSEVENT_ADAPTER_H