2
0
mirror of https://github.com/boostorg/mqtt5.git synced 2026-01-19 04:22:11 +00:00

86 Commits

Author SHA1 Message Date
Bruno Iljazovic
6198b0e44a Mock timer and resolver in unit tests.
Summary:
* Removed all usage of real timers and resolvers in unit tests
* Moved most of the tests to test/unit folder
* cmake: split boost_mqtt5_tests into boost_mqtt5_unittests and boost_mqtt5_integrationtests

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen

Differential Revision: https://repo.mireo.local/D38186
2025-11-17 13:10:36 +01:00
Bruno Iljazovic
d3fc7684eb When resending packets, revalidate them with new connack props.
Summary: Resolves #37

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen

Differential Revision: https://repo.mireo.local/D38010
2025-11-06 10:32:26 +01:00
Bruno Iljazovic
adce5d6fca tests: Add missing asio::system_executor include.
Closes #41
2025-10-29 20:55:08 +01:00
Bruno Iljazovic
68ac83505e Add AppleClang to CI.
Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen

Differential Revision: https://repo.mireo.local/D37779
2025-10-21 13:56:57 +02:00
Bruno Iljazovic
3f50d398a8 Reconnect on all transport layer errors and log them.
Summary: Ref #38

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen

Differential Revision: https://repo.mireo.local/D37743
2025-10-20 17:34:50 +02:00
Bruno Iljazovic
150ba94d14 Drop Spirit dependency
Summary: Ref #36

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen

Differential Revision: https://repo.mireo.local/D37107
2025-09-19 10:52:14 +02:00
Bruno Iljazovic
53c33f23bb Send default Maximum Packet Size in the CONNECT packet
Summary: #33

Reviewers: ivica

Reviewed By: ivica

Subscribers: korina, miljen

Differential Revision: https://repo.mireo.local/D36253
2025-07-15 14:10:03 +02:00
Bruno Iljazovic
14bca520d9 Fix parsing of URI paths in hosts string
Summary: Fixes #31

Reviewers: ivica

Reviewed By: ivica

Subscribers: korina, miljen

Differential Revision: https://repo.mireo.local/D35126
2025-05-06 09:56:12 +02:00
Korina Šimičević
7292ca453a Add tests to verify correct logging output based on log level
Summary:
related to T15252
- Add logger tests that verify correct logging output based on log_level & cover all functions and branches
- Changed default log_level to info

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D33830
2025-02-21 08:15:51 +01:00
Korina Šimičević
40ad372736 Bump copyright year
Summary:
related to T15996

updates copyright year to 2025

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D33759
2025-02-17 10:47:39 +01:00
Bruno Iljazovic
7d18f20e56 Add Jamfile, make CMake scripts Boost compliant
Summary: related to T15996

Reviewers: ivica, korina

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D33480
2025-02-12 15:54:14 +01:00
Bruno Iljazovic
8b41f0dd4d Gracefully shutdown Websocket and TLS streams
Summary:
Resolves #18
Ref T15241

Reviewers: ivica

Reviewed By: ivica

Subscribers: korina, miljen

Maniphest Tasks: T15241

Differential Revision: https://repo.mireo.local/D33395
2025-01-30 18:18:05 +01:00
Korina Šimičević
4df9dbbb07 Fix build
Summary: related to T15996

Reviewers: iljazovic

Reviewed By: iljazovic

Subscribers: miljen

Differential Revision: https://repo.mireo.local/D33388
2025-01-27 10:31:57 +01:00
Bruno Iljazovic
9a0d41b7a7 fix for default completion tokens on Boost 1.87.0
Reviewers: ivica

Reviewed By: ivica

Subscribers: korina, miljen

Differential Revision: https://repo.mireo.local/D33181
2025-01-15 16:01:09 +01:00
Korina Šimičević
afc270f10e Async.MQTT5 -> Boost.MQTT5
Summary:
related to T15996

folder structure include/async_mqtt5 -> include/boost/mqtt5
namespace async_mqtt5 -> namespace boost::mqtt5
all tabs replaced with 4 spaces (because tabs are banned)
boost-like order of includes

TODO: fix all docs

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D33152
2025-01-14 08:57:44 +01:00
Korina Šimičević
9a6788c913 Examples rework
Summary:
related to T15261, T15262
- all examples are added to CI checks
	- as a result, CMakeLists.txt in example folder is reworked to build all examples instead of one
	- also removed chapter Building with CMake temporarily (it will be back)
