From fa9476fe1f40bacc7ffb58c1a6572e77b4a6c167 Mon Sep 17 00:00:00 2001 From: Nikolai Shipilov Date: Tue, 8 Apr 2025 13:27:51 +0200 Subject: [PATCH 1/3] Use unsigned short as type for ep port number --- include/native_streaming/client.hpp | 2 +- include/native_streaming/server.hpp | 2 +- include/native_streaming/session.hpp | 6 +++--- src/client.cpp | 4 ++-- src/server.cpp | 4 ++-- src/session.cpp | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/native_streaming/client.hpp b/include/native_streaming/client.hpp index 7e339fb..a98ad11 100644 --- a/include/native_streaming/client.hpp +++ b/include/native_streaming/client.hpp @@ -73,7 +73,7 @@ class Client : public std::enable_shared_from_this /// @return pointer to created Session object std::shared_ptr createSession(std::shared_ptr wsStream, const std::string& endpointAddress, - const boost::asio::ip::port_type& endpointPortNumber); + const uint16_t& endpointPortNumber); /// async operations handler std::shared_ptr ioContextPtr; diff --git a/include/native_streaming/server.hpp b/include/native_streaming/server.hpp index d845996..a470326 100644 --- a/include/native_streaming/server.hpp +++ b/include/native_streaming/server.hpp @@ -89,7 +89,7 @@ class Server : public std::enable_shared_from_this std::shared_ptr createSession(std::shared_ptr wsStream, const std::shared_ptr& userContext, const std::string& endpointAddress, - const boost::asio::ip::port_type& endpointPortNumber); + const uint16_t& endpointPortNumber); /// async operations handler std::shared_ptr ioContextPtr; diff --git a/include/native_streaming/session.hpp b/include/native_streaming/session.hpp index 9d32829..ba27e71 100644 --- a/include/native_streaming/session.hpp +++ b/include/native_streaming/session.hpp @@ -38,7 +38,7 @@ class Session : public std::enable_shared_from_this boost::beast::role_type role, LogCallback logCallback, const std::string& endpointAddress, - const boost::asio::ip::port_type& endpointPortNumber); + const uint16_t& endpointPortNumber); ~Session(); Session(const Session&) = delete; @@ -79,7 +79,7 @@ class Session : public std::enable_shared_from_this std::string getEndpointAddress(); /// @brief returns a port number of the connection endpoint associated with the session. - boost::asio::ip::port_type getEndpointPortNumber(); + uint16_t getEndpointPortNumber(); /// @brief sets a callback to be called when the write operation has not been scheduled due to a timeout reached /// @param writeTaskTimeoutHandler callback @@ -130,7 +130,7 @@ class Session : public std::enable_shared_from_this std::string endpointAddress; /// @brief port number of the connection endpoint associated with the session - boost::asio::ip::port_type endpointPortNumber; + uint16_t endpointPortNumber; }; END_NAMESPACE_NATIVE_STREAMING diff --git a/src/client.cpp b/src/client.cpp index 8d85c4d..441f83f 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -157,7 +157,7 @@ void Client::onUpgradeConnection(const boost::system::error_code& ec, std::share } std::string endpointAddress; - boost::asio::ip::port_type endpointPortNumber; + uint16_t endpointPortNumber; try { auto remoteEp = wsStream->next_layer().socket().remote_endpoint(); @@ -175,7 +175,7 @@ void Client::onUpgradeConnection(const boost::system::error_code& ec, std::share std::shared_ptr Client::createSession(std::shared_ptr wsStream, const std::string& endpointAddress, - const boost::asio::ip::port_type& endpointPortNumber) + const uint16_t& endpointPortNumber) { websocketStream.reset(); return std::make_shared(ioContextPtr, wsStream, nullptr, boost::beast::role_type::client, logCallback, endpointAddress, endpointPortNumber); diff --git a/src/server.cpp b/src/server.cpp index 679bda0..a41705d 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -213,7 +213,7 @@ void Server::onUpgradeConnection(const boost::system::error_code& ec, // it throws an exception when attempting to retrieve the endpoint address. // To handle this, first verify the socket state and then safely attempt to retrieve the endpoint name. std::string endpointAddress; - boost::asio::ip::port_type endpointPortNumber; + uint16_t endpointPortNumber; if (!(wsStream->is_open() && wsStream->next_layer().socket().is_open())) { NS_LOG_W("Websocket connection aborted: the socket is already closed"); @@ -241,7 +241,7 @@ void Server::onUpgradeConnection(const boost::system::error_code& ec, std::shared_ptr Server::createSession(std::shared_ptr wsStream, const std::shared_ptr& userContext, const std::string& endpointAddress, - const boost::asio::ip::port_type& endpointPortNumber) + const uint16_t& endpointPortNumber) { return std::make_shared(ioContextPtr, wsStream, userContext, boost::beast::role_type::server, logCallback, endpointAddress, endpointPortNumber); } diff --git a/src/session.cpp b/src/session.cpp index c0da1e3..7991993 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -11,7 +11,7 @@ Session::Session(std::shared_ptr ioContextPtr, boost::beast::role_type role, LogCallback logCallback, const std::string& endpointAddress, - const boost::asio::ip::port_type& endpointPortNumber) + const uint16_t& endpointPortNumber) : role(role) , logCallback(logCallback) , ioContextPtr(ioContextPtr) @@ -180,7 +180,7 @@ std::string Session::getEndpointAddress() return endpointAddress; } -boost::asio::ip::port_type Session::getEndpointPortNumber() +uint16_t Session::getEndpointPortNumber() { return endpointPortNumber; } From e6a64b5ec14bad8c2ec3d5c44a297e6e284f86dd Mon Sep 17 00:00:00 2001 From: Nikolai Shipilov Date: Tue, 8 Apr 2025 13:28:18 +0200 Subject: [PATCH 2/3] Prepare v1.0.18 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 19c6e3c..3dc4bb2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.24) -project(native_streaming VERSION 1.0.17 LANGUAGES CXX) +project(native_streaming VERSION 1.0.18 LANGUAGES CXX) if (NOT CMAKE_MESSAGE_CONTEXT) set(CMAKE_MESSAGE_CONTEXT ${PROJECT_NAME}) From 5027ac61371c22386ab39bdc129771f300c6c64b Mon Sep 17 00:00:00 2001 From: Nikolai Shipilov Date: Tue, 8 Apr 2025 13:44:41 +0200 Subject: [PATCH 3/3] Update year in license header --- LICENSE.txt | 2 +- include/native_streaming/async_reader.hpp | 2 +- include/native_streaming/async_writer.hpp | 2 +- include/native_streaming/authentication.hpp | 2 +- include/native_streaming/client.hpp | 2 +- include/native_streaming/common.hpp | 2 +- include/native_streaming/logging.hpp | 2 +- include/native_streaming/server.hpp | 2 +- include/native_streaming/session.hpp | 2 +- include/native_streaming/utils/base64.hpp | 2 +- include/native_streaming/utils/boost_compatibility_utils.hpp | 2 +- test/test_base.hpp | 2 +- test/test_connection.hpp | 2 +- tools/license-header-checker/do-license-header-check.sh | 2 +- tools/license-header-checker/license.in | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index e73eafb..f5592a4 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 openDAQ d.o.o. + * Copyright 2022-2025 openDAQ d.o.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/include/native_streaming/async_reader.hpp b/include/native_streaming/async_reader.hpp index 5846cf6..8f756bf 100644 --- a/include/native_streaming/async_reader.hpp +++ b/include/native_streaming/async_reader.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 openDAQ d.o.o. + * Copyright 2022-2025 openDAQ d.o.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/include/native_streaming/async_writer.hpp b/include/native_streaming/async_writer.hpp index d32e30e..ef51cac 100644 --- a/include/native_streaming/async_writer.hpp +++ b/include/native_streaming/async_writer.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 openDAQ d.o.o. + * Copyright 2022-2025 openDAQ d.o.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/include/native_streaming/authentication.hpp b/include/native_streaming/authentication.hpp index 9feff02..3918f4a 100644 --- a/include/native_streaming/authentication.hpp +++ b/include/native_streaming/authentication.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 openDAQ d.o.o. + * Copyright 2022-2025 openDAQ d.o.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/include/native_streaming/client.hpp b/include/native_streaming/client.hpp index a98ad11..8234794 100644 --- a/include/native_streaming/client.hpp +++ b/include/native_streaming/client.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 openDAQ d.o.o. + * Copyright 2022-2025 openDAQ d.o.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/include/native_streaming/common.hpp b/include/native_streaming/common.hpp index c59730f..c0f946f 100644 --- a/include/native_streaming/common.hpp +++ b/include/native_streaming/common.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 openDAQ d.o.o. + * Copyright 2022-2025 openDAQ d.o.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/include/native_streaming/logging.hpp b/include/native_streaming/logging.hpp index d338dfd..f1c46ec 100644 --- a/include/native_streaming/logging.hpp +++ b/include/native_streaming/logging.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 openDAQ d.o.o. + * Copyright 2022-2025 openDAQ d.o.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/include/native_streaming/server.hpp b/include/native_streaming/server.hpp index a470326..a14f007 100644 --- a/include/native_streaming/server.hpp +++ b/include/native_streaming/server.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 openDAQ d.o.o. + * Copyright 2022-2025 openDAQ d.o.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/include/native_streaming/session.hpp b/include/native_streaming/session.hpp index ba27e71..5520419 100644 --- a/include/native_streaming/session.hpp +++ b/include/native_streaming/session.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 openDAQ d.o.o. + * Copyright 2022-2025 openDAQ d.o.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/include/native_streaming/utils/base64.hpp b/include/native_streaming/utils/base64.hpp index 0b8f578..c5ce478 100644 --- a/include/native_streaming/utils/base64.hpp +++ b/include/native_streaming/utils/base64.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 openDAQ d.o.o. + * Copyright 2022-2025 openDAQ d.o.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/include/native_streaming/utils/boost_compatibility_utils.hpp b/include/native_streaming/utils/boost_compatibility_utils.hpp index ce4b05a..e2bbfc8 100644 --- a/include/native_streaming/utils/boost_compatibility_utils.hpp +++ b/include/native_streaming/utils/boost_compatibility_utils.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 openDAQ d.o.o. + * Copyright 2022-2025 openDAQ d.o.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/test/test_base.hpp b/test/test_base.hpp index 3904506..b5fec21 100644 --- a/test/test_base.hpp +++ b/test/test_base.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 openDAQ d.o.o. + * Copyright 2022-2025 openDAQ d.o.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/test/test_connection.hpp b/test/test_connection.hpp index 969444f..1013702 100644 --- a/test/test_connection.hpp +++ b/test/test_connection.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 openDAQ d.o.o. + * Copyright 2022-2025 openDAQ d.o.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/tools/license-header-checker/do-license-header-check.sh b/tools/license-header-checker/do-license-header-check.sh index 87bdbe1..8d3bba9 100755 --- a/tools/license-header-checker/do-license-header-check.sh +++ b/tools/license-header-checker/do-license-header-check.sh @@ -2,7 +2,7 @@ : ' /* - * Copyright 2022-2024 openDAQ d.o.o. + * Copyright 2022-2025 openDAQ d.o.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/tools/license-header-checker/license.in b/tools/license-header-checker/license.in index e73eafb..f5592a4 100644 --- a/tools/license-header-checker/license.in +++ b/tools/license-header-checker/license.in @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 openDAQ d.o.o. + * Copyright 2022-2025 openDAQ d.o.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.