summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew O'Doherty <andrew.odoherty@qt.io>2018-09-17 15:03:57 +0200
committerKarsten Heimrich <karsten.heimrich@qt.io>2018-09-18 08:59:38 +0000
commit750f0a2963f701c6984a073212080513e5c15e1e (patch)
treea20cd7cd600a65ef96653d9218ac21fb70a94e9d
parent922468345956605f66381f3fd2b3e92f2b8c47dd (diff)
Rename QKnxNetIpRoutingInterface class to QKnxNetIpRouter
Change-Id: I2641205492b5603c5229f0eebb4d582cf2c5ab78 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
-rw-r--r--examples/knx/router/main.cpp38
-rw-r--r--src/knx/netip/netip.pri10
-rw-r--r--src/knx/netip/qknxnetiprouter.cpp (renamed from src/knx/netip/qknxnetiproutinginterface.cpp)193
-rw-r--r--src/knx/netip/qknxnetiprouter.h (renamed from src/knx/netip/qknxnetiproutinginterface.h)26
-rw-r--r--src/knx/netip/qknxnetiprouter_p.cpp (renamed from src/knx/netip/qknxnetiproutinginterface_p.cpp)130
-rw-r--r--src/knx/netip/qknxnetiprouter_p.h (renamed from src/knx/netip/qknxnetiproutinginterface_p.h)30
-rw-r--r--src/knx/netip/qknxnetiptestrouter_p.h (renamed from src/knx/netip/qknxtestingrouter_p.h)41
-rw-r--r--src/knx/netip/qknxtestingrouter_p.cpp67
-rw-r--r--tests/auto/auto.pro2
-rw-r--r--tests/auto/qknxnetiprouter/qknxnetiprouter.pro (renamed from tests/auto/qknxnetiproutinginterface/qknxnetiproutinginterface.pro)2
-rw-r--r--tests/auto/qknxnetiprouter/tst_qknxnetiprouter.cpp (renamed from tests/auto/qknxnetiproutinginterface/tst_qknxnetiproutinginterface.cpp)184
11 files changed, 339 insertions, 384 deletions
diff --git a/examples/knx/router/main.cpp b/examples/knx/router/main.cpp
index 1c5a21e..8c921bb 100644
--- a/examples/knx/router/main.cpp
+++ b/examples/knx/router/main.cpp
@@ -53,9 +53,9 @@
#include <QtCore/qdebug.h>
#include <QtCore/qdatetime.h>
-#include <QtKnx/qknxnetiproutinginterface.h>
+#include <QtKnx/qknxnetiprouter.h>
#include <QtKnx/qknxlinklayerframebuilder.h>
-#include <QtKnx/qknxnetiproutinginterface.h>
+#include <QtKnx/qknxnetiprouter.h>
#include <QtKnx/qknxnetiproutingbusy.h>
#include <QtKnx/qknxnetiproutingindication.h>
#include <QtKnx/qknxnetiproutinglostmessage.h>
@@ -74,11 +74,11 @@
# include <unistd.h>
#endif
-void startRouter(QKnxNetIpRoutingInterface &router, const QCommandLineParser &cliParser)
+void startRouter(QKnxNetIpRouter &router, const QCommandLineParser &cliParser)
{
router.start();
- if (router.error() != QKnxNetIpRoutingInterface::Error::None)
+ if (router.error() != QKnxNetIpRouter::Error::None)
return;
qInfo().noquote() << "Network interface used: "
@@ -102,7 +102,7 @@ void startRouter(QKnxNetIpRoutingInterface &router, const QCommandLineParser &cl
}
}
-void setupRouterCLI(QKnxNetIpRoutingInterface &router,
+void setupRouterCLI(QKnxNetIpRouter &router,
const QCommandLineParser &cliParser,
QTextStream & input,
#ifdef Q_OS_WIN
@@ -144,36 +144,36 @@ void setupRouterCLI(QKnxNetIpRoutingInterface &router,
});
}
-void setupRouterSignalHandlers(QKnxNetIpRoutingInterface &router, const QNetworkInterface &iface,
+void setupRouterSignalHandlers(QKnxNetIpRouter &router, const QNetworkInterface &iface,
const QHostAddress &multicastAddress)
{
router.setInterfaceAffinity(iface);
Q_ASSERT(router.interfaceAffinity().index() == iface.index());
router.setMulticastAddress(multicastAddress);
- QObject::connect(&router, &QKnxNetIpRoutingInterface::stateChanged,
- [&](QKnxNetIpRoutingInterface::State state) {
- if (state == QKnxNetIpRoutingInterface::State::Routing)
+ QObject::connect(&router, &QKnxNetIpRouter::stateChanged,
+ [&](QKnxNetIpRouter::State state) {
+ if (state == QKnxNetIpRouter::State::Routing)
qInfo().noquote() << QTime::currentTime().toString()
<< ": Router is in Routing state.";
- else if (state == QKnxNetIpRoutingInterface::State::Failure)
+ else if (state == QKnxNetIpRouter::State::Failure)
qInfo().noquote() << QTime::currentTime().toString()
<< ": Error: " << router.errorString();
- else if (state == QKnxNetIpRoutingInterface::State::NeighborBusy)
+ else if (state == QKnxNetIpRouter::State::NeighborBusy)
qInfo().noquote() << QTime::currentTime().toString()
<< ": Neighbor router is busy. Busy timer started";
- else if (state == QKnxNetIpRoutingInterface::State::Stop)
+ else if (state == QKnxNetIpRouter::State::Stop)
QCoreApplication::quit();
});
- QObject::connect(&router, &QKnxNetIpRoutingInterface::routingIndicationReceived,
+ QObject::connect(&router, &QKnxNetIpRouter::routingIndicationReceived,
[](QKnxNetIpFrame frame) {
QKnxNetIpRoutingIndicationProxy indication(frame);
qInfo().noquote() << "Received routing indication"
<< indication.isValid();
});
- QObject::connect(&router, &QKnxNetIpRoutingInterface::routingBusyReceived,
+ QObject::connect(&router, &QKnxNetIpRouter::routingBusyReceived,
[](QKnxNetIpFrame frame) {
QKnxNetIpRoutingBusyProxy busy(frame);
qInfo().noquote() << "Received routing busy, wait time: "
@@ -181,26 +181,26 @@ void setupRouterSignalHandlers(QKnxNetIpRoutingInterface &router, const QNetwork
<< busy.routingBusyControl();
});
- QObject::connect(&router, &QKnxNetIpRoutingInterface::routingLostCountReceived,
+ QObject::connect(&router, &QKnxNetIpRouter::routingLostCountReceived,
[](QKnxNetIpFrame frame) {
QKnxNetIpRoutingLostMessageProxy lost(frame);
qInfo().noquote() << "Received routing lost count"
<< lost.deviceState();
});
- QObject::connect(&router, &QKnxNetIpRoutingInterface::routingIndicationSent,
+ QObject::connect(&router, &QKnxNetIpRouter::routingIndicationSent,
[](QKnxNetIpFrame frame) {
qInfo().noquote() << "Sent routing indication";
Q_UNUSED(frame);
});
- QObject::connect(&router, &QKnxNetIpRoutingInterface::routingBusySent,
+ QObject::connect(&router, &QKnxNetIpRouter::routingBusySent,
[](QKnxNetIpFrame frame) {
qInfo().noquote() << "Sent routing busy";
Q_UNUSED(frame);
});
- QObject::connect(&router, &QKnxNetIpRoutingInterface::routingLostCountSent,
+ QObject::connect(&router, &QKnxNetIpRouter::routingLostCountSent,
[](QKnxNetIpFrame frame) {
qInfo().noquote() << "Sent routing lost count";
Q_UNUSED(frame);
@@ -262,7 +262,7 @@ int main(int argc, char *argv[])
cliParser.showHelp();
}
- QKnxNetIpRoutingInterface router;
+ QKnxNetIpRouter router;
setupRouterSignalHandlers(router, iface, multicastAddress);
QTextStream input(stdin, QIODevice::ReadOnly);
diff --git a/src/knx/netip/netip.pri b/src/knx/netip/netip.pri
index 6f566e6..5652563 100644
--- a/src/knx/netip/netip.pri
+++ b/src/knx/netip/netip.pri
@@ -53,7 +53,7 @@ PUBLIC_HEADERS += $$PWD/qknxnetip.h \
$$PWD/qknxnetipsessionstatus.h \
$$PWD/qknxnetiptimernotify.h \
$$PWD/qknxnetipsecurewrapper.h \
- $$PWD/qknxnetiproutinginterface.h
+ $$PWD/qknxnetiprouter.h
PRIVATE_HEADERS += \
$$PWD/qknxbuilderdata_p.h \
@@ -61,8 +61,7 @@ PRIVATE_HEADERS += \
$$PWD/qknxnetipserverdescriptionagent_p.h \
$$PWD/qknxnetipserverdiscoveryagent_p.h \
$$PWD/qknxnetipserverinfo_p.h \
- $$PWD/qknxnetiproutinginterface_p.h \
- $$PWD/qknxtestingrouter_p.h
+ $$PWD/qknxnetiptestrouter_p.h
SOURCES += $$PWD/qknxnetip.cpp \
$$PWD/qknxnetipconfigdib.cpp \
@@ -117,6 +116,5 @@ SOURCES += $$PWD/qknxnetip.cpp \
$$PWD/qknxnetipsessionstatus.cpp \
$$PWD/qknxnetiptimernotify.cpp \
$$PWD/qknxnetipsecurewrapper.cpp \
- $$PWD/qknxnetiproutinginterface_p.cpp \
- $$PWD/qknxnetiproutinginterface.cpp \
- $$PWD/qknxtestingrouter_p.cpp
+ $$PWD/qknxnetiprouter.cpp \
+ $$PWD/qknxnetiprouter_p.cpp
diff --git a/src/knx/netip/qknxnetiproutinginterface.cpp b/src/knx/netip/qknxnetiprouter.cpp
index 5fe1251..4a64d51 100644
--- a/src/knx/netip/qknxnetiproutinginterface.cpp
+++ b/src/knx/netip/qknxnetiprouter.cpp
@@ -27,8 +27,8 @@
**
******************************************************************************/
-#include "qknxnetiproutinginterface.h"
-#include "qknxnetiproutinginterface_p.h"
+#include "qknxnetiprouter.h"
+#include "qknxnetiprouter_p.h"
#include "qknxnetip.h"
#include "qknxnetipframe.h"
#include "qknxnetiproutingbusy.h"
@@ -43,14 +43,14 @@
QT_BEGIN_NAMESPACE
/*!
- \class QKnxNetIpRoutingInterface
+ \class QKnxNetIpRouter
\inmodule QtKnx
\ingroup qtknx-routing
\ingroup qtknx-netip
\since 5.12
- \brief The QKnxNetIpRoutingInterface class enables sending and receiving
+ \brief The QKnxNetIpRouter class enables sending and receiving
routing KNXnet/IP packets to and from other KNXnet/IP routers.
KNXnet/IP routing is defined as a set of KNXnet/IP routers communicating
@@ -63,15 +63,15 @@ QT_BEGIN_NAMESPACE
backbone that connects KNX subnets and is a high-speed replacement for
the KNX backbone.
- The QKnxNetIpRoutingInterface is bound to a physical network interface
+ The QKnxNetIpRouter is bound to a physical network interface
which is used for transmitting and receiving the routing frames. It also
requires the multicast address used by the KNX installation.
The following code sample illustrates how to use the
- QKnxNetIpRoutingInterface to send and receive KNXnet/IP frames:
+ QKnxNetIpRouter to send and receive KNXnet/IP frames:
\code
- QKnxNetIpRoutingInterface router;
+ QKnxNetIpRouter router;
router.setInterfaceAffinity(QNetworkInterface::interfaceFromName("eth0"));
router.setMulticastAddress(QHostAddress("224.0.23.32"));
router.start();
@@ -89,7 +89,7 @@ QT_BEGIN_NAMESPACE
// Processing routing indications received
QObject::connect(&router,
- &QKnxNetIpRoutingInterface::routingIndicationReceived,
+ &QKnxNetIpRouter::routingIndicationReceived,
[](QKnxNetIpFrame frame) {
QKnxNetIpRoutingIndicationProxy indication(frame);
qInfo().noquote() << "Received routing indication:"
@@ -102,16 +102,19 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \typedef QKnxNetIpRoutingInterface::FilterTable
+ \typedef QKnxNetIpRouter::FilterTable
- A synonym for QKnxNetIpRoutingInterface::QSet<QKnxAddress> which is the
- type used to store the filter table of the routing interface.
+ A synonym for QKnxNetIpRouter::QSet<QKnxAddress> which is the type used
+ to store the filter table of the router. The filter table is interpreted
+ as whitelist by the routing algorithm. The addresses stored are allowed
+ to be routed. Any frame which has a destination address that is not contained
+ in the table is blocked.
*/
/*!
- \enum QKnxNetIpRoutingInterface::State
+ \enum QKnxNetIpRouter::State
- This enum holds the state of the QKnxNetIpRoutingInterface.
+ This enum holds the state of the QKnxNetIpRouter.
\value NotInit
Router not started yet.
@@ -120,7 +123,7 @@ QT_BEGIN_NAMESPACE
for sending.
\value NeighborBusy
A KNX router in the same network sent a busy message or the
- QKnxNetIpRoutingInterface itself detected a busy situation.
+ QKnxNetIpRouter itself detected a busy situation.
\value Stop
Router has been explicitly stopped by the user.
\value Failure
@@ -128,9 +131,9 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \enum QKnxNetIpRoutingInterface::Error
+ \enum QKnxNetIpRouter::Error
- This enum holds the state of the QKnxNetIpRoutingInterface.
+ This enum holds the state of the QKnxNetIpRouter.
\value None
No errors.
@@ -141,7 +144,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \enum QKnxNetIpRoutingInterface::FilterAction
+ \enum QKnxNetIpRouter::FilterAction
This enum holds the possible courses of action of a router in response to a
received layer service data unit (LSDU). An LSDU is a type of frame used by
@@ -172,7 +175,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \enum QKnxNetIpRoutingInterface::RoutingMode
+ \enum QKnxNetIpRouter::RoutingMode
This enum holds the possible parameterization actions that a router shall
apply on telegrams of a point-to-multipoint connectionless communication
@@ -188,109 +191,109 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QKnxNetIpRoutingInterface::routingIndicationReceived(QKnxNetIpFrame frame, QKnxNetIpRoutingInterface::FilterAction routingAction)
+ \fn void QKnxNetIpRouter::routingIndicationReceived(QKnxNetIpFrame frame, QKnxNetIpRouter::FilterAction routingAction)
This signal is emitted when the KNXnet/IP router receives a routing indication
\a frame and specifies the action \a routingAction to be applied by the router.
*/
/*!
- \fn void QKnxNetIpRoutingInterface::routingBusyReceived(QKnxNetIpFrame frame)
+ \fn void QKnxNetIpRouter::routingBusyReceived(QKnxNetIpFrame frame)
This signal is emitted when the KNXnet/IP router receives a routing busy
\a frame.
*/
/*!
- \fn void QKnxNetIpRoutingInterface::routingLostCountReceived(QKnxNetIpFrame frame)
+ \fn void QKnxNetIpRouter::routingLostCountReceived(QKnxNetIpFrame frame)
This signal is emitted when the KNXnet/IP router receives a routing lost
count message held in \a frame.
*/
/*!
- \fn void QKnxNetIpRoutingInterface::routingIndicationSent(QKnxNetIpFrame frame)
+ \fn void QKnxNetIpRouter::routingIndicationSent(QKnxNetIpFrame frame)
This signal is emitted when the KNXnet/IP router has finished sending the
routing indication \a frame.
*/
/*!
- \fn void QKnxNetIpRoutingInterface::routingBusySent(QKnxNetIpFrame frame)
+ \fn void QKnxNetIpRouter::routingBusySent(QKnxNetIpFrame frame)
This signal is emitted when the KNXnet/IP router has finished sending the
routing busy \a frame.
*/
/*!
- \fn void QKnxNetIpRoutingInterface::routingLostCountSent(QKnxNetIpFrame frame)
+ \fn void QKnxNetIpRouter::routingLostCountSent(QKnxNetIpFrame frame)
This signal is emitted when the KNXnet/IP router has finished sending the
routing lost count \a frame.
*/
/*!
- \fn void QKnxNetIpRoutingInterface::routingSystemBroadcastSent(QKnxNetIpFrame frame)
+ \fn void QKnxNetIpRouter::routingSystemBroadcastSent(QKnxNetIpFrame frame)
This signal is emitted when the KNXnet/IP router has finished sending the
routing system broadcast \a frame.
*/
/*!
- \fn void QKnxNetIpRoutingInterface::routingSystemBroadcastReceived(QKnxNetIpFrame frame)
+ \fn void QKnxNetIpRouter::routingSystemBroadcastReceived(QKnxNetIpFrame frame)
This signal is emitted when the KNXnet/IP router receives the routing system
broadcast \a frame.
*/
/*!
- \fn void QKnxNetIpRoutingInterface::stateChanged(QKnxNetIpRoutingInterface::State state)
+ \fn void QKnxNetIpRouter::stateChanged(QKnxNetIpRouter::State state)
This signal is emitted when the KNXnet/IP router transitions to a different
\a state.
*/
/*!
- \fn void QKnxNetIpRoutingInterface::errorOccurred(QKnxNetIpRoutingInterface::Error error, QString errorString)
+ \fn void QKnxNetIpRouter::errorOccurred(QKnxNetIpRouter::Error error, QString errorString)
This signal is emitted when the KNXnet/IP router encounters the error \a
error that is described by \a errorString.
*/
/*!
- Returns the current state of the KNX routing interface.
+ Returns the current state of the KNX router.
*/
-QKnxNetIpRoutingInterface::State QKnxNetIpRoutingInterface::state() const
+QKnxNetIpRouter::State QKnxNetIpRouter::state() const
{
- Q_D(const QKnxNetIpRoutingInterface);
+ Q_D(const QKnxNetIpRouter);
return d->m_state;
}
/*!
Returns a QString describing the latest known error that occurred in the
- KNX routing interface.
+ KNX router.
*/
-QString QKnxNetIpRoutingInterface::errorString() const
+QString QKnxNetIpRouter::errorString() const
{
- Q_D(const QKnxNetIpRoutingInterface);
+ Q_D(const QKnxNetIpRouter);
return d->m_errorMessage;
}
/*!
Returns the filter table used by the routing algorithm.
*/
-QKnxNetIpRoutingInterface::FilterTable QKnxNetIpRoutingInterface::filterTable() const
+QKnxNetIpRouter::FilterTable QKnxNetIpRouter::filterTable() const
{
- Q_D(const QKnxNetIpRoutingInterface);
+ Q_D(const QKnxNetIpRouter);
return d->m_filterTable;
}
/*!
Sets the filter table used by the routing algorithm to \a table.
*/
-void QKnxNetIpRoutingInterface::setFilterTable(const QKnxNetIpRoutingInterface::FilterTable &table)
+void QKnxNetIpRouter::setFilterTable(const QKnxNetIpRouter::FilterTable &table)
{
- Q_D(QKnxNetIpRoutingInterface);
+ Q_D(QKnxNetIpRouter);
d->m_filterTable = table;
d->m_routingMode = RoutingMode::Filter;
}
@@ -298,54 +301,54 @@ void QKnxNetIpRoutingInterface::setFilterTable(const QKnxNetIpRoutingInterface::
/*!
Returns the routing mode.
*/
-QKnxNetIpRoutingInterface::RoutingMode QKnxNetIpRoutingInterface::routingMode() const
+QKnxNetIpRouter::RoutingMode QKnxNetIpRouter::routingMode() const
{
- Q_D(const QKnxNetIpRoutingInterface);
+ Q_D(const QKnxNetIpRouter);
return d->m_routingMode;
}
/*!
- Sets the interface routing mode to \a mode.
+ Sets the routing mode to \a mode.
*/
-void QKnxNetIpRoutingInterface::setRoutingMode(QKnxNetIpRoutingInterface::RoutingMode mode)
+void QKnxNetIpRouter::setRoutingMode(QKnxNetIpRouter::RoutingMode mode)
{
- Q_D(QKnxNetIpRoutingInterface);
+ Q_D(QKnxNetIpRouter);
d->m_routingMode = mode;
}
/*!
- Returns an error code that describes the last error that occurred in the
- KNX routing interface.
+ Returns an routing error code that describing the last error occurred in the
+ KNX router.
*/
-QKnxNetIpRoutingInterface::Error QKnxNetIpRoutingInterface::error() const
+QKnxNetIpRouter::Error QKnxNetIpRouter::error() const
{
- Q_D(const QKnxNetIpRoutingInterface);
+ Q_D(const QKnxNetIpRouter);
return d->m_error;
}
/*!
- Constructs a KNXnet/IP routing interface with the parent \a parent.
+ Constructs a KNXnet/IP router with the parent \a parent.
*/
-QKnxNetIpRoutingInterface::QKnxNetIpRoutingInterface(QObject *parent)
- : QObject(*new QKnxNetIpRoutingInterfacePrivate, parent)
+QKnxNetIpRouter::QKnxNetIpRouter(QObject *parent)
+ : QObject(*new QKnxNetIpRouterPrivate, parent)
{}
/*!
Returns the current network interface used by this KNX routing instance.
*/
-QNetworkInterface QKnxNetIpRoutingInterface::interfaceAffinity() const
+QNetworkInterface QKnxNetIpRouter::interfaceAffinity() const
{
- Q_D(const QKnxNetIpRoutingInterface);
+ Q_D(const QKnxNetIpRouter);
return d->m_iface;
}
/*!
Searches for the network interface that is bound to \a address that the
- QKnxNetIpRoutingInterface instance shall use.
+ QKnxNetIpRouter instance shall use.
*/
-void QKnxNetIpRoutingInterface::setInterfaceAffinity(const QHostAddress &address)
+void QKnxNetIpRouter::setInterfaceAffinity(const QHostAddress &address)
{
- Q_D(QKnxNetIpRoutingInterface);
+ Q_D(QKnxNetIpRouter);
const auto interfaces = QNetworkInterface::allInterfaces();
for (const auto &iface : interfaces) {
@@ -372,9 +375,9 @@ void QKnxNetIpRoutingInterface::setInterfaceAffinity(const QHostAddress &address
Sets the network interface \a iface that the QNetworkInterface instance
shall use.
*/
-void QKnxNetIpRoutingInterface::setInterfaceAffinity(const QNetworkInterface &iface)
+void QKnxNetIpRouter::setInterfaceAffinity(const QNetworkInterface &iface)
{
- Q_D(QKnxNetIpRoutingInterface);
+ Q_D(QKnxNetIpRouter);
if (iface.flags().testFlag(QNetworkInterface::IsRunning))
d->m_iface = iface;
else
@@ -382,20 +385,20 @@ void QKnxNetIpRoutingInterface::setInterfaceAffinity(const QNetworkInterface &if
}
/*!
- Returns the multicast address used by the QKnxNetIpRoutingInterface.
+ Returns the multicast address used by the QKnxNetIpRouter.
*/
-QHostAddress QKnxNetIpRoutingInterface::multicastAddress() const
+QHostAddress QKnxNetIpRouter::multicastAddress() const
{
- Q_D(const QKnxNetIpRoutingInterface);
+ Q_D(const QKnxNetIpRouter);
return d->m_multicastAddress;
}
/*!
Sets the multicast address to \a address.
*/
-void QKnxNetIpRoutingInterface::setMulticastAddress(const QHostAddress &address)
+void QKnxNetIpRouter::setMulticastAddress(const QHostAddress &address)
{
- Q_D(QKnxNetIpRoutingInterface);
+ Q_D(QKnxNetIpRouter);
auto isIPv4 = false;
address.toIPv4Address(&isIPv4);
@@ -408,20 +411,20 @@ void QKnxNetIpRoutingInterface::setMulticastAddress(const QHostAddress &address)
/*!
Returns the routing interface's individual address.
*/
-QKnxAddress QKnxNetIpRoutingInterface::individualAddress() const
+QKnxAddress QKnxNetIpRouter::individualAddress() const
{
- Q_D(const QKnxNetIpRoutingInterface);
+ Q_D(const QKnxNetIpRouter);
return d->m_individualAddress;
}
/*!
Sets the routing interface's individual address to \a address.
*/
-void QKnxNetIpRoutingInterface::setIndividualAddress(const QKnxAddress &address)
+void QKnxNetIpRouter::setIndividualAddress(const QKnxAddress &address)
{
- Q_D(QKnxNetIpRoutingInterface);
+ Q_D(QKnxNetIpRouter);
if (!address.isCouplerOrRouter()) {
- d->errorOccurred(QKnxNetIpRoutingInterface::Error::KnxRouting, tr("Could not set "
+ d->errorOccurred(QKnxNetIpRouter::Error::KnxRouting, tr("Could not set "
"individual address."));
} else {
d->m_individualAddress = address;
@@ -430,13 +433,13 @@ void QKnxNetIpRoutingInterface::setIndividualAddress(const QKnxAddress &address)
/*!
Multicasts the routing indication \a frame through the network interface
- associated with the QKnxNetIpRoutingInterface.
+ associated with the QKnxNetIpRouter.
*/
-void QKnxNetIpRoutingInterface::sendRoutingIndication(const QKnxNetIpFrame &frame)
+void QKnxNetIpRouter::sendRoutingIndication(const QKnxNetIpFrame &frame)
{
- Q_D(QKnxNetIpRoutingInterface);
+ Q_D(QKnxNetIpRouter);
- if (d->m_state != QKnxNetIpRoutingInterface::State::Routing)
+ if (d->m_state != QKnxNetIpRouter::State::Routing)
return;
QKnxNetIpRoutingIndicationProxy indication(frame);
@@ -444,7 +447,7 @@ void QKnxNetIpRoutingInterface::sendRoutingIndication(const QKnxNetIpFrame &fram
return;
if (!d->sendFrame(frame)) {
- d->errorOccurred(QKnxNetIpRoutingInterface::Error::KnxRouting, tr("Could not send routing "
+ d->errorOccurred(QKnxNetIpRouter::Error::KnxRouting, tr("Could not send routing "
"indication."));
} else {
emit routingIndicationSent(frame);
@@ -453,9 +456,9 @@ void QKnxNetIpRoutingInterface::sendRoutingIndication(const QKnxNetIpFrame &fram
/*!
Multicasts the routing indication \a linkFrame through the network interface
- associated with the QKnxNetIpRoutingInterface.
+ associated with the QKnxNetIpRouter.
*/
-void QKnxNetIpRoutingInterface::sendRoutingIndication(const QKnxLinkLayerFrame &linkFrame)
+void QKnxNetIpRouter::sendRoutingIndication(const QKnxLinkLayerFrame &linkFrame)
{
auto netIpFrame = QKnxNetIpRoutingIndicationProxy::builder()
.setCemi(linkFrame)
@@ -465,13 +468,13 @@ void QKnxNetIpRoutingInterface::sendRoutingIndication(const QKnxLinkLayerFrame &
/*!
Multicasts the routing busy message containing \a frame through the
- network interface associated with the QKnxNetIpRoutingInterface.
+ network interface associated with the QKnxNetIpRouter.
*/
-void QKnxNetIpRoutingInterface::sendRoutingBusy(const QKnxNetIpFrame &frame)
+void QKnxNetIpRouter::sendRoutingBusy(const QKnxNetIpFrame &frame)
{
- Q_D(QKnxNetIpRoutingInterface);
+ Q_D(QKnxNetIpRouter);
- if (d->m_state != QKnxNetIpRoutingInterface::State::Routing)
+ if (d->m_state != QKnxNetIpRouter::State::Routing)
return;
QKnxNetIpRoutingBusyProxy routingBusy(frame);
@@ -479,7 +482,7 @@ void QKnxNetIpRoutingInterface::sendRoutingBusy(const QKnxNetIpFrame &frame)
return;
if (!d->sendFrame(frame)) {
- d->errorOccurred(QKnxNetIpRoutingInterface::Error::KnxRouting, tr("Could not send routing "
+ d->errorOccurred(QKnxNetIpRouter::Error::KnxRouting, tr("Could not send routing "
"busy."));
} else {
emit routingBusySent(frame);
@@ -488,13 +491,13 @@ void QKnxNetIpRoutingInterface::sendRoutingBusy(const QKnxNetIpFrame &frame)
/*!
Multicasts the routing lost message \a frame through the network interface
- associated with the QKnxNetIpRoutingInterface.
+ associated with the QKnxNetIpRouter.
*/
-void QKnxNetIpRoutingInterface::sendRoutingLostMessage(const QKnxNetIpFrame &frame)
+void QKnxNetIpRouter::sendRoutingLostMessage(const QKnxNetIpFrame &frame)
{
- Q_D(QKnxNetIpRoutingInterface);
+ Q_D(QKnxNetIpRouter);
- if (d->m_state != QKnxNetIpRoutingInterface::State::Routing)
+ if (d->m_state != QKnxNetIpRouter::State::Routing)
return;
QKnxNetIpRoutingLostMessageProxy lostMessageFrame(frame);
@@ -502,7 +505,7 @@ void QKnxNetIpRoutingInterface::sendRoutingLostMessage(const QKnxNetIpFrame &fra
return;
if (!d->sendFrame(frame)) {
- d->errorOccurred(QKnxNetIpRoutingInterface::Error::KnxRouting, tr("Could not send routing "
+ d->errorOccurred(QKnxNetIpRouter::Error::KnxRouting, tr("Could not send routing "
"lost count."));
} else {
emit routingLostCountSent(frame);
@@ -511,11 +514,11 @@ void QKnxNetIpRoutingInterface::sendRoutingLostMessage(const QKnxNetIpFrame &fra
/*!
Multicasts the routing system broadcast \a linkFrame through the network
- interface associated with the QKnxNetIpRoutingInterface.
+ interface associated with the QKnxNetIpRouter.
*/
-void QKnxNetIpRoutingInterface::sendRoutingSystemBroadcast(const QKnxLinkLayerFrame &linkFrame)
+void QKnxNetIpRouter::sendRoutingSystemBroadcast(const QKnxLinkLayerFrame &linkFrame)
{
- Q_D(QKnxNetIpRoutingInterface);
+ Q_D(QKnxNetIpRouter);
auto netipFrame = QKnxNetIpRoutingSystemBroadcastProxy::builder()
.setCemi(linkFrame)
@@ -526,7 +529,7 @@ void QKnxNetIpRoutingInterface::sendRoutingSystemBroadcast(const QKnxLinkLayerFr
return;
if (!d->sendFrame(netipFrame)) {
- d->errorOccurred(QKnxNetIpRoutingInterface::Error::KnxRouting, tr("Could not send routing "
+ d->errorOccurred(QKnxNetIpRouter::Error::KnxRouting, tr("Could not send routing "
"system broadcast."));
} else {
emit routingSystemBroadcastSent(netipFrame);
@@ -534,12 +537,12 @@ void QKnxNetIpRoutingInterface::sendRoutingSystemBroadcast(const QKnxLinkLayerFr
}
/*!
- Signals the QKnxNetIpRoutingInterface to start listening for messages
+ Signals the QKnxNetIpRouter to start listening for messages
received and accept sending messages.
*/
-void QKnxNetIpRoutingInterface::start()
+void QKnxNetIpRouter::start()
{
- Q_D(QKnxNetIpRoutingInterface);
+ Q_D(QKnxNetIpRouter);
if (d->m_state == State::NotInit)
d->start();
else if (d->m_state == State::Failure || d->m_state == State::Stop)
@@ -547,14 +550,14 @@ void QKnxNetIpRoutingInterface::start()
}
/*!
- Stops the QKnxNetIpRoutingInterface. No messages can be received and/or
+ Stops the QKnxNetIpRouter. No messages can be received and/or
sent to the network.
*/
-void QKnxNetIpRoutingInterface::stop()
+void QKnxNetIpRouter::stop()
{
- Q_D(QKnxNetIpRoutingInterface);
+ Q_D(QKnxNetIpRouter);
d->stop();
- d->changeState(QKnxNetIpRoutingInterface::State::Stop);
+ d->changeState(QKnxNetIpRouter::State::Stop);
}
QT_END_NAMESPACE
diff --git a/src/knx/netip/qknxnetiproutinginterface.h b/src/knx/netip/qknxnetiprouter.h
index dc88aba..04d9660 100644
--- a/src/knx/netip/qknxnetiproutinginterface.h
+++ b/src/knx/netip/qknxnetiprouter.h
@@ -27,8 +27,8 @@
**
******************************************************************************/
-#ifndef QKNXNETIPROUTINGINTERFACE_H
-#define QKNXNETIPROUTINGINTERFACE_H
+#ifndef QKNXNETIPROUTER_H
+#define QKNXNETIPROUTER_H
#include <QtKnx/qknxaddress.h>
#include <QtKnx/qknxnetipframe.h>
@@ -41,12 +41,12 @@
QT_BEGIN_NAMESPACE
-class QKnxNetIpRoutingInterfacePrivate;
-class Q_KNX_EXPORT QKnxNetIpRoutingInterface : public QObject
+class QKnxNetIpRouterPrivate;
+class Q_KNX_EXPORT QKnxNetIpRouter : public QObject
{
Q_OBJECT
- Q_DISABLE_COPY(QKnxNetIpRoutingInterface)
- Q_DECLARE_PRIVATE(QKnxNetIpRoutingInterface)
+ Q_DISABLE_COPY(QKnxNetIpRouter)
+ Q_DECLARE_PRIVATE(QKnxNetIpRouter)
public:
using FilterTable = QSet<QKnxAddress>;
@@ -60,7 +60,7 @@ public:
Failure
};
Q_ENUM(State)
- QKnxNetIpRoutingInterface::State state() const;
+ QKnxNetIpRouter::State state() const;
enum class Error : quint8
{
@@ -71,7 +71,7 @@ public:
Q_ENUM(Error)
QString errorString() const;
- QKnxNetIpRoutingInterface::Error error() const;
+ QKnxNetIpRouter::Error error() const;
enum class FilterAction : quint8
{
@@ -90,8 +90,8 @@ public:
Filter
};
- QKnxNetIpRoutingInterface(QObject *parent = nullptr);
- ~QKnxNetIpRoutingInterface() = default;
+ QKnxNetIpRouter(QObject *parent = nullptr);
+ ~QKnxNetIpRouter() = default;
RoutingMode routingMode() const;
void setRoutingMode(RoutingMode mode);
@@ -125,13 +125,13 @@ Q_SIGNALS:
void routingLostCountSent(QKnxNetIpFrame frame);
void routingSystemBroadcastSent(QKnxNetIpFrame frame);
- void routingIndicationReceived(QKnxNetIpFrame frame, QKnxNetIpRoutingInterface::FilterAction action);
+ void routingIndicationReceived(QKnxNetIpFrame frame, QKnxNetIpRouter::FilterAction action);
void routingBusyReceived(QKnxNetIpFrame frame);
void routingLostCountReceived(QKnxNetIpFrame frame);
void routingSystemBroadcastReceived(QKnxNetIpFrame frame);
- void stateChanged(QKnxNetIpRoutingInterface::State state);
- void errorOccurred(QKnxNetIpRoutingInterface::Error error, QString errorString);
+ void stateChanged(QKnxNetIpRouter::State state);
+ void errorOccurred(QKnxNetIpRouter::Error error, QString errorString);
};
QT_END_NAMESPACE
diff --git a/src/knx/netip/qknxnetiproutinginterface_p.cpp b/src/knx/netip/qknxnetiprouter_p.cpp
index 8b10c17..fca79eb 100644
--- a/src/knx/netip/qknxnetiproutinginterface_p.cpp
+++ b/src/knx/netip/qknxnetiprouter_p.cpp
@@ -29,48 +29,48 @@
#include "qknxnetiproutingbusy.h"
#include "qknxnetiproutingindication.h"
-#include "qknxnetiproutinginterface_p.h"
-#include "qknxnetiproutinginterface.h"
+#include "qknxnetiprouter_p.h"
+#include "qknxnetiprouter.h"
#include "qknxnetiproutinglostmessage.h"
#include "qknxnetiproutingsystembroadcast.h"
#ifdef QT_BUILD_INTERNAL
-#include "qknxtestingrouter_p.h"
+#include "qknxnetiptestrouter_p.h"
#endif
#include <QtCore/qrandom.h>
QT_BEGIN_NAMESPACE
-void QKnxNetIpRoutingInterfacePrivate::errorOccurred(QKnxNetIpRoutingInterface::Error error,
+void QKnxNetIpRouterPrivate::errorOccurred(QKnxNetIpRouter::Error error,
const QString &errorString)
{
m_error = error;
m_errorMessage = errorString;
- changeState(QKnxNetIpRoutingInterface::State::Failure);
+ changeState(QKnxNetIpRouter::State::Failure);
- Q_Q(QKnxNetIpRoutingInterface);
+ Q_Q(QKnxNetIpRouter);
emit q->errorOccurred(m_error, m_errorMessage);
}
-void QKnxNetIpRoutingInterfacePrivate::changeState(QKnxNetIpRoutingInterface::State state)
+void QKnxNetIpRouterPrivate::changeState(QKnxNetIpRouter::State state)
{
if (m_state == state)
return;
m_state = state;
- Q_Q(QKnxNetIpRoutingInterface);
+ Q_Q(QKnxNetIpRouter);
emit q->stateChanged(m_state);
}
-void QKnxNetIpRoutingInterfacePrivate::start()
+void QKnxNetIpRouterPrivate::start()
{
- if (m_state != QKnxNetIpRoutingInterface::State::NotInit
- && m_state != QKnxNetIpRoutingInterface::State::Stop)
+ if (m_state != QKnxNetIpRouter::State::NotInit
+ && m_state != QKnxNetIpRouter::State::Stop)
return;
#ifdef QT_BUILD_INTERNAL
- TestingRouter::instance()->setRouterInstance(this);
+ QKnxNetIpTestRouter::instance()->setRouterInstance(this);
#endif
if (!m_iface.isValid()) {
@@ -86,8 +86,8 @@ void QKnxNetIpRoutingInterfacePrivate::start()
}
// still no interface valid found
if (!m_iface.isValid()) {
- errorOccurred(QKnxNetIpRoutingInterface::Error::Network,
- QKnxNetIpRoutingInterface::tr("Could not start routing because there isn't a "
+ errorOccurred(QKnxNetIpRouter::Error::Network,
+ QKnxNetIpRouter::tr("Could not start routing because there isn't a "
"valid interface."));
return;
}
@@ -111,7 +111,7 @@ void QKnxNetIpRoutingInterfacePrivate::start()
m_busyTimer->setInterval(m_busyCounter * 100);
m_busyTimer->start();
m_busyStage = BusyTimerStage::SlowDuration;
- this->changeState(QKnxNetIpRoutingInterface::State::Routing);
+ this->changeState(QKnxNetIpRouter::State::Routing);
break;
case BusyTimerStage::SlowDuration:
m_busyTimer->setInterval(5);
@@ -138,18 +138,18 @@ void QKnxNetIpRoutingInterfacePrivate::start()
case QUdpSocket::BoundState:
m_socket->setMulticastInterface(m_iface);
if (m_socket->joinMulticastGroup(m_multicastAddress, m_iface)) {
- changeState(QKnxNetIpRoutingInterface::State::Routing);
+ changeState(QKnxNetIpRouter::State::Routing);
} else {
- errorOccurred(QKnxNetIpRoutingInterface::Error::Network,
- QKnxNetIpRoutingInterface::tr("Could not join multicast group."));
+ errorOccurred(QKnxNetIpRouter::Error::Network,
+ QKnxNetIpRouter::tr("Could not join multicast group."));
}
break;
case QUdpSocket::ClosingState:
if (!m_socket->leaveMulticastGroup(m_multicastAddress, m_iface)) {
- changeState(QKnxNetIpRoutingInterface::State::NotInit);
+ changeState(QKnxNetIpRouter::State::NotInit);
} else {
- errorOccurred(QKnxNetIpRoutingInterface::Error::Network,
- QKnxNetIpRoutingInterface::tr("Could not leave multicast group."));
+ errorOccurred(QKnxNetIpRouter::Error::Network,
+ QKnxNetIpRouter::tr("Could not leave multicast group."));
}
break;
default:
@@ -216,7 +216,7 @@ void QKnxNetIpRoutingInterfacePrivate::start()
using overload = void (QUdpSocket::*)(QUdpSocket::SocketError);
QObject::connect(m_socket,
static_cast<overload>(&QUdpSocket::error), [&](QUdpSocket::SocketError) {
- errorOccurred(QKnxNetIpRoutingInterface::Error::Network,
+ errorOccurred(QKnxNetIpRouter::Error::Network,
m_socket->errorString());
});
@@ -224,26 +224,26 @@ void QKnxNetIpRoutingInterfacePrivate::start()
// initialize UDP socket and bind
if (!m_socket->bind(QHostAddress(QHostAddress::AnyIPv4), m_multicastPort,
(QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint))) {
- errorOccurred(QKnxNetIpRoutingInterface::Error::Network,
- QKnxNetIpRoutingInterface::tr("Could not bind endpoint: %1")
+ errorOccurred(QKnxNetIpRouter::Error::Network,
+ QKnxNetIpRouter::tr("Could not bind endpoint: %1")
.arg(m_socket->errorString()));
}
}
-void QKnxNetIpRoutingInterfacePrivate::restart()
+void QKnxNetIpRouterPrivate::restart()
{
stop();
start();
}
-void QKnxNetIpRoutingInterfacePrivate::stop()
+void QKnxNetIpRouterPrivate::stop()
{
- if (m_state == QKnxNetIpRoutingInterface::State::NotInit)
+ if (m_state == QKnxNetIpRouter::State::NotInit)
return;
cleanup();
}
-void QKnxNetIpRoutingInterfacePrivate::cleanup()
+void QKnxNetIpRouterPrivate::cleanup()
{
if (m_socket) {
m_socket->disconnect();
@@ -261,15 +261,15 @@ void QKnxNetIpRoutingInterfacePrivate::cleanup()
m_busyStage = BusyTimerStage::NotInit;
m_errorMessage = QString();
- m_error = QKnxNetIpRoutingInterface::Error::None;
+ m_error = QKnxNetIpRouter::Error::None;
}
-void QKnxNetIpRoutingInterfacePrivate::processRoutingIndication(const QKnxNetIpFrame &frame)
+void QKnxNetIpRouterPrivate::processRoutingIndication(const QKnxNetIpFrame &frame)
{
QKnxNetIpRoutingIndicationProxy indication(frame);
if (!indication.isValid()) {
- errorOccurred(QKnxNetIpRoutingInterface::Error::KnxRouting,
- QKnxNetIpRoutingInterface::tr("QKnxNetIp Routing Indication Message is not "
+ errorOccurred(QKnxNetIpRouter::Error::KnxRouting,
+ QKnxNetIpRouter::tr("QKnxNetIp Routing Indication Message is not "
"correctly formed."));
return;
}
@@ -284,11 +284,11 @@ void QKnxNetIpRoutingInterfacePrivate::processRoutingIndication(const QKnxNetIpF
m_sameKnxDstAddressIndicationCount = 0;
}
- Q_Q(QKnxNetIpRoutingInterface);
+ Q_Q(QKnxNetIpRouter);
emit q->routingIndicationReceived(frame, filterAction(cemi));
}
-void QKnxNetIpRoutingInterfacePrivate::processRoutingBusy(const QKnxNetIpFrame &frame)
+void QKnxNetIpRouterPrivate::processRoutingBusy(const QKnxNetIpFrame &frame)
{
QKnxNetIpRoutingBusyProxy busyMessage(frame);
if (!busyMessage.isValid())
@@ -296,40 +296,40 @@ void QKnxNetIpRoutingInterfacePrivate::processRoutingBusy(const QKnxNetIpFrame &
flowControlHandling(busyMessage.routingBusyWaitTime());
- Q_Q(QKnxNetIpRoutingInterface);
+ Q_Q(QKnxNetIpRouter);
emit q->routingBusyReceived(frame);
}
-void QKnxNetIpRoutingInterfacePrivate::processRoutingLostMessage(const QKnxNetIpFrame &frame)
+void QKnxNetIpRouterPrivate::processRoutingLostMessage(const QKnxNetIpFrame &frame)
{
QKnxNetIpRoutingLostMessageProxy lostMessage(frame);
if (!lostMessage.isValid()) {
- errorOccurred(QKnxNetIpRoutingInterface::Error::KnxRouting,
- QKnxNetIpRoutingInterface::tr("QKnxNetIp Routing Lost Message is not "
+ errorOccurred(QKnxNetIpRouter::Error::KnxRouting,
+ QKnxNetIpRouter::tr("QKnxNetIp Routing Lost Message is not "
"correctly formed."));
return;
}
- Q_Q(QKnxNetIpRoutingInterface);
+ Q_Q(QKnxNetIpRouter);
emit q->routingLostCountReceived(frame);
}
-void QKnxNetIpRoutingInterfacePrivate::processRoutingSystemBroadcast(const QKnxNetIpFrame &frame)
+void QKnxNetIpRouterPrivate::processRoutingSystemBroadcast(const QKnxNetIpFrame &frame)
{
QKnxNetIpRoutingSystemBroadcastProxy sbc(frame);
if (sbc.isValid()) {
- Q_Q(QKnxNetIpRoutingInterface);
+ Q_Q(QKnxNetIpRouter);
emit q->routingSystemBroadcastReceived(frame);
} else {
- errorOccurred(QKnxNetIpRoutingInterface::Error::KnxRouting,
- QKnxNetIpRoutingInterface::tr("QKnxNetIp Routing System Broadcast is not correctly "
+ errorOccurred(QKnxNetIpRouter::Error::KnxRouting,
+ QKnxNetIpRouter::tr("QKnxNetIp Routing System Broadcast is not correctly "
"formed."));
}
}
-bool QKnxNetIpRoutingInterfacePrivate::sendFrame(const QKnxNetIpFrame &frame)
+bool QKnxNetIpRouterPrivate::sendFrame(const QKnxNetIpFrame &frame)
{
- if (m_state != QKnxNetIpRoutingInterface::State::Routing)
+ if (m_state != QKnxNetIpRouter::State::Routing)
return true; // no errors, only ignore the frame
return m_socket->writeDatagram(frame.bytes().toByteArray(),
@@ -337,7 +337,7 @@ bool QKnxNetIpRoutingInterfacePrivate::sendFrame(const QKnxNetIpFrame &frame)
m_multicastPort) != -1;
}
-void QKnxNetIpRoutingInterfacePrivate::flowControlHandling(quint16 newBusyWaitTime)
+void QKnxNetIpRouterPrivate::flowControlHandling(quint16 newBusyWaitTime)
{
if (m_busyStage == BusyTimerStage::Wait) {
auto elapsedTime = (m_busyTimer->interval() - m_busyTimer->remainingTime());
@@ -355,11 +355,11 @@ void QKnxNetIpRoutingInterfacePrivate::flowControlHandling(quint16 newBusyWaitTi
m_busyStage = BusyTimerStage::Wait;
}
m_busyTimer->start();
- changeState(QKnxNetIpRoutingInterface::State::NeighborBusy);
+ changeState(QKnxNetIpRouter::State::NeighborBusy);
}
-QKnxNetIpRoutingInterface::FilterAction
- QKnxNetIpRoutingInterfacePrivate::filterAction(const QKnxLinkLayerFrame &frame)
+QKnxNetIpRouter::FilterAction
+ QKnxNetIpRouterPrivate::filterAction(const QKnxLinkLayerFrame &frame)
{
auto dst = frame.destinationAddress();
auto extCtrlField = frame.extendedControlField();
@@ -369,20 +369,20 @@ QKnxNetIpRoutingInterface::FilterAction
// TODO: review this part
auto gAdd = QKnxAddress::createGroup(dst.mainOrAreaSection(), dst.middleOrLineSection(), 0);
bool routingCondition = true;
- if (m_routingMode == QKnxNetIpRoutingInterface::RoutingMode::Filter)
+ if (m_routingMode == QKnxNetIpRouter::RoutingMode::Filter)
routingCondition = m_filterTable.contains(gAdd);
- if (m_routingMode == QKnxNetIpRoutingInterface::RoutingMode::Block)
- return QKnxNetIpRoutingInterface::FilterAction::IgnoreTotally;
+ if (m_routingMode == QKnxNetIpRouter::RoutingMode::Block)
+ return QKnxNetIpRouter::FilterAction::IgnoreTotally;
if (routingCondition && hopCount > 0 && hopCount <= 7)
- return QKnxNetIpRoutingInterface::FilterAction::RouteDecremented;
+ return QKnxNetIpRouter::FilterAction::RouteDecremented;
if (routingCondition && hopCount == 0)
- return QKnxNetIpRoutingInterface::FilterAction::IgnoreAcked;
- return QKnxNetIpRoutingInterface::FilterAction::IgnoreTotally;
+ return QKnxNetIpRouter::FilterAction::IgnoreAcked;
+ return QKnxNetIpRouter::FilterAction::IgnoreTotally;
}
// only gets here if destination address is individual
if (!m_individualAddress.isValid())
- return QKnxNetIpRoutingInterface::FilterAction::IgnoreTotally;
+ return QKnxNetIpRouter::FilterAction::IgnoreTotally;
auto ownAddress = m_individualAddress;
bool isLineCoupler = ownAddress.middleOrLineSection() != 0;
@@ -392,29 +392,29 @@ QKnxNetIpRoutingInterface::FilterAction
|| (dst.middleOrLineSection() == ownAddress.middleOrLineSection());
if (notInOwnSubnetwork) {
if (dst.subOrDeviceSection() == 0) // address to this line coupler
- return QKnxNetIpRoutingInterface::FilterAction::ForwardLocally;
+ return QKnxNetIpRouter::FilterAction::ForwardLocally;
if (hopCount > 0 && hopCount <= 7)
- return QKnxNetIpRoutingInterface::FilterAction::RouteDecremented;
- return QKnxNetIpRoutingInterface::FilterAction::IgnoreAcked;
+ return QKnxNetIpRouter::FilterAction::RouteDecremented;
+ return QKnxNetIpRouter::FilterAction::IgnoreAcked;
}
// no main line to sub-line routing done by a KNXnet/IP RoutingInteface
- return QKnxNetIpRoutingInterface::FilterAction::IgnoreTotally;
+ return QKnxNetIpRouter::FilterAction::IgnoreTotally;
}
// backbone to main line
if (dst.mainOrAreaSection() == ownAddress.mainOrAreaSection()) {
if (dst.middleOrLineSection() == 0 && dst.subOrDeviceSection() == 0)
// address to area coupler or backbone router.
- return QKnxNetIpRoutingInterface::FilterAction::ForwardLocally;
+ return QKnxNetIpRouter::FilterAction::ForwardLocally;
if (hopCount > 0 && hopCount <= 7)
- return QKnxNetIpRoutingInterface::FilterAction::RouteDecremented;
- return QKnxNetIpRoutingInterface::FilterAction::IgnoreAcked;
+ return QKnxNetIpRouter::FilterAction::RouteDecremented;
+ return QKnxNetIpRouter::FilterAction::IgnoreAcked;
}
// main line to backbone routing
if (hopCount > 0 && hopCount <= 7)
- return QKnxNetIpRoutingInterface::FilterAction::RouteDecremented;
- return QKnxNetIpRoutingInterface::FilterAction::IgnoreAcked;
+ return QKnxNetIpRouter::FilterAction::RouteDecremented;
+ return QKnxNetIpRouter::FilterAction::IgnoreAcked;
}
QT_END_NAMESPACE
diff --git a/src/knx/netip/qknxnetiproutinginterface_p.h b/src/knx/netip/qknxnetiprouter_p.h
index afd05e0..755ee3a 100644
--- a/src/knx/netip/qknxnetiproutinginterface_p.h
+++ b/src/knx/netip/qknxnetiprouter_p.h
@@ -27,8 +27,8 @@
**
******************************************************************************/
-#ifndef QKNXNETIPROUTINGINTERFACE_P_H
-#define QKNXNETIPROUTINGINTERFACE_P_H
+#ifndef QKNXNETIPROUTER_P_H
+#define QKNXNETIPROUTER_P_H
//
// W A R N I N G
@@ -41,12 +41,12 @@
// We mean it.
//
-#include <QtCore/private/qobject_p.h>
#include <QtCore/qtimer.h>
+#include <QtCore/private/qobject_p.h>
#include <QtKnx/qknxnetip.h>
#include <QtKnx/qknxnetipframe.h>
-#include <QtKnx/qknxnetiproutinginterface.h>
+#include <QtKnx/qknxnetiprouter.h>
#include <QtNetwork/qnetworkdatagram.h>
#include <QtNetwork/qnetworkinterface.h>
@@ -54,12 +54,12 @@
QT_BEGIN_NAMESPACE
-class QKnxNetIpRoutingInterfacePrivate : public QObjectPrivate
+class QKnxNetIpRouterPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QKnxNetIpRoutingInterface)
+ Q_DECLARE_PUBLIC(QKnxNetIpRouter)
public:
- QKnxNetIpRoutingInterfacePrivate() = default;
- ~QKnxNetIpRoutingInterfacePrivate() = default;
+ QKnxNetIpRouterPrivate() = default;
+ ~QKnxNetIpRouterPrivate() = default;
void start();
void restart();
@@ -76,10 +76,10 @@ public:
void flowControlHandling(quint16 newBusyWaitTime);
- void changeState(QKnxNetIpRoutingInterface::State state);
- void errorOccurred(QKnxNetIpRoutingInterface::Error error, const QString &errorString);
+ void changeState(QKnxNetIpRouter::State state);
+ void errorOccurred(QKnxNetIpRouter::Error error, const QString &errorString);
- QKnxNetIpRoutingInterface::FilterAction filterAction(const QKnxLinkLayerFrame &frame);
+ QKnxNetIpRouter::FilterAction filterAction(const QKnxLinkLayerFrame &frame);
QUdpSocket *m_socket { nullptr };
@@ -94,7 +94,7 @@ public:
quint16 m_multicastPort { QKnxNetIp::Constants::DefaultPort };
QHostAddress m_ownAddress;
- QKnxNetIpRoutingInterface::State m_state { QKnxNetIpRoutingInterface::State::NotInit };
+ QKnxNetIpRouter::State m_state { QKnxNetIpRouter::State::NotInit };
quint16 m_busyWaitTime { QKnxNetIp::RoutingBusyWaitTime };
QTimer *m_busyTimer { nullptr };
@@ -110,11 +110,11 @@ public:
BusyTimerStage m_busyStage { BusyTimerStage::NotInit };
quint32 m_busyCounter { 0 };
- QKnxNetIpRoutingInterface::Error m_error { QKnxNetIpRoutingInterface::Error::None };
+ QKnxNetIpRouter::Error m_error { QKnxNetIpRouter::Error::None };
QString m_errorMessage;
- QKnxNetIpRoutingInterface::FilterTable m_filterTable;
- QKnxNetIpRoutingInterface::RoutingMode m_routingMode { QKnxNetIpRoutingInterface::RoutingMode::Block };
+ QKnxNetIpRouter::FilterTable m_filterTable;
+ QKnxNetIpRouter::RoutingMode m_routingMode { QKnxNetIpRouter::RoutingMode::Block };
};
QT_END_NAMESPACE
diff --git a/src/knx/netip/qknxtestingrouter_p.h b/src/knx/netip/qknxnetiptestrouter_p.h
index b6d0b76..cba8a7b 100644
--- a/src/knx/netip/qknxtestingrouter_p.h
+++ b/src/knx/netip/qknxnetiptestrouter_p.h
@@ -27,8 +27,8 @@
**
******************************************************************************/
-#ifndef QKNXTESTINGROUTER_P_H
-#define QKNXTESTINGROUTER_P_H
+#ifndef QKNXNETIPTESTROUTER_P_H
+#define QKNXNETIPTESTROUTER_P_H
//
// W A R N I N G
@@ -43,22 +43,43 @@
#include <QtCore/qobject.h>
+#include <QtNetwork/qudpsocket.h>
+#include <QtNetwork/qhostaddress.h>
+
+#include <QtKnx/private/qknxnetiprouter_p.h>
+
QT_BEGIN_NAMESPACE
-class QKnxNetIpRoutingInterfacePrivate;
-class Q_AUTOTEST_EXPORT TestingRouter
+class QKnxNetIpRouterPrivate;
+class Q_AUTOTEST_EXPORT QKnxNetIpTestRouter
{
public:
- static TestingRouter *instance();
+ static QKnxNetIpTestRouter *instance()
+ {
+ static QKnxNetIpTestRouter routerInterface;
+ return &routerInterface;
+ }
+
+ void emitReadyRead(bool readAllPackets = true)
+ {
+ Q_ASSERT(m_router);
+ auto socket = m_router->m_socket;
+ Q_ASSERT(socket);
- void emitReadyRead(bool readAllPackets = true);
+ // By default the QKnxNetIpRouter gets the IP of the interface. A dummy
+ // address is assigned to trick the router into not discarding packets that
+ // have the same address as the interface used by the QKnxNetIpRouter
+ if (readAllPackets)
+ m_router->m_ownAddress = QHostAddress(16843010); // setting ip 1.1.1.2
+ socket->waitForReadyRead(1);
+ }
- QKnxNetIpRoutingInterfacePrivate *routerInstance();
- void setRouterInstance(QKnxNetIpRoutingInterfacePrivate *router);
+ QKnxNetIpRouterPrivate *routerInstance() { return m_router; }
+ void setRouterInstance(QKnxNetIpRouterPrivate *router) { m_router = router; }
private:
- TestingRouter() = default;
- QKnxNetIpRoutingInterfacePrivate *m_router { nullptr };
+ QKnxNetIpTestRouter() = default;
+ QKnxNetIpRouterPrivate *m_router { nullptr };
};
QT_END_NAMESPACE
diff --git a/src/knx/netip/qknxtestingrouter_p.cpp b/src/knx/netip/qknxtestingrouter_p.cpp
deleted file mode 100644
index 22302c3..0000000
--- a/src/knx/netip/qknxtestingrouter_p.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/******************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtKnx module.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-******************************************************************************/
-
-#include "qknxtestingrouter_p.h"
-#include "qknxnetiproutinginterface_p.h"
-
-#include <QtNetwork/qudpsocket.h>
-#include <QtNetwork/qhostaddress.h>
-
-QT_BEGIN_NAMESPACE
-
-TestingRouter *TestingRouter::instance()
-{
- static TestingRouter routerInterface;
- return &routerInterface;
-}
-
-void TestingRouter::emitReadyRead(bool readAllPackets)
-{
- auto socket = m_router->m_socket;
- Q_ASSERT(socket);
-
- // By default the QKnxNetIpRoutingInterface gets the IP of the interface. A dummy
- // address is assigned to trick the router into not discarding packets that
- // have the same address as the interface used by the QKnxNetIpRoutingInterface
- if (readAllPackets)
- m_router->m_ownAddress = QHostAddress(16843010); // setting ip 1.1.1.2
- socket->waitForReadyRead(1);
-}
-
-void TestingRouter::setRouterInstance(QKnxNetIpRoutingInterfacePrivate *router)
-{
- m_router = router;
-}
-
-QKnxNetIpRoutingInterfacePrivate *TestingRouter::routerInstance()
-{
- return m_router;
-}
-
-QT_END_NAMESPACE
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 97ab534..be105c4 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -46,7 +46,7 @@ SUBDIRS += cmake \
qknxnetipsecuredservicefamiliesdib \
qknxnetipsessionrequest \
qknxnetipsessionresponse \
- qknxnetiproutinginterface
+ qknxnetiprouter
QT_FOR_CONFIG += network
qtConfig(opensslv11):SUBDIRS+=qknxcryptographicengine
diff --git a/tests/auto/qknxnetiproutinginterface/qknxnetiproutinginterface.pro b/tests/auto/qknxnetiprouter/qknxnetiprouter.pro
index 11f421d..1318ebd 100644
--- a/tests/auto/qknxnetiproutinginterface/qknxnetiproutinginterface.pro
+++ b/tests/auto/qknxnetiprouter/qknxnetiprouter.pro
@@ -4,4 +4,4 @@ QT = core testlib knx network knx-private
CONFIG += testcase c++11
CONFIG -= app_bundle
-SOURCES += tst_qknxnetiproutinginterface.cpp
+SOURCES += tst_qknxnetiprouter.cpp
diff --git a/tests/auto/qknxnetiproutinginterface/tst_qknxnetiproutinginterface.cpp b/tests/auto/qknxnetiprouter/tst_qknxnetiprouter.cpp
index 4c3509b..8806edd 100644
--- a/tests/auto/qknxnetiproutinginterface/tst_qknxnetiproutinginterface.cpp
+++ b/tests/auto/qknxnetiprouter/tst_qknxnetiprouter.cpp
@@ -29,14 +29,14 @@
#include <QtKnx/qknxnetipframe.h>
#include <QtKnx/qknxlinklayerframebuilder.h>
-#include <QtKnx/qknxnetiproutinginterface.h>
+#include <QtKnx/qknxnetiprouter.h>
#include <QtKnx/qknxnetiproutingbusy.h>
#include <QtKnx/qknxnetiproutingindication.h>
#include <QtKnx/qknxnetiproutinglostmessage.h>
#include <QtKnx/qknxnetiproutingsystembroadcast.h>
-#include <QtKnx/private/qknxnetiproutinginterface_p.h>
-#include <QtKnx/private/qknxtestingrouter_p.h>
+#include <QtKnx/private/qknxnetiprouter_p.h>
+#include <QtKnx/private/qknxnetiptestrouter_p.h>
#include <QtKnx/private/qknxtpdufactory_p.h>
#include <QtCore/qdebug.h>
@@ -49,12 +49,12 @@ Q_DECLARE_METATYPE(QKnxAddress)
#ifdef QT_BUILD_INTERNAL
-class tst_QKnxNetIpRoutingInterface : public QObject
+class tst_QKnxNetIpRouter : public QObject
{
Q_OBJECT
public:
- tst_QKnxNetIpRoutingInterface();
+ tst_QKnxNetIpRouter();
private slots:
void initTestCase();
@@ -81,10 +81,10 @@ private:
QNetworkInterface kIface;
QHostAddress kMulticastAddress { QString("224.0.23.12") };
- QKnxNetIpRoutingInterface m_routingInterface;
+ QKnxNetIpRouter m_router;
};
-tst_QKnxNetIpRoutingInterface::tst_QKnxNetIpRoutingInterface()
+tst_QKnxNetIpRouter::tst_QKnxNetIpRouter()
{
// look for one interface running and able to multicast
@@ -106,7 +106,7 @@ tst_QKnxNetIpRoutingInterface::tst_QKnxNetIpRoutingInterface()
}
}
-void tst_QKnxNetIpRoutingInterface::initTestCase()
+void tst_QKnxNetIpRouter::initTestCase()
{
// don't run test case if this check fails
runTests = kIface.flags().testFlag(QNetworkInterface::IsRunning)
@@ -116,87 +116,87 @@ void tst_QKnxNetIpRoutingInterface::initTestCase()
return;
auto interfaceIndividualAddress = QKnxAddress::createIndividual(1, 1, 0);
- m_routingInterface.setIndividualAddress(interfaceIndividualAddress);
- m_routingInterface.setInterfaceAffinity(kIface);
+ m_router.setIndividualAddress(interfaceIndividualAddress);
+ m_router.setInterfaceAffinity(kIface);
}
-void tst_QKnxNetIpRoutingInterface::cleanup()
+void tst_QKnxNetIpRouter::cleanup()
{
if (!runTests)
return;
- m_routingInterface.disconnect();
- m_routingInterface.stop();
+ m_router.disconnect();
+ m_router.stop();
}
-void tst_QKnxNetIpRoutingInterface::test_network_interface()
+void tst_QKnxNetIpRouter::test_network_interface()
{
if (!runTests)
return;
bool errorEmitted = false;
- QObject::connect(&m_routingInterface, &QKnxNetIpRoutingInterface::errorOccurred,
- [&](QKnxNetIpRoutingInterface::Error error, QString errorString){
- QCOMPARE(error, QKnxNetIpRoutingInterface::Error::Network);
- QCOMPARE(error, m_routingInterface.error());
- QCOMPARE(errorString, m_routingInterface.errorString());
- QCOMPARE(m_routingInterface.state(), QKnxNetIpRoutingInterface::State::Failure);
+ QObject::connect(&m_router, &QKnxNetIpRouter::errorOccurred,
+ [&](QKnxNetIpRouter::Error error, QString errorString){
+ QCOMPARE(error, QKnxNetIpRouter::Error::Network);
+ QCOMPARE(error, m_router.error());
+ QCOMPARE(errorString, m_router.errorString());
+ QCOMPARE(m_router.state(), QKnxNetIpRouter::State::Failure);
errorEmitted = true;
});
{
// setting invalid interface should cause error
auto m_iface = QNetworkInterface();
- m_routingInterface.setInterfaceAffinity(m_iface);
+ m_router.setInterfaceAffinity(m_iface);
QVERIFY(errorEmitted);
}
{
// setting invalid interface using IP address of the interface
errorEmitted = false;
- m_routingInterface.setInterfaceAffinity(QHostAddress("2.2.2.2"));
+ m_router.setInterfaceAffinity(QHostAddress("2.2.2.2"));
QVERIFY(errorEmitted);
}
{
// local host address does not allow multicast
errorEmitted = false;
- m_routingInterface.setInterfaceAffinity(QHostAddress(QHostAddress::LocalHost));
+ m_router.setInterfaceAffinity(QHostAddress(QHostAddress::LocalHost));
QVERIFY(errorEmitted);
}
{
// setting a valid interface no signal emitted
errorEmitted = false;
- m_routingInterface.setInterfaceAffinity(kIface);
+ m_router.setInterfaceAffinity(kIface);
QVERIFY(!errorEmitted);
- QCOMPARE(kIface.index(), m_routingInterface.interfaceAffinity().index());
+ QCOMPARE(kIface.index(), m_router.interfaceAffinity().index());
}
}
-void tst_QKnxNetIpRoutingInterface::test_multicast_address()
+void tst_QKnxNetIpRouter::test_multicast_address()
{
if (!runTests)
return;
{
// default multicast address
- QKnxNetIpRoutingInterface m_router;
+ QKnxNetIpRouter m_router;
QCOMPARE(m_router.multicastAddress(), kMulticastAddress);
}
{
// setting an invalid multicast address shouldn't work
- QKnxNetIpRoutingInterface m_router;
+ QKnxNetIpRouter m_router;
auto kMulticastAddress = QHostAddress(QHostAddress::LocalHost);
m_router.setMulticastAddress(kMulticastAddress);
QVERIFY(m_router.multicastAddress() != kMulticastAddress);
}
{
// setting a valid multicast address
- QKnxNetIpRoutingInterface m_router;
+ QKnxNetIpRouter m_router;
auto address = QHostAddress("224.0.55.55");
m_router.setMulticastAddress(address);
QCOMPARE(m_router.multicastAddress(), address);
}
}
-void tst_QKnxNetIpRoutingInterface::test_udp_sockets()
+void tst_QKnxNetIpRouter::test_udp_sockets()
{
if (!runTests)
return;
@@ -260,7 +260,7 @@ QKnxNetIpFrame dummyRoutingIndication(QKnxAddress dst = QKnxAddress::createIndiv
.create();
}
-void tst_QKnxNetIpRoutingInterface::simulateFramesReceived(const QKnxNetIpFrame &netIpFrame, int numFrames)
+void tst_QKnxNetIpRouter::simulateFramesReceived(const QKnxNetIpFrame &netIpFrame, int numFrames)
{
if (!runTests)
return;
@@ -277,7 +277,7 @@ void tst_QKnxNetIpRoutingInterface::simulateFramesReceived(const QKnxNetIpFrame
}
// notify router socket to wait for any received packet
- TestingRouter::instance()->emitReadyRead();
+ QKnxNetIpTestRouter::instance()->emitReadyRead();
if (s) {
s->disconnect();
@@ -285,29 +285,29 @@ void tst_QKnxNetIpRoutingInterface::simulateFramesReceived(const QKnxNetIpFrame
}
}
-void tst_QKnxNetIpRoutingInterface::test_routing()
+void tst_QKnxNetIpRouter::test_routing()
{
if (!runTests)
return;
bool stateChangedEmitted = false;
- QObject::connect(&m_routingInterface, &QKnxNetIpRoutingInterface::stateChanged
- , [&](QKnxNetIpRoutingInterface::State state) {
+ QObject::connect(&m_router, &QKnxNetIpRouter::stateChanged
+ , [&](QKnxNetIpRouter::State state) {
stateChangedEmitted = true;
- QCOMPARE(state, QKnxNetIpRoutingInterface::State::Routing);
+ QCOMPARE(state, QKnxNetIpRouter::State::Routing);
});
- m_routingInterface.start();
+ m_router.start();
QVERIFY(stateChangedEmitted);
}
-void tst_QKnxNetIpRoutingInterface::test_routing_sends_indications()
+void tst_QKnxNetIpRouter::test_routing_sends_indications()
{
if (!runTests)
return;
- m_routingInterface.start();
+ m_router.start();
auto bytes = QKnxByteArray::fromHex("2900b4e000000002010000");
auto frameSent = QKnxLinkLayerFrame::builder()
@@ -316,57 +316,57 @@ void tst_QKnxNetIpRoutingInterface::test_routing_sends_indications()
.createFrame();
bool indicationSentEmitted = false;
- QObject::connect(&m_routingInterface, &QKnxNetIpRoutingInterface::routingIndicationSent
+ QObject::connect(&m_router, &QKnxNetIpRouter::routingIndicationSent
, [&](QKnxNetIpFrame frame) {
indicationSentEmitted = true;
QKnxNetIpRoutingIndicationProxy indicationSent(frame);
QVERIFY(indicationSent.isValid());
QCOMPARE(indicationSent.linkLayerFrame().bytes(), frameSent.bytes());
});
- m_routingInterface.sendRoutingIndication(frameSent);
+ m_router.sendRoutingIndication(frameSent);
QVERIFY(indicationSentEmitted);
bool stateChangedEmitted = false;
- QObject::connect(&m_routingInterface, &QKnxNetIpRoutingInterface::stateChanged
- , [&](QKnxNetIpRoutingInterface::State state) {
+ QObject::connect(&m_router, &QKnxNetIpRouter::stateChanged
+ , [&](QKnxNetIpRouter::State state) {
stateChangedEmitted = true;
- QCOMPARE(state, QKnxNetIpRoutingInterface::State::Stop);
+ QCOMPARE(state, QKnxNetIpRouter::State::Stop);
});
- m_routingInterface.stop();
+ m_router.stop();
QVERIFY(stateChangedEmitted);
}
// Test receiving routing indications!
-void tst_QKnxNetIpRoutingInterface::test_routing_receives_indications()
+void tst_QKnxNetIpRouter::test_routing_receives_indications()
{
if (!runTests)
return;
- m_routingInterface.start();
+ m_router.start();
bool indicationRcvEmitted = false;
- QObject::connect(&m_routingInterface, &QKnxNetIpRoutingInterface::routingIndicationReceived
+ QObject::connect(&m_router, &QKnxNetIpRouter::routingIndicationReceived
, [&](QKnxNetIpFrame frame
- , QKnxNetIpRoutingInterface::FilterAction routingAction) {
+ , QKnxNetIpRouter::FilterAction routingAction) {
indicationRcvEmitted = true;
QKnxNetIpRoutingIndicationProxy indicationRcv(frame);
QVERIFY(indicationRcv.isValid());
- QCOMPARE(routingAction, QKnxNetIpRoutingInterface::FilterAction::RouteDecremented);
+ QCOMPARE(routingAction, QKnxNetIpRouter::FilterAction::RouteDecremented);
});
simulateFramesReceived(dummyRoutingIndication());
QVERIFY(indicationRcvEmitted);
}
-void tst_QKnxNetIpRoutingInterface::test_routing_receives_busy()
+void tst_QKnxNetIpRouter::test_routing_receives_busy()
{
if (!runTests)
return;
// test receiving routing busy!
- m_routingInterface.start();
+ m_router.start();
bool indicationRcvEmitted = false;
- QObject::connect(&m_routingInterface, &QKnxNetIpRoutingInterface::routingBusyReceived
+ QObject::connect(&m_router, &QKnxNetIpRouter::routingBusyReceived
, [&](QKnxNetIpFrame frame) {
indicationRcvEmitted = true;
QKnxNetIpRoutingBusyProxy busy(frame);
@@ -382,21 +382,21 @@ void tst_QKnxNetIpRoutingInterface::test_routing_receives_busy()
QVERIFY(indicationRcvEmitted);
}
-void tst_QKnxNetIpRoutingInterface::test_routing_busy_sent_packets_same_individual_address()
+void tst_QKnxNetIpRouter::test_routing_busy_sent_packets_same_individual_address()
{
if (!runTests)
return;
// test receiving routing indications!
- m_routingInterface.start();
+ m_router.start();
int indRecvCount = 0;
- QObject::connect(&m_routingInterface, &QKnxNetIpRoutingInterface::routingIndicationReceived
+ QObject::connect(&m_router, &QKnxNetIpRouter::routingIndicationReceived
, [&](QKnxNetIpFrame frame
- , QKnxNetIpRoutingInterface::FilterAction routingAction) {
+ , QKnxNetIpRouter::FilterAction routingAction) {
QKnxNetIpRoutingIndicationProxy indicationRcv(frame);
QVERIFY(indicationRcv.isValid());
- QCOMPARE(routingAction, QKnxNetIpRoutingInterface::FilterAction::RouteDecremented);
+ QCOMPARE(routingAction, QKnxNetIpRouter::FilterAction::RouteDecremented);
indRecvCount++;
});
simulateFramesReceived(dummyRoutingIndication(), 7);
@@ -405,10 +405,10 @@ void tst_QKnxNetIpRoutingInterface::test_routing_busy_sent_packets_same_individu
// the same individual address. Router shall send automatically a busy message
QCOMPARE(indRecvCount, 6);
- QCOMPARE(TestingRouter::instance()->routerInstance()->m_framesReadCount, 6);
- QCOMPARE(TestingRouter::instance()->routerInstance()->m_sameKnxDstAddressIndicationCount, 5);
+ QCOMPARE(QKnxNetIpTestRouter::instance()->routerInstance()->m_framesReadCount, 6);
+ QCOMPARE(QKnxNetIpTestRouter::instance()->routerInstance()->m_sameKnxDstAddressIndicationCount, 5);
- QCOMPARE(m_routingInterface.state(), QKnxNetIpRoutingInterface::State::NeighborBusy);
+ QCOMPARE(m_router.state(), QKnxNetIpRouter::State::NeighborBusy);
}
QKnxLinkLayerFrame generateDummySbcFrame()
@@ -437,34 +437,34 @@ QKnxLinkLayerFrame generateDummySbcFrame()
.createFrame();
}
-void tst_QKnxNetIpRoutingInterface::test_routing_interface_sends_system_broadcast()
+void tst_QKnxNetIpRouter::test_routing_interface_sends_system_broadcast()
{
if (!runTests)
return;
- m_routingInterface.start();
+ m_router.start();
bool sbcSent = false;
- QObject::connect(&m_routingInterface,
- &QKnxNetIpRoutingInterface::routingSystemBroadcastSent, [&](QKnxNetIpFrame frame) {
+ QObject::connect(&m_router,
+ &QKnxNetIpRouter::routingSystemBroadcastSent, [&](QKnxNetIpFrame frame) {
sbcSent = true;
QKnxNetIpRoutingSystemBroadcastProxy sbc(frame);
QVERIFY(sbc.isValid());
});
- m_routingInterface.sendRoutingSystemBroadcast(generateDummySbcFrame());
+ m_router.sendRoutingSystemBroadcast(generateDummySbcFrame());
QVERIFY(sbcSent);
}
-void tst_QKnxNetIpRoutingInterface::test_routing_interface_receives_system_broadcast()
+void tst_QKnxNetIpRouter::test_routing_interface_receives_system_broadcast()
{
if (!runTests)
return;
- m_routingInterface.start();
+ m_router.start();
bool sbcRcvEmitted = false;
- QObject::connect(&m_routingInterface,
- &QKnxNetIpRoutingInterface::routingSystemBroadcastReceived
+ QObject::connect(&m_router,
+ &QKnxNetIpRouter::routingSystemBroadcastReceived
, [&](QKnxNetIpFrame frame) {
sbcRcvEmitted = true;
QKnxNetIpRoutingSystemBroadcastProxy sbc(frame);
@@ -479,25 +479,25 @@ void tst_QKnxNetIpRoutingInterface::test_routing_interface_receives_system_broad
QVERIFY(sbcRcvEmitted);
}
-void tst_QKnxNetIpRoutingInterface::test_routing_filter()
+void tst_QKnxNetIpRouter::test_routing_filter()
{
if (!runTests)
return;
QFETCH(QKnxAddress, interfaceIndividualAddress);
- QFETCH(QKnxNetIpRoutingInterface::FilterAction, expectedRoutingAction);
+ QFETCH(QKnxNetIpRouter::FilterAction, expectedRoutingAction);
QFETCH(QKnxAddress, dst);
QFETCH(int, hopCount);
- QFETCH(QKnxNetIpRoutingInterface::FilterTable, filterTable);
+ QFETCH(QKnxNetIpRouter::FilterTable, filterTable);
- m_routingInterface.setIndividualAddress(interfaceIndividualAddress);
- m_routingInterface.setFilterTable(filterTable);
- m_routingInterface.start();
+ m_router.setIndividualAddress(interfaceIndividualAddress);
+ m_router.setFilterTable(filterTable);
+ m_router.start();
bool receivedIndication = false;
- QObject::connect(&m_routingInterface, &QKnxNetIpRoutingInterface::routingIndicationReceived
+ QObject::connect(&m_router, &QKnxNetIpRouter::routingIndicationReceived
, [&](QKnxNetIpFrame frame
- , QKnxNetIpRoutingInterface::FilterAction routingAction) {
+ , QKnxNetIpRouter::FilterAction routingAction) {
QKnxNetIpRoutingIndicationProxy indicationRcv(frame);
QVERIFY(indicationRcv.isValid());
QCOMPARE(routingAction, expectedRoutingAction);
@@ -509,56 +509,56 @@ void tst_QKnxNetIpRoutingInterface::test_routing_filter()
QVERIFY(receivedIndication);
}
-void tst_QKnxNetIpRoutingInterface::test_routing_filter_data()
+void tst_QKnxNetIpRouter::test_routing_filter_data()
{
QTest::addColumn<QKnxAddress>("interfaceIndividualAddress");
QTest::addColumn<QKnxAddress>("dst");
QTest::addColumn<int>("hopCount");
- QTest::addColumn<QKnxNetIpRoutingInterface::FilterAction>("expectedRoutingAction");
- QTest::addColumn<QKnxNetIpRoutingInterface::FilterTable>("filterTable");
+ QTest::addColumn<QKnxNetIpRouter::FilterAction>("expectedRoutingAction");
+ QTest::addColumn<QKnxNetIpRouter::FilterTable>("filterTable");
- QKnxNetIpRoutingInterface::FilterTable filterTable;
+ QKnxNetIpRouter::FilterTable filterTable;
filterTable << QKnxAddress::createGroup(1,1,0);
QTest::newRow("RouterIndividual(1.1.0)_groupDestination(1.1.1)_hop6")
<< QKnxAddress::createIndividual(1,1,0)
<< QKnxAddress::createGroup(1,1,1)
<< 6
- << QKnxNetIpRoutingInterface::FilterAction::RouteDecremented
+ << QKnxNetIpRouter::FilterAction::RouteDecremented
<< filterTable;
QTest::newRow("destinationAddressFiltered")
<< QKnxAddress::createIndividual(1,1,0)
<< QKnxAddress::createGroup(1,2,1)
<< 6
- << QKnxNetIpRoutingInterface::FilterAction::IgnoreTotally
+ << QKnxNetIpRouter::FilterAction::IgnoreTotally
<< filterTable;
QTest::newRow("RouterIndividual(1.1.0)_groupDestination(1.1.1)_hop0")
<< QKnxAddress::createIndividual(1,1,0)
<< QKnxAddress::createGroup(1,1,1)
<< 0
- << QKnxNetIpRoutingInterface::FilterAction::IgnoreAcked
+ << QKnxNetIpRouter::FilterAction::IgnoreAcked
<< filterTable;
QTest::newRow("RouterIndividual(1.1.0)_individualDestination(1.1.1)_hop0")
<< QKnxAddress::createIndividual(1,1,0)
<< QKnxAddress::createIndividual(1,1,1)
<< 0
- << QKnxNetIpRoutingInterface::FilterAction::IgnoreAcked
+ << QKnxNetIpRouter::FilterAction::IgnoreAcked
<< filterTable;
QTest::newRow("RouterIndividual(1.1.0)_individualDestination(1.1.1)_hop5")
<< QKnxAddress::createIndividual(1,1,0)
<< QKnxAddress::createIndividual(1,1,1)
<< 5
- << QKnxNetIpRoutingInterface::FilterAction::RouteDecremented
+ << QKnxNetIpRouter::FilterAction::RouteDecremented
<< filterTable;
QTest::newRow("RouterIndividual(1.1.0)_individualDestination(1.1.1)_hop5")
<< QKnxAddress::createIndividual(1,1,0)
<< QKnxAddress::createIndividual(1,1,0)
<< 5
- << QKnxNetIpRoutingInterface::FilterAction::ForwardLocally
+ << QKnxNetIpRouter::FilterAction::ForwardLocally
<< filterTable;
}
@@ -567,19 +567,19 @@ void tst_QKnxNetIpRoutingInterface::test_routing_filter_data()
#else
-class tst_QKnxNetIpRoutingInterface : public QObject
+class tst_QKnxNetIpRouter : public QObject
{
Q_OBJECT
private slots:
void initTestCase()
{
- QSKIP("QKnxNetIpRoutingInterface methods aren't available to test");
+ QSKIP("QKnxNetIpRouter methods aren't available to test");
}
};
#endif
-QTEST_MAIN(tst_QKnxNetIpRoutingInterface)
+QTEST_MAIN(tst_QKnxNetIpRouter)
-#include "tst_qknxnetiproutinginterface.moc"
+#include "tst_qknxnetiprouter.moc"