Skip to content

Commit

Permalink
Release v5.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
arobenko committed Sep 3, 2024
2 parents 4879850 + b9a6a2e commit 961c060
Show file tree
Hide file tree
Showing 8 changed files with 220 additions and 13 deletions.
110 changes: 108 additions & 2 deletions .github/workflows/actions_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Github Actions Build
on: [push]

env:
COMMS_TAG: v5.2.4
COMMS_TAG: v5.2.6

jobs:

Expand Down Expand Up @@ -58,7 +58,60 @@ jobs:
shell: bash
run: cmake --build . --config ${{matrix.type}} --target install
env:
VERBOSE: 1
VERBOSE: 1

build_gcc_ubuntu_24_04:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
type: [Debug, Release, MinSizeRel]
cc_ver: [13, 14]
cpp: [17, 20]
qt_ver: [5, 6]

steps:
- uses: actions/checkout@v4

- name: Prepare Install
run: sudo apt-get update --fix-missing

- name: Install Packages
run: sudo apt install qtbase5-dev qt6-base-dev libqt${{matrix.qt_ver}}serialport${{matrix.qt_ver}}-dev gcc-${{matrix.cc_ver}} g++-${{matrix.cc_ver}}

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Prepare externals
shell: bash
run: $GITHUB_WORKSPACE/script/prepare_externals.sh
env:
BUILD_DIR: ${{runner.workspace}}/build
CC: gcc-${{matrix.cc_ver}}
CXX: g++-${{matrix.cc_ver}}
EXTERNALS_DIR: ${{runner.workspace}}/externals
COMMON_INSTALL_DIR: ${{runner.workspace}}/build/install
COMMON_BUILD_TYPE: ${{matrix.type}}
COMMON_CXX_STANDARD: ${{matrix.cpp}}
COMMS_TAG: ${{env.COMMS_TAG}}

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} \
-DCC_TOOLS_QT_BUILD_PLUGIN_DEMO_PROTOCOL=ON -DCC_TOOLS_QT_MAJOR_QT_VERSION=${{matrix.qt_ver}}
env:
CC: gcc-${{matrix.cc_ver}}
CXX: g++-${{matrix.cc_ver}}

- name: Build Target
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config ${{matrix.type}} --target install
env:
VERBOSE: 1

build_clang_ubuntu_22_04:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -121,6 +174,59 @@ jobs:
run: cmake --build . --config ${{matrix.type}} --target install
env:
VERBOSE: 1

build_clang_ubuntu_24_04:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
type: [Debug, Release, MinSizeRel]
cc_ver: [16, 17, 18]
cpp: [17, 20]
qt_ver: [5, 6]

steps:
- uses: actions/checkout@v4

- name: Prepare Install
run: sudo apt-get update --fix-missing

- name: Install Packages
run: sudo apt install qtbase5-dev qt6-base-dev libqt${{matrix.qt_ver}}serialport${{matrix.qt_ver}}-dev clang-${{matrix.cc_ver}}

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Prepare externals
shell: bash
run: $GITHUB_WORKSPACE/script/prepare_externals.sh
env:
BUILD_DIR: ${{runner.workspace}}/build
CC: clang-${{matrix.cc_ver}}
CXX: clang++-${{matrix.cc_ver}}
EXTERNALS_DIR: ${{runner.workspace}}/externals
COMMON_INSTALL_DIR: ${{runner.workspace}}/build/install
COMMON_BUILD_TYPE: ${{matrix.type}}
COMMON_CXX_STANDARD: ${{matrix.cpp}}
COMMS_TAG: ${{env.COMMS_TAG}}

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} \
-DCC_TOOLS_QT_BUILD_PLUGIN_DEMO_PROTOCOL=ON -DCC_TOOLS_QT_MAJOR_QT_VERSION=${{matrix.qt_ver}}
env:
CC: clang-${{matrix.cc_ver}}
CXX: clang++-${{matrix.cc_ver}}

- name: Build Target
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config ${{matrix.type}} --target install
env:
VERBOSE: 1

build_msvc_2019:
runs-on: windows-2019
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ option (CC_TOOLS_QT_BUILD_PLUGINS "Build plugins." ${CC_TOOLS_QT_BUILD_APPS})
option (CC_TOOLS_QT_WARN_AS_ERR "Treat warning as error" ON)
option (CC_TOOLS_QT_USE_CCACHE "Use ccache on UNIX systems if it's available" OFF)
option (CC_TOOLS_QT_STATIC_RUNTIME "Enable/Disable static runtime" OFF)
option (CC_TOOLS_QT_WIN32_FORCE_CONSOLE_APPS "Force treating GUI apps as console ones even on Release" OFF)

