[mqtt client&test] #includes housekeeping

Summary: resolves T12777

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen

Maniphest Tasks: T12777

Differential Revision: https://repo.mireo.local/D25995
This commit is contained in:
Korina Šimičević
2023-10-06 11:51:04 +02:00
parent 2d957cd46f
commit 83493c83d9
49 changed files with 204 additions and 187 deletions

View File

@@ -1,11 +1,12 @@
#include <fmt/format.h>
#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/ssl.hpp>
#include <boost/asio/co_spawn.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/ssl.hpp>
#include <boost/asio/use_awaitable.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <async_mqtt5.hpp>
namespace asio = boost::asio;

View File

@@ -1,7 +1,7 @@
#include <fmt/format.h>
#include <iostream>
#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <async_mqtt5.hpp>

View File

@@ -1,7 +1,9 @@
#include <fmt/format.h>
#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/beast/websocket.hpp>
#include <async_mqtt5.hpp>

View File

@@ -1,10 +1,12 @@
#include <fmt/format.h>
#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/beast/websocket.hpp>
#include <boost/asio/ssl.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/beast/websocket.hpp>
#include <async_mqtt5.hpp>
namespace asio = boost::asio;

View File

@@ -1,12 +1,10 @@
#ifndef ASYNC_MQTT5_ASYNC_MUTEX_HPP
#define ASYNC_MQTT5_ASYNC_MUTEX_HPP
#include <boost/asio/bind_cancellation_slot.hpp>
#include <boost/asio/bind_executor.hpp>
#include <boost/asio/dispatch.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/steady_timer.hpp>
#include <boost/asio/any_completion_handler.hpp>
#include <boost/asio/associated_allocator.hpp>
#include <boost/asio/associated_cancellation_slot.hpp>
#include <boost/asio/bind_cancellation_slot.hpp>
#include <boost/asio/execution.hpp>
#include <async_mqtt5/detail/async_traits.hpp>
@@ -25,7 +23,7 @@ private:
using queued_op_t = asio::any_completion_handler<
void (boost::system::error_code)
>;
using queue_t = detail::ring_buffer<queued_op_t>;
using queue_t = ring_buffer<queued_op_t>;
// Handler with assigned tracking executor.
// Objects of this type are type-erased by any_completion_handler

View File

