• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 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 TraceStreamerSqlOperate(const uint8_t* sql, int32_t sqlLen);
42 int32_t TraceStreamerSqlOperateEx(int32_t sqlLen);
43 int32_t TraceStreamerReset();
44 int32_t TraceStreamerSqlQuery(const uint8_t* sql, int32_t sqlLen, uint8_t* out, int32_t outLen);
45 int32_t TraceStreamer_Plugin_Out_SendData(const char* pluginData, int32_t len, int32_t componentId);
46 int32_t TraceStreamer_Plugin_Out_Filter(const char* pluginData, int32_t len, const std::string& componentName);
47 void TraceStreamer_Set_Log_Level(uint32_t level);
48 
49 int32_t TraceStreamerSqlQueryEx(int32_t sqlLen);
50 int32_t TraceStreamerSqlQueryToProtoCallback(int32_t sqlLen);
51 int32_t TraceStreamerCancel();
52 } // extern "C"
53 } // namespace TraceStreamer
54 } // namespace SysTuning
55 
56 #endif // RPC_WASM_FUNC_H
57