1 /* 2 * Copyright (c) 2025 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 HKS_REPORT_GENERATE_KEY_H 17 #define HKS_REPORT_GENERATE_KEY_H 18 19 #include "hks_type.h" 20 #include "hks_type_inner.h" 21 #include "hks_event_info.h" 22 #include "hks_type_enum.h" 23 #include <stdint.h> 24 25 #ifdef __cplusplus 26 #include <vector> 27 #include <unordered_map> 28 #include <string> 29 #endif 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 struct InfoPair { 36 uint64_t startTime; 37 uint64_t traceId; 38 }; 39 40 int32_t PreConstructGenKeyReportParamSet(const struct HksBlob *keyAlias, const struct HksParamSet *paramSetIn, 41 struct InfoPair infoPair, const struct HksBlob *keyIn, struct HksParamSet **paramSetOut); 42 43 #ifdef __cplusplus 44 } 45 #endif 46 47 #ifdef __cplusplus 48 49 int32_t HksParamSetToEventInfoForKeyGen(const struct HksParamSet *paramSetIn, struct HksEventInfo* eventInfo); 50 51 bool HksEventInfoIsNeedReportForKeyGen(const struct HksEventInfo *eventInfo); 52 53 bool HksEventInfoIsEqualForKeyGen(const struct HksEventInfo *eventInfo1, const struct HksEventInfo *eventInfo2); 54 55 void HksEventInfoAddForKeyGen(struct HksEventInfo *dstEventInfo, const struct HksEventInfo *srcEventInfo); 56 57 int32_t HksEventInfoToMapForKeyGen(const struct HksEventInfo *eventInfo, 58 std::unordered_map<std::string, std::string> &reportData); 59 60 #endif 61 62 #endif // HKS_REPORT_GENERATE_KEY_H 63