Skip to content

Commit

Permalink
Merge branch 'master' into development/workerpool
Browse files Browse the repository at this point in the history
  • Loading branch information
msieben committed Sep 9, 2024
2 parents 81e2ef5 + 377b90f commit 60a2d51
Show file tree
Hide file tree
Showing 270 changed files with 36,660 additions and 11,970 deletions.
24 changes: 15 additions & 9 deletions .github/workflows/Linux build template.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Thunder on Linux
name: Linux build template

on:
workflow_call:
Expand All @@ -11,8 +11,9 @@ jobs:
matrix:
build_type: [Debug, Release, MinSizeRel]
shared_libs: [ON, OFF]
architecture: [32, 64]

name: Build type - ${{matrix.shared_libs == 'OFF' && 'Static ' || ''}}${{matrix.build_type}}
name: Build type - ${{matrix.shared_libs == 'OFF' && 'Static ' || ''}}${{matrix.build_type}}${{matrix.architecture == '32' && ' x86' || ''}}
steps:
# --------- Installing packages ---------
- name: Install necessary packages
Expand All @@ -23,10 +24,12 @@ jobs:
command: |
sudo gem install apt-spy2
sudo apt-spy2 fix --commit --launchpad --country=US
echo "deb http://archive.ubuntu.com/ubuntu/ jammy main universe restricted multiverse" | sudo tee -a /etc/apt/sources.list
echo "deb http://archive.ubuntu.com/ubuntu/ jammy-updates main universe restricted multiverse" | sudo tee -a /etc/apt/sources.list
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt install python3-pip
pip install jsonref
sudo apt install build-essential cmake ninja-build libusb-1.0-0-dev zlib1g-dev libssl-dev
sudo apt install python3-pip build-essential cmake ninja-build libusb-1.0-0-dev zlib1g-dev zlib1g-dev:i386 libssl-dev gcc-11-multilib g++-11-multilib
sudo pip install jsonref
# ----- Checkout & DependsOn regex -----
# --------- Thunder ----------
Expand Down Expand Up @@ -83,6 +86,8 @@ jobs:
- name: Install generators
run: |
cmake -G Ninja -S ThunderTools -B ${{matrix.build_type}}/build/ThunderTools \
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -m${{matrix.architecture}}" \
-DCMAKE_C_FLAGS="-Wall -Wextra -Wpedantic -Werror -m${{matrix.architecture}}" \
-DCMAKE_INSTALL_PREFIX=${{matrix.build_type}}/install/usr
cmake --build ${{matrix.build_type}}/build/ThunderTools --target install
Expand All @@ -99,7 +104,8 @@ jobs:
- name: Build Thunder
run: |
cmake -G Ninja -S Thunder -B ${{matrix.build_type}}/build/Thunder \
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror" \
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -m${{matrix.architecture}}" \
-DCMAKE_C_FLAGS="-Wall -Wextra -Wpedantic -Werror -m${{matrix.architecture}}" \
-DBUILD_SHARED_LIBS=${{matrix.shared_libs}} \
-DBINDING="127.0.0.1" \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
Expand All @@ -120,11 +126,11 @@ jobs:
- name: Tar files
if: matrix.shared_libs == 'ON'
run: tar -czvf ${{matrix.build_type}}.tar.gz ${{matrix.build_type}}
run: tar -czvf ${{matrix.build_type}}${{matrix.architecture == '32' && '_x86' || ''}}.tar.gz ${{matrix.build_type}}