- all examples accept runtime arguments (brokers, port, clientid) (default: hivemq public broker)
- implemented example suggestions by R.Perez, most notable:
	- all examples include mqtt headers they use (no more unified headers)
	- multithreaded examples use thread_pool instead of asio::io_context
- all examples use logger with log_level::info by default

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D32602
2024-12-04 09:45:18 +01:00
Korina Šimičević
d19f466e3e Remove Beast dependency from connect_op.hpp
Summary: resolves T15243

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Maniphest Tasks: T15243

Differential Revision: https://repo.mireo.local/D32561
2024-12-02 15:47:19 +01:00
Korina Šimičević
e5d36cf088 Move logger traits out of detail namespace into logger_traits.hpp
Summary:
related to T15252, #24
- move logger traits out of detail namespace into logger_traits.hpp to allow writers of their own loggers to verify that their implementation satisfies the LoggerType requirements
- move impl/codecs/traits to detail/traits, traits functions are now in detail namespace
- logger outputs the contents of props in debug mode

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D32524
2024-12-02 10:31:22 +01:00
Korina Šimičević
319d024981 Document LoggerType concept and improve Getting Started chapter
Summary:
related to T15252, T15261, T15263, #24

- documented LoggerType concept
- configuring the client chapter changed to getting started chapter with new additions:
	- code examples for each section (choosing underlying type, configuring the client, and using it)
	- added a secion on debugging the client using our logger implementation
- minor fixes related to reviewer's suggestions

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D32487
2024-12-02 07:56:13 +01:00
Korina Šimičević
f22a3c7bec Add log invoke and logger
Summary: related to T15252, #24

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Maniphest Tasks: T15252

Differential Revision: https://repo.mireo.local/D32382
2024-11-27 13:45:23 +01:00
Bruno Iljazovic
9240c51b28 remove thread mutex from async_mutex
Summary: also fixes per-operation-cancelled operations preventing unlock of mutex

Reviewers: ivica

Reviewed By: ivica

Subscribers: korina, miljen

Differential Revision: https://repo.mireo.local/D32427
2024-11-27 13:28:41 +01:00
Korina Šimičević
edb94108b6 Remove Beast dependency from rebind_executor.hpp and async_traits.hpp
Summary:
related to T15243
remove beast as dependancy from async_traits and rebind_executor

run mqtt_features test on websocket-tcp client instead (tcp broker is usually overloaded)

add tests for next_layer/lowest_layer

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D32212
2024-11-19 09:07:14 +01:00
Korina Šimičević
f80c189767 Allow IPv6 connections
Summary: related to T13767, #19

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D32140
2024-11-13 11:46:20 +01:00
Korina Šimičević
0e62d8f8b3 Consistently use BOOST_TEST instead of BOOST_CHECK in tests
Summary:
related to T13767
We used BOOST_CHECK in older tests and BOOST_TEST macro in newer tests.
Now we use BOOST_TEST consistently.

Reviewers: ivica!

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D31701
2024-10-08 15:25:36 +02:00
Korina Šimičević
4cbae1056b #includes revision and housekeeping
Summary: related to T13767

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D31700
2024-10-08 13:13:31 +02:00
Korina Šimičević
7bc1ccf072 Add support for default completion tokens
Summary: related to #12 T13767

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen

Differential Revision: https://repo.mireo.local/D30725
2024-08-06 08:22:16 +02:00
Korina Šimičević
927c1c6e3a Update license to BSL-1.0
Summary: related to T13767 T13767

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D29686
2024-05-27 10:59:59 +02:00
Korina Šimičević
68840dda95 Add missing topic alias name validation
Summary:
related to T13767

- allow empty topic name + topic alias in props
- add mqtt features tests

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D29445
2024-05-15 07:43:44 +02:00
Korina Šimičević
a1249b433d Reconnect on every Reason Code > 0x80 received in the CONNACK packet
Summary: related to T13767

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28217
2024-02-29 14:18:33 +01:00
Bruno Iljazovic
701698e5ec resend terminal disconnect
Summary:
- if we are in the process of connecting when user invokes async_disconnect we should send a disconnect packet after connect completes
- move integration disconnect tests to integration folder

Reviewers: ivica

Reviewed By: ivica

Subscribers: korina

