1
0
mirror of https://github.com/qt/qtmqtt.git synced 2026-10-25 16:16:26 +00:00
Commit Graph

462 Commits

Author SHA1 Message Date
Antti Kokko
10e0203b94 Add changes file for Qt 5.12.10
Change-Id: I0164e4e56cb477df8d05156676a781a71fc45b10
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
(cherry picked from commit 91d59b6e10)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-11-12 10:13:02 +00:00
Antti Kokko
c24f9bcc45 Add changes file for Qt 5.15.2
Change-Id: Id115fbbfb691cac1522d188ac3961a48caaf9fc1
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
(cherry picked from commit cade213f56)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-11-12 10:12:55 +00:00
Jani Heikkinen
426c06abb5 Bump module version to 6.0.0
Change-Id: I4eed33497c9d480e9b72a66216ed0ad94b505ffc
Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-11-12 12:12:48 +02:00
Jani Heikkinen
5735946c27 Update dependencies on 'dev'
Also, remove optional dependency to websockets, which is not
part of Qt 6.0 and fix compile error against unsigned comparison.

Switch default test configuration to not launch TLS brokers.
Latest COIN updates causes paho to fail in the SSL setup.

Task-number: QTBUG-88189
Change-Id: I9d31f9e54801d269122878ab4cf7541512fdbe98
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2020-11-11 12:41:25 +01:00
Maurice Kalinowski
00ca74ada4 Update dependencies
Change-Id: I8bbe275d61a616a5fb88d1a9cc8d922015ce3832
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-21 11:04:14 +02:00
Antti Kokko
7b0aa786ab Add changes file for Qt 5.15.1
Change-Id: I669e04ba3da47b9e23fa3ec482a6cb29e25392cf
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
(cherry picked from commit 0da764d8fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-08-25 06:06:59 +00:00
Konstantin Ritt
c63c552d2b [BiC] Fix dangling pointer dereferencing when destroying QMqttClient
when QMqttClient gets destroyed in Connected state, d->m_connection
in its destructor (indirectly called by ~QObject) sends DISCONNECT
Control packet and then closes connection, causing
transportConnectionClosed() to call m_clientPrivate->setStateAndError(),
which, in its turn, accesses [a partially destroyed] QMqttClient instance

Change-Id: I216f700d92838dc25e385fe2d449f3ad93a642e6
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-08-18 20:30:13 +03:00
Alexandru Croitor
5ff2e91d95 Update dependencies.yaml to sha1s of latest qt5.git
Required to also enable CMake CI configurations.

Change-Id: I20099cb8a1a41e210bff6a157e84ed718efb4396
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-08-06 13:49:51 +02:00
Sona Kurazyan
87fbd09c2b Use QList instead of QVector in qtmqtt
Task-number: QTBUG-84469
Change-Id: Id8d2f39fabaec11babddf22cd7e77fb06048d2db
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-06-25 12:09:52 +02:00
Maurice Kalinowski
f8661b035e Port QtMqtt from QStringRef to QStringView
Task-number: QTBUG-84319
Change-Id: I2184c8ba15f9e9671f9b8f404e6a5d5054bea3bb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-06-08 20:22:01 +02:00
Maurice Kalinowski
34442a23f6 Add dependencies.yaml to Qt Mqtt
Change-Id: I69ba765a5fd8a9ecb5529730b6247476b2ebc68d
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-06-08 19:49:56 +02:00
Maurice Kalinowski
7477c29f47 Prefer utf8 instead of local8Bit
Change-Id: I19343409b5b9b9deeba37b8ef6a8ac688ec74341
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-06-03 16:21:40 +02:00
Alexandru Croitor
5ea20cc458 CMake: Regenerate projects
And use an updated coin instruction file.

Change-Id: I852d38febe9ecaa86c516b7f4a0451d0f80d8011
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-05-26 17:43:51 +02:00
Alexandru Croitor
a450023285 Merge remote-tracking branch 'origin/wip/cmake' into dev
Change-Id: I5074da47986bcc826d3990238b02ebe7e6cc3d2e
2020-05-26 17:38:47 +02:00
Maurice Kalinowski
07b7baf3ca Regenerate projects
Change-Id: I8b306c077030ffe1904d42f813f3b7cacc35a0c9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-26 15:23:16 +00:00
Qt Forward Merge Bot
51ef71daac Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I5e3459f90c8131cf8b00a1a7aed301f6d3d0e8f7
2020-05-18 08:44:14 +02:00
Konstantin Ritt
e6c2ddfc2a MQTT 5: respect UNSUBACK Properties and Reason Code
UNSUBACK supported properties are exactly the same as SUBACK ones,
so re-use the existing readSubscriptionProperties() implementation.

Change-Id: I1d3d99f33d44882505960b603a07237c2a578dcb
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-05-15 18:58:30 +02:00
Konstantin Ritt
a5facff165 Do not change state in QMqttSubscription::unsubscribe()
the state of a respective subscription is updated by the UNSUBACK handler,
once the broker confirms unsubscription
(see QMqttConnection::finalize_unsuback() for details)

Change-Id: Ib5c06dc7813609a66fad577d594447fade357a3e
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-05-15 18:58:26 +02:00
Konstantin Ritt
8509e7c2b8 Introduce MQTT 5 UNSUBSCRIBE specific Reason Code
Change-Id: Idd988e7ddab4e589ba7bc3a634fb37aa9342aac4
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-05-15 18:58:21 +02:00
Konstantin Ritt
e1f7758574 Treat SUBACK with an empty payload as a protocol violation
by assuming a non-empty payload and then failing to read the data
if that assumption was too optimistic.

As per [MQTT-3.8.3-2]:
> The Payload MUST contain at least one Topic Filter and Subscription Options pair.
> A SUBSCRIBE packet with no Payload is a Protocol Error.
and then as per [MQTT-3.9.3-1]:
> The Payload contains a list of Reason Codes. Each Reason Code corresponds to a Topic Filter in the SUBSCRIBE packet being acknowledged.
> The order of Reason Codes in the SUBACK packet MUST match the order of Topic Filters in the SUBSCRIBE packet.

Change-Id: I5939d901c897f679ece43b3ec3845c43ee6f2a47
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-05-15 18:58:16 +02:00
Konstantin Ritt
de07f41c7b QMqttConnection::sendControlSubscribe: minor simplification
plus add some more verbosity on invalid argument values

Change-Id: I7e0a091c2603e16d3e1d90f116e3f134122d42a2
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-05-15 19:38:14 +03:00
Qt Forward Merge Bot
e37ad05851 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I9f4ebe3b924bae1567605410de6c2dcd56dfe7a6
2020-05-14 21:08:49 +02:00
Qt Forward Merge Bot
fc130f3681 Merge remote-tracking branch 'origin/5.15.0' into 5.15
Change-Id: I9a0e57355d7fc5e5032a8626a49aa41a4f3ba6c4
2020-05-14 14:03:41 +02:00
Konstantin Ritt
b9c7ef4d68 [BiC] Fix size of ReasonCode enum
all reason codes are of a single byte long

Change-Id: I65c223bf034aab1f2a03934ffb1cdc841f4aa8c5
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-05-07 11:12:19 +03:00
Konstantin Ritt
c49a1d268a QMqttConnection: avoid codegen for methods that aren't needed to be SLOTS
Change-Id: I28088d6ff71f9005b6cb4f9c57a3d38efcad3e4b
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-05-07 11:11:34 +03:00
Konstantin Ritt
d2806f040c Do not ignore MQTT 5 protocol violations in some more cases
The exceptional texts in 3.4.2.1, 3.5.2.1, 3.6.2.1, 3.7.2.1,
3.14.2.1 and 3.15.2.1 propose a micro optimization:
> The Reason Code and Property Length can be omitted
> if the Reason Code is 0x00 (Success) and there are no Properties.

which our current implementation treats like if it were
"The Property Length can be omitted if the Reason Code is 0x00".

In theory, this optimization could apply to CONNACK as well,
as there is a reason code and no payload, but that's not stated
anywhere in the spec and should not be assumed.

Change-Id: Ifaf9a3c45876661b8f7a4d688600f53b46288752
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-05-06 14:44:13 +03:00
Konstantin Ritt
5c5664c776 Better handling of MQTT 5 PUBACK/REC/REL/COMP Reason Codes
prohibit reason codes not allowed for MQTT 5 PUBACK/REC/REL/COMP
(see sections 3.4.2.1, 3.5.2.1, 3.6.2.1, 3.7.2.1 for details)

Change-Id: If33a704e2667f07c9e2b79f6aa4fc241406fd892
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-05-06 14:44:01 +03:00
Konstantin Ritt
f702420627 Tst_QMqttClient: fix the FakeServer's response regarding payload size
Change-Id: Ia4df16b8ad37c1d241b959dfc4c3194b770c7813
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-05-06 11:16:06 +00:00
Konstantin Ritt
cc62970c8c Fix remaining bytes calculation when parsing Controls Packets
change readVariableByteInteger() to decrease the passed value
(just like other read* functions) and remember to decrease
the remaining bytes counter by the properties length
when we read properties
(otherwise we're getting a reasonable Q_ASSERT(m_missingData == 0)
after i.e. readSubscriptionProperties())

Change-Id: Iaa050b1b543da2186da8e4deb1e701f4ac2ac2fa
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-05-06 13:43:18 +03:00
Maurice Kalinowski
e1ac865ac6 Add runtime check for different test server
Some test servers might have different configurations.
For instance, mosquitto broker provides a different
default value for topic aliases.

Change-Id: I00bc9c6b27d06358a352f9c0adb04e4044666aac
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-05-06 08:30:54 +02:00
Maurice Kalinowski
824635b275 Increase waiting time
mosquitto MQTT5 support seems to wait longer to send
will messages.

Change-Id: I2c13609e228319ce8fefc5e79d4f99bbfe0b061b
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-05-06 08:30:51 +02:00
Konstantin Ritt
ab2e985e3c Exit more gracefuly on protocol violations
Change-Id: Ie797b505e67f02e65cfff3b25d49ddae523f4131
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-05-02 15:15:14 +03:00
Maurice Kalinowski
87e9d1c7fb Fix qHash related warnings
Follow up to qtbase related changes.

Change-Id: I84fdb92fbdbeba66062fd0e427c8a7fad4ea052b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-02 11:03:56 +02:00
Antti Kokko
9ae8940b5e Add changes file for Qt 5.15.0
Change-Id: I0ca662476df16a9509f265032df92a5d181f0350
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-04-23 07:28:52 +03:00
Qt Forward Merge Bot
7bc8dddd99 Merge remote-tracking branch 'origin/5.15' into 5.15.0
Change-Id: I522adee104c0c2f3abddebfe3920e691430ad8a0
2020-04-22 10:16:11 +02:00
Qt Forward Merge Bot
70a7791c36 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ic1690472800b0e1652e078a135594a2ee39b56e5
2020-04-21 21:14:57 +02:00
Qt Forward Merge Bot
11b7ad0659 Merge remote-tracking branch 'origin/5.14.2' into 5.14
Change-Id: I3043ab60b48c711c9c3e3f127b8b282fc10885c6
2020-04-21 09:32:17 +02:00
Qt Forward Merge Bot
2bb073c835 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I1531ecc329c1fab6cffbc8ecf1f5da6edf440f01
2020-04-21 03:04:06 +02:00
Maurice Kalinowski
6e48bcfd40 Fix deprecation warnings
Change-Id: Icf598a98ff6999b3c6e615c4defa90f47e5e02d2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-18 18:13:16 +02:00
Qt Forward Merge Bot
05f2f5c475 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I6fa6962ac8618f5fe59a67dfe6bec060cc274227
2020-04-04 03:04:21 +02:00
Konstantin Ritt
3390820509 QMqttConnection: Minor renaming
transportReadReady() -> transportReadyRead()

Change-Id: Icefdc3a7249e32560b7c461feae915433cb513ab
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-04-02 10:48:44 +03:00
Konstantin Ritt
e672503b2f Expose CONNACK Reason Code via serverConnectionProperties() for MQTT <5
Change-Id: Ieea55c5990a24857c27a9dd71279bf08b2ff0170
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-04-02 02:39:37 +03:00
Konstantin Ritt
6a441b4d67 Better handling of MQTT SUBACK Reason Codes
prohibit reason codes not allowed for MQTT <=5 SUBACK
(see section 3.9.3 for details)

Change-Id: Ic433d14cd1c787da584e311c04273b676f4b450a
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-04-02 02:39:26 +03:00
Konstantin Ritt
d0cd34dc80 Better handling of MQTT 5 CONNACK Reason Codes
* map MQTT 5 reason codes to a legacy ClientError values
* prohibit reason codes not allowed for MQTT 5 CONNACK
  (see section 3.2.2.2 for details)

Change-Id: Ia5f5c2a55c9cf7477409b7f5bf670768b42eb979
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-04-02 02:39:15 +03:00
Konstantin Ritt
c561f28d7e QMqttConnection: code deduplication
squash finalize_pubAckRecComp() with finalize_pubrel()

Change-Id: I1a14d1ca0efccbfc58edafe0eaf27d58543ac82a
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-04-02 02:39:08 +03:00
Maurice Kalinowski
a97d917b40 Doc: Update reason code documentation
As a follow up to 8b90d4808f
specify the version that the AUTH related enums have
been introduced.

Change-Id: I3f03a16504091f030e32bb97f9cae4e9b0864c62
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2020-04-01 23:37:53 +00:00
Konstantin Ritt
17337160d9 Fix handling of incoming DISCONNECT Control packet
as of MQTT 5, DISCONNECT Control packet could be sent
from the Client or the Server, however QMqttControlPacket::DISCONNECT
wasn't handled in the switch, causing connection close
with ProtocolViolation error.

Change-Id: Ic908f4e51ad133aff90cac1c65aa6df7eb21a427
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-04-02 02:36:02 +03:00
Konstantin Ritt
e37c80b52f QMqttConnection: do not block when connecting with encryption
instead, postpone the transportConnectionEstablished() call from
QSslSocket's Connected to Encrypted state

Change-Id: I4ed146897c6b084c3dd19848655a3c28979175ba
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-03-31 12:51:07 +03:00
Konstantin Ritt
c72a47b703 Fix documentation of the qos argument meaning
Change-Id: I530ca158ca01a4d793bad9a5ea2eaf12f6098506
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-03-31 12:51:01 +03:00
Konstantin Ritt
bc07e72a43 Prohibit Subscription Identifier in Client to a Server PUBLISH
as per 3.3.4
> A PUBLISH packet sent from a Client to a Server MUST NOT contain a Subscription Identifier

Change-Id: I490d46cdb346b0ebcd47f333ff410835a9c30733
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-03-31 12:50:54 +03:00