1 /*
2 * Copyright (c) 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 CODE_SIGN_HISYSEVENT_H
17 #define CODE_SIGN_HISYSEVENT_H
18
19 #include <hisysevent.h>
20 #include <string>
21
22 namespace OHOS {
23 namespace Security {
24 namespace CodeSign {
ReportEnableError(std::string filePath,int32_t errCode)25 inline void ReportEnableError(std::string filePath, int32_t errCode)
26 {
27 HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::CODE_SIGN, "CS_ENABLE_ERR",
28 HiviewDFX::HiSysEvent::EventType::SECURITY,
29 "FILE_INFO", filePath, "ERR_TYPE", errCode);
30 }
31
ReportLoadSAError(int32_t errCode)32 inline void ReportLoadSAError(int32_t errCode)
33 {
34 HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::CODE_SIGN, "CS_LOAD_SA_ERR",
35 HiviewDFX::HiSysEvent::EventType::FAULT, "ERR_TYPE", errCode);
36 }
37
ReportInvalidCaller(const std::string & interfaceType,uint32_t tokenId)38 inline void ReportInvalidCaller(const std::string &interfaceType, uint32_t tokenId)
39 {
40 HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::CODE_SIGN, "CS_SA_INVALID_CALLER",
41 HiviewDFX::HiSysEvent::EventType::SECURITY,
42 "INTERFACE", interfaceType, "TOKEN_ID", tokenId);
43 }
44 }
45 }
46 }
47 #endif