7 #if !defined(MQTT_TCP_ENDPOINT_HPP)
8 #define MQTT_TCP_ENDPOINT_HPP
10 #include <boost/asio.hpp>
11 #include <boost/asio/bind_executor.hpp>
22 template <
typename Socket,
typename Strand>
25 template <
typename... Args>
27 :tcp_(ioc, std::forward<Args>(args)...),
32 as::mutable_buffer buffers,
33 std::function<
void(
error_code, std::size_t)> handler
46 std::vector<as::const_buffer> buffers,
47 std::function<
void(
error_code, std::size_t)> handler
60 std::vector<as::const_buffer> buffers,
63 return as::write(tcp_,
force_move(buffers), ec);
74 return tcp_.lowest_layer();
78 return tcp_.native_handle();
82 tcp_.lowest_layer().close(ec);
85 #if BOOST_VERSION < 107400 || defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT)
96 auto const&
socket()
const {
return tcp_; }
98 template <
typename... Args>
100 tcp_.set_option(std::forward<Args>(args)...);
103 template <
typename... Args>
105 tcp_.async_accept(std::forward<Args>(args)...);
108 #if defined(MQTT_USE_TLS)
110 template <
typename... Args>
111 void handshake(Args&& ... args) {
112 tcp_.handshake(std::forward<Args>(args)...);
115 template <
typename... Args>
116 void async_handshake(Args&& ... args) {
117 tcp_.async_handshake(std::forward<Args>(args)...);
#define MQTT_ALWAYS_INLINE
Definition: attributes.hpp:18
Definition: type_erased_socket.hpp:22
Definition: tcp_endpoint.hpp:23
MQTT_ALWAYS_INLINE as::executor get_executor() override final
Definition: tcp_endpoint.hpp:86
MQTT_ALWAYS_INLINE void close(boost::system::error_code &ec) override final
Definition: tcp_endpoint.hpp:81
MQTT_ALWAYS_INLINE std::size_t write(std::vector< as::const_buffer > buffers, boost::system::error_code &ec) override final
Definition: tcp_endpoint.hpp:59
MQTT_ALWAYS_INLINE any native_handle() override final
Definition: tcp_endpoint.hpp:77
void async_accept(Args &&... args)
Definition: tcp_endpoint.hpp:104
MQTT_ALWAYS_INLINE void async_read(as::mutable_buffer buffers, std::function< void(error_code, std::size_t)> handler) override final
Definition: tcp_endpoint.hpp:31
MQTT_ALWAYS_INLINE as::ip::tcp::socket::lowest_layer_type & lowest_layer() override final
Definition: tcp_endpoint.hpp:73
void set_option(Args &&... args)
Definition: tcp_endpoint.hpp:99
auto const & socket() const
Definition: tcp_endpoint.hpp:96
MQTT_ALWAYS_INLINE void post(std::function< void()> handler) override final
Definition: tcp_endpoint.hpp:66
tcp_endpoint(as::io_context &ioc, Args &&... args)
Definition: tcp_endpoint.hpp:26
MQTT_ALWAYS_INLINE void async_write(std::vector< as::const_buffer > buffers, std::function< void(error_code, std::size_t)> handler) override final
Definition: tcp_endpoint.hpp:45
auto & socket()
Definition: tcp_endpoint.hpp:95
boost::system::error_code error_code
Definition: error_code.hpp:16
constexpr std::remove_reference_t< T > && force_move(T &&t)
Definition: move.hpp:20
Definition: buffer.hpp:242