Differential Revision: https://repo.mireo.local/D28119
2024-02-23 14:40:00 +01:00
Korina Šimičević
2f055e8894 Remove connection error codes
Summary: related to T13767

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28117
2024-02-23 14:01:28 +01:00
Korina Šimičević
634a4bdfa9 async_disconnect will close the connection regardless of the current connection state
Summary: related to T13761

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28057
2024-02-22 12:14:24 +01:00
Bruno Iljazovic
22d3b644c5 add subscription_identifers unit test
Reviewers: korina

Reviewed By: korina

Differential Revision: https://repo.mireo.local/D28003
2024-02-19 14:19:24 +01:00
Korina Šimičević
7cbd7725fc Wait exponentially longer when all hosts have been exhausted during reconnect
Summary: related to T13746

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27995
2024-02-19 13:26:12 +01:00
Bruno Iljazovic
1acdd99f28 Support multiple subscription identifiers in received messages.
Summary:
- refactor property encoding
- change user property type to be std::pair<std::string, std::string>

Reviewers: ivica

Reviewed By: ivica

Subscribers: korina

Differential Revision: https://repo.mireo.local/D27867
2024-02-16 10:59:07 +01:00
Korina Šimičević
b40ddb3ced Separate tests to compile and run all configuration-related client functions
Summary: related to T12015

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27945
2024-02-16 07:38:58 +01:00
Bruno Iljazovic
cbe477a701 Correct two/four byte integer properties' types.
Reviewers: ivica

Reviewed By: ivica

Subscribers: korina

Differential Revision: https://repo.mireo.local/D27901
2024-02-14 15:20:45 +01:00
Korina Šimičević
cfa2b76176 Remove unused cnf parameter in client_service
Summary: related to T13709

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27895
2024-02-14 14:40:41 +01:00
Korina Šimičević
d1d50d029d Add connection error codes
Summary:
related to T13651
- separate code related to reason codes into their own header
- introduce new connection error codes that will be return when a non-recoverable error occurs in connect_op
- add appropriate coverage tests

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27808
2024-02-08 12:27:22 +01:00
Korina Šimičević
0de02e3c53 Add async mutex unit tests
Summary:
related to T12015
- relax coroutine tests
- add async mutex unit tests

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27719
2024-02-06 07:44:05 +01:00
Korina Šimičević
5c7f0bc29d Add missing malformed tests for publish packets
Summary:
related to T12015
- all malformed cases should now be fully covered!
- additionally, added a receive channel overflow test

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27709
2024-02-05 07:54:08 +01:00
Korina Šimičević
677e625d1a Simplify usage of subscribe options enums
Summary: related to T13606

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27679
2024-02-02 10:21:03 +01:00
Korina Šimičević
e143fcce63 Fix initialization
Summary: related to T12015

Reviewers: iljazovic

Reviewed By: iljazovic

Subscribers: miljen

Differential Revision: https://repo.mireo.local/D27664
2024-02-01 11:00:05 +01:00
Korina Šimičević
33c8eea890 Add function to set keep alive/ping interval
Summary:
related to T13566
- mqtt_client has a new keep_alive(seconds) function
- keep_alive(0) disables ping
- if keep_alive() is not called, the client assumes keep_alive=10
- the client respects server_keep_alive if sent by the broker

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27557
2024-02-01 08:29:22 +01:00
Korina Šimičević
d6c4884d53 (Un)subscribe validates the number of topics and reason codes
Test Plan:
related to T12015
- (un)subscribe reason codes will always contain as many reason codes as there are topic filters
- if, by some odd chance, the client receives the wrong number of rcs or some are invalid, it will treat it as malformed
- both subscribe_op and unsubscribe_op should be 100% covered by tests now

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27592
2024-01-30 15:25:58 +01:00
Korina Šimičević
61f17f6e0f Fix user property encoding
Summary: related to T11798

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27532
2024-01-24 13:03:38 +01:00
Korina Šimičević
85ef3e70e4 Simplify and shorten unit test code - part 2
Summary: related to T12015

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27502
2024-01-23 08:50:26 +01:00
Korina Šimičević
9b92f7fca2 Simplify and shorten unit test code - part 1
Summary: related to T12015

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27488
2024-01-23 07:54:38 +01:00
Korina Šimičević
fa014fc337 Add op cancellation tests
Summary: related to T12015

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27459
2024-01-19 14:47:14 +01:00
Korina Šimičević
d7d0b4c239 Add re authentication tests
Summary: related to T12015

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27436
2024-01-19 11:30:41 +01:00