-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5949 from npoltorapavlo/RDK-52316-main
Merge pull request #5790 from npoltorapavlo/RDK-52316-24Q4
- Loading branch information
Showing
11 changed files
with
1,036 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: L2-ContentProtection | ||
|
||
on: | ||
push: | ||
paths: | ||
- ContentProtection/** | ||
- .github/workflows/*ContentProtection*.yml | ||
pull_request: | ||
paths: | ||
- ContentProtection/** | ||
- .github/workflows/*ContentProtection*.yml | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: ${{github.repository}} | ||
|
||
- name: Install cmake | ||
run: | | ||
sudo apt update | ||
sudo apt install -y cmake | ||
- name: Build Thunder | ||
working-directory: ${{github.workspace}} | ||
run: sh +x ${GITHUB_REPOSITORY}/.github/workflows/BuildThunder.sh | ||
|
||
- name: Build | ||
working-directory: ${{github.workspace}} | ||
run: | | ||
cmake -S ${GITHUB_REPOSITORY}/ContentProtection -B build/ContentProtection -DCMAKE_INSTALL_PREFIX="install" -DCMAKE_CXX_FLAGS="-Wall -Werror" | ||
cmake --build build/ContentProtection --target install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Changelog | ||
|
||
All notable changes to this RDK Service will be documented in this file. | ||
|
||
* Each RDK Service has a CHANGELOG file that contains all changes done so far. When version is updated, add a entry in the CHANGELOG.md at the top with user friendly information on what was changed with the new version. Please don't mention JIRA tickets in CHANGELOG. | ||
|
||
* Please Add entry in the CHANGELOG for each version change and indicate the type of change with these labels: | ||
* **Added** for new features. | ||
* **Changed** for changes in existing functionality. | ||
* **Deprecated** for soon-to-be removed features. | ||
* **Removed** for now removed features. | ||
* **Fixed** for any bug fixes. | ||
* **Security** in case of vulnerabilities. | ||
|
||
* Changes in CHANGELOG should be updated when commits are added to the main or release branches. There should be one CHANGELOG entry per JIRA Ticket. This is not enforced on sprint branches since there could be multiple changes for the same JIRA ticket during development. | ||
|
||
* For more details, refer to [versioning](https://github.com/rdkcentral/rdkservices#versioning) section under Main README. | ||
|
||
## [1.0.0] - 2024-07-15 | ||
### Added | ||
- Add CHANGELOG | ||
|
||
### Change | ||
- Reset API version to 1.0.0 | ||
- Change README to inform how to update changelog and API version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# If not stated otherwise in this file or this component's LICENSE file the | ||
# following copyright and licenses apply: | ||
# | ||
# Copyright 2022 RDK Management | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
cmake_minimum_required(VERSION 3.14) | ||
|
||
set(PLUGIN_NAME ContentProtection) | ||
find_package(WPEFramework NAMES WPEFramework Thunder) | ||
set(MODULE_NAME ${NAMESPACE}${PLUGIN_NAME}) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
set(PLUGIN_CONTENTPROTECTION_STARTUPORDER "" CACHE STRING "To configure startup order of the plugin") | ||
set(PLUGIN_CONTENTPROTECTION_AUTOSTART false CACHE STRING "To automatically start the plugin") | ||
|
||
add_library(${MODULE_NAME} SHARED | ||
ContentProtection.cpp | ||
Module.cpp | ||
) | ||
|
||
find_package(${NAMESPACE}Plugins REQUIRED) | ||
find_package(${NAMESPACE}Definitions REQUIRED) | ||
target_link_libraries(${MODULE_NAME} PRIVATE | ||
${NAMESPACE}Plugins::${NAMESPACE}Plugins | ||
${NAMESPACE}Definitions::${NAMESPACE}Definitions | ||
) | ||
|
||
install(TARGETS ${MODULE_NAME} | ||
DESTINATION lib/${STORAGE_DIRECTORY}/plugins) | ||
|
||
write_config(${PLUGIN_NAME}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
precondition = ["Platform"] | ||
callsign = "org.rdk.ContentProtection" | ||
autostart = "@PLUGIN_CONTENTPROTECTION_AUTOSTART@" | ||
startuporder = "@PLUGIN_CONTENTPROTECTION_STARTUPORDER@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
set(autostart ${PLUGIN_CONTENTPROTECTION_AUTOSTART}) | ||
set(preconditions Platform) | ||
set(callsign "org.rdk.ContentProtection") | ||
|
||
if(PLUGIN_CONTENTPROTECTION_STARTUPORDER) | ||
set (startuporder ${PLUGIN_CONTENTPROTECTION_STARTUPORDER}) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* If not stated otherwise in this file or this component's LICENSE file the | ||
* following copyright and licenses apply: | ||
* | ||
* Copyright 2022 RDK Management | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "ContentProtection.h" | ||
|
||
#define API_VERSION_NUMBER_MAJOR 1 | ||
#define API_VERSION_NUMBER_MINOR 0 | ||
#define API_VERSION_NUMBER_PATCH 0 | ||
|
||
namespace WPEFramework { | ||
namespace Plugin { | ||
|
||
namespace { | ||
static Metadata<ContentProtection> metadata( | ||
// Version (Major, Minor, Patch) | ||
API_VERSION_NUMBER_MAJOR, API_VERSION_NUMBER_MINOR, API_VERSION_NUMBER_PATCH, | ||
// Preconditions | ||
{}, | ||
// Terminations | ||
{}, | ||
// Controls | ||
{}); | ||
} | ||
|
||
SERVICE_REGISTRATION(ContentProtection, API_VERSION_NUMBER_MAJOR, API_VERSION_NUMBER_MINOR, API_VERSION_NUMBER_PATCH); | ||
|
||
const string ContentProtection::Initialize(PluginHost::IShell* service) | ||
{ | ||
string result; | ||
|
||
ASSERT(service != nullptr); | ||
|
||
_implementation = Core::Service<Implementation>::Create< | ||
Exchange::IContentProtection>(*this); | ||
Exchange::JContentProtection::Register(*this, _implementation); | ||
|
||
string token; | ||
auto security = service->QueryInterfaceByCallsign< | ||
PluginHost::IAuthenticate>("SecurityAgent"); | ||
if (security != nullptr) { | ||
string payload = "http://localhost"; | ||
auto ret = security->CreateToken( | ||
static_cast<uint16_t>(payload.length()), | ||
reinterpret_cast<const uint8_t*>(payload.c_str()), | ||
token); | ||
if (ret != Core::ERROR_NONE) { | ||
SYSLOG(Logging::Startup, | ||
(_T("Couldn't create token: %d"), ret)); | ||
} | ||
security->Release(); | ||
} | ||
|
||
Core::SystemInfo::SetEnvironment(_T("THUNDER_ACCESS"), | ||
(_T("127.0.0.1:9998"))); | ||
_secManager = Core::ProxyType<JSONRPCLink>::Create( | ||
_T("SecManager"), _T(""), "token=" + token); | ||
_watermark = Core::ProxyType<JSONRPCLink>::Create( | ||
_T("Watermark"), _T(""), "token=" + token); | ||
Subscribe(); | ||
|
||
return result; | ||
} | ||
|
||
void ContentProtection::Deinitialize(PluginHost::IShell*) | ||
{ | ||
Unsubscribe(); | ||
Exchange::JContentProtection::Unregister(*this); | ||
if (_implementation != nullptr) { | ||
_implementation->Release(); | ||
} | ||
} | ||
|
||
string ContentProtection::Information() const | ||
{ | ||
return (string()); | ||
} | ||
|
||
} // namespace Plugin | ||
} // namespace WPEFramework |
Oops, something went wrong.