- name: Upload
if: matrix.shared_libs == 'ON'
uses: actions/upload-artifact@v4
with:
name: Thunder-${{matrix.build_type}}-artifact
path: ${{matrix.build_type}}.tar.gz
name: Thunder-${{matrix.build_type}}${{matrix.architecture == '32' && '_x86' || ''}}-artifact
path: ${{matrix.build_type}}${{matrix.architecture == '32' && '_x86' || ''}}.tar.gz
13 changes: 10 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,16 @@ workspace/
/artifacts/Release
*.pyc
Source/Thunder/Thunder
Source/Thunder/Thunder-1.0.0
Source/Thunder/Thunder-*
Source/Thunder/config/
Source/ThunderPlugin/ThunderPlugin
Source/ThunderPlugin/ThunderPlugin-1.0.0
Source/Thunder/scripts/wpeframework
Source/ThunderPlugin/ThunderPlugin-*
Source/extensions/localtracer/example/local_trace_test
Source/extensions/privilegedrequest/example/fdpassing
Source/messaging/tracing.h
Source/plugins/json/
Thunder.cmake
*/*/generated/
*/*/*/generated/
install_manifest.txt
site/
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
# the RPATH to be used when installing, but only if it's not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
![Linux Build](https://github.com/rdkcentral/Thunder/actions/workflows/Build%20Thunder%20on%20Linux.yml/badge.svg) ![Windows Build](https://github.com/rdkcentral/Thunder/actions/workflows/Build%20Thunder%20on%20Windows.yml/badge.svg) ![Unit Test](https://github.com/rdkcentral/Thunder/actions/workflows/Test%20Thunder.yml/badge.svg)


Thunder (also known as Thunder) is an open-source plugin-based device abstraction layer, where business functionality can be implemented as plugins and applications can query and control those plugins. Using Thunder provides a consistent interface-driven development model for both plugins and client applications, with an RPC engine that is suited to both web-based and native apps.
Thunder is an open-source plugin-based device abstraction layer, where business functionality can be implemented as plugins and applications can query and control those plugins. Using Thunder provides a consistent interface-driven development model for both plugins and client applications, with an RPC engine that is suited to both web-based and native apps.

Designed from the ground up for embedded platforms and written in C++11, Thunder can be run on even the most low-power of devices (including ARM and MIPS-based platforms).

Expand Down
231 changes: 231 additions & 0 deletions ReleaseNotes/ThunderReleaseNotes_R5.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
# Thunder Release Notes R5.0

## introduction

This document describes the new features and changes introduced in Thunder R5.0 (compared to the latest R4 release).
See [here](https://github.com/rdkcentral/Thunder/blob/master/ReleaseNotes/ThunderReleaseNotes_R4.4.md) for the release notes of Thunder R4.4.
This document describes the changes in Thunder and ThunderTools as they are related.

## WARNING

Thunder R5.0 is a major step up from R4. For the new features quite a lot of the internal code was changed or rewritten. Although it was very carefully tested by QA it will most probably contain some issues that have not been found yet as the Thunder framework can be used in a lot of different ways. Therefore our advise will be to use R5.0 only to do an early integration as it also contains some breaking changes (see the Braking Changes paragraph below). Please report any issues you find so these can be fixed. Our advise will be to use R5.1 for production usage as it will have all the combined fixes for the issues found with R5.0.

# Thunder

## Process Changes and new Features

### New Feature: Issue Template

An issue template was added to the documentation for reporting Thunder issues. Please use the template that can be found [here](https://rdkcentral.github.io/Thunder/issuetemplate/issuetemplate/) when you want to report a Thunder issue.

### Change: Unit test improvements

The existing Thunder unit tests were improved and new tests were added. These are also triggered from a GitHub action on each merge of a Pull Request.

### Change: Thunder Documentation

The Thunder documentation was extended with new content, please find the documentation [here](https://rdkcentral.github.io/Thunder/). More content still to come!

### Change: QA interfaces

To make it clear what interfaces are specifically intended for QA purposes these have been put into a separate folder and namespace. They can be found [here](https://github.com/rdkcentral/ThunderInterfaces/tree/master/qa_interfaces)

## Major Changes and new Features

### New Feature: JSON-RPC non happy day scenarios

One of the main focus points of Thunder R5 was improved support for JSON-RPC non happy day scenario's. When a JSON-RPC interface was for example "session based" there was little automated support for handling connection issues and correct session management based on that (one would need to write the complete interface by hand). In R5 it is now possible to specify a separate JSON-RPC interface for these purposes and this will bring also much more options when the JSON-RPC interface deviates from the COM-RPC interface. An example can be found [here](https://github.com/rdkcentral/ThunderInterfaces/blob/227976cc2fa9e7167414aa6e924d3767ae9cf2b0/interfaces/IMessenger.h#L66) but this will be fully documented in the Thunder documentation asap.

### New Feature: Private COM-RPC

A feature was added where the communicator used to access a plugin via COM-RPC can be changed from the default communicator (that can be used to access all plugins) to a specific port so that for example applications in a process container can only be given access to that port and will not be able to access other containers.

### New Feature: Off host plugin support

Infrastructure was added to enable running plugins on different devices/SOCs. A second instance of Thunder can be run on a different device handling the actual remote plugin but the plugin is exposed as a normal plugin in the local instance of Thunder (so can be activated/deactivated, communicated with via JSON-RPC and COM-RPC etc.)

### New Feature: Aggregated plugin support

It is now possible to expose multiple plugins within a parent plugin, so to have an aggregated plugin. These can then be access and communicated with via the parent plugin. This is for example convenient when a group of plugins share a common responsibility or to expose multiple plugins running on a different host.

### New Feature: Thundershark [Application]

A plugin was developed for the popular WireShark network analysis tool that enables analyzing Thunder COM-RPC in detail. All message exchange can be seen in detail (both online and offline) with details like which method is called on what interface using what parameters.
Details can be found [here](https://rdkcentral.github.io/Thunder/debugging/thundershark/)

### New Feature: proxy leakage detection and reporting

Thunder now has improved detection of proxies being leaked when an out of process plugin is deactivated/crashed. These can now also be reported in more detail, for example via a JSON-RPC interface for QA purposes.

### New Feature: Mac-OS support

Next to Linux and Microsoft Windows Thunder can now also be build and run on Mac-OS.

### Change: IController suspend en resume via IController ILifetime

Managing suspend and resume plugin lifetime now can be done from the IController ILifetime interface. Most importantly this means that there are no longer both a JSON-RPC and COM-RPC interface file but all is specified in one IDL header file. The JSON-RPC interface has not changed because of this.

### New Feature: Delegated release configurable.

Unbalanced reference counted objects are for the non-happy day scenarios now automatically destructed. This can lead to unexpected crashes in case the plugin has an incorrectly implementation of the refcount handling of objects. This automatic cleanup feature can be turned off by using the "ccdr" (COM-RPC channel delegated releases) boolean option in the Thunder configuration file (default is on off course)


## Minor Changes and new Features

### New Feature: Installation and Cryptography subsystems

Two new subsystems were added to the available subsystems: Installation and Cryptography.

### New Feature: Messaging enhancement

The messaging engine now by default also reroutes all stdin and stdout messages to the message control plugin (where it then like all other messages can be printed, saved to file, forwarded to a websocket etc.). This behaviour can be turned of using the -f or -F startup parameter.

### Change: Messaging efficiency improvements

The internal handling of messages in the messaging engine has been improved to reduce the duplication of messages and therefore improving the resource usage of the message engine in both memory as CPU usage.

### Change: Messaging -F -f behaviour

When the message engine -f or -F option is used no longer the messages (tracing, syslog, waring reporting etc.) are forwarded to the message control plugin, they are now only locally outputted improving performance in this situation.


### Change: Yocto meta layers

The Yocto meta layers for Thunder and its components have been refactored to comply with the latest CMake standards.


### Change: Plugin/interface versioning improved

The plugin MetaData (holding the version information) is now also inserted through the COM-RPC definitions.

### Change: JSON serialization/deserialization improvements

There have been multiple improvements to the JSON serialization and deserialization to improve compliance with the JSON standard (e.g. utf-8 handling, escaping, type support, hex characters have been improved)
These changes have also been backported to R4.4.

### Change: Websocket improvements

WebSocket: Masking handling has been improved.

### Change: Compliance higher waring level

CMake as well as Thunder code has been changed to handle higher warning levels and prevent false positives. Also the default is now that a warning is treated as an error.
Also compliance with GCC12 warning generation was achieved.

### Change: Verify SSL certificates by default

In the secure websocket implementation the SNI is now always validated against the root-certificates installed on the box.

### General bug fixes

A lot of issues were fixed in Thunder R5.0 improving stability and resource usage.

## Breaking Changes

### WPEFramework renamed to Thunder

All references to WPEFramework have been renamed to Thunder, this goes for example for the namespace in code, names of binaries, name of build files etc.
For the namespace changes mitigation measures have been put in place to have old code still using the WPEFramework namespace still compile but due to the complexity of the C++ language this will not cover all cases. Also make sure to adapt your script referring to Thunder binary and/or make files.

### Plugin/interface versioning

In the JSON-RPC interface the plugin version is now embedded in a MetaData structure.

### JSONRPC error codes

The JSON-RPC error codes are now better aligned with the JSON-RPC specification so error codes can have different numbers compared to older Thunder versions.

### Old config meta files

The old config meta files are removed and the new config.in files are now the default. For plugins the old meta files are still supported.

### AutoStart

In plugin config files the "AutoStart" : boolean has been changed into "Mode" : [Unavailable,Activated,Deactivated,Resumes,Suspend] . Reason for this change was the addition of the Unavailable mode.
Note that tools will still handle plugin configuration meta files correctly that use "AutoStart", it will generate a correct config will (where "mode" will be used).

### Metadata

The "Metadata" structure in plugins has been renamed to "MetaData".

### Plugin status via Controller JSON-RPC

The plugin status that can be retrieved via the controller JSON-RPC will now always return an array. You can still request one plugin status but it will be enclosed in an array

### Addref has return value

The IReferenceCounted AddRef virtual method now requires a return value. This should not cause any issues as it is not expected that there would be a need to implement this outside the Thunder framework itself.
This was also backported to R4.4.

### JSONRPC event forwarding

The controller all event: the event data is no longer wrapped in an additional layer called Data.


# Thunder Tools

## Changes and new Features

### @text

The @text metatag was extended to have more options to influence the names used in generated code. E.g. there is now also an option, "keep", to override the case used for generation of names per interface. See [here](https://rdkcentral.github.io/Thunder/plugin/interfaces/tags/#text) for all the possibilities in the documentation.
(backported to R4.4.3)

### Nested pods

Nested pods are now fully supported in the IDL header files, even more than one level including its uses in iterators.
(Backported to R4.4)

### Core::Time

The Core::time is type is now also supported in the IDL header files.

### Notifications

Context and indexes are now also supported in Notifications

### Length support

The length (and maxlength) tags can be used to indicate the (max) length of a buffer used in the IDL header file. See [here](https://rdkcentral.github.io/Thunder/plugin/interfaces/tags/#length) for the detailed documentation.


### @length:return

As an optimization the @length for out parameters can now be a return value.

### JSON::InstanceId

The JSON::InstanceId is now also supported in the IDL header files.

### Description tags

The description tag will now support multiple line descriptions.

### POD Inheritance

The IDL header file code generation tools now also support PODs that use inheritance (if for example there are shared members for different POD types)

### float support

The float type is now also supported in the IDL header files.

### Waring cleanup

The existing interfaces have been cleanup to no longer generate warnings when the code generator is executed.

### Multiple methods for event

It is now possible to have multiple event names to be emitted for a single event (fot backward compatibility cases) using the @alt tag.

### JSON-RPC Event iterators

The code generation tooling now also support the usage of Iterators for events.

### Optional

The tooling now allows to specify that a parameter is optional in the IDL header file using Core::OptionalType (this superseded @optional). In COM-RPC the OptionalType can be used to see if a value was set and in JSON-RPC it is then allowed to omit this parameter. Detailed documentation will be added to the Thunder documentation.

### Default

When using optional types as described above it is now also possible to provide a default value to be used in case the parameter value was not specified. Also this will be described in more detail in the Thunder documentation.

18 changes: 16 additions & 2 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ if(ENABLE_STRICT_COMPILER_SETTINGS)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(FATAL_ERROR "Compiling with Clang")
set(CMAKE_STRICT_COMPILER_SETTINGS "-Weverything -Wextra -Wpedantic -Werror")
set(CMAKE_STRICT_CXX_COMPILER_SETTINGS "${CMAKE_STRICT_COMPILER_SETTINGS} -Wnon-virtual-dtor")
set(CMAKE_STRICT_CXX_COMPILER_SETTINGS "${CMAKE_STRICT_COMPILER_SETTINGS} -Wnon-virtual-dtor -Wmisleading-indentation")
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 12)
set(CMAKE_STRICT_CXX_COMPILER_SETTINGS "${CMAKE_STRICT_CXX_COMPILER_SETTINGS} -Wrange-loop-construct")
endif()

elseif(${CMAKE_COMPILER_IS_GNUCXX})
message(STATUS "Compiling with GCC")
set(CMAKE_STRICT_COMPILER_SETTINGS "-Wall -Wextra -Wpedantic -Werror")
set(CMAKE_STRICT_CXX_COMPILER_SETTINGS "${CMAKE_STRICT_COMPILER_SETTINGS} -Wnon-virtual-dtor")
set(CMAKE_STRICT_CXX_COMPILER_SETTINGS "${CMAKE_STRICT_COMPILER_SETTINGS} -Wnon-virtual-dtor -Wmisleading-indentation")
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 12)
set(CMAKE_STRICT_CXX_COMPILER_SETTINGS "${CMAKE_STRICT_CXX_COMPILER_SETTINGS} -Wrange-loop-construct")
endif()

elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
message(STATUS "Compiling with MS Visual Studio")
set(CMAKE_STRICT_COMPILER_SETTINGS "/W4")
Expand All @@ -68,6 +76,12 @@ if(ENABLE_STRICT_COMPILER_SETTINGS)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_STRICT_CXX_COMPILER_SETTINGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_STRICT_COMPILER_SETTINGS}")
else()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_COMPILER_SETTINGS "-Wno-deprecated-declarations")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_COMPILER_SETTINGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_COMPILER_SETTINGS}")
endif()
endif()

if(CORE)
Expand Down
Loading

0 comments on commit 60a2d51

Please sign in to comment.