# More fine-grained options
option (CC_TOOLS_QT_BUILD_PLUGIN_ECHO_SOCKET "Build echo socket plugin." ${CC_TOOLS_QT_BUILD_PLUGINS})
Expand Down
4 changes: 3 additions & 1 deletion app/cc_view/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ function (bin_cc_view)
)

set (gui_exe)
if (WIN32 AND ("${CMAKE_BUILD_TYPE}" STREQUAL "Release"))
if ((WIN32) AND
(NOT CC_TOOLS_QT_WIN32_FORCE_CONSOLE_APPS) AND
(("${CMAKE_BUILD_TYPE}" STREQUAL "Release") OR ("${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel")))
set (gui_exe WIN32)
endif ()

Expand Down
4 changes: 2 additions & 2 deletions lib/include/cc_tools_qt/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define CC_TOOLS_QT_MINOR_VERSION 3U

/// @brief Patch level of the library
#define CC_TOOLS_QT_PATCH_VERSION 1U
#define CC_TOOLS_QT_PATCH_VERSION 2U

/// @brief Macro to create numeric version as single unsigned number
#define CC_TOOLS_QT_MAKE_VERSION(major_, minor_, patch_) \
Expand Down Expand Up @@ -77,7 +77,7 @@ constexpr unsigned version()
return CC_TOOLS_QT_VERSION;
}

static_assert(COMMS_MAKE_VERSION(5, 2, 4) <= comms::version(),
static_assert(COMMS_MAKE_VERSION(5, 2, 6) <= comms::version(),
"The version of COMMS library is too old");

} // namespace cc_tools_qt
6 changes: 5 additions & 1 deletion plugin/ssl_socket/client/SslClientSocketConfigWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,23 @@ const SslProtocolMap& sslProtocolMap()
static const SslProtocolMap Map = {
{"Any Secure", QSsl::SecureProtocols},
{"Any Supported", QSsl::AnyProtocol},
#if QT_VERSION < QT_VERSION_CHECK(6, 3, 0)
{"TLSv1.0", QSsl::TlsV1_0},
{"TLSv1.0+", QSsl::TlsV1_0OrLater},
{"TLSv1.1", QSsl::TlsV1_1},
{"TLSv1.1+", QSsl::TlsV1_1OrLater},
{"TLSv1.2", QSsl::TlsV1_2},
#endif // #if QT_VERSION < QT_VERSION_CHECK(6, 3, 0)
{"TLSv1.2+", QSsl::TlsV1_2OrLater},
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
{"TLSv1.3", QSsl::TlsV1_3},
{"TLSv1.3+", QSsl::TlsV1_3OrLater},
#endif
#endif // #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
#if QT_VERSION < QT_VERSION_CHECK(6, 3, 0)
{"DTLSv1.0", QSsl::DtlsV1_0},
{"DTLSv1.0+", QSsl::DtlsV1_0OrLater},
{"DTLSv1.2", QSsl::DtlsV1_2},
#endif // #if QT_VERSION < QT_VERSION_CHECK(6, 3, 0)
{"DTLSv1.2+", QSsl::DtlsV1_2OrLater},
};

Expand Down
99 changes: 93 additions & 6 deletions plugin/udp_socket/generic/UdpGenericSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ const QString& udpBroadcastMaskProp()
return Str;
}

const QString& udpBroadcastTtlProp()
{
static const QString Str("udp.broadcast_ttl");
return Str;
}

const QString& udpBroadcastRadiusProp()
{
static const QString Str("udp.broadcast_radius");
return Str;
}

const QString& udpHostProp()
{
static const QString Str("udp.host");
Expand Down Expand Up @@ -94,12 +106,30 @@ const QString& networkLocalPortProp()
return Str;
}

const QString& networkBroadcastProp()
{
static const QString Str("network.broadcast");
return Str;
}

const QString& networkBroadcastMaskProp()
{
static const QString Str("network.broadcast_mask");
return Str;
}

const QString& networkBroadcastTtlProp()
{
static const QString Str("network.broadcast_ttl");
return Str;
}

const QString& networkBroadcastRadiusProp()
{
static const QString Str("network.broadcast_radius");
return Str;
}

} // namespace


Expand Down Expand Up @@ -169,6 +199,23 @@ bool UdpGenericSocket::socketConnectImpl()
reportError("Failed to connect UDP socket to " + QString("%1:%2").arg(m_host).arg(m_port));
}
} while (false);

do {
if (m_defaultTtl != 0) {
break;
}

auto ttlVal = m_socket.socketOption(QUdpSocket::MulticastTtlOption);
if (ttlVal.isValid() && ttlVal.canConvert<int>()) {
m_defaultTtl = ttlVal.value<int>();
break;
}

static const int DefaultTtl = 64;
std::cerr << "WARNING: Failed to retrieve default TTL value, assuming " << DefaultTtl << std::endl;
m_defaultTtl = DefaultTtl;
} while (false);

