async_mqtt 5.0.0
Loading...
Searching...
No Matches
async_mqtt::v3_1_1::connect_packet Class Reference

MQTT CONNECT packet (v3.1.1) More...

#include <v3_1_1_connect.hpp>

Public Member Functions

 connect_packet (bool clean_session, std::uint16_t keep_alive_sec, buffer client_id, optional< buffer > user_name=nullopt, optional< buffer > password=nullopt)
 
 connect_packet (bool clean_session, std::uint16_t keep_alive_sec, buffer client_id, optional< will > w, optional< buffer > user_name=nullopt, optional< buffer > password=nullopt)
 
std::vector< as::const_buffer > const_buffer_sequence () const
 Create const buffer sequence it is for boost asio APIs.
 
std::size_t size () const
 Get packet size.
 
std::size_t num_of_const_buffer_sequence () const
 Get number of element of const_buffer_sequence.
 
bool clean_session () const
 Get clean_session.
 
std::uint16_t keep_alive () const
 Get keep_alive.
 
buffer client_id () const
 Get client_id.
 
optional< bufferuser_name () const
 Get user_name.
 
optional< bufferpassword () const
 Get password.
 
optional< will > get_will () const
 Get will.
 

Detailed Description

MQTT CONNECT packet (v3.1.1)

Only MQTT client can send this packet.
See http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718028

Constructor & Destructor Documentation

◆ connect_packet() [1/2]

async_mqtt::v3_1_1::connect_packet::connect_packet ( bool clean_session,
std::uint16_t keep_alive_sec,
buffer client_id,
optional< buffer > user_name = nullopt,
optional< buffer > password = nullopt )
inline

@bried constructor

Parameters
clean_sessionWhen the endpoint sends CONNECT packet with clean_session is true, then stored packets are erased. When the endpoint receives CONNECT packet with clean_session is false, then the endpoint start storing PUBLISH packet (QoS1 and QoS2) and PUBREL packet that would send by the endpoint until the corresponding response would be received.
See http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349231
keep_alive_secWhen the endpoint sends CONNECT packet with keep_alive_sec, then the endpoint start sending PINGREQ packet keep_alive_sec after the last packet is sent. When the endpoint receives CONNECT packet with keep_alive_sec, then start keep_alive_sec * 1.5 timer. The timer is reset if any packet is received. If the timer is fired, then the endpoint close the underlying layer automatically. At that time, if the endpoint recv() is called, then the CompletionToken is invoked with system_error.
See http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349237
client_idMQTT ClientIdentifier. It is the request to the broker for generating ClientIdentifier if it is empty string and clean_session is true, If false then protocol error.
See http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349242
user_nameMQTT UserName. It is often used for authentication.
See http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349245
passwordMQTT Password. It is often used for authentication.
See http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349246

◆ connect_packet() [2/2]

async_mqtt::v3_1_1::connect_packet::connect_packet ( bool clean_session,
std::uint16_t keep_alive_sec,
buffer client_id,
optional< will > w,
optional< buffer > user_name = nullopt,
optional< buffer > password = nullopt )
inline

@bried constructor

Parameters
clean_sessionWhen the endpoint sends CONNECT packet with clean_session is true, then stored packets are erased. When the endpoint receives CONNECT packet with clean_session is false, then the endpoint start storing PUBLISH packet (QoS1 and QoS2) and PUBREL packet that would send by the endpoint until the corresponding response would be received.
See http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349231
keep_alive_secWhen the endpoint sends CONNECT packet with keep_alive_sec, then the endpoint start sending PINGREQ packet keep_alive_sec after the last packet is sent. When the endpoint receives CONNECT packet with keep_alive_sec, then start keep_alive_sec * 1.5 timer. The timer is reset if any packet is received. If the timer is fired, then the endpoint close the underlying layer automatically. At that time, if the endpoint recv() is called, then the CompletionToken is invoked with system_error.
See http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349237
client_idMQTT ClientIdentifier. It is the request to the broker for generating ClientIdentifier if it is empty string and clean_session is true, If false then protocol error.
See http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349242
willMQTT Will
See http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349243
user_nameMQTT UserName. It is often used for authentication.
See http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349245
passwordMQTT Password. It is often used for authentication.
See http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349246

Member Function Documentation

◆ clean_session()

bool async_mqtt::v3_1_1::connect_packet::clean_session ( ) const
inline

Get clean_session.

Returns
clean_session

◆ client_id()

buffer async_mqtt::v3_1_1::connect_packet::client_id ( ) const
inline

Get client_id.

Returns
client_id

◆ const_buffer_sequence()

std::vector< as::const_buffer > async_mqtt::v3_1_1::connect_packet::const_buffer_sequence ( ) const
inline

Create const buffer sequence it is for boost asio APIs.

Returns
const buffer sequence

◆ get_will()

optional< will > async_mqtt::v3_1_1::connect_packet::get_will ( ) const
inline

Get will.

Returns
will

◆ keep_alive()

std::uint16_t async_mqtt::v3_1_1::connect_packet::keep_alive ( ) const
inline

Get keep_alive.

Returns
keep_alive

◆ num_of_const_buffer_sequence()

std::size_t async_mqtt::v3_1_1::connect_packet::num_of_const_buffer_sequence ( ) const
inline

Get number of element of const_buffer_sequence.

Returns
number of element of const_buffer_sequence

◆ password()

optional< buffer > async_mqtt::v3_1_1::connect_packet::password ( ) const
inline

Get password.

Returns
password

◆ size()

std::size_t async_mqtt::v3_1_1::connect_packet::size ( ) const
inline

Get packet size.

Returns
packet size

◆ user_name()

optional< buffer > async_mqtt::v3_1_1::connect_packet::user_name ( ) const
inline

Get user_name.

Returns
user_name

The documentation for this class was generated from the following file: