diff --git a/client/main.cpp b/client/main.cpp index e596568..04f66eb 100644 --- a/client/main.cpp +++ b/client/main.cpp @@ -33,6 +33,7 @@ #include #include "proxyclient.h" +#include "../version.h" static QHash s_loggingFilters; static const char *const normal = "\033[0m"; diff --git a/debian/control b/debian/control index 7446b13..c71b20b 100644 --- a/debian/control +++ b/debian/control @@ -1,7 +1,7 @@ Source: nymea-remoteproxy Section: utils Priority: options -Maintainer: Simon Stürz +Maintainer: nymea GmbH Standards-Version: 3.9.3 Homepage: https://nymea.io Vcs-Git: https://github.com/nymea/nymea-remoteproxy.git @@ -16,6 +16,8 @@ Build-depends: debhelper (>= 9.0.0), Package: nymea-remoteproxy Architecture: any +Section: net +Multi-Arch: same Depends: ${shlibs:Depends}, ${misc:Depends}, awscli, @@ -28,6 +30,7 @@ Description: The nymea remote proxy server Package: libnymea-remoteproxy Architecture: any Section: libs +Multi-Arch: same Depends: ${shlibs:Depends}, ${misc:Depends}, Description: The nymea remote proxy server lib @@ -48,7 +51,8 @@ Description: The nymea remote proxy server lib - development files Package: nymea-remoteproxy-client Architecture: any -Section: libs +Section: utils +Multi-Arch: same Depends: ${shlibs:Depends}, ${misc:Depends}, Description: The nymea remote proxy client for testing @@ -57,7 +61,8 @@ Description: The nymea remote proxy client for testing Package: nymea-remoteproxy-tunnelclient Architecture: any -Section: libs +Section: utils +Multi-Arch: same Depends: ${shlibs:Depends}, ${misc:Depends}, Description: The nymea remote proxy tunnel client for testing @@ -67,6 +72,7 @@ Description: The nymea remote proxy tunnel client for testing Package: libnymea-remoteproxyclient Architecture: any Section: libs +Multi-Arch: same Depends: ${shlibs:Depends}, ${misc:Depends}, Description: The nymea remote proxy server client lib @@ -87,6 +93,8 @@ Description: The nymea remote proxy server client lib - development files Package: nymea-remoteproxy-tests Architecture: any +Multi-Arch: same +Section: devel Depends: ${shlibs:Depends}, ${misc:Depends}, libnymea-remoteproxy (= ${binary:Version}), @@ -96,8 +104,9 @@ Description: The nymea remote proxy server tests Package: nymea-remoteproxy-monitor Architecture: any +Multi-Arch: same +Section: utils Depends: ${shlibs:Depends}, ${misc:Depends}, - libncurses5, Description: The nymea remote proxy monitor tool The nymea remote proxy server monitor diff --git a/debian/copyright b/debian/copyright index 6e741f3..b390f18 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,7 +1,7 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: nymea-remoteproxy Upstream-Contact: Simon Stürz -Copyright: 2018 - 2021, nymea GmbH +Copyright: 2018 - 2022, nymea GmbH Download: http://www.github.com/nymea/nymea-remoteproxy Source: https://github.com/nymea/nymea-remoteproxy.git @@ -16,24 +16,24 @@ License: LGPL-3 Files: libnymea-remoteproxyclient/* License: LGPL-3 -Copyright: 2018 - 2021, nymea GmbH +Copyright: 2018 - 2022, nymea GmbH Files: libnymea-remoteproxy/* License: GPL-3 -Copyright: 2018 - 2021, nymea GmbH +Copyright: 2018 - 2022, nymea GmbH Files: client/* License: GPL-3 -Copyright: 2018 - 2021, nymea GmbH +Copyright: 2018 - 2022, nymea GmbH Files: monitor/* License: GPL-3 -Copyright: 2018 - 2021, nymea GmbH +Copyright: 2018 - 2022, nymea GmbH Files: server/* License: GPL-3 -Copyright: 2018 - 2021, nymea GmbH +Copyright: 2018 - 2022, nymea GmbH Files: tests/* License: GPL-3 -Copyright: 2018 - 2021, nymea GmbH +Copyright: 2018 - 2022, nymea GmbH diff --git a/libnymea-remoteproxy/engine.cpp b/libnymea-remoteproxy/engine.cpp index 469795c..492f865 100644 --- a/libnymea-remoteproxy/engine.cpp +++ b/libnymea-remoteproxy/engine.cpp @@ -27,6 +27,7 @@ #include "engine.h" #include "loggingcategories.h" +#include "../version.h" namespace remoteproxy { @@ -327,7 +328,6 @@ void Engine::clean() } } - void Engine::setRunning(bool running) { if (m_running == running) diff --git a/libnymea-remoteproxy/server/jsonrpcserver.cpp b/libnymea-remoteproxy/server/jsonrpcserver.cpp index 4b3085e..6b30d5e 100644 --- a/libnymea-remoteproxy/server/jsonrpcserver.cpp +++ b/libnymea-remoteproxy/server/jsonrpcserver.cpp @@ -31,6 +31,7 @@ #include "jsonrpc/jsontypes.h" #include "transportclient.h" #include "../common/slipdataprocessor.h" +#include "../version.h" #include #include diff --git a/libnymea-remoteproxy/server/tcpsocketserver.cpp b/libnymea-remoteproxy/server/tcpsocketserver.cpp index dc152e6..d164c00 100644 --- a/libnymea-remoteproxy/server/tcpsocketserver.cpp +++ b/libnymea-remoteproxy/server/tcpsocketserver.cpp @@ -115,7 +115,7 @@ bool TcpSocketServer::startServer() } connect(m_server, &SslServer::clientConnected, this, &TcpSocketServer::onClientConnected); - connect(m_server, SIGNAL(clientDisconnected(QSslSocket*)), SLOT(onClientDisconnected(QSslSocket*))); + connect(m_server, &SslServer::clientDisconnected, this, &TcpSocketServer::onClientDisconnected); connect(m_server, &SslServer::dataAvailable, this, &TcpSocketServer::onDataAvailable); qCDebug(dcTcpSocketServer()) << "Server started successfully."; return true; @@ -152,7 +152,9 @@ void SslServer::incomingConnection(qintptr socketDescriptor) qCDebug(dcTcpSocketServer()) << "Incomming connection" << sslSocket; connect(sslSocket, &QSslSocket::readyRead, this, &SslServer::onSocketReadyRead); connect(sslSocket, &QSslSocket::disconnected, this, &SslServer::onClientDisconnected); - connect(sslSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onSocketError(QAbstractSocket::SocketError))); + + typedef void (QAbstractSocket:: *errorSignal)(QAbstractSocket::SocketError); + connect(sslSocket, static_cast(&QAbstractSocket::error), this, &SslServer::onSocketError); connect(sslSocket, &QSslSocket::encrypted, this, [this, sslSocket](){ qCDebug(dcTcpSocketServer()) << "SSL encryption established for" << sslSocket; emit clientConnected(sslSocket); diff --git a/libnymea-remoteproxy/server/transportclient.cpp b/libnymea-remoteproxy/server/transportclient.cpp index 58ca3b3..9fd42f2 100644 --- a/libnymea-remoteproxy/server/transportclient.cpp +++ b/libnymea-remoteproxy/server/transportclient.cpp @@ -129,7 +129,7 @@ quint64 TransportClient::rxDataCount() const void TransportClient::addRxDataCount(int dataCount) { - m_rxDataCount += static_cast(dataCount); + m_rxDataCount += dataCount; } quint64 TransportClient::txDataCount() const @@ -139,7 +139,7 @@ quint64 TransportClient::txDataCount() const void TransportClient::addTxDataCount(int dataCount) { - m_txDataCount += static_cast(dataCount); + m_txDataCount += dataCount; } int TransportClient::bufferSize() const diff --git a/libnymea-remoteproxy/server/transportclient.h b/libnymea-remoteproxy/server/transportclient.h index caddee0..5426bfe 100644 --- a/libnymea-remoteproxy/server/transportclient.h +++ b/libnymea-remoteproxy/server/transportclient.h @@ -108,6 +108,7 @@ protected: // Json data information int m_messageId = 0; +private: // Statistics info quint64 m_rxDataCount = 0; quint64 m_txDataCount = 0; diff --git a/libnymea-remoteproxy/tunnelproxy/tunnelproxyclient.cpp b/libnymea-remoteproxy/tunnelproxy/tunnelproxyclient.cpp index 19dffcb..a9354c7 100644 --- a/libnymea-remoteproxy/tunnelproxy/tunnelproxyclient.cpp +++ b/libnymea-remoteproxy/tunnelproxy/tunnelproxyclient.cpp @@ -27,7 +27,6 @@ void TunnelProxyClient::setType(Type type) QList TunnelProxyClient::processData(const QByteArray &data) { - // TODO: unescape if this data is for the json handler QList packages; // Parse packages depending on the encoded diff --git a/libnymea-remoteproxyclient/tcpsocketconnection.cpp b/libnymea-remoteproxyclient/tcpsocketconnection.cpp index 180314a..e4fcd93 100644 --- a/libnymea-remoteproxyclient/tcpsocketconnection.cpp +++ b/libnymea-remoteproxyclient/tcpsocketconnection.cpp @@ -36,7 +36,6 @@ TcpSocketConnection::TcpSocketConnection(QObject *parent) : { m_tcpSocket = new QSslSocket(this); - QObject::connect(m_tcpSocket, &QSslSocket::connected, this, [=](){ qCDebug(dcRemoteProxyClientTcpSocket()) << "Connected!!!!"; }); QObject::connect(m_tcpSocket, &QSslSocket::disconnected, this, &TcpSocketConnection::onDisconnected); QObject::connect(m_tcpSocket, &QSslSocket::encrypted, this, &TcpSocketConnection::onEncrypted); QObject::connect(m_tcpSocket, &QSslSocket::readyRead, this, &TcpSocketConnection::onReadyRead); @@ -47,10 +46,6 @@ TcpSocketConnection::TcpSocketConnection(QObject *parent) : typedef void (QSslSocket:: *sslErrorsSignal)(const QList &); QObject::connect(m_tcpSocket, static_cast(&QSslSocket::sslErrors), this, &TcpSocketConnection::sslErrors); - - // QObject::connect(m_tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onError(QAbstractSocket::SocketError))); - // QObject::connect(m_tcpSocket, SIGNAL(sslErrors(QList)), this, SIGNAL(sslErrors(QList))); - } TcpSocketConnection::~TcpSocketConnection() diff --git a/libnymea-remoteproxyclient/tunnelproxy/tunnelproxysocket.h b/libnymea-remoteproxyclient/tunnelproxy/tunnelproxysocket.h index a518e65..58bc005 100644 --- a/libnymea-remoteproxyclient/tunnelproxy/tunnelproxysocket.h +++ b/libnymea-remoteproxyclient/tunnelproxy/tunnelproxysocket.h @@ -66,7 +66,7 @@ private: ProxyConnection *m_connection = nullptr; TunnelProxySocketServer *m_socketServer = nullptr; - bool m_connected = true; // Note: on creatrion, the socket is connected, otherwise it would not have been created + bool m_connected = true; // Note: on creation, the socket is connected, otherwise it would not have been created QString m_clientName; QUuid m_clientUuid; diff --git a/monitor/main.cpp b/monitor/main.cpp index 93a3d62..d2363ed 100644 --- a/monitor/main.cpp +++ b/monitor/main.cpp @@ -33,6 +33,7 @@ #include #include "monitor.h" +#include "../version.h" int main(int argc, char *argv[]) { diff --git a/nymea-remoteproxy.pri b/nymea-remoteproxy.pri index 7d85b99..be3350e 100644 --- a/nymea-remoteproxy.pri +++ b/nymea-remoteproxy.pri @@ -1,16 +1,6 @@ QT *= network websockets QT -= gui -# Define versions -SERVER_NAME=nymea-remoteproxy -API_VERSION_MAJOR=0 -API_VERSION_MINOR=5 -SERVER_VERSION=0.2.1 - -DEFINES += SERVER_NAME_STRING=\\\"$${SERVER_NAME}\\\" \ - SERVER_VERSION_STRING=\\\"$${SERVER_VERSION}\\\" \ - API_VERSION_STRING=\\\"$${API_VERSION_MAJOR}.$${API_VERSION_MINOR}\\\" - CONFIG += c++11 console QMAKE_CXXFLAGS *= -Werror -std=c++11 -g -Wno-deprecated-declarations diff --git a/nymea-remoteproxy.pro b/nymea-remoteproxy.pro index 96929c3..6a2cbed 100644 --- a/nymea-remoteproxy.pro +++ b/nymea-remoteproxy.pro @@ -1,5 +1,15 @@ include(nymea-remoteproxy.pri) +# Define versions +SERVER_NAME=nymea-remoteproxy +API_VERSION_MAJOR=0 +API_VERSION_MINOR=5 + +# Parse and export SERVER_VERSION +SERVER_VERSION=$$system('dpkg-parsechangelog | sed -n -e "s/^Version: //p"') + +QMAKE_SUBSTITUTES += version.h.in + TEMPLATE=subdirs SUBDIRS += server client tunnelclient libnymea-remoteproxy libnymea-remoteproxyclient diff --git a/server/main.cpp b/server/main.cpp index dd6258b..17eba19 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -51,6 +51,8 @@ #include "authentication/aws/awsauthenticator.h" #include "authentication/dummy/dummyauthenticator.h" +#include "../version.h" + using namespace remoteproxy; static QHash s_loggingFilters; @@ -65,7 +67,7 @@ static const char *const error = "\e[31m"; static void consoleLogHandler(QtMsgType type, const QMessageLogContext& context, const QString& message) { QString messageString; - QString timeString = QDateTime::currentDateTimeUtc().toString("yyyy.MM.dd hh:mm:ss.zzz"); + QString timeString = QDateTime::currentDateTime().toString("yyyy.MM.dd hh:mm:ss.zzz"); switch (type) { case QtInfoMsg: messageString = QString(" I %1 | %2: %3").arg(timeString).arg(context.category).arg(message); diff --git a/tests/test-proxy/remoteproxytestsproxy.cpp b/tests/test-proxy/remoteproxytestsproxy.cpp index 5e5649f..435595c 100644 --- a/tests/test-proxy/remoteproxytestsproxy.cpp +++ b/tests/test-proxy/remoteproxytestsproxy.cpp @@ -30,6 +30,7 @@ #include "engine.h" #include "loggingcategories.h" #include "remoteproxyconnection.h" +#include "../../version.h" #include #include diff --git a/tests/test-tunnelproxy/remoteproxyteststunnelproxy.cpp b/tests/test-tunnelproxy/remoteproxyteststunnelproxy.cpp index e14655f..f714f38 100644 --- a/tests/test-tunnelproxy/remoteproxyteststunnelproxy.cpp +++ b/tests/test-tunnelproxy/remoteproxyteststunnelproxy.cpp @@ -31,6 +31,7 @@ #include "loggingcategories.h" #include "remoteproxyconnection.h" #include "../common/slipdataprocessor.h" +#include "../../version.h" // Client #include "tunnelproxy/tunnelproxysocketserver.h" diff --git a/tunnelclient/main.cpp b/tunnelclient/main.cpp index 55d4698..fab5f3d 100644 --- a/tunnelclient/main.cpp +++ b/tunnelclient/main.cpp @@ -36,6 +36,8 @@ #include "serverconnection.h" #include "clientconnection.h" +#include "../version.h" + static QHash s_loggingFilters; static const char *const normal = "\033[0m"; static const char *const warning = "\e[33m"; diff --git a/version.h.in b/version.h.in new file mode 100644 index 0000000..12f50bd --- /dev/null +++ b/version.h.in @@ -0,0 +1,38 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2022, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea. +* This project including source code and documentation is protected by +* copyright law, and remains the property of nymea GmbH. All rights, including +* reproduction, publication, editing and translation, are reserved. The use of +* this project is subject to the terms of a license agreement to be concluded +* with nymea GmbH in accordance with the terms of use of nymea GmbH, available +* under https://nymea.io/license +* +* GNU General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the +* terms of the GNU General Public License as published by the Free Software +* Foundation, GNU version 3. This project is distributed in the hope that it +* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +* Public License for more details. +* +* You should have received a copy of the GNU General Public License along with +* this project. If not, see . +* +* For any further details and any questions please contact us under +* contact@nymea.io or see our FAQ/Licensing Information on +* https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef VERSION_H +#define VERSION_H + +#define SERVER_NAME_STRING '"$$SERVER_NAME"' +#define SERVER_VERSION_STRING '"$$SERVER_VERSION"' +#define API_VERSION_STRING '"$$API_VERSION_MAJOR.$$API_VERSION_MINOR"' + +#endif