@@ -4,13 +4,13 @@
#include <concepts>
#include <type_traits>
#include <boost/asio/buffer.hpp>
#include <boost/asio/associated_executor.hpp>
#include <boost/asio/prefer.hpp>
#include <boost/asio/write.hpp>
#include <boost/asio/associated_executor.hpp>
#include <boost/beast/core/stream_traits.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/types.hpp>
namespace async_mqtt5 {
@@ -44,7 +44,7 @@ template <typename T, typename B>
concept has_async_write = requires(T a) {
a.async_write(
std::declval<B>(),
[](boost::system::error_code, size_t) {}
[](error_code, size_t) {}
);
};
@@ -144,14 +144,10 @@ decltype(auto) async_write(
template <typename TlsContext, typename Stream>
void setup_tls_sni(const authority_path& ap, TlsContext& ctx, Stream& s) {
if constexpr (has_tls_handshake<Stream>) {
using tls_stream_type = Stream;
if constexpr (has_tls_handshake<Stream>)
assign_tls_sni(ap, ctx, s);
}
else if constexpr (has_next_layer<Stream>) {
using next_layer_type = typename Stream::next_layer_type;
else if constexpr (has_next_layer<Stream>)
setup_tls_sni(ap, ctx, next_layer(s));
}
}
} // end namespace detail

View File

@@ -1,16 +1,15 @@
#ifndef ASYNC_MQTT5_CANCELLABLE_HANDLER_HPP
#define ASYNC_MQTT5_CANCELLABLE_HANDLER_HPP
#include <boost/asio/cancellation_type.hpp>
#include <memory>
#include <boost/asio/associated_allocator.hpp>
#include <boost/asio/associated_cancellation_slot.hpp>
#include <boost/asio/associated_executor.hpp>
#include <boost/asio/error.hpp>
#include <boost/asio/prepend.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/cancellation_type.hpp>
#include <boost/asio/dispatch.hpp>
#include <boost/asio/bind_executor.hpp>
#include <memory>
#include <boost/asio/error.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/prepend.hpp>
#include <async_mqtt5/detail/async_traits.hpp>

View File

@@ -10,7 +10,6 @@
namespace async_mqtt5 {
namespace asio = boost::asio;
enum class control_code_e : std::uint8_t {
no_packet = 0b00000000, // 0

View File

@@ -4,6 +4,7 @@
#include <optional>
#include <string>
#include <async_mqtt5/error.hpp>
#include <async_mqtt5/types.hpp>
namespace async_mqtt5::detail {

View File

@@ -1,16 +1,20 @@
#ifndef ASYNC_MQTT5_ASSEMBLE_OP_HPP
#define ASYNC_MQTT5_ASSEMBLE_OP_HPP
#include <string>
#include <boost/asio/append.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/asio/completion_condition.hpp>
#include <boost/asio/dispatch.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/prepend.hpp>
#include <boost/asio/append.hpp>
#include <boost/asio/dispatch.hpp>
#include <boost/asio/completion_condition.hpp>
#include <async_mqtt5/error.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/detail/control_packet.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/impl/internal/codecs/base_decoders.hpp>
#include <async_mqtt5/impl/internal/codecs/message_decoders.hpp>

View File

@@ -4,6 +4,7 @@
#include <boost/asio/any_completion_handler.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/asio/prepend.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <async_mqtt5/detail/internal_types.hpp>

View File

@@ -3,24 +3,20 @@
#include <utility>
#include <boost/asio/connect.hpp>
#include <boost/asio/read.hpp>
#include <boost/asio/write.hpp>
#include <boost/asio/completion_condition.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/detail/async_mutex.hpp>
#include <async_mqtt5/detail/async_traits.hpp>
#include <async_mqtt5/impl/endpoints.hpp>
#include <async_mqtt5/impl/reconnect_op.hpp>
#include <async_mqtt5/impl/read_op.hpp>
#include <async_mqtt5/impl/reconnect_op.hpp>
#include <async_mqtt5/impl/write_op.hpp>
namespace async_mqtt5::detail {
namespace asio = boost::asio;
using error_code = boost::system::error_code;
template <
typename StreamType,

View File

@@ -3,18 +3,18 @@
#include <boost/asio/experimental/concurrent_channel.hpp>
#include <async_mqtt5/error.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/impl/autoconnect_stream.hpp>
#include <async_mqtt5/impl/replies.hpp>
#include <async_mqtt5/impl/async_sender.hpp>
#include <async_mqtt5/impl/assemble_op.hpp>
#include <async_mqtt5/impl/async_sender.hpp>
#include <async_mqtt5/impl/autoconnect_stream.hpp>
#include <async_mqtt5/impl/ping_op.hpp>
#include <async_mqtt5/impl/replies.hpp>
#include <async_mqtt5/impl/sentry_op.hpp>
namespace async_mqtt5::detail {
namespace asio = boost::asio;
template <typename StreamType, typename TlsContext>
class stream_context;
@@ -95,8 +95,8 @@ template <
typename TlsContext = std::monostate
>
class client_service {
using stream_context_type = detail::stream_context<StreamType, TlsContext>;
using stream_type = detail::autoconnect_stream<
using stream_context_type = stream_context<StreamType, TlsContext>;
using stream_type = autoconnect_stream<
StreamType, stream_context_type
>;
public:
@@ -108,26 +108,26 @@ private:
>;
template <typename ClientService>
friend class detail::async_sender;
friend class async_sender;
template <typename ClientService, typename Handler>
friend class detail::assemble_op;
friend class assemble_op;
template <typename ClientService>
friend class detail::ping_op;
friend class ping_op;
template <typename ClientService>
friend class detail::sentry_op;
friend class sentry_op;
stream_context_type _stream_context;
stream_type _stream;
packet_id_allocator _pid_allocator;
detail::replies _replies;
detail::async_sender<client_service> _async_sender;
replies _replies;
async_sender<client_service> _async_sender;
std::string _read_buff;
detail::data_span _active_span;
data_span _active_span;
receive_channel _rec_channel;
@@ -231,7 +231,7 @@ public:
template <typename CompletionToken>
decltype(auto) async_assemble(duration wait_for, CompletionToken&& token) {
auto initiation = [this] (auto handler, duration wait_for) mutable {
detail::assemble_op {
assemble_op {
*this, std::move(handler),
_read_buff, _active_span
}.perform(wait_for, asio::transfer_at_least(0));

View File

@@ -1,26 +1,26 @@
#ifndef ASYNC_MQTT5_CONNECT_OP_HPP
#define ASYNC_MQTT5_CONNECT_OP_HPP
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/consign.hpp>
#include <boost/asio/prepend.hpp>
#include <boost/asio/append.hpp>
#include <boost/asio/consign.hpp>
#include <boost/asio/dispatch.hpp>
#include <boost/asio/prepend.hpp>
#include <boost/asio/read.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/write.hpp>
#include <boost/beast/websocket.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <async_mqtt5/error.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/detail/async_traits.hpp>
#include <async_mqtt5/detail/control_packet.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/impl/internal/codecs/base_decoders.hpp>
#include <async_mqtt5/impl/internal/codecs/message_encoders.hpp>
#include <async_mqtt5/impl/internal/codecs/message_decoders.hpp>
#include <async_mqtt5/impl/internal/codecs/message_encoders.hpp>
namespace async_mqtt5::detail {
@@ -71,7 +71,7 @@ public:
}
void perform(
const connect_op::epoints& eps, authority_path ap
const epoints& eps, authority_path ap
) {
lowest_layer(_stream).async_connect(
*std::begin(eps),
@@ -83,7 +83,7 @@ public:
}
void operator()(
on_connect, error_code ec, connect_op::endpoint ep, authority_path ap
on_connect, error_code ec, endpoint ep, authority_path ap
) {
if (ec)
return complete(ec);
@@ -91,7 +91,7 @@ public:
do_tls_handshake(std::move(ep), std::move(ap));
}
void do_tls_handshake(connect_op::endpoint ep, authority_path ap) {
void do_tls_handshake(endpoint ep, authority_path ap) {
if constexpr (has_tls_handshake<Stream>) {
_stream.async_handshake(
tls_handshake_type<Stream>::client,
@@ -116,7 +116,7 @@ public:
void operator()(
on_tls_handshake, error_code ec,
connect_op::endpoint ep, authority_path ap
endpoint ep, authority_path ap
) {
if (ec)
return complete(ec);
@@ -124,7 +124,7 @@ public:
do_ws_handshake(std::move(ep), std::move(ap));
}
void do_ws_handshake(connect_op::endpoint ep, authority_path ap) {
void do_ws_handshake(endpoint ep, authority_path ap) {
if constexpr (has_ws_handshake<Stream>) {
using namespace boost::beast;
@@ -173,7 +173,7 @@ public:
const auto& wire_data = packet.wire_data();
async_mqtt5::detail::async_write(
detail::async_write(
_stream, asio::buffer(wire_data),
asio::consign(
asio::prepend(std::move(*this), on_send_connect{}),

View File

@@ -1,14 +1,15 @@
#ifndef ASYNC_MQTT5_DISCONNECT_OP_HPP
#define ASYNC_MQTT5_DISCONNECT_OP_HPP
#include <boost/asio/prepend.hpp>
#include <boost/asio/consign.hpp>
#include <boost/asio/dispatch.hpp>
#include <boost/asio/prepend.hpp>
#include <async_mqtt5/types.hpp>
#include <async_mqtt5/detail/async_traits.hpp>
#include <async_mqtt5/detail/control_packet.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/impl/internal/codecs/message_encoders.hpp>
namespace async_mqtt5::detail {
@@ -119,18 +120,18 @@ decltype(auto) async_disconnect(
using Signature = void (error_code);
auto initiate = [](
auto handler, detail::disconnect_context ctx, bool terminal,
auto handler, disconnect_context ctx,
const std::shared_ptr<ClientService>& svc_ptr
) {
detail::disconnect_op {
disconnect_op {
svc_ptr, std::move(ctx), std::move(handler)
}.perform();
};
return asio::async_initiate<CompletionToken, Signature>(
std::move(initiate), token,
detail::disconnect_context { reason_code, props, terminal },
terminal, svc_ptr
disconnect_context { reason_code, props, terminal },
svc_ptr
);
}

View File

@@ -1,16 +1,19 @@
#ifndef ASYNC_MQTT5_ENDPOINTS_HPP
#define ASYNC_MQTT5_ENDPOINTS_HPP
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/prepend.hpp>
#include <boost/asio/append.hpp>
#include <boost/asio/deferred.hpp>
#include <boost/asio/dispatch.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/prepend.hpp>
#include <boost/asio/experimental/parallel_group.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/spirit/home/x3.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/detail/async_traits.hpp>
#include <async_mqtt5/types.hpp>
namespace async_mqtt5::detail {

View File

@@ -1,9 +1,6 @@
#ifndef ASYNC_MQTT5_MEMORY_H
#define ASYNC_MQTT5_MEMORY_H
#include <string>
#include <vector>
#include "memory_resource.h"
namespace pma {

View File

@@ -3,11 +3,12 @@
#include <boost/spirit/home/x3.hpp>
#include <boost/spirit/home/x3/binary/binary.hpp>
#include <boost/fusion/adapted/std_tuple.hpp>
#include <async_mqtt5/property_types.hpp>
#include <async_mqtt5/impl/internal/codecs/traits.hpp>
#include <async_mqtt5/impl/internal/codecs/traits.hpp>
namespace async_mqtt5::decoders {

View File

@@ -3,9 +3,11 @@
#include <cstddef>
#include <cstdint>
#include <boost/endian/conversion.hpp>
#include <async_mqtt5/property_types.hpp>
#include <async_mqtt5/impl/internal/codecs/traits.hpp>
namespace async_mqtt5::encoders {

View File

@@ -5,6 +5,7 @@
#include <string>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/impl/internal/codecs/base_decoders.hpp>
#include <async_mqtt5/impl/internal/codecs/message_decoders.hpp>

View File

@@ -5,6 +5,7 @@
#include <optional>
#include <async_mqtt5/types.hpp>
#include <async_mqtt5/impl/internal/codecs/base_encoders.hpp>
#include <async_mqtt5/impl/internal/codecs/message_encoders.hpp>

View File

@@ -4,14 +4,14 @@
#include <chrono>
#include <memory>
#include <boost/asio/prepend.hpp>
#include <boost/asio/consign.hpp>
#include <boost/asio/prepend.hpp>
#include <boost/asio/recycling_allocator.hpp>
#include <boost/asio/cancellation_state.hpp>
#include <boost/asio/steady_timer.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/detail/control_packet.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/impl/internal/codecs/message_encoders.hpp>
namespace async_mqtt5::detail {

View File

@@ -2,19 +2,21 @@
#define ASYNC_MQTT5_PUBLISH_REC_OP_HPP
#include <memory>
#include <boost/asio/prepend.hpp>
#include <boost/asio/consign.hpp>
#include <boost/asio/detached.hpp>
#include <boost/asio/dispatch.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/prepend.hpp>
#include <boost/asio/recycling_allocator.hpp>
#include <async_mqtt5/error.hpp>
#include <async_mqtt5/property_types.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/detail/control_packet.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/impl/disconnect_op.hpp>
#include <async_mqtt5/impl/internal/codecs/message_encoders.hpp>
#include <async_mqtt5/impl/internal/codecs/message_decoders.hpp>
#include <async_mqtt5/impl/internal/codecs/message_encoders.hpp>
namespace async_mqtt5::detail {
@@ -69,7 +71,7 @@ public:
auto puback = control_packet<allocator_type>::of(
with_pid, get_allocator(),
encoders::encode_puback, *packet_id,
uint8_t(0), puback_props{}
uint8_t(0), puback_props {}
);
return send_puback(std::move(puback));
}
@@ -78,7 +80,7 @@ public:
auto pubrec = control_packet<allocator_type>::of(
with_pid, get_allocator(),
encoders::encode_pubrec, *packet_id,
uint8_t(0), pubrec_props{}
uint8_t(0), pubrec_props {}
);
return send_pubrec(std::move(pubrec));

View File

@@ -2,18 +2,18 @@
#define ASYNC_MQTT5_PUBLISH_SEND_OP_HPP
#include <boost/asio/detached.hpp>
#include <boost/asio/prepend.hpp>
#include <async_mqtt5/error.hpp>
#include <async_mqtt5/types.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/detail/async_traits.hpp>
#include <async_mqtt5/detail/control_packet.hpp>
#include <async_mqtt5/detail/cancellable_handler.hpp>
#include <async_mqtt5/impl/internal/codecs/message_decoders.hpp>
#include <async_mqtt5/impl/internal/codecs/message_encoders.hpp>
#include <async_mqtt5/detail/control_packet.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/impl/disconnect_op.hpp>
#include <async_mqtt5/impl/internal/codecs/message_decoders.hpp>
#include <async_mqtt5/impl/internal/codecs/message_encoders.hpp>
namespace async_mqtt5::detail {

View File

@@ -7,10 +7,13 @@
#include <boost/asio/recycling_allocator.hpp>
#include <async_mqtt5/types.hpp>
#include <async_mqtt5/detail/control_packet.hpp>
#include <async_mqtt5/impl/internal/codecs/message_decoders.hpp>
#include <async_mqtt5/impl/publish_rec_op.hpp>
#include <async_mqtt5/impl/disconnect_op.hpp>
#include <async_mqtt5/impl/publish_rec_op.hpp>
#include <async_mqtt5/impl/internal/codecs/message_decoders.hpp>
namespace async_mqtt5::detail {
@@ -76,6 +79,7 @@ public:
private:
// TODO: ec & packet_id are not used here
void dispatch(
error_code ec, uint16_t packet_id, uint8_t control_byte,
byte_citer first, byte_citer last
@@ -106,6 +110,7 @@ private:
}
break;
}
perform();
}

View File

@@ -1,8 +1,9 @@
#ifndef ASYNC_MQTT5_READ_OP_HPP
#define ASYNC_MQTT5_READ_OP_HPP
#include <boost/asio/prepend.hpp>
#include <boost/asio/deferred.hpp>
#include <boost/asio/prepend.hpp>
#include <boost/asio/experimental/parallel_group.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
@@ -57,7 +58,6 @@ public:
asioex::wait_for_one(),
asio::prepend(std::move(*this), on_read {}, stream_ptr)
);
}
else
(*this)(

View File

@@ -1,14 +1,18 @@
#ifndef ASYNC_MQTT5_RECONNECT_OP_HPP
#define ASYNC_MQTT5_RECONNECT_OP_HPP
#include <boost/asio/prepend.hpp>
#include <boost/asio/dispatch.hpp>
#include <boost/asio/deferred.hpp>
#include <boost/asio/dispatch.hpp>
#include <boost/asio/prepend.hpp>
#include <boost/asio/experimental/parallel_group.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <async_mqtt5/types.hpp>
#include <async_mqtt5/detail/async_traits.hpp>
#include <async_mqtt5/impl/connect_op.hpp>
namespace async_mqtt5::detail {

View File

@@ -1,16 +1,13 @@
#ifndef ASYNC_MQTT5_REPLIES_HPP
#define ASYNC_MQTT5_REPLIES_HPP
#include <boost/asio/error.hpp>
#include <boost/asio/any_completion_handler.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/dispatch.hpp>
#include <boost/asio/consign.hpp>
#include <async_mqtt5/error.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <boost/asio/error.hpp>
#include <boost/asio/post.hpp>
#include <async_mqtt5/detail/control_packet.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
namespace async_mqtt5::detail {

View File

@@ -1,14 +1,17 @@
#ifndef ASYNC_MQTT5_SENTRY_OP_HPP
#define ASYNC_MQTT5_SENTRY_OP_HPP
#include <boost/asio/cancellation_signal.hpp>
#include <boost/asio/error.hpp>
#include <boost/asio/recycling_allocator.hpp>
#include <boost/asio/prepend.hpp>
#include <boost/asio/cancellation_state.hpp>
#include <boost/asio/recycling_allocator.hpp>
#include <boost/asio/steady_timer.hpp>
#include <async_mqtt5/error.hpp>
#include <async_mqtt5/types.hpp>
#include <async_mqtt5/impl/disconnect_op.hpp>
namespace async_mqtt5::detail {
namespace asio = boost::asio;

View File

@@ -5,13 +5,12 @@
#include <async_mqtt5/error.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/detail/async_traits.hpp>
#include <async_mqtt5/detail/control_packet.hpp>
#include <async_mqtt5/detail/cancellable_handler.hpp>
#include <async_mqtt5/detail/control_packet.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/impl/internal/codecs/message_encoders.hpp>
#include <async_mqtt5/impl/internal/codecs/message_decoders.hpp>
#include <async_mqtt5/impl/internal/codecs/message_encoders.hpp>
#include <async_mqtt5/impl/disconnect_op.hpp>

View File

@@ -1,18 +1,18 @@
#ifndef ASYNC_MQTT5_UNSUBSCRIBE_OP_HPP
#define ASYNC_MQTT5_UNSUBSCRIBE_OP_HPP
#include <boost/asio/associated_allocator.hpp>
#include <boost/asio/detached.hpp>
#include <async_mqtt5/error.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/detail/async_traits.hpp>
#include <async_mqtt5/detail/control_packet.hpp>
#include <async_mqtt5/detail/cancellable_handler.hpp>
#include <async_mqtt5/impl/internal/codecs/message_encoders.hpp>
#include <async_mqtt5/impl/internal/codecs/message_decoders.hpp>
#include <async_mqtt5/detail/cancellable_handler.hpp>
#include <async_mqtt5/detail/control_packet.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/impl/disconnect_op.hpp>
#include <async_mqtt5/impl/internal/codecs/message_decoders.hpp>
#include <async_mqtt5/impl/internal/codecs/message_encoders.hpp>
namespace async_mqtt5::detail {
@@ -144,7 +144,7 @@ private:
void on_malformed_packet(
const std::string& reason
) {
auto props = disconnect_props{};
auto props = disconnect_props {};
props[prop::reason_string] = reason;
async_disconnect(
disconnect_rc_e::malformed_packet, props, false, _svc_ptr,

View File

@@ -1,11 +1,10 @@
#ifndef ASYNC_MQTT5_WRITE_OP_HPP
#define ASYNC_MQTT5_WRITE_OP_HPP
#include <boost/asio/dispatch.hpp>
#include <boost/asio/prepend.hpp>
#include <boost/asio/write.hpp>
#include <boost/asio/dispatch.hpp>
#include <async_mqtt5/detail/internal_types.hpp>
#include <async_mqtt5/detail/async_traits.hpp>
namespace async_mqtt5::detail {

View File

@@ -1,9 +1,14 @@
#ifndef ASYNC_MQTT5_MQTT_CLIENT_HPP
#define ASYNC_MQTT5_MQTT_CLIENT_HPP
#include <boost/system/error_code.hpp>
#include <async_mqtt5/error.hpp>
#include <async_mqtt5/types.hpp>
#include <async_mqtt5/impl/client_service.hpp>
#include <async_mqtt5/impl/read_message_op.hpp>
#include <async_mqtt5/impl/publish_send_op.hpp>
#include <async_mqtt5/impl/read_message_op.hpp>
#include <async_mqtt5/impl/subscribe_op.hpp>
#include <async_mqtt5/impl/unsubscribe_op.hpp>

View File

@@ -3,11 +3,11 @@
#include <cstdint>
#include <string>
#include <boost/system/error_code.hpp>
#include <async_mqtt5/property_types.hpp>
#include <async_mqtt5/error.hpp>
#include <async_mqtt5/property_types.hpp>
namespace async_mqtt5 {

View File

@@ -4,9 +4,8 @@
#include <chrono>
#include <boost/asio/append.hpp>
#include <boost/asio/cancellation_signal.hpp>
#include <boost/asio/cancellation_state.hpp>
#include <boost/asio/bind_cancellation_slot.hpp>
#include <boost/asio/cancellation_signal.hpp>
#include <boost/asio/dispatch.hpp>
#include <boost/asio/prepend.hpp>
#include <boost/asio/recycling_allocator.hpp>

View File

@@ -7,16 +7,10 @@
#include <string>
#include <vector>
#include <boost/asio/append.hpp>
#include <boost/asio/detached.hpp>
#include <boost/asio/steady_timer.hpp>
#include "test_common/delayed_op.hpp"
namespace async_mqtt5::test {
namespace asio = boost::asio;
using error_code = boost::system::error_code;
using time_stamp = std::chrono::time_point<std::chrono::steady_clock>;
using duration = time_stamp::duration;

View File

@@ -1,15 +1,16 @@
#ifndef ASYNC_MQTT5_TEST_PACKET_UTIL_HPP
#define ASYNC_MQTT5_TEST_PACKET_UTIL_HPP
#include <unordered_map>
#include <string>
#include <async_mqtt5/detail/control_packet.hpp>
#include <async_mqtt5/impl/internal/codecs/message_decoders.hpp>
#include <async_mqtt5/impl/internal/codecs/message_encoders.hpp>
#include <async_mqtt5/detail/control_packet.hpp>
namespace async_mqtt5::test {
using error_code = boost::system::error_code;
inline qos_e extract_qos(uint8_t flags) {
auto byte = (flags & 0b0110) >> 1;

View File

@@ -9,18 +9,18 @@
#include <boost/asio/any_completion_handler.hpp>
#include <boost/asio/any_io_executor.hpp>
#include <boost/asio/cancellation_signal.hpp>
#include <boost/asio/bind_cancellation_slot.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/prepend.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/test/included/unit_test.hpp>
#include <async_mqtt5/impl/internal/codecs/message_decoders.hpp>
#include "test_common/protocol_logging.hpp"
#include "test_common/message_exchange.hpp"
#include "test_common/packet_util.hpp"
#include "test_common/protocol_logging.hpp"
namespace async_mqtt5::test {

View File

@@ -1,9 +1,8 @@
#ifndef ASYNC_MQTT5_TEST_TEST_SERVICE_HPP
#define ASYNC_MQTT5_TEST_TEST_SERVICE_HPP
#include <string>
#include <boost/asio/any_io_executor.hpp>
#include <boost/asio/associated_executor.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/prepend.hpp>
@@ -11,6 +10,8 @@
namespace async_mqtt5::test {
namespace asio = boost::asio;
template <
typename StreamType,
typename TlsContext = std::monostate
@@ -31,13 +32,13 @@ public:
CompletionToken&& token
) {
auto initiation = [this](auto handler) {
auto ex = boost::asio::get_associated_executor(handler, _ex);
boost::asio::post(ex,
boost::asio::prepend(std::move(handler), error_code {})
auto ex = asio::get_associated_executor(handler, _ex);
asio::post(ex,
asio::prepend(std::move(handler), error_code {})
);
};
return boost::asio::async_initiate<
return asio::async_initiate<
CompletionToken, void (error_code)
> (std::move(initiation), token);
}

View File

@@ -3,18 +3,17 @@
#include <boost/asio/dispatch.hpp>
#include <boost/asio/execution_context.hpp>
#include <boost/asio/recycling_allocator.hpp>
#include <boost/asio/prepend.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/prepend.hpp>
#include <boost/asio/recycling_allocator.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/experimental/channel.hpp>
#include "test_common/test_broker.hpp"
namespace async_mqtt5::test {
namespace asio = boost::asio;
namespace asioex = asio::experimental;
using error_code = boost::system::error_code;
using time_stamp = std::chrono::time_point<std::chrono::steady_clock>;

View File

@@ -1,4 +1,5 @@
#include <boost/test/unit_test.hpp>
#include <test_common/protocol_logging.hpp>
boost::unit_test::test_suite* init_tests(

View File

@@ -1,15 +1,16 @@
#include <boost/test/unit_test.hpp>
#include <chrono>
#include <boost/asio/io_context.hpp>
#include <boost/asio/steady_timer.hpp>
#include <async_mqtt5.hpp>
#include <async_mqtt5/impl/internal/codecs/message_encoders.hpp>
#include "test_common/test_stream.hpp"
#include "test_common/message_exchange.hpp"
#include <async_mqtt5.hpp>
#include <boost/test/unit_test.hpp>
#include "test_common/message_exchange.hpp"
#include "test_common/test_stream.hpp"
using namespace async_mqtt5;

View File

@@ -1,7 +1,5 @@
#include <boost/test/unit_test.hpp>
#include <async_mqtt5.hpp>
#include <boost/asio/co_spawn.hpp>
#include <boost/asio/detached.hpp>
#include <boost/asio/io_context.hpp>
@@ -10,6 +8,8 @@
#include <boost/beast/websocket.hpp>
#include <async_mqtt5.hpp>
BOOST_AUTO_TEST_SUITE(coroutine/*, *boost::unit_test::disabled()*/)
using namespace async_mqtt5;

View File

@@ -6,6 +6,7 @@
#include <boost/asio/steady_timer.hpp>
#include <async_mqtt5/error.hpp>
#include <async_mqtt5/impl/client_service.hpp>
#include <async_mqtt5/impl/publish_send_op.hpp>

View File

@@ -1,6 +1,7 @@
#include <boost/test/unit_test.hpp>
#include <async_mqtt5/types.hpp>
#include <async_mqtt5/impl/internal/codecs/message_decoders.hpp>
#include <async_mqtt5/impl/internal/codecs/message_encoders.hpp>

View File

@@ -55,9 +55,9 @@
<ClInclude Include="..\include\async_mqtt5\impl\subscribe_op.hpp" />
<ClInclude Include="..\include\async_mqtt5\impl\unsubscribe_op.hpp" />
<ClInclude Include="..\include\async_mqtt5\impl\write_op.hpp" />
<ClInclude Include="..\include\async_mqtt5\mqtt_client.hpp" />
<ClInclude Include="..\include\async_mqtt5\property_types.hpp" />
<ClInclude Include="..\include\async_mqtt5\types.hpp" />
<ClInclude Include="..\include\mqtt_client.hpp" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\example\openssl-tls.cpp" />

View File

@@ -147,12 +147,12 @@
<ClInclude Include="..\include\async_mqtt5\error.hpp">
<Filter>Header Files\include</Filter>
</ClInclude>
<ClInclude Include="..\include\mqtt_client.hpp">
<Filter>Header Files\include</Filter>
</ClInclude>
<ClInclude Include="..\include\async_mqtt5.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\async_mqtt5\mqtt_client.hpp">
<Filter>Header Files\include</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\example\openssl-tls.cpp">

View File

@@ -18,13 +18,6 @@
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\test\unit\src\run_tests.cpp" />
<ClCompile Include="..\..\test\unit\test\client_broker.cpp" />
<ClCompile Include="..\..\test\unit\test\coroutine.cpp" />
<ClCompile Include="..\..\test\unit\test\publish_send_op.cpp" />
<ClCompile Include="..\..\test\unit\test\serialization.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\test\unit\include\test_common\delayed_op.hpp" />
<ClInclude Include="..\..\test\unit\include\test_common\message_exchange.hpp" />
@@ -34,6 +27,13 @@
<ClInclude Include="..\..\test\unit\include\test_common\test_service.hpp" />
<ClInclude Include="..\..\test\unit\include\test_common\test_stream.hpp" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\test\unit\src\run_tests.cpp" />
<ClCompile Include="..\..\test\unit\test\client_broker.cpp" />
<ClCompile Include="..\..\test\unit\test\coroutine.cpp" />
<ClCompile Include="..\..\test\unit\test\publish_send_op.cpp" />
<ClCompile Include="..\..\test\unit\test\serialization.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>

View File

@@ -13,29 +13,12 @@
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Source Files\test">
<UniqueIdentifier>{237ad32b-00b2-42f0-8b54-e4f62a437742}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\test_common">
<UniqueIdentifier>{6361a7f6-7954-4ea3-a2a7-f3b15537a3ac}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\test\unit\test\client_broker.cpp">
<Filter>Source Files\test</Filter>
</ClCompile>
<ClCompile Include="..\..\test\unit\test\coroutine.cpp">
<Filter>Source Files\test</Filter>
</ClCompile>
<ClCompile Include="..\..\test\unit\test\publish_send_op.cpp">
<Filter>Source Files\test</Filter>
</ClCompile>
<ClCompile Include="..\..\test\unit\test\serialization.cpp">
<Filter>Source Files\test</Filter>
</ClCompile>
<ClCompile Include="..\..\test\unit\src\run_tests.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<Filter Include="Source Files\test">
<UniqueIdentifier>{cf0bb550-9227-400c-9e0a-8b38fe2c32a3}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\test\unit\include\test_common\delayed_op.hpp">
@@ -60,4 +43,21 @@
<Filter>Header Files\test_common</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\test\unit\test\client_broker.cpp">
<Filter>Source Files\test</Filter>
</ClCompile>
<ClCompile Include="..\..\test\unit\test\coroutine.cpp">
<Filter>Source Files\test</Filter>
</ClCompile>
<ClCompile Include="..\..\test\unit\test\publish_send_op.cpp">
<Filter>Source Files\test</Filter>
</ClCompile>
<ClCompile Include="..\..\test\unit\test\serialization.cpp">
<Filter>Source Files\test</Filter>
</ClCompile>
<ClCompile Include="..\..\test\unit\src\run_tests.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>