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 HiTraceChainTracepointExWithDomain. 30 void HiTraceChainTracepointExWithDomainWrapper(int mode, int type, const HiTraceIdStruct* pId, 31 unsigned int domain, const char* fmt, ...) __attribute__((__format__(os_log, 5, 6))); 32 33 // rust ffi border redefinition adapts for function HiTraceChainIsFlagEnabled. 34 int HiTraceChainIsFlagEnabledWrapper(const HiTraceIdStruct* pId, int flag); 35 36 // rust ffi border redefinition adapts for function HiTraceChainEnableFlag. 37 void HiTraceChainEnableFlagWrapper(HiTraceIdStruct* pId, int flag); 38 39 // rust ffi border redefinition adapts for function HiTraceChainIsValid. 40 int HiTraceChainIsValidWrapper(const HiTraceIdStruct* pId); 41 42 // rust ffi border redefinition adapts for function HiTraceChainSetFlags. 43 void HiTraceChainSetFlagsWrapper(HiTraceIdStruct* pId, int flags); 44 45 // rust ffi border redefinition adapts for function HiTraceChainGetFlags. 46 int HiTraceChainGetFlagsWrapper(const HiTraceIdStruct* pId); 47 48 // rust ffi border redefinition adapts for function HiTraceChainSetChainId. 49 void HiTraceChainSetChainIdWrapper(HiTraceIdStruct* pId, uint64_t chainId); 50 51 // rust ffi border redefinition adapts for function HiTraceChainGetChainId. 52 uint64_t HiTraceChainGetChainIdWrapper(const HiTraceIdStruct* pId); 53 54 // rust ffi border redefinition adapts for function HiTraceChainSetSpanId. 55 void HiTraceChainSetSpanIdWrapper(HiTraceIdStruct* pId, uint64_t spanId); 56 57 // rust ffi border redefinition adapts for function HiTraceChainGetSpanId. 58 uint64_t HiTraceChainGetSpanIdWrapper(const HiTraceIdStruct* pId); 59 60 // rust ffi border redefinition adapts for function HiTraceChainSetParentSpanId. 61 void HiTraceChainSetParentSpanIdWrapper(HiTraceIdStruct* pId, uint64_t parentSpanId); 62 63 // rust ffi border redefinition adapts for function HiTraceChainGetParentSpanId. 64 uint64_t HiTraceChainGetParentSpanIdWrapper(const HiTraceIdStruct* pId); 65 66 // rust ffi border redefinition adapts for function HiTraceChainIdToBytes. 67 int HiTraceChainIdToBytesWrapper(const HiTraceIdStruct* pId, uint8_t* pIdArray, int len); 68 69 // rust ffi border redefinition adapts for function HiTraceChainBytesToId. 70 HiTraceIdStruct HiTraceChainBytesToIdWrapper(const uint8_t* pIdArray, int len); 71 72 #ifdef __cplusplus 73 } 74 #endif 75 76 #endif //HIVIEWDFX_HITRACECHAIN_C_WRAPPER_H