7#if !defined(ASYNC_MQTT_ENDPOINT_HPP)
8#define ASYNC_MQTT_ENDPOINT_HPP
10#include <async_mqtt/detail/endpoint_impl.hpp>
32template <role Role, std::
size_t PacketIdBytes,
typename NextLayer>
35 using impl_type = detail::basic_endpoint_impl<Role, PacketIdBytes, NextLayer>;
65 template <
typename... Args>
215 typename CompletionToken = as::default_completion_token_t<executor_type>
217#if !defined(GENERATING_DOCUMENTATION)
218 BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(
224 CompletionToken&& token = as::default_completion_token_t<executor_type>{}
243 typename CompletionToken = as::default_completion_token_t<executor_type>
245#if !defined(GENERATING_DOCUMENTATION)
246 BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(
252 CompletionToken&& token = as::default_completion_token_t<executor_type>{}
272 typename CompletionToken = as::default_completion_token_t<executor_type>
274#if !defined(GENERATING_DOCUMENTATION)
275 BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(
282 CompletionToken&& token = as::default_completion_token_t<executor_type>{}
301 typename CompletionToken = as::default_completion_token_t<executor_type>
303#if !defined(GENERATING_DOCUMENTATION)
304 BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(
311 CompletionToken&& token = as::default_completion_token_t<executor_type>{}
333 typename CompletionToken = as::default_completion_token_t<executor_type>
335#if !defined(GENERATING_DOCUMENTATION)
336 BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(
343 CompletionToken&& token = as::default_completion_token_t<executor_type>{}
362 typename CompletionToken = as::default_completion_token_t<executor_type>
364#if !defined(GENERATING_DOCUMENTATION)
365 BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(
371 CompletionToken&& token = as::default_completion_token_t<executor_type>{}
393 typename CompletionToken = as::default_completion_token_t<executor_type>
395#if !defined(GENERATING_DOCUMENTATION)
396 BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(
402 std::set<control_packet_type> types,
403 CompletionToken&& token = as::default_completion_token_t<executor_type>{}
426 typename CompletionToken = as::default_completion_token_t<executor_type>
428#if !defined(GENERATING_DOCUMENTATION)
429 BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(
436 std::set<control_packet_type> types,
437 CompletionToken&& token = as::default_completion_token_t<executor_type>{}
454 typename CompletionToken = as::default_completion_token_t<executor_type>
456#if !defined(GENERATING_DOCUMENTATION)
457 BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(
463 CompletionToken&& token = as::default_completion_token_t<executor_type>{}
483 typename CompletionToken = as::default_completion_token_t<executor_type>
485#if !defined(GENERATING_DOCUMENTATION)
486 BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(
493 CompletionToken&& token = as::default_completion_token_t<executor_type>{}
516 typename CompletionToken = as::default_completion_token_t<executor_type>
518#if !defined(GENERATING_DOCUMENTATION)
519 BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(
525 CompletionToken&& token = as::default_completion_token_t<executor_type>{}
545 typename CompletionToken = as::default_completion_token_t<executor_type>
547#if !defined(GENERATING_DOCUMENTATION)
548 BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(
555 CompletionToken&& token = as::default_completion_token_t<executor_type>{}
651 template <
typename Executor1>
666 template <
typename Other>
673 std::shared_ptr<impl_type> impl_;
678#include <async_mqtt/impl/endpoint_impl.hpp>
679#include <async_mqtt/impl/endpoint_acquire_unique_packet_id.hpp>
680#include <async_mqtt/impl/endpoint_acquire_unique_packet_id_wait_until.hpp>
681#include <async_mqtt/impl/endpoint_register_packet_id.hpp>
682#include <async_mqtt/impl/endpoint_release_packet_id.hpp>
683#include <async_mqtt/impl/endpoint_send.hpp>
684#include <async_mqtt/impl/endpoint_recv.hpp>
685#include <async_mqtt/impl/endpoint_close.hpp>
686#include <async_mqtt/impl/endpoint_restore_packets.hpp>
687#include <async_mqtt/impl/endpoint_get_stored_packets.hpp>
688#include <async_mqtt/impl/endpoint_regulate_for_store.hpp>
689#include <async_mqtt/impl/endpoint_add_retry.hpp>
MQTT endpoint corresponding to the connection.
Definition endpoint_fwd.hpp:32
async_recv(filter fil, std::set< control_packet_type > types, CompletionToken &&token=as::default_completion_token_t< executor_type >{})
receive packet if packet is not filterd, then next recv() starts automatically. if receive error happ...
~basic_endpoint()
destructor This function destroys the basic_endpoint, cancelling any outstanding asynchronous operati...
void set_bulk_write(bool val)
Set bulk write mode. If true, then concatenate multiple packets' const buffer sequence when send() is...
this_type & operator=(this_type &&)=default
move assign operator
void set_pingresp_recv_timeout(std::chrono::milliseconds duration)
Set timeout for receiving PINGRESP packet after PINGREQ packet is sent. If the timer is fired,...
basic_endpoint(this_type &&)=default
move constructor
async_release_packet_id(typename basic_packet_id_type< PacketIdBytes >::type packet_id, CompletionToken &&token=as::default_completion_token_t< executor_type >{})
release packet_id.
async_send(Packet packet, CompletionToken &&token=as::default_completion_token_t< executor_type >{})
send packet users can call send() before the previous send()'s CompletionToken is invoked
async_acquire_unique_packet_id_wait_until(CompletionToken &&token=as::default_completion_token_t< executor_type >{})
acuire unique packet_id. If packet_id is fully acquired, then wait until released.
async_regulate_for_store(v5::basic_publish_packet< PacketIdBytes > packet, CompletionToken &&token=as::default_completion_token_t< executor_type >{})
regulate publish packet for store remove topic alias from the packet and extract the topic name
lowest_layer_type & lowest_layer()
lowest_layer getter
basic_packet_variant< PacketIdBytes > packet_variant_type
Type of packet_variant.
Definition endpoint.hpp:51
void set_auto_map_topic_alias_send(bool val)
auto map (allocate) topic alias on send PUBLISH packet. If all topic aliases are used,...
async_recv(CompletionToken &&token=as::default_completion_token_t< executor_type >{})
receive packet
std::set< typename basic_packet_id_type< PacketIdBytes >::type > get_qos2_publish_handled_pids() const
Get processed but not released QoS2 packet ids This function should be called after disconnection.
void set_auto_ping_response(bool val)
auto pingreq response setter. Should be called before send()/recv() call.
void set_auto_pub_response(bool val)
auto publish response setter. Should be called before send()/recv() call.
std::vector< basic_store_packet_variant< PacketIdBytes > > get_stored_packets() const
get stored packets sotred packets mean inflight packets.
void regulate_for_store(v5::basic_publish_packet< PacketIdBytes > &packet, error_code &ec) const
Regulate publish packet for store If topic is empty, extract topic from topic alias,...
typename next_layer_type::executor_type executor_type
executor_type of the given NextLayer
Definition endpoint.hpp:48
void restore_packets(std::vector< basic_store_packet_variant< PacketIdBytes > > pvs)
restore packets the restored packets would automatically send when CONNACK packet is received
void set_auto_replace_topic_alias_send(bool val)
auto replace topic with corresponding topic alias on send PUBLISH packet. Registering topic alias nee...
async_acquire_unique_packet_id(CompletionToken &&token=as::default_completion_token_t< executor_type >{})
acuire unique packet_id.
async_close(CompletionToken &&token=as::default_completion_token_t< executor_type >{})
close the underlying connection
async_recv(std::set< control_packet_type > types, CompletionToken &&token=as::default_completion_token_t< executor_type >{})
receive packet if packet is not filterd, then next recv() starts automatically. if receive error happ...
lowest_layer_type const & lowest_layer() const
lowest_layer getter
std::optional< typename basic_packet_id_type< PacketIdBytes >::type > acquire_unique_packet_id()
acuire unique packet_id.
protocol_version get_protocol_version() const
get MQTT protocol version
basic_endpoint(this_type const &)=delete
copy constructor deleted
async_restore_packets(std::vector< basic_store_packet_variant< PacketIdBytes > > pvs, CompletionToken &&token=as::default_completion_token_t< executor_type >{})
restore packets the restored packets would automatically send when CONNACK packet is received
basic_endpoint(protocol_version ver, Args &&... args)
constructor
void restore_qos2_publish_handled_pids(std::set< typename basic_packet_id_type< PacketIdBytes >::type > pids)
Restore processed but not released QoS2 packet ids This function should be called before receive the ...
async_get_stored_packets(CompletionToken &&token=as::default_completion_token_t< executor_type >{})
get stored packets
typename stream_type::lowest_layer_type lowest_layer_type
lowest_layer_type of the given NextLayer
Definition endpoint.hpp:45
next_layer_type & next_layer()
next_layer getter
void set_bulk_read_buffer_size(std::size_t val)
Set the bulk read buffer size. If bulk read is enabled, the val parameter specifies the size of the i...
void set_pingreq_send_interval(std::chrono::milliseconds duration)
Set PINGREQ packet sending interval.
next_layer_type const & next_layer() const
next_layer getter
bool register_packet_id(typename basic_packet_id_type< PacketIdBytes >::type packet_id)
register packet_id.
this_type & operator=(this_type const &)=delete
copy assign operator deleted
void release_packet_id(typename basic_packet_id_type< PacketIdBytes >::type packet_id)
release packet_id.
as::any_io_executor get_executor()
executor getter
typename stream_type::next_layer_type next_layer_type
type of the given NextLayer
Definition endpoint.hpp:42
async_register_packet_id(typename basic_packet_id_type< PacketIdBytes >::type packet_id, CompletionToken &&token=as::default_completion_token_t< executor_type >{})
register packet_id.
bool is_publish_processing(typename basic_packet_id_type< PacketIdBytes >::type pid) const
Get MQTT PUBLISH packet processing status.
The varaint type of all packets and system_error.
Definition packet_variant_fwd.hpp:37
MQTT packet variant for store.
Definition store_packet_variant_fwd.hpp:35
MQTT PUBLISH packet (v5)
Definition v5_publish.hpp:63
filter
receive packet filter
Definition endpoint.hpp:27
@ except
no matched control_packet_type is target
@ match
matched control_packet_type is target
sys::error_code error_code
sys is a namespace alias of boost::sytem.
Definition error.hpp:56
protocol_version
MQTT protocol version.
Definition protocol_version.hpp:29
rebinds the basic_endpoint type to another executor
Definition endpoint.hpp:652
packet idenfitifer type class template
Definition packet_id_type.hpp:25