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 HIVIEWDFX_HITRACECHAIN_C_WRAPPER_H 17 #define HIVIEWDFX_HITRACECHAIN_C_WRAPPER_H 18 19 #include "hitrace/hitracechainc.h" 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 // rust ffi border redefinition adapts for function HiTraceChainTracepointEx. 26 void HiTraceChainTracepointExWrapper(int mode, int type, const HiTraceIdStruct* pId, const char* fmt, ...) 27 __attribute__((__format__(os_log, 4, 5))); 28 29 // rust ffi border redefinition adapts for function HiTraceChainIsFlagEnabled. 30 int HiTraceChainIsFlagEnabledWrapper(const HiTraceIdStruct* pId, int flag); 31 32 // rust ffi border redefinition adapts for function HiTraceChainEnableFlag. 33 void HiTraceChainEnableFlagWrapper(HiTraceIdStruct* pId, int flag); 34 35 // rust ffi border redefinition adapts for function HiTraceChainIsValid. 36 int HiTraceChainIsValidWrapper(const HiTraceIdStruct* pId); 37 38 // rust ffi border redefinition adapts for function HiTraceChainSetFlags. 39 void HiTraceChainSetFlagsWrapper(HiTraceIdStruct* pId, int flags); 40 41 // rust ffi border redefinition adapts for function HiTraceChainGetFlags. 42 int HiTraceChainGetFlagsWrapper(const HiTraceIdStruct* pId); 43 44 // rust ffi border redefinition adapts for function HiTraceChainSetChainId. 45 void HiTraceChainSetChainIdWrapper(HiTraceIdStruct* pId, uint64_t chainId); 46 47 // rust ffi border redefinition adapts for function HiTraceChainGetChainId. 48 uint64_t HiTraceChainGetChainIdWrapper(const HiTraceIdStruct* pId); 49 50 // rust ffi border redefinition adapts for function HiTraceChainSetSpanId. 51 void HiTraceChainSetSpanIdWrapper(HiTraceIdStruct* pId, uint64_t spanId); 52 53 // rust ffi border redefinition adapts for function HiTraceChainGetSpanId. 54 uint64_t HiTraceChainGetSpanIdWrapper(const HiTraceIdStruct* pId); 55 56 // rust ffi border redefinition adapts for function HiTraceChainSetParentSpanId. 57 void HiTraceChainSetParentSpanIdWrapper(HiTraceIdStruct* pId, uint64_t parentSpanId); 58 59 // rust ffi border redefinition adapts for function HiTraceChainGetParentSpanId. 60 uint64_t HiTraceChainGetParentSpanIdWrapper(const HiTraceIdStruct* pId); 61 62 // rust ffi border redefinition adapts for function HiTraceChainIdToBytes. 63 int HiTraceChainIdToBytesWrapper(const HiTraceIdStruct* pId, uint8_t* pIdArray, int len); 64 65 // rust ffi border redefinition adapts for function HiTraceChainBytesToId. 66 HiTraceIdStruct HiTraceChainBytesToIdWrapper(const uint8_t* pIdArray, int len); 67 68 #ifdef __cplusplus 69 } 70 #endif 71 72 #endif //HIVIEWDFX_HITRACECHAIN_C_WRAPPER_H