diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index deab88e..70e4cf9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -127,6 +127,16 @@ jobs: cxxflags: '' ldflags: '' + - toolset: g++-12 + compiler: g++-12 + install: g++-12 + os: ubuntu-latest + container: ubuntu:22.04 + build-type: 'Release' + cxxstd: 20 + cxxflags: '' + ldflags: '' + - toolset: clang++-12 compiler: clang++-12 install: clang++-12 @@ -137,6 +147,16 @@ jobs: cxxflags: '-fdeclspec' ldflags: '' + - toolset: clang++-13 + compiler: clang++-13 + install: clang++-13 + os: ubuntu-latest + container: ubuntu:22.04 + build-type: 'Release' + cxxstd: 17 + cxxflags: '-fdeclspec' + ldflags: '' + - toolset: clang++-14-libc++-14 compiler: clang++-14 install: 'clang++-14 libc++-14-dev libc++abi-14-dev' diff --git a/README.md b/README.md index 9338ccc..9dcc46f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ -Async.MQTT5: A ~~C++20~~ C++17 MQTT client based on Boost.Asio +Async.MQTT5: A C++17 MQTT client based on Boost.Asio =============================== + +Branch | Windows/Linux Build | Coverage | Documentation | +-------|---------------------|----------|---------------| +[`master`](https://github.com/mireo/async-mqtt5/tree/master) | [![build status](https://github.com/mireo/async-mqtt5/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/mireo/async-mqtt5/actions/workflows/ci.yml) | [![codecov](https://codecov.io/gh/mireo/async-mqtt5/branch/master/graph/badge.svg)](https://codecov.io/gh/mireo/async-mqtt5/branch/master) | [Documentation](https://spacetime.mireo.com/async-mqtt5/) + Async.MQTT5 is a professional, industrial-grade C++17 client built on [Boost.Asio](https://www.boost.org/doc/libs/1_82_0/doc/html/boost_asio.html). This client is designed for publishing or receiving messages from an MQTT 5.0 compatible broker. Async.MQTT5 represents a comprehensive implementation of the MQTT 5.0 protocol standard, offering full support for publishing or receiving messages with QoS 0, 1, and 2. Our clear intention is to include the Async.MQTT5 library into [Boost](https://www.boost.org/). We are actively working on it. @@ -106,8 +111,8 @@ Async.MQTT5 is a header-only library. To use Async.MQTT5 it requires the followi - **OpenSSL**. Only if you require an SSL connection by using [boost::asio::ssl::stream](https://www.boost.org/doc/libs/1_82_0/doc/html/boost_asio/reference/ssl__stream.html). Async.MQTT5 has been tested with the following compilers: -- clang 14.0 (Linux) -- GCC 12 (Linux) +- clang 12.0, 13.0, 14.0, 15.0 (Linux) +- GCC 10, 11, 12 (Linux) - MSVC 14.37 - Visual Studio 2022 (Windows) Contributing @@ -119,7 +124,7 @@ You may merge a Pull Request once you have the sign-off from other developers, o License --------- -Copyright (c) 2001-2023 Mireo, EU +Copyright (c) 2001-2024 Mireo, EU Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/doc/qbk/00_main.qbk b/doc/qbk/00_main.qbk index 44c70da..9a0452c 100644 --- a/doc/qbk/00_main.qbk +++ b/doc/qbk/00_main.qbk @@ -1,4 +1,4 @@ -[library Async.MQTT5: a C++20 MQTT client +[library Async.MQTT5: a C++17 MQTT client [quickbook 1.7] [copyright 2023 Mireo] [id async_mqtt5] diff --git a/doc/qbk/01_intro.qbk b/doc/qbk/01_intro.qbk index f424212..4cbceee 100644 --- a/doc/qbk/01_intro.qbk +++ b/doc/qbk/01_intro.qbk @@ -60,18 +60,19 @@ The following example illustrates a simple scenario of configuring a Client and using client_type = async_mqtt5::mqtt_client; client_type c(ioc, ""); - c.credentials("clientid", "", "") - .brokers("mqtt.broker", 1883) + c.credentials("", "", "") + .brokers("", 1883) .async_run(asio::detached); c.async_publish( - "test/mqtt-test", "hello world!", + "", "Hello world!", async_mqtt5::retain_e::no, async_mqtt5::publish_props {}, - [](async_mqtt5::error_code ec) { + [&c](async_mqtt5::error_code ec) { std::cout << ec.message() << std::endl; + c.async_disconnect(boost::asio::detached); // disconnect and close the client } ); - + ioc.run(); } @@ -102,8 +103,9 @@ To use __Self__ it requires the following: __Self__ has been tested with the following compilers: -* clang 14.0 (Linux) -* MSVC 14.37 - Visual Studio 2022 (Windows) +* clang 12.0, 13.0, 14.0, 15.0 (Linux) +* GCC 10, 11, 12 (Linux) +* MSVC 14.37 - Visual Studio 2022 (Windows) [heading Acknowledgements] We thank [@https://github.com/chriskohlhoff Christopher Kohlhoff] for his outstanding __Asio__ library, diff --git a/test/integration/cancellation.cpp b/test/integration/cancellation.cpp index d917531..00c35e1 100644 --- a/test/integration/cancellation.cpp +++ b/test/integration/cancellation.cpp @@ -338,6 +338,7 @@ BOOST_FIXTURE_TEST_CASE(rerunning_the_client, shared_test_data) { [&]() -> asio::awaitable { mqtt_client c(ioc, ""); c.brokers("127.0.0.1,127.0.0.1", 1883) // to avoid reconnect backoff + .credentials("cliend-id", "", "") .async_run(asio::detached); auto [ec, rc, props] = co_await c.async_publish( diff --git a/test/integration/re_authentication.cpp b/test/integration/re_authentication.cpp index f1d7d5a..ab9744a 100644 --- a/test/integration/re_authentication.cpp +++ b/test/integration/re_authentication.cpp @@ -190,6 +190,28 @@ BOOST_FIXTURE_TEST_CASE(async_auth_fail, shared_test_data) { ); } +BOOST_FIXTURE_TEST_CASE(unexpected_auth, shared_test_data) { + auto connect_no_auth = encoders::encode_connect( + "", std::nullopt, std::nullopt, 10, false, {}, std::nullopt + ); + auto disconnect = encoders::encode_disconnect( + reason_codes::protocol_error.value(), + dprops_with_reason_string("Unexpected AUTH received") + ); + + test::msg_exchange broker_side; + broker_side + .expect(connect_no_auth) + .complete_with(success, after(0ms)) + .reply_with(connack, after(1ms)) + .send(auth_challenge, after(50ms)) + .expect(disconnect); + + run_test( + std::move(broker_side) + ); +} + BOOST_FIXTURE_TEST_CASE(re_auth_without_authenticator, shared_test_data) { auto connect_no_auth = encoders::encode_connect( "", std::nullopt, std::nullopt, 10, false, {}, std::nullopt