return true;
}

Expand All @@ -190,9 +237,17 @@ void UdpGenericSocket::sendDataImpl(DataInfoPtr dataPtr)

do {
bool broadcastRequested = false;
auto broadcastVar = dataPtr->m_extraProperties.value(udpBroadcastProp());
if (broadcastVar.isValid() && broadcastVar.canConvert<bool>()) {
broadcastRequested = broadcastVar.value<bool>();
static const QString* BroadcastProps[] = {
&networkBroadcastProp(),
&udpBroadcastProp(),
};

for (auto* s : BroadcastProps) {
assert(s != nullptr);
auto broadcastVar = dataPtr->m_extraProperties.value(*s);
if (broadcastVar.isValid() && broadcastVar.canConvert<bool>()) {
broadcastRequested = broadcastVar.value<bool>();
}
}

if ((!broadcastRequested) ||
Expand All @@ -202,11 +257,39 @@ void UdpGenericSocket::sendDataImpl(DataInfoPtr dataPtr)
}

auto broadcastMask = m_broadcastMask;
auto broadcastMaskVar = dataPtr->m_extraProperties.value(udpBroadcastMaskProp());
if (broadcastMaskVar.isValid() && broadcastMaskVar.canConvert<QString>()) {
broadcastMask = broadcastMaskVar.toString();
static const QString* BroadcastMaskProps[] = {
&networkBroadcastMaskProp(),
&udpBroadcastMaskProp(),
};

for (auto* s : BroadcastMaskProps) {
assert(s != nullptr);
auto broadcastMaskVar = dataPtr->m_extraProperties.value(*s);
if (broadcastMaskVar.isValid() && broadcastMaskVar.canConvert<QString>()) {
broadcastMask = broadcastMaskVar.toString();
}
}

auto broadcastTtl = m_defaultTtl;
static const QString* BroadcastTtlProps[] = {
&networkBroadcastRadiusProp(),
&networkBroadcastTtlProp(),
&udpBroadcastRadiusProp(),
&udpBroadcastTtlProp(),
};

for (auto* s : BroadcastTtlProps) {
assert(s != nullptr);
auto broadcastTtlVar = dataPtr->m_extraProperties.value(*s);
if (broadcastTtlVar.isValid() && broadcastTtlVar.canConvert<int>()) {
broadcastTtl = broadcastTtlVar.value<int>();
}
}

if (broadcastTtl != 0) {
m_socket.setSocketOption(QUdpSocket::MulticastTtlOption, broadcastTtl);
}

std::size_t writtenCount = 0;
while (writtenCount < dataPtr->m_data.size()) {
auto remSize = static_cast<qint64>(dataPtr->m_data.size() - writtenCount);
Expand Down Expand Up @@ -236,6 +319,10 @@ void UdpGenericSocket::sendDataImpl(DataInfoPtr dataPtr)
return;
}

if (m_defaultTtl != 0) {
m_socket.setSocketOption(QUdpSocket::MulticastTtlOption, m_defaultTtl);
}

std::size_t writtenCount = 0;
while (writtenCount < dataPtr->m_data.size()) {
auto remSize = static_cast<qint64>(dataPtr->m_data.size() - writtenCount);
Expand Down
1 change: 1 addition & 0 deletions plugin/udp_socket/generic/UdpGenericSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ private slots:
PortType m_localPort = 0;
QString m_broadcastMask = "255.255.255.255";
QUdpSocket m_socket;
int m_defaultTtl = 0;
bool m_running = false;
};

Expand Down
8 changes: 7 additions & 1 deletion plugin/udp_socket/generic/udp_socket.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
" { \"network.broadcast_mask\": 1234} - Alias to \"udp.broadcast_mask\".\n\n",
"Supported message properties:\n",
" { \"udp.broadcast\": true } - Broadcast the packet.\n",
" { \"udp.broadcast_mask\": \"255.255.255.255\" } - Override the configured broadcast mask.\n"
" { \"udp.broadcast_mask\": \"255.255.255.255\" } - Override the configured broadcast mask.\n",
" { \"udp.broadcast_ttl\": 32 } - Override the default TTL value.\n",
" { \"udp.broadcast_radius\": 32 } - Alias to \"udp.broadcast_ttl\".\n",
" { \"network.broadcast\": true } - Alias to \"udp.broadcast\".\n",
" { \"network.broadcast_mask\": true } - Alias to \"udp.broadcast_mask\".\n",
" { \"network.broadcast_ttl\": 32 } - Alias to \"udp.broadcast_ttl\".\n",
" { \"network.broadcast_radius\": 32 } - Alias to \"udp.broadcast_ttl\".\n"
],
"type" : "socket"
}

0 comments on commit 961c060

Please sign in to comment.