1 /* 2 * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. 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 RPC_WASM_FUNC_H 17 #define RPC_WASM_FUNC_H 18 19 #include <cstdio> 20 #ifndef IS_UT 21 #include <emscripten.h> 22 #endif 23 #ifdef IS_UT 24 #define EMSCRIPTEN_KEEPALIVE __attribute__((used)) 25 26 #ifdef __wasm__ 27 #define EM_IMPORT(NAME) __attribute__((import_module("env"), import_name(#NAME))) 28 #else 29 #define EM_IMPORT(NAME) 30 #endif 31 32 #endif 33 #include "rpc_server.h" 34 35 namespace SysTuning { 36 namespace TraceStreamer { 37 extern "C" { 38 int32_t TraceStreamerParseData(const uint8_t *data, int32_t dataLen); 39 int32_t TraceStreamerParseDataEx(int32_t dataLen, bool isFinish); 40 int32_t TraceStreamerParseDataOver(); 41 int32_t TraceStreamerSqlOperateEx(int32_t sqlLen); 42 int32_t TraceStreamerReset(); 43 int32_t TraceStreamerSqlQuery(const uint8_t *sql, int32_t sqlLen, uint8_t *out, int32_t outLen); 44 int32_t TraceStreamerPluginOutSendData(const char *pluginData, int32_t len, int32_t componentId); 45 int32_t TraceStreamerPluginOutFilter(const char *pluginData, int32_t len, const std::string &componentName); 46 void TraceStreamerSetLogLevel(uint32_t level); 47 48 int32_t TraceStreamerSqlQueryEx(int32_t sqlLen); 49 int32_t TraceStreamerSqlQueryToProtoCallback(int32_t sqlLen); 50 int32_t TraceStreamerCancel(); 51 } // extern "C" 52 } // namespace TraceStreamer 53 } // namespace SysTuning 54 55 #endif // RPC_WASM_FUNC_H 56