1 /* 2 * Copyright (c) 2021 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 RPC_WASM_FUNC_H 17 #define RPC_WASM_FUNC_H 18 19 #include <cstdio> 20 #ifndef UT_MAC 21 #include <emscripten.h> 22 #endif 23 #ifdef UT_MAC 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 int TraceStreamerParseData(const uint8_t* data, int dataLen); 39 int TraceStreamerParseDataEx(int dataLen); 40 int TraceStreamerParseDataOver(); 41 int TraceStreamerSqlOperate(const uint8_t* sql, int sqlLen); 42 int TraceStreamerSqlOperateEx(int sqlLen); 43 int TraceStreamerReset(); 44 int TraceStreamerSqlQuery(const uint8_t* sql, int sqlLen, uint8_t* out, int outLen); 45 int TraceStreamer_Plugin_Out_SendData(const char* pluginData, int len, int componentId); 46 int TraceStreamer_Plugin_Out_Filter(const char* pluginData, int len, const std::string componentName); 47 48 int TraceStreamerSqlQueryEx(int sqlLen); 49 int TraceStreamerCancel(); 50 } // extern "C" 51 } // namespace TraceStreamer 52 } // namespace SysTuning 53 54 #endif // RPC_WASM_FUNC_H 55