summaryrefslogtreecommitdiffstats
path: root/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple
diff options
context:
space:
mode:
Diffstat (limited to 'fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple')
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/.gitignore1
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/CMakeLists.txt40
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/README.md342
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/build.sh166
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm-interp/toolchain.cmake40
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm-interp/wamr_config_simple.cmake11
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-aot/toolchain.cmake38
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-aot/wamr_config_simple.cmake12
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-interp/toolchain.cmake38
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-interp/wamr_config_simple.cmake12
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/host-aot/wamr_config_simple.cmake11
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/host-interp/wamr_config_simple.cmake11
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/macos-interp/wamr_config_simple.cmake11
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/sample_test_run.py224
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/src/iwasm_main.c568
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/src/main.c14
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/connection.c89
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/event_publisher.c54
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/event_subscriber.c29
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/request_handler.c59
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/request_sender.c52
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/sensor.c83
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/timer.c34
23 files changed, 0 insertions, 1939 deletions
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/.gitignore b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/.gitignore
deleted file mode 100644
index e2e7327cd..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/out
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/CMakeLists.txt
deleted file mode 100644
index f3a0848fe..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/CMakeLists.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 2.9)
-
-project (simple)
-
-################ wamr runtime settings ################
-message(STATUS "WAMR_BUILD_SDK_PROFILE=${WAMR_BUILD_SDK_PROFILE}")
-
-# Reset default linker flags
-set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
-
-if ("$ENV{COLLECT_CODE_COVERAGE}" STREQUAL "1" OR COLLECT_CODE_COVERAGE EQUAL 1)
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
-endif ()
-
-set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-
-## use library and headers in the SDK
-link_directories(${WAMR_ROOT_DIR}/wamr-sdk/out/${WAMR_BUILD_SDK_PROFILE}/runtime-sdk/lib)
-include_directories(
- ${WAMR_ROOT_DIR}/wamr-sdk/out/${WAMR_BUILD_SDK_PROFILE}/runtime-sdk/include
- ${WAMR_ROOT_DIR}/core/shared/utils
- ${WAMR_ROOT_DIR}/core/shared/platform/linux
-)
-
-################ application related ################
-
-include_directories(${CMAKE_CURRENT_LIST_DIR}/src)
-
-#Note: uncomment below line to use UART mode
-#add_definitions (-DCONNECTION_UART)
-
-add_executable (simple src/main.c src/iwasm_main.c)
-target_link_libraries (simple vmlib -lm -ldl -lpthread -lrt)
-
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/README.md
deleted file mode 100644
index 5625212f9..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/README.md
+++ /dev/null
@@ -1,342 +0,0 @@
-
-
-"simple" sample introduction
-==============
-
-This sample demonstrates following scenarios:
-
-- Use tool "host_tool" to remotely install/uninstall wasm applications from the WAMR runtime over either TCP socket or UART cable
-- Inter-app communication programming models
-- Communication between WASM applications and the remote app host_tool
-- A number of WASM applications built on top of WAMR application framework API sets
-
-
-
-Directory structure
-------------------------------
-```
-simple/
-├── build.sh
-├── CMakeLists.txt
-├── README.md
-├── src
-│   ├── ext_lib_export.c
-│   ├── iwasm_main.c
-│   └── main.c
-└── wasm-apps
- ├── connection.c
- ├── event_publisher.c
- ├── event_subscriber.c
- ├── request_handler.c
- ├── request_sender.c
- ├── sensor.c
- └── timer.c
-```
-
-- src/ext_lib_export.c<br/>
- This file is used to export native APIs. See the `The mechanism of exporting Native API to WASM application` section in WAMR README.md for detail.
-- src/iwam_main.c<br/>
- This file is the implementation by platform integrator. It implements the interfaces that enable the application manager communicating with the host side. See `{WAMR_ROOT}/core/app-mgr/app-mgr-shared/app_manager_export.h` for the definition of the host interface.
-## Set physical communication between device and remote
-
-
-
-```
-/* Interfaces of host communication */
-typedef struct host_interface {
- host_init_func init;
- host_send_fun send;
- host_destroy_fun destroy;
-} host_interface;
-
-```
-The `host_init_func` is called when the application manager starts up. And `host_send_fun` is called by the application manager to send data to the host.
-
-Define a global variable "interface" of the data structure:
-
-```
-
-host_interface interface = {
- .init = host_init,
- .send = host_send,
- .destroy = host_destroy
-};
-```
-This interface is passed to application manager during the runtime startup:
-```
-app_manager_startup(&interface);
-```
-
->
-
-**Note:** The connection between simple and host_tool is TCP by default. The simple application works as a server and the host_tool works as a client. You can also use UART connection. To achieve this you have to uncomment the below line in CMakeLists.txt and rebuild.
-
-```
-#add_definitions (-DCONNECTION_UART)`
-```
-
-To run the UART based test, you have to set up a UART hardware connection between host_tool and the simple application. See the help of host_tool for how to specify UART device parameters.
-
-
-Build the sample
-==============
-Execute the build.sh script then all binaries including wasm application files would be generated in 'out' directory.
-
-```
-$ ./build.sh
-Enter build target profile (default=host-interp) -->
-arm-interp
-host-aot
-host-interp
-\>:
-
-```
-
-Enter the profile name for starting your build. "host-***" profiles build the sample for executing on your development machine, and "arm-interp" profile will do cross building for ARM target platform. If "arm-interp" is entered, please ensure the ARM cross compiler toolchain is already installed in your development machine. Your should set *ARM_A7_COMPILER_DIR* and *ARM_A7_SDKTARGETSYSROOT* environment variable in your ~/.bashrc correctly. refer to the file [profiles/arm-interp/toolchain.cmake](./profiles/arm-interp/toolchain.cmake).
-
-```
-~/.bashrc:
-export ARM_A7_COMPILER_DIR="/home/beihai/cross-toolchains/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin"
-export ARM_A7_SDKTARGETSYSROOT="/home/beihai/cross-toolchains/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/arm-linux-gnueabihf/libc"
-
-notes: please set the value to the actual path of your cross toolchain.
-```
-
-If you need to create additional profile for customizing your runtime, application framework or the target platforms, a new subfolder can be created under the *profiles* folder, and place your own version of "toolchain.cmake" and "wamr_config_simple.cmake" in it.
-
-```
-$wamr-root/samples/simple/profiles$ ls
-arm-interp host-aot host-interp
-$wamr-root/samples/simple/profiles$ ls arm-interp/
-toolchain.cmake wamr_config_simple.cmake
-
-```
-
-
-
-
-
-**Out directory structure**
-
-```
-out/
-├── host_tool
-├── simple
-└── wasm-apps
- ├── connection.wasm
- ├── event_publisher.wasm
- ├── event_subscriber.wasm
- ├── request_handler.wasm
- ├── request_sender.wasm
- ├── sensor.wasm
- └── timer.wasm
-```
-
-- host_tool:
- A small testing tool to interact with WAMR. See the usage of this tool by executing "./host_tool -h".
- `./host_tool -h`
-
-- simple:
- A simple testing tool running on the host side that interact with WAMR. It is used to install, uninstall and query WASM applications in WAMR, and send request or subscribe event, etc. See the usage of this application by executing "./simple -h".
- `./simple -h`
->
-
-Run the sample
-==========================
-- Enter the out directory
-```
-$ cd ./out/
-```
-
-- Startup the 'simple' process works in TCP server mode and you would see "App Manager started." is printed.
-```
-$ ./simple -s
-App Manager started.
-```
-
-- Query all installed applications
-```
-$ ./host_tool -q
-
-response status 69
-{
- "num": 0
-}
-```
-
-The `69` stands for response code SUCCESS. The payload is printed with JSON format where the `num` stands for application installations number and value `0` means currently no application is installed yet.
-
-- Install the request handler wasm application<br/>
-```
-$ ./host_tool -i request_handler -f ./wasm-apps/request_handler.wasm
-
-response status 65
-```
-Now the request handler application is running and waiting for host or other wasm application to send a request.
-
-- Query again
-```
-$ ./host_tool -q
-
-response status 69
-{
- "num": 1,
- "applet1": "request_handler",
- "heap1": 49152
-}
-```
-In the payload, we can see `num` is 1 which means 1 application is installed. `applet1`stands for the name of the 1st application. `heap1` stands for the heap size of the 1st application.
-
-- Send request from host to specific wasm application
-```
-$ ./host_tool -r /app/request_handler/url1 -A GET
-
-response status 69
-{
- "key1": "value1",
- "key2": "value2"
-}
-```
-
-We can see a response with status `69` and a payload is received.
-
-Output of simple application:
-```
-connection established!
-Send request to applet: request_handler
-Send request to app request_handler success.
-App request_handler got request, url url1, action 1
-[resp] ### user resource 1 handler called
-sent 150 bytes to host
-Wasm app process request success.
-```
-
-- Send a general request from host (not specify target application name)<br/>
-```
-$ ./host_tool -r /url1 -A GET
-
-response status 69
-{
- "key1": "value1",
- "key2": "value2"
-}
-```
-
-Output of simple application:
-```
-connection established!
-Send request to app request_handler success.
-App request_handler got request, url /url1, action 1
-[resp] ### user resource 1 handler called
-sent 150 bytes to host
-Wasm app process request success.
-```
-
-- Install the event publisher wasm application
-```
-$ ./host_tool -i pub -f ./wasm-apps/event_publisher.wasm
-
-response status 65
-```
-
-- Subscribe event by host_tool<br/>
-```
-$ ./host_tool -s /alert/overheat -a 3000
-
-response status 69
-
-received an event alert/overheat
-{
- "warning": "temperature is over high"
-}
-received an event alert/overheat
-{
- "warning": "temperature is over high"
-}
-received an event alert/overheat
-{
- "warning": "temperature is over high"
-}
-received an event alert/overheat
-{
- "warning": "temperature is over high"
-}
-```
-We can see 4 `alert/overheat` events are received in 3 seconds which is published by the `pub` application.
-
-Output of simple
-```
-connection established!
-am_register_event adding url:(alert/overheat)
-client: -3 registered event (alert/overheat)
-sent 16 bytes to host
-sent 142 bytes to host
-sent 142 bytes to host
-sent 142 bytes to host
-sent 142 bytes to host
-```
-- Install the event subscriber wasm application<br/>
-```
-$ ./host_tool -i sub -f ./wasm-apps/event_subscriber.wasm
-
-response status 65
-```
-The `sub` application is installed.
-
-Output of simple
-```
-connection established!
-Install WASM app success!
-WASM app 'sub' started
-am_register_event adding url:(alert/overheat)
-client: 3 registered event (alert/overheat)
-sent 16 bytes to host
-Send request to app sub success.
-App sub got request, url alert/overheat, action 6
-### user over heat event handler called
-Attribute container dump:
-Tag:
-Attribute list:
- key: warning, type: string, value: temperature is over high
-
-Wasm app process request success.
-```
-
-We can see the `sub` application receives the `alert/overheat` event and dumps it out.<br/>
-At device side, the event is represented by an attribute container which contains key-value pairs like below:
-```
-Attribute container dump:
-Tag:
-Attribute list:
- key: warning, type: string, value: temperature is over high
-```
-`warning` is the key's name. `string` means this is a string value and `temperature is over high` is the value.
-
-- Uninstall the wasm application<br/>
-```
-$ ./host_tool -u request_handler
-
-response status 66
-
-$ ./host_tool -u pub
-
-response status 66
-
-$ ./host_tool -u sub
-
-response status 66
-```
-
-- Query again<br/>
-```
-$ ./host_tool -q
-
-response status 69
-{
- "num": 0
-}
-```
-
- >**Note:** Here we only installed part of the sample WASM applications. You can try others by yourself.
-
- >**Note:** You have to manually kill the simple process by Ctrl+C after use.
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/build.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/build.sh
deleted file mode 100755
index 4e8155156..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/build.sh
+++ /dev/null
@@ -1,166 +0,0 @@
-#
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-
-#!/bin/bash
-
-CURR_DIR=$PWD
-WAMR_DIR=${PWD}/../..
-OUT_DIR=${PWD}/out
-BUILD_DIR=${PWD}/build
-
-IWASM_ROOT=${PWD}/../../core/iwasm
-APP_FRAMEWORK_DIR=${PWD}/../../core/app-framework
-NATIVE_LIBS=${APP_FRAMEWORK_DIR}/app-native-shared
-APP_LIB_SRC="${APP_FRAMEWORK_DIR}/base/app/*.c ${APP_FRAMEWORK_DIR}/sensor/app/*.c \
- ${APP_FRAMEWORK_DIR}/connection/app/*.c ${NATIVE_LIBS}/*.c"
-WASM_APPS=${PWD}/wasm-apps
-CLEAN=
-CM_BUILD_TYPE="-DCMAKE_BUILD_TYPE=Release"
-CM_TOOLCHAIN=""
-
-usage ()
-{
- echo "build.sh [options]"
- echo " -p [profile]"
- echo " -d [target]"
- echo " -c, rebuild SDK"
- exit 1
-}
-
-
-while getopts "p:dch" opt
-do
- case $opt in
- p)
- PROFILE=$OPTARG
- ;;
- d)
- CM_BUILD_TYPE="-DCMAKE_BUILD_TYPE=Debug"
- ;;
- c)
- CLEAN="TRUE"
- ;;
- h)
- usage
- exit 1;
- ;;
- ?)
- echo "Unknown arg: $arg"
- usage
- exit 1
- ;;
- esac
-done
-
-
-if [ "$CLEAN" = "TRUE" ]; then
- rm -rf $CURR_DIR/cmake-build
-fi
-
-
-while [ ! -n "$PROFILE" ]
-do
- support_profiles=`ls -l "profiles/" |grep '^d' | awk '{print $9}'`
- read -p "Enter build target profile (default=host-interp) -->
-$support_profiles
-\>:" read_platform
- if [ ! -n "$read_platform" ]; then
- PROFILE="host-interp"
- else
- PROFILE=$read_platform
- fi
-done
-
-ARG_TOOLCHAIN=""
-TOOL_CHAIN_FILE=$CURR_DIR/profiles/$PROFILE/toolchain.cmake
-if [ -f $TOOL_CHAIN_FILE ]; then
- CM_TOOLCHAIN="-DCMAKE_TOOLCHAIN_FILE=$TOOL_CHAIN_FILE"
- ARG_TOOLCHAIN="-t $TOOL_CHAIN_FILE"
- echo "toolchain file: $TOOL_CHAIN_FILE"
-fi
-
-
-SDK_CONFIG_FILE=$CURR_DIR/profiles/$PROFILE/wamr_config_simple.cmake
-if [ ! -f $SDK_CONFIG_FILE ]; then
- echo "SDK config file [$SDK_CONFIG_FILE] doesn't exit. quit.."
- exit 1
-fi
-
-
-
-rm -rf ${OUT_DIR}
-mkdir ${OUT_DIR}
-mkdir ${OUT_DIR}/wasm-apps
-
-cd ${WAMR_DIR}/core/shared/mem-alloc
-
-PROFILE="simple-$PROFILE"
-
-
-echo "#####################build wamr sdk"
-cd ${WAMR_DIR}/wamr-sdk
-./build_sdk.sh -n $PROFILE -x $SDK_CONFIG_FILE $ARG_TOOLCHAIN
-[ $? -eq 0 ] || exit $?
-
-
-echo "#####################build simple project"
-cd ${CURR_DIR}
-mkdir -p cmake-build/$PROFILE
-cd cmake-build/$PROFILE
-cmake ../.. -DWAMR_BUILD_SDK_PROFILE=$PROFILE $CM_TOOLCHAIN $CM_BUILD_TYPE
-make
-if [ $? != 0 ];then
- echo "BUILD_FAIL simple exit as $?\n"
- exit 2
-fi
-cp -a simple ${OUT_DIR}
-echo "#####################build simple project success"
-
-echo -e "\n\n"
-echo "#####################build host-tool"
-cd ${WAMR_DIR}/test-tools/host-tool
-mkdir -p bin
-cd bin
-cmake .. $CM_TOOLCHAIN $CM_BUILD_TYPE
-make
-if [ $? != 0 ];then
- echo "BUILD_FAIL host tool exit as $?\n"
- exit 2
-fi
-cp host_tool ${OUT_DIR}
-echo "#####################build host-tool success"
-
-echo -e "\n\n"
-echo "#####################build wasm apps"
-
-cd ${WASM_APPS}
-
-for i in `ls *.c`
-do
-APP_SRC="$i"
-OUT_FILE=${i%.*}.wasm
-
-/opt/wasi-sdk/bin/clang \
- -I${WAMR_DIR}/wamr-sdk/out/$PROFILE/app-sdk/wamr-app-framework/include \
- -L${WAMR_DIR}/wamr-sdk/out/$PROFILE/app-sdk/wamr-app-framework/lib \
- -lapp_framework \
- --target=wasm32 -O3 -z stack-size=4096 -Wl,--initial-memory=65536 \
- --sysroot=${WAMR_DIR}/wamr-sdk/out/$PROFILE/app-sdk/libc-builtin-sysroot \
- -Wl,--allow-undefined-file=${WAMR_DIR}/wamr-sdk/out/$PROFILE/app-sdk/libc-builtin-sysroot/share/defined-symbols.txt \
- -Wl,--strip-all,--no-entry -nostdlib \
- -Wl,--export=on_init -Wl,--export=on_destroy \
- -Wl,--export=on_request -Wl,--export=on_response \
- -Wl,--export=on_sensor_event -Wl,--export=on_timer_callback \
- -Wl,--export=on_connection_data \
- -Wl,--export=__heap_base -Wl,--export=__data_end \
- -o ${OUT_DIR}/wasm-apps/${OUT_FILE} ${APP_SRC}
-if [ -f ${OUT_DIR}/wasm-apps/${OUT_FILE} ]; then
- echo "build ${OUT_FILE} success"
-else
- echo "build ${OUT_FILE} fail"
-fi
-done
-
-echo "#####################build wasm apps done"
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm-interp/toolchain.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm-interp/toolchain.cmake
deleted file mode 100644
index 604141d0a..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm-interp/toolchain.cmake
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-INCLUDE(CMakeForceCompiler)
-
-SET(CMAKE_SYSTEM_NAME Linux) # this one is important
-SET(CMAKE_SYSTEM_VERSION 1) # this one not so much
-
-message(STATUS "*** ARM A7 toolchain file ***")
-set(CMAKE_VERBOSE_MAKEFILE ON)
-
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNU_SOURCE")
-
-
-if (NOT $ENV{ARM_A7_COMPILER_DIR} STREQUAL "")
- SET (toolchain_sdk_dir $ENV{ARM_A7_COMPILER_DIR}/)
-endif ()
-
-if (NOT $ENV{ARM_A7_SDKTARGETSYSROOT} STREQUAL "")
- SET(SDKTARGETSYSROOT $ENV{ARM_A7_SDKTARGETSYSROOT})
- #SET(CMAKE_SYSROOT SDKTARGETSYSROOT)
-endif ()
-
-message(STATUS "SDKTARGETSYSROOT=${SDKTARGETSYSROOT}")
-message(STATUS "toolchain_sdk_dir=${toolchain_sdk_dir}")
-
-SET(CMAKE_C_COMPILER ${toolchain_sdk_dir}arm-linux-gnueabihf-gcc)
-SET(CMAKE_CXX_COMPILER ${toolchain_sdk_dir}arm-linux-gnueabihf-g++)
-
-
-# this is the file system root of the target
-SET(CMAKE_FIND_ROOT_PATH ${SDKTARGETSYSROOT})
-
-# search for programs in the build host directories
-SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-
-# for libraries and headers in the target directories
-SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm-interp/wamr_config_simple.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm-interp/wamr_config_simple.cmake
deleted file mode 100644
index 90bb2f8d1..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm-interp/wamr_config_simple.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-set (WAMR_BUILD_PLATFORM "linux")
-set (WAMR_BUILD_TARGET ARM)
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 0)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-set (WAMR_BUILD_LIBC_WASI 0)
-set (WAMR_BUILD_APP_FRAMEWORK 1)
-set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE WAMR_APP_BUILD_CONNECTION WAMR_APP_BUILD_SENSOR)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-aot/toolchain.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-aot/toolchain.cmake
deleted file mode 100644
index 182504fea..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-aot/toolchain.cmake
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-INCLUDE(CMakeForceCompiler)
-
-SET(CMAKE_SYSTEM_NAME Linux) # this one is important
-SET(CMAKE_SYSTEM_VERSION 1) # this one not so much
-
-message(STATUS "*** ARM A7 toolchain file ***")
-set(CMAKE_VERBOSE_MAKEFILE ON)
-
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNU_SOURCE")
-
-
-if (NOT $ENV{ARM_A7_COMPILER_DIR} STREQUAL "")
- SET (toolchain_sdk_dir $ENV{ARM_A7_COMPILER_DIR}/)
-endif ()
-
-if (NOT $ENV{ARM_A7_SDKTARGETSYSROOT} STREQUAL "")
- SET(SDKTARGETSYSROOT $ENV{ARM_A7_SDKTARGETSYSROOT})
-endif ()
-
-message(STATUS "SDKTARGETSYSROOT=${SDKTARGETSYSROOT}")
-message(STATUS "toolchain_sdk_dir=${toolchain_sdk_dir}")
-
-SET(CMAKE_C_COMPILER ${toolchain_sdk_dir}aarch64-linux-gnu-gcc)
-SET(CMAKE_CXX_COMPILER ${toolchain_sdk_dir}aarch64-linux-gnu-g++)
-
-
-# this is the file system root of the target
-SET(CMAKE_FIND_ROOT_PATH ${SDKTARGETSYSROOT})
-
-# search for programs in the build host directories
-SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-
-# for libraries and headers in the target directories
-SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-aot/wamr_config_simple.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-aot/wamr_config_simple.cmake
deleted file mode 100644
index 7e6604885..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-aot/wamr_config_simple.cmake
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-set (WAMR_BUILD_PLATFORM "linux")
-set (WAMR_BUILD_TARGET AARCH64)
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 1)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_SIMD 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-set (WAMR_BUILD_LIBC_WASI 0)
-set (WAMR_BUILD_APP_FRAMEWORK 1)
-set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE WAMR_APP_BUILD_CONNECTION WAMR_APP_BUILD_SENSOR)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-interp/toolchain.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-interp/toolchain.cmake
deleted file mode 100644
index 182504fea..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-interp/toolchain.cmake
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-INCLUDE(CMakeForceCompiler)
-
-SET(CMAKE_SYSTEM_NAME Linux) # this one is important
-SET(CMAKE_SYSTEM_VERSION 1) # this one not so much
-
-message(STATUS "*** ARM A7 toolchain file ***")
-set(CMAKE_VERBOSE_MAKEFILE ON)
-
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNU_SOURCE")
-
-
-if (NOT $ENV{ARM_A7_COMPILER_DIR} STREQUAL "")
- SET (toolchain_sdk_dir $ENV{ARM_A7_COMPILER_DIR}/)
-endif ()
-
-if (NOT $ENV{ARM_A7_SDKTARGETSYSROOT} STREQUAL "")
- SET(SDKTARGETSYSROOT $ENV{ARM_A7_SDKTARGETSYSROOT})
-endif ()
-
-message(STATUS "SDKTARGETSYSROOT=${SDKTARGETSYSROOT}")
-message(STATUS "toolchain_sdk_dir=${toolchain_sdk_dir}")
-
-SET(CMAKE_C_COMPILER ${toolchain_sdk_dir}aarch64-linux-gnu-gcc)
-SET(CMAKE_CXX_COMPILER ${toolchain_sdk_dir}aarch64-linux-gnu-g++)
-
-
-# this is the file system root of the target
-SET(CMAKE_FIND_ROOT_PATH ${SDKTARGETSYSROOT})
-
-# search for programs in the build host directories
-SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-
-# for libraries and headers in the target directories
-SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-interp/wamr_config_simple.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-interp/wamr_config_simple.cmake
deleted file mode 100644
index 13fb9ac13..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/arm64-interp/wamr_config_simple.cmake
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-set (WAMR_BUILD_PLATFORM "linux")
-set (WAMR_BUILD_TARGET AARCH64)
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 0)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_SIMD 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-set (WAMR_BUILD_LIBC_WASI 0)
-set (WAMR_BUILD_APP_FRAMEWORK 1)
-set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE WAMR_APP_BUILD_CONNECTION WAMR_APP_BUILD_SENSOR)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/host-aot/wamr_config_simple.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/host-aot/wamr_config_simple.cmake
deleted file mode 100644
index 1f8cf9f8f..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/host-aot/wamr_config_simple.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-set (WAMR_BUILD_PLATFORM "linux")
-set (WAMR_BUILD_TARGET X86_64)
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 1)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-set (WAMR_BUILD_LIBC_WASI 0)
-set (WAMR_BUILD_APP_FRAMEWORK 1)
-set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE WAMR_APP_BUILD_CONNECTION WAMR_APP_BUILD_SENSOR)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/host-interp/wamr_config_simple.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/host-interp/wamr_config_simple.cmake
deleted file mode 100644
index 1f8cf9f8f..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/host-interp/wamr_config_simple.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-set (WAMR_BUILD_PLATFORM "linux")
-set (WAMR_BUILD_TARGET X86_64)
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 1)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-set (WAMR_BUILD_LIBC_WASI 0)
-set (WAMR_BUILD_APP_FRAMEWORK 1)
-set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE WAMR_APP_BUILD_CONNECTION WAMR_APP_BUILD_SENSOR)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/macos-interp/wamr_config_simple.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/macos-interp/wamr_config_simple.cmake
deleted file mode 100644
index d13c06d97..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/profiles/macos-interp/wamr_config_simple.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-set (WAMR_BUILD_PLATFORM "darwin")
-set (WAMR_BUILD_TARGET X86_64)
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 1)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-set (WAMR_BUILD_LIBC_WASI 0)
-set (WAMR_BUILD_APP_FRAMEWORK 1)
-set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE WAMR_APP_BUILD_CONNECTION WAMR_APP_BUILD_SENSOR)
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/sample_test_run.py b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/sample_test_run.py
deleted file mode 100755
index 09c36db5e..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/sample_test_run.py
+++ /dev/null
@@ -1,224 +0,0 @@
-#!/usr/bin/env python3
-#
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-
-import argparse
-import shlex
-import subprocess
-import sys
-import time
-import traceback
-import glob
-
-WAMRC_CMD = "../../wamr-compiler/build/wamrc"
-
-def compile_wasm_files_to_aot(wasm_apps_dir):
- wasm_files = glob.glob(wasm_apps_dir + "/*.wasm")
- print("Compile wasm app into aot files")
- for wasm_file in wasm_files:
- aot_file = wasm_file[0 : len(wasm_file) - 5] + ".aot";
- cmd = [ WAMRC_CMD, "-o", aot_file, wasm_file ]
- subprocess.check_call(cmd)
-
-def start_server(cwd):
- """
- Startup the 'simple' process works in TCP server mode
- """
- app_server = subprocess.Popen(shlex.split("./simple -s "), cwd=cwd)
- return app_server
-
-
-def query_installed_application(cwd):
- """
- Query all installed applications
- """
- qry_prc = subprocess.run(
- shlex.split("./host_tool -q"), cwd=cwd, check=False, capture_output=True
- )
- assert qry_prc.returncode == 69
- return qry_prc.returncode, qry_prc.stdout
-
-
-def install_wasm_application(wasm_name, wasm_file, cwd):
- """
- Install a wasm application
- """
- inst_prc = subprocess.run(
- shlex.split(f"./host_tool -i {wasm_name} -f {wasm_file}"),
- cwd=cwd,
- check=False,
- capture_output=True,
- )
- assert inst_prc.returncode == 65
- return inst_prc.returncode, inst_prc.stdout
-
-
-def uninstall_wasm_application(wasm_name, cwd):
- """
- Uninstall a wasm application
- """
-
- unst_prc = subprocess.run(
- shlex.split(f"./host_tool -u {wasm_name}"),
- cwd=cwd,
- check=False,
- capture_output=True,
- )
- assert unst_prc.returncode == 66
- return unst_prc.returncode, unst_prc.stdout
-
-
-def send_get_to_wasm_application(wasm_name, url, cwd):
- """
- send a request (GET) from host to an applicaton
- """
- qry_prc = subprocess.run(
- shlex.split(f"./host_tool -r /app/{wasm_name}{url} -A GET"),
- cwd=cwd,
- check=False,
- capture_output=True,
- )
- assert qry_prc.returncode == 69
- return qry_prc.returncode, qry_prc.stdout
-
-
-def main():
- """
- GO!GO!!GO!!!
- """
- parser = argparse.ArgumentParser(description="run the sample and examine outputs")
- parser.add_argument("working_directory", type=str)
- parser.add_argument("--aot", action='store_true', help="Test with AOT")
- args = parser.parse_args()
-
- test_aot = False
- suffix = ".wasm"
- if not args.aot:
- print("Test with interpreter mode")
- else:
- print("Test with AOT mode")
- test_aot = True
- suffix = ".aot"
- wasm_apps_dir = args.working_directory + "/wasm-apps"
- compile_wasm_files_to_aot(wasm_apps_dir)
-
- ret = 1
- app_server = None
- try:
- app_server = start_server(args.working_directory)
-
- # wait for a second
- time.sleep(1)
-
- print("--> Install timer" + suffix + "...")
- install_wasm_application(
- "timer", "./wasm-apps/timer" + suffix, args.working_directory
- )
-
- # wait for a second
- time.sleep(3)
-
- print("--> Query all installed applications...")
- query_installed_application(args.working_directory)
-
- print("--> Install event_publisher" + suffix + "...")
- install_wasm_application(
- "event_publisher",
- "./wasm-apps/event_publisher" + suffix,
- args.working_directory,
- )
-
- print("--> Install event_subscriber" + suffix + "...")
- install_wasm_application(
- "event_subscriber",
- "./wasm-apps/event_subscriber" + suffix,
- args.working_directory,
- )
-
- print("--> Query all installed applications...")
- query_installed_application(args.working_directory)
-
- print("--> Uninstall timer" + suffix + "...")
- uninstall_wasm_application("timer", args.working_directory)
-
- print("--> Query all installed applications...")
- query_installed_application(args.working_directory)
-
- print("--> Uninstall event_publisher" + suffix + "...")
- uninstall_wasm_application(
- "event_publisher",
- args.working_directory,
- )
-
- print("--> Uninstall event_subscriber" + suffix + "...")
- uninstall_wasm_application(
- "event_subscriber",
- args.working_directory,
- )
-
- print("--> Query all installed applications...")
- query_installed_application(args.working_directory)
-
- print("--> Install request_handler" + suffix + "...")
- install_wasm_application(
- "request_handler",
- "./wasm-apps/request_handler" + suffix,
- args.working_directory,
- )
-
- print("--> Query again...")
- query_installed_application(args.working_directory)
-
- print("--> Install request_sender" + suffix + "...")
- install_wasm_application(
- "request_sender",
- "./wasm-apps/request_sender" + suffix,
- args.working_directory,
- )
-
- print("--> Send GET to the Wasm application named request_handler...")
- send_get_to_wasm_application("request_handler", "/url1", args.working_directory)
-
- print("--> Uninstall request_handler" + suffix + "...")
- uninstall_wasm_application(
- "request_handler",
- args.working_directory,
- )
-
- print("--> Uninstall request_sender" + suffix + "...")
- uninstall_wasm_application(
- "request_sender",
- args.working_directory,
- )
-
- # Install a wasm app named "__exit_app_manager__" just to make app manager exit
- # while the wasm app is uninstalled, so as to collect the code coverage data.
- # Only available when collecting code coverage is enabled.
- print("--> Install timer" + suffix + "...")
- install_wasm_application(
- "__exit_app_manager__", "./wasm-apps/timer" + suffix, args.working_directory
- )
-
- print("--> Uninstall timer" + suffix + "...")
- uninstall_wasm_application(
- "__exit_app_manager__",
- args.working_directory,
- )
-
- # wait for a second
- time.sleep(1)
-
- print("--> All pass")
- ret = 0
- except AssertionError:
- traceback.print_exc()
- finally:
- app_server.kill()
-
- return ret
-
-
-if __name__ == "__main__":
- sys.exit(main())
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/src/iwasm_main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/src/iwasm_main.c
deleted file mode 100644
index 36fb35b12..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/src/iwasm_main.c
+++ /dev/null
@@ -1,568 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#ifndef CONNECTION_UART
-#include <netdb.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#else
-#include <termios.h>
-#endif
-
-#include <arpa/inet.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <signal.h>
-#include <unistd.h>
-#include <strings.h>
-
-#include "runtime_lib.h"
-#include "runtime_timer.h"
-#include "native_interface.h"
-#include "app_manager_export.h"
-#include "bh_platform.h"
-#include "runtime_sensor.h"
-#include "bi-inc/attr_container.h"
-#include "module_wasm_app.h"
-#include "wasm_export.h"
-
-#define MAX 2048
-
-#ifndef CONNECTION_UART
-#define SA struct sockaddr
-static char *host_address = "127.0.0.1";
-static int port = 8888;
-#else
-static char *uart_device = "/dev/ttyS2";
-static int baudrate = B115200;
-#endif
-
-extern bool
-init_sensor_framework();
-extern void
-exit_sensor_framework();
-extern void
-exit_connection_framework();
-extern int
-aee_host_msg_callback(void *msg, uint32_t msg_len);
-extern bool
-init_connection_framework();
-
-#ifndef CONNECTION_UART
-int listenfd = -1;
-int sockfd = -1;
-static pthread_mutex_t sock_lock = PTHREAD_MUTEX_INITIALIZER;
-#else
-int uartfd = -1;
-#endif
-
-#ifndef CONNECTION_UART
-static bool server_mode = false;
-
-// Function designed for chat between client and server.
-void *
-func(void *arg)
-{
- char buff[MAX];
- int n;
- struct sockaddr_in servaddr;
-
- while (1) {
- if (sockfd != -1)
- close(sockfd);
- // socket create and verification
- sockfd = socket(AF_INET, SOCK_STREAM, 0);
- if (sockfd == -1) {
- printf("socket creation failed...\n");
- return NULL;
- }
- else
- printf("Socket successfully created..\n");
- bzero(&servaddr, sizeof(servaddr));
- // assign IP, PORT
- servaddr.sin_family = AF_INET;
- servaddr.sin_addr.s_addr = inet_addr(host_address);
- servaddr.sin_port = htons(port);
-
- // connect the client socket to server socket
- if (connect(sockfd, (SA *)&servaddr, sizeof(servaddr)) != 0) {
- printf("connection with the server failed...\n");
- sleep(10);
- continue;
- }
- else {
- printf("connected to the server..\n");
- }
-
- // infinite loop for chat
- for (;;) {
- bzero(buff, MAX);
-
- // read the message from client and copy it in buffer
- n = read(sockfd, buff, sizeof(buff));
- // print buffer which contains the client contents
- // fprintf(stderr, "recieved %d bytes from host: %s", n, buff);
-
- // socket disconnected
- if (n <= 0)
- break;
-
- aee_host_msg_callback(buff, n);
- }
- }
-
- // After chatting close the socket
- close(sockfd);
-}
-
-static bool
-host_init()
-{
- return true;
-}
-
-int
-host_send(void *ctx, const char *buf, int size)
-{
- int ret;
-
- if (pthread_mutex_trylock(&sock_lock) == 0) {
- if (sockfd == -1) {
- pthread_mutex_unlock(&sock_lock);
- return 0;
- }
-
- ret = write(sockfd, buf, size);
-
- pthread_mutex_unlock(&sock_lock);
- return ret;
- }
-
- return -1;
-}
-
-void
-host_destroy()
-{
- if (server_mode)
- close(listenfd);
-
- pthread_mutex_lock(&sock_lock);
- close(sockfd);
- pthread_mutex_unlock(&sock_lock);
-}
-
-/* clang-format off */
-host_interface interface = {
- .init = host_init,
- .send = host_send,
- .destroy = host_destroy
-};
-/* clang-format on */
-
-/* Change it to 1 when fuzzing test */
-#define WASM_ENABLE_FUZZ_TEST 0
-
-void *
-func_server_mode(void *arg)
-{
- int clilent;
- struct sockaddr_in serv_addr, cli_addr;
- int n;
- char buff[MAX];
- struct sigaction sa;
-
- sa.sa_handler = SIG_IGN;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGPIPE, &sa, 0);
-
- /* First call to socket() function */
- listenfd = socket(AF_INET, SOCK_STREAM, 0);
-
- if (listenfd < 0) {
- perror("ERROR opening socket");
- exit(1);
- }
-
- /* Initialize socket structure */
- bzero((char *)&serv_addr, sizeof(serv_addr));
-
- serv_addr.sin_family = AF_INET;
- serv_addr.sin_addr.s_addr = INADDR_ANY;
- serv_addr.sin_port = htons(port);
-
- /* Now bind the host address using bind() call.*/
- if (bind(listenfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
- perror("ERROR on binding");
- exit(1);
- }
-
- listen(listenfd, 5);
- clilent = sizeof(cli_addr);
-
- while (1) {
- pthread_mutex_lock(&sock_lock);
-
- sockfd = accept(listenfd, (struct sockaddr *)&cli_addr, &clilent);
-
- pthread_mutex_unlock(&sock_lock);
-
- if (sockfd < 0) {
- perror("ERROR on accept");
- exit(1);
- }
-
- printf("connection established!\n");
-
- for (;;) {
- bzero(buff, MAX);
-
- // read the message from client and copy it in buffer
- n = read(sockfd, buff, sizeof(buff));
-
- // socket disconnected
- if (n <= 0) {
- pthread_mutex_lock(&sock_lock);
- close(sockfd);
- sockfd = -1;
- pthread_mutex_unlock(&sock_lock);
-
- sleep(1);
- break;
- }
-
- aee_host_msg_callback(buff, n);
- }
-#if WASM_ENABLE_FUZZ_TEST != 0
- /* Exit the process when host disconnect.
- This is helpful for reproducing failure case. */
- close(sockfd);
- exit(1);
-#endif
- }
-}
-
-#else
-static int
-parse_baudrate(int baud)
-{
- switch (baud) {
- case 9600:
- return B9600;
- case 19200:
- return B19200;
- case 38400:
- return B38400;
- case 57600:
- return B57600;
- case 115200:
- return B115200;
- case 230400:
- return B230400;
- case 460800:
- return B460800;
- case 500000:
- return B500000;
- case 576000:
- return B576000;
- case 921600:
- return B921600;
- case 1000000:
- return B1000000;
- case 1152000:
- return B1152000;
- case 1500000:
- return B1500000;
- case 2000000:
- return B2000000;
- case 2500000:
- return B2500000;
- case 3000000:
- return B3000000;
- case 3500000:
- return B3500000;
- case 4000000:
- return B4000000;
- default:
- return -1;
- }
-}
-static bool
-uart_init(const char *device, int baudrate, int *fd)
-{
- int uart_fd;
- struct termios uart_term;
-
- uart_fd = open(device, O_RDWR | O_NOCTTY);
-
- if (uart_fd <= 0)
- return false;
-
- memset(&uart_term, 0, sizeof(uart_term));
- uart_term.c_cflag = baudrate | CS8 | CLOCAL | CREAD;
- uart_term.c_iflag = IGNPAR;
- uart_term.c_oflag = 0;
-
- /* set noncanonical mode */
- uart_term.c_lflag = 0;
- uart_term.c_cc[VTIME] = 30;
- uart_term.c_cc[VMIN] = 1;
- tcflush(uart_fd, TCIFLUSH);
-
- if (tcsetattr(uart_fd, TCSANOW, &uart_term) != 0) {
- close(uart_fd);
- return false;
- }
-
- *fd = uart_fd;
-
- return true;
-}
-
-static void *
-func_uart_mode(void *arg)
-{
- int n;
- char buff[MAX];
-
- if (!uart_init(uart_device, baudrate, &uartfd)) {
- printf("open uart fail! %s\n", uart_device);
- return NULL;
- }
-
- for (;;) {
- bzero(buff, MAX);
-
- n = read(uartfd, buff, sizeof(buff));
-
- if (n <= 0) {
- close(uartfd);
- uartfd = -1;
- break;
- }
-
- aee_host_msg_callback(buff, n);
- }
-
- return NULL;
-}
-
-static int
-uart_send(void *ctx, const char *buf, int size)
-{
- int ret;
-
- ret = write(uartfd, buf, size);
-
- return ret;
-}
-
-static void
-uart_destroy()
-{
- close(uartfd);
-}
-
-/* clang-format off */
-static host_interface interface = {
- .send = uart_send,
- .destroy = uart_destroy
-};
-/* clang-format on */
-
-#endif
-
-static attr_container_t *
-read_test_sensor(void *sensor)
-{
- attr_container_t *attr_obj = attr_container_create("read test sensor data");
- if (attr_obj) {
- bool ret =
- attr_container_set_string(&attr_obj, "name", "read test sensor");
- if (!ret) {
- attr_container_destroy(attr_obj);
- return NULL;
- }
- return attr_obj;
- }
- return NULL;
-}
-
-static bool
-config_test_sensor(void *s, void *config)
-{
- return false;
-}
-
-static char global_heap_buf[1024 * 1024] = { 0 };
-
-/* clang-format off */
-static void
-showUsage()
-{
-#ifndef CONNECTION_UART
- printf("Usage:\n");
- printf("\nWork as TCP server mode:\n");
- printf("\tsimple -s|--server_mode -p|--port <Port>\n");
- printf("where\n");
- printf("\t<Port> represents the port that would be listened on and the default is 8888\n");
- printf("\nWork as TCP client mode:\n");
- printf("\tsimple -a|--host_address <Host Address> -p|--port <Port>\n");
- printf("where\n");
- printf("\t<Host Address> represents the network address of host and the default is 127.0.0.1\n");
- printf("\t<Port> represents the listen port of host and the default is 8888\n");
-#else
- printf("Usage:\n");
- printf("\tsimple -u <Uart Device> -b <Baudrate>\n\n");
- printf("where\n");
- printf("\t<Uart Device> represents the UART device name and the default is /dev/ttyS2\n");
- printf("\t<Baudrate> represents the UART device baudrate and the default is 115200\n");
-#endif
-}
-/* clang-format on */
-
-static bool
-parse_args(int argc, char *argv[])
-{
- int c;
-
- while (1) {
- int optIndex = 0;
- static struct option longOpts[] = {
-#ifndef CONNECTION_UART
- { "server_mode", no_argument, NULL, 's' },
- { "host_address", required_argument, NULL, 'a' },
- { "port", required_argument, NULL, 'p' },
-#else
- { "uart", required_argument, NULL, 'u' },
- { "baudrate", required_argument, NULL, 'b' },
-#endif
- { "help", required_argument, NULL, 'h' },
- { 0, 0, 0, 0 }
- };
-
- c = getopt_long(argc, argv, "sa:p:u:b:w:h", longOpts, &optIndex);
- if (c == -1)
- break;
-
- switch (c) {
-#ifndef CONNECTION_UART
- case 's':
- server_mode = true;
- break;
- case 'a':
- host_address = optarg;
- printf("host address: %s\n", host_address);
- break;
- case 'p':
- port = atoi(optarg);
- printf("port: %d\n", port);
- break;
-#else
- case 'u':
- uart_device = optarg;
- printf("uart device: %s\n", uart_device);
- break;
- case 'b':
- baudrate = parse_baudrate(atoi(optarg));
- printf("uart baudrate: %s\n", optarg);
- break;
-#endif
- case 'h':
- showUsage();
- return false;
- default:
- showUsage();
- return false;
- }
- }
-
- return true;
-}
-
-// Driver function
-int
-iwasm_main(int argc, char *argv[])
-{
- RuntimeInitArgs init_args;
- korp_tid tid;
-
- if (!parse_args(argc, argv))
- return -1;
-
- memset(&init_args, 0, sizeof(RuntimeInitArgs));
-
-#if USE_GLOBAL_HEAP_BUF != 0
- init_args.mem_alloc_type = Alloc_With_Pool;
- init_args.mem_alloc_option.pool.heap_buf = global_heap_buf;
- init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
-#else
- init_args.mem_alloc_type = Alloc_With_Allocator;
- init_args.mem_alloc_option.allocator.malloc_func = malloc;
- init_args.mem_alloc_option.allocator.realloc_func = realloc;
- init_args.mem_alloc_option.allocator.free_func = free;
-#endif
-
- /* initialize runtime environment */
- if (!wasm_runtime_full_init(&init_args)) {
- printf("Init runtime environment failed.\n");
- return -1;
- }
-
- /* connection framework */
- if (!init_connection_framework()) {
- goto fail1;
- }
-
- /* sensor framework */
- if (!init_sensor_framework()) {
- goto fail2;
- }
-
- /* timer manager */
- if (!init_wasm_timer()) {
- goto fail3;
- }
-
- /* add the sys sensor objects */
- add_sys_sensor("sensor_test1", "This is a sensor for test", 0, 1000,
- read_test_sensor, config_test_sensor);
- add_sys_sensor("sensor_test2", "This is a sensor for test", 0, 1000,
- read_test_sensor, config_test_sensor);
- start_sensor_framework();
-
-#ifndef CONNECTION_UART
- if (server_mode)
- os_thread_create(&tid, func_server_mode, NULL,
- BH_APPLET_PRESERVED_STACK_SIZE);
- else
- os_thread_create(&tid, func, NULL, BH_APPLET_PRESERVED_STACK_SIZE);
-#else
- os_thread_create(&tid, func_uart_mode, NULL,
- BH_APPLET_PRESERVED_STACK_SIZE);
-#endif
-
- app_manager_startup(&interface);
-
- exit_wasm_timer();
-
-fail3:
- exit_sensor_framework();
-
-fail2:
- exit_connection_framework();
-
-fail1:
- wasm_runtime_destroy();
-
- return -1;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/src/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/src/main.c
deleted file mode 100644
index e603420ee..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/src/main.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-extern void
-iwasm_main();
-
-int
-main(int argc, char *argv[])
-{
- iwasm_main(argc, argv);
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/connection.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/connection.c
deleted file mode 100644
index d8efefdcf..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/connection.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_app.h"
-#include "wa-inc/connection.h"
-#include "wa-inc/timer_wasm_app.h"
-#include "wa-inc/request.h"
-
-/* User global variable */
-static int num = 0;
-static user_timer_t g_timer;
-static connection_t *g_conn = NULL;
-
-void
-on_data1(connection_t *conn, conn_event_type_t type, const char *data,
- uint32 len, void *user_data)
-{
- if (type == CONN_EVENT_TYPE_DATA) {
- char message[64] = { 0 };
- memcpy(message, data, len);
- printf("Client got a message from server -> %s\n", message);
- }
- else if (type == CONN_EVENT_TYPE_DISCONNECT) {
- printf("connection is close by server!\n");
- }
- else {
- printf("error: got unknown event type!!!\n");
- }
-}
-
-/* Timer callback */
-void
-timer1_update(user_timer_t timer)
-{
- char message[64] = { 0 };
- /* Reply to server */
- snprintf(message, sizeof(message), "Hello %d", num++);
- api_send_on_connection(g_conn, message, strlen(message));
-}
-
-void
-my_close_handler(request_t *request)
-{
- response_t response[1];
-
- if (g_conn != NULL) {
- api_timer_cancel(g_timer);
- api_close_connection(g_conn);
- }
-
- make_response_for_request(request, response);
- set_response(response, DELETED_2_02, 0, NULL, 0);
- api_response_send(response);
-}
-
-void
-on_init()
-{
- user_timer_t timer;
- attr_container_t *args;
- char *str = "this is client!";
-
- api_register_resource_handler("/close", my_close_handler);
-
- args = attr_container_create("");
- attr_container_set_string(&args, "address", "127.0.0.1");
- attr_container_set_uint16(&args, "port", 7777);
-
- g_conn = api_open_connection("TCP", args, on_data1, NULL);
- if (g_conn == NULL) {
- printf("connect to server fail!\n");
- return;
- }
-
- printf("connect to server success! handle: %p\n", g_conn);
-
- /* set up a timer */
- timer = api_timer_create(1000, true, false, timer1_update);
- api_timer_restart(timer, 1000);
-}
-
-void
-on_destroy()
-{
- /* real destroy work including killing timer and closing sensor is
- accomplished in wasm app library version of on_destroy() */
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/event_publisher.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/event_publisher.c
deleted file mode 100644
index 2fa4418ca..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/event_publisher.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_app.h"
-#include "wa-inc/request.h"
-#include "wa-inc/timer_wasm_app.h"
-
-int num = 0;
-
-void
-publish_overheat_event()
-{
- attr_container_t *event;
-
- event = attr_container_create("event");
- attr_container_set_string(&event, "warning", "temperature is over high");
-
- api_publish_event("alert/overheat", FMT_ATTR_CONTAINER, event,
- attr_container_get_serialize_length(event));
-
- attr_container_destroy(event);
-}
-
-/* Timer callback */
-void
-timer1_update(user_timer_t timer)
-{
- publish_overheat_event();
-}
-
-void
-start_timer()
-{
- user_timer_t timer;
-
- /* set up a timer */
- timer = api_timer_create(1000, true, false, timer1_update);
- api_timer_restart(timer, 1000);
-}
-
-void
-on_init()
-{
- start_timer();
-}
-
-void
-on_destroy()
-{
- /* real destroy work including killing timer and closing sensor is
- accomplished in wasm app library version of on_destroy() */
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/event_subscriber.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/event_subscriber.c
deleted file mode 100644
index 7ebd309e7..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/event_subscriber.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_app.h"
-#include "wa-inc/request.h"
-
-void
-over_heat_event_handler(request_t *request)
-{
- printf("### user over heat event handler called\n");
-
- if (request->payload != NULL && request->fmt == FMT_ATTR_CONTAINER)
- attr_container_dump((attr_container_t *)request->payload);
-}
-
-void
-on_init()
-{
- api_subscribe_event("alert/overheat", over_heat_event_handler);
-}
-
-void
-on_destroy()
-{
- /* real destroy work including killing timer and closing sensor is
- accomplished in wasm app library version of on_destroy() */
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/request_handler.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/request_handler.c
deleted file mode 100644
index be6c56030..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/request_handler.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_app.h"
-#include "wa-inc/request.h"
-
-static void
-url1_request_handler(request_t *request)
-{
- response_t response[1];
- attr_container_t *payload;
-
- printf("[resp] ### user resource 1 handler called\n");
-
- if (request->payload != NULL && request->fmt == FMT_ATTR_CONTAINER)
- attr_container_dump((attr_container_t *)request->payload);
-
- payload = attr_container_create("wasm app response payload");
- if (payload == NULL)
- return;
-
- attr_container_set_string(&payload, "key1", "value1");
- attr_container_set_string(&payload, "key2", "value2");
-
- make_response_for_request(request, response);
- set_response(response, CONTENT_2_05, FMT_ATTR_CONTAINER, (void *)payload,
- attr_container_get_serialize_length(payload));
- api_response_send(response);
-
- attr_container_destroy(payload);
-}
-
-static void
-url2_request_handler(request_t *request)
-{
- response_t response[1];
- make_response_for_request(request, response);
- set_response(response, DELETED_2_02, 0, NULL, 0);
- api_response_send(response);
-
- printf("### user resource 2 handler called\n");
-}
-
-void
-on_init()
-{
- /* register resource uri */
- api_register_resource_handler("/url1", url1_request_handler);
- api_register_resource_handler("/url2", url2_request_handler);
-}
-
-void
-on_destroy()
-{
- /* real destroy work including killing timer and closing sensor is
- accomplished in wasm app library version of on_destroy() */
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/request_sender.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/request_sender.c
deleted file mode 100644
index 823f7f62c..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/request_sender.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_app.h"
-#include "wa-inc/request.h"
-
-static void
-my_response_handler(response_t *response, void *user_data)
-{
- char *tag = (char *)user_data;
-
- if (response == NULL) {
- printf("[req] request timeout!\n");
- return;
- }
-
- printf("[req] response handler called mid:%d, status:%d, fmt:%d, "
- "payload:%p, len:%d, tag:%s\n",
- response->mid, response->status, response->fmt, response->payload,
- response->payload_len, tag);
-
- if (response->payload != NULL && response->payload_len > 0
- && response->fmt == FMT_ATTR_CONTAINER) {
- printf("[req] dump the response payload:\n");
- attr_container_dump((attr_container_t *)response->payload);
- }
-}
-
-static void
-test_send_request(char *url, char *tag)
-{
- request_t request[1];
-
- init_request(request, url, COAP_PUT, 0, NULL, 0);
- api_send_request(request, my_response_handler, tag);
-}
-
-void
-on_init()
-{
- test_send_request("/app/request_handler/url1", "a request to target app");
- test_send_request("url1", "a general request");
-}
-
-void
-on_destroy()
-{
- /* real destroy work including killing timer and closing sensor is
- accomplished in wasm app library version of on_destroy() */
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/sensor.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/sensor.c
deleted file mode 100644
index c45ff67d9..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/sensor.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_app.h"
-#include "wa-inc/sensor.h"
-
-static sensor_t sensor1 = NULL;
-static sensor_t sensor2 = NULL;
-static char *user_data = NULL;
-
-/* Sensor event callback*/
-void
-sensor_event_handler(sensor_t sensor, attr_container_t *event, void *user_data)
-{
- if (sensor == sensor1) {
- printf("### app get sensor event from sensor1\n");
- attr_container_dump(event);
- }
- else {
- printf("### app get sensor event from sensor2\n");
- attr_container_dump(event);
- }
-}
-
-void
-on_init()
-{
- attr_container_t *config;
-
- printf("### app on_init 1\n");
- /* open a sensor */
- user_data = malloc(100);
- if (!user_data) {
- printf("allocate memory failed\n");
- return;
- }
-
- printf("### app on_init 2\n");
- sensor1 = sensor_open("sensor_test1", 0, sensor_event_handler, user_data);
- if (!sensor1) {
- printf("open sensor1 failed\n");
- return;
- }
- /* config the sensor */
- sensor_config(sensor1, 1000, 0, 0);
-
- printf("### app on_init 3\n");
- sensor2 = sensor_open("sensor_test2", 0, sensor_event_handler, user_data);
- if (!sensor2) {
- printf("open sensor2 failed\n");
- return;
- }
- /* config the sensor */
- sensor_config(sensor2, 5000, 0, 0);
-
- printf("### app on_init 4\n");
- /*
- config = attr_container_create("sensor config");
- sensor_config(sensor, config);
- attr_container_destroy(config);
- */
-}
-
-void
-on_destroy()
-{
- if (NULL != sensor1) {
- sensor_config(sensor1, 0, 0, 0);
- }
-
- if (NULL != sensor2) {
- sensor_config(sensor2, 0, 0, 0);
- }
-
- if (NULL != user_data) {
- free(user_data);
- }
-
- /* real destroy work including killing timer and closing sensor is
- accomplished in wasm app library version of on_destroy() */
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/timer.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/timer.c
deleted file mode 100644
index 5bf0822cd..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/simple/wasm-apps/timer.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_app.h"
-#include "wa-inc/timer_wasm_app.h"
-
-/* User global variable */
-static int num = 0;
-
-/* Timer callback */
-void
-timer1_update(user_timer_t timer)
-{
- printf("Timer update %d\n", num++);
-}
-
-void
-on_init()
-{
- user_timer_t timer;
-
- /* set up a timer */
- timer = api_timer_create(1000, true, false, timer1_update);
- api_timer_restart(timer, 1000);
-}
-
-void
-on_destroy()
-{
- /* real destroy work including killing timer and closing sensor is
- accomplished in wasm app library version of on_destroy() */
-}