Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/build_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
permissions: read-all
container:
image: ghcr.io/aosedge/aos-core-build-base:latest
image: ghcr.io/aosedge/aos-core-build:latest
options: "--entrypoint /usr/bin/bash"
credentials:
username: ${{ github.actor }}
Expand All @@ -33,10 +33,6 @@ jobs:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory

steps:
# Apply solution to "HOME is overridden for containers" problem: https://github.com/actions/runner/issues/863
- name: Preserve $HOME set in the container
run: echo HOME=/root >> "$GITHUB_ENV"

- name: Checkout
uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion external/aos_core_lib_cpp
Submodule aos_core_lib_cpp updated 81 files
+14 −17 .github/workflows/build-test.yaml
+0 −0 .github/workflows/check-format.yaml
+0 −24 .github/workflows/static_analysis.yaml
+1 −0 .gitignore
+1 −1 CMakeLists.txt
+53 −71 README.md
+201 −0 build.sh
+0 −54 host_build.sh
+8 −8 include/aos/common/cloudprotocol/alerts.hpp
+2 −2 include/aos/common/config.hpp
+39 −9 include/aos/common/crypto/crypto.hpp
+17 −10 include/aos/common/crypto/mbedtls/cryptoprovider.hpp
+17 −10 include/aos/common/crypto/openssl/cryptoprovider.hpp
+7 −20 include/aos/common/downloader/downloader.hpp
+24 −0 include/aos/common/logprovider/config.hpp
+1 −1 include/aos/common/ocispec/imagespec.hpp
+1 −1 include/aos/common/ocispec/runtimespec.hpp
+1 −0 include/aos/common/pkcs11/pkcs11.hpp
+5 −1 include/aos/common/tools/array.hpp
+2 −0 include/aos/common/tools/buffer.hpp
+2 −0 include/aos/common/tools/function.hpp
+1 −0 include/aos/common/tools/list.hpp
+1 −6 include/aos/common/tools/log.hpp
+3 −2 include/aos/common/tools/map.hpp
+7 −2 include/aos/common/tools/memory.hpp
+1 −0 include/aos/common/tools/optional.hpp
+1 −0 include/aos/common/tools/queue.hpp
+29 −2 include/aos/common/tools/string.hpp
+1 −1 include/aos/common/tools/thread.hpp
+0 −7 include/aos/common/tools/uuid.hpp
+1 −0 include/aos/common/tools/variant.hpp
+4 −4 include/aos/common/types.hpp
+3 −3 include/aos/iam/certmodules/pkcs11/pkcs11.hpp
+10 −1 include/aos/iam/permhandler.hpp
+4 −1 include/aos/sm/launcher.hpp
+8 −7 include/aos/sm/networkmanager.hpp
+1 −1 include/aos/test/crypto/providers/cryptofactoryitf.hpp
+2 −2 include/aos/test/crypto/providers/mbedtlsfactory.hpp
+2 −2 include/aos/test/crypto/providers/opensslfactory.hpp
+51 −31 src/common/crypto/mbedtls/cryptoprovider.cpp
+44 −27 src/common/crypto/openssl/cryptoprovider.cpp
+18 −15 src/common/crypto/openssl/opensslprovider.cpp
+1 −3 src/common/monitoring/average.cpp
+4 −3 src/common/monitoring/resourcemonitor.cpp
+2 −2 src/common/pkcs11/pkcs11.cpp
+0 −2 src/common/tools/semver.cpp
+1 −1 src/common/tools/timer.cpp
+5 −17 src/common/tools/uuid.cpp
+1 −1 src/iam/certhandler/certhandler.cpp
+25 −17 src/iam/certmodules/pkcs11/pkcs11.cpp
+3 −17 src/iam/nodeinfoprovider/nodeinfoprovider.cpp
+3 −3 src/iam/nodemanager/nodemanager.cpp
+25 −6 src/iam/permhandler/permhandler.cpp
+1 −3 src/sm/launcher/instance.cpp
+17 −5 src/sm/launcher/launcher.cpp
+8 −8 src/sm/launcher/runtimespec.cpp
+2 −1 src/sm/layermanager/layermanager.cpp
+36 −19 src/sm/networkmanager/networkmanager.cpp
+2 −2 src/sm/resourcemanager/resourcemanager.cpp
+2 −1 src/sm/servicemanager/servicemanager.cpp
+3 −3 suppressions.txt
+1 −1 tests/common/src/crypto/cryptoprovider_test.cpp
+1 −1 tests/common/src/crypto/cryptoutils_test.cpp
+1 −1 tests/common/src/pkcs11_test.cpp
+0 −2 tests/common/src/tools/buffer_test.cpp
+1 −0 tests/common/src/tools/enum_test.cpp
+1 −1 tests/common/src/tools/memory_test.cpp
+22 −0 tests/common/src/tools/string_test.cpp
+1 −1 tests/common/src/tools/time_test.cpp
+0 −17 tests/common/src/tools/uuid_test.cpp
+1 −1 tests/common/src/tools/variant_test.cpp
+7 −3 tests/iam/certmodules/certmodules_test.cpp
+1 −1 tests/iam/iam_test.cpp
+1 −0 tests/iam/identmodules/fileidentifier_test.cpp
+15 −4 tests/iam/permhandler/permhandler_test.cpp
+7 −8 tests/iam/stubs/certhandlerstub.cpp
+0 −1 tests/include/mocks/cryptomock.hpp
+2 −1 tests/include/mocks/downloadermock.hpp
+20 −15 tests/sm/launcher/launcher_test.cpp
+25 −24 tests/utils/src/crypto/providers/mbedtlsfactory.cpp
+7 −7 tests/utils/src/crypto/providers/opensslfactory.cpp
7 changes: 5 additions & 2 deletions include/downloader/downloader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ class Downloader : public aos::downloader::DownloaderItf {
*
* @param url URL.
* @param path path to file.
* @param contentType content type.
* @param targetType target type.
* @param targetID target ID.
* @param version version.
* @return Error.
*/
Error Download(const String& url, const String& path, aos::downloader::DownloadContent contentType) override;
Error Download(const String& url, const String& path, cloudprotocol::DownloadTarget targetType,
const String& targetID = "", const String& version = "") override;

private:
constexpr static std::chrono::milliseconds cDelay {1000};
Expand Down
5 changes: 2 additions & 3 deletions include/network/interfacemanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <functional>
#include <optional>
#include <string>
#include <vector>

#include <sys/socket.h>

Expand Down Expand Up @@ -203,7 +204,7 @@ class InterfaceManager : public sm::networkmanager::InterfaceManagerItf,
* @param[out] routes routes.
* @return Error.
*/
Error GetRouteList(Array<RouteInfo>& routes) const;
Error GetRouteList(std::vector<RouteInfo>& routes) const;

/**
* Adds link.
Expand Down Expand Up @@ -248,8 +249,6 @@ class InterfaceManager : public sm::networkmanager::InterfaceManagerItf,
using LinkDeleter = std::function<void(rtnl_link*)>;
using UniqueLink = std::unique_ptr<rtnl_link, LinkDeleter>;

static constexpr size_t cMaxRouteCount = 20;

RetWithError<int> GetMasterInterfaceIndex() const;
RetWithError<UniqueNetlinkSocket> CreateNetlinkSocket() const;
RetWithError<UniqueLink> CreateLink() const;
Expand Down
8 changes: 6 additions & 2 deletions src/downloader/downloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ Downloader::~Downloader()
mCondVar.notify_all();
}

Error Downloader::Download(const String& url, const String& path, aos::downloader::DownloadContent contentType)
Error Downloader::Download(const String& url, const String& path, cloudprotocol::DownloadTarget targetType,
const String& targetID, const String& version)
{
LOG_DBG() << "Start download: url=" << url << ", path=" << path << ", contentType=" << contentType;
(void)targetID;
(void)version;

LOG_DBG() << "Start download: url=" << url << ", path=" << path << ", contentType=" << targetType;

return RetryDownload(url, path);
}
Expand Down
8 changes: 3 additions & 5 deletions src/network/interfacemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ Error InterfaceManager::SetMasterLink(const String& ifname, const String& master
return ErrorEnum::eNone;
}

Error InterfaceManager::GetRouteList(Array<RouteInfo>& routes) const
Error InterfaceManager::GetRouteList(std::vector<RouteInfo>& routes) const
{
LOG_DBG() << "List routes";

Expand Down Expand Up @@ -475,9 +475,7 @@ Error InterfaceManager::GetRouteList(Array<RouteInfo>& routes) const
}
}

if (err = routes.PushBack(info); !err.IsNone()) {
return AOS_ERROR_WRAP(err);
}
routes.push_back(std::move(info));
}

return ErrorEnum::eNone;
Expand Down Expand Up @@ -574,7 +572,7 @@ RetWithError<int> InterfaceManager::GetMasterInterfaceIndex() const
{
LOG_DBG() << "Get master interface index";

StaticArray<RouteInfo, cMaxRouteCount> routes;
std::vector<RouteInfo> routes;

if (auto err = GetRouteList(routes); !err.IsNone()) {
return {-1, err};
Expand Down
4 changes: 2 additions & 2 deletions tests/downloader/downloader_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ TEST_F(DownloaderTest, Download)
StartServer();

auto err = mDownloader.Download(
"http://localhost:8000/test_file.dat", mFilePath.c_str(), aos::downloader::DownloadContentEnum::eService);
"http://localhost:8000/test_file.dat", mFilePath.c_str(), aos::cloudprotocol::DownloadTargetEnum::eService);
EXPECT_EQ(err, aos::ErrorEnum::eNone);

EXPECT_TRUE(std::filesystem::exists(mFilePath));
Expand All @@ -79,7 +79,7 @@ TEST_F(DownloaderTest, Download)
TEST_F(DownloaderTest, DownloadFileScheme)
{
auto err = mDownloader.Download(
"file://test_file.dat", mFilePath.c_str(), aos::downloader::DownloadContentEnum::eService);
"file://test_file.dat", mFilePath.c_str(), aos::cloudprotocol::DownloadTargetEnum::eService);
EXPECT_EQ(err, aos::ErrorEnum::eNone);

EXPECT_TRUE(std::filesystem::exists(mFilePath));
Expand Down
Loading