acl  3.5.3.0
acl::mqtt_aclient类 参考abstract

#include <mqtt_aclient.hpp>

+ 类 acl::mqtt_aclient 继承关系图:
+ acl::mqtt_aclient 的协作图:

Public 成员函数

 mqtt_aclient (aio_handle &handle, sslbase_conf *ssl_conf=NULL)
 
virtual void destroy (void)=0
 
sslbase_confget_ssl_conf (void) const
 
bool open (const char *addr, int conn_timeout, int rw_timeout)
 
bool open (aio_socket_stream *conn)
 
void close (void)
 
aio_socket_streamget_conn (void) const
 
void set_host (const char *host)
 
bool send (mqtt_message &message)
 
bool get_ns_addr (string &out) const
 
bool get_server_addr (string &out) const
 
- Public 成员函数 继承自 acl::aio_open_callback
 aio_open_callback (void)
 
virtual ~aio_open_callback (void)
 
- Public 成员函数 继承自 acl::aio_callback
 aio_callback (void)
 
virtual ~aio_callback (void)
 
virtual bool write_callback (void)
 
virtual bool write_wakeup (void)
 

Protected 成员函数

virtual ~mqtt_aclient (void)
 
bool open_callback (void)
 
bool timeout_callback (void)
 
void close_callback (void)
 
bool read_wakeup (void)
 
bool read_callback (char *data, int len)
 
bool message_await (void)
 
virtual void on_ns_failed (void)
 
virtual void on_connect_timeout (void)
 
virtual void on_connect_failed (void)
 
virtual bool on_read_timeout (void)
 
virtual void on_disconnect (void)
 
virtual bool on_open (void)=0
 
virtual bool on_header (const mqtt_header &)
 
virtual bool on_body (const mqtt_message &)=0
 
- Protected 成员函数 继承自 acl::acl::noncopyable
 noncopyable ()
 
 ~noncopyable ()
 

详细描述

mqtt communication class in aio mode, used by mqtt client or mqtt server.

在文件 mqtt_aclient.hpp15 行定义.

构造及析构函数说明

◆ mqtt_aclient()

acl::mqtt_aclient::mqtt_aclient ( aio_handle handle,
sslbase_conf ssl_conf = NULL 
)

constructor

参数
handle{aio_handle&}
ssl_conf{sslbase_conf*} if not NULL, ssl will be used

◆ ~mqtt_aclient()

virtual acl::mqtt_aclient::~mqtt_aclient ( void  )
protectedvirtual

成员函数说明

◆ close()

void acl::mqtt_aclient::close ( void  )

close the connection with the mqtt server async

◆ close_callback()

void acl::mqtt_aclient::close_callback ( void  )
protectedvirtual

◆ destroy()

virtual void acl::mqtt_aclient::destroy ( void  )
pure virtual

because the subclass object was created dynamically, the method will be called when the subclass object is to be freed.

◆ get_conn()

aio_socket_stream* acl::mqtt_aclient::get_conn ( void  ) const
inline

get the connection with the mqtt server

返回
{aio_socket_stream*} return NULL if not connected

在文件 mqtt_aclient.hpp67 行定义.

67  {
68  return conn_;
69  }

◆ get_ns_addr()

bool acl::mqtt_aclient::get_ns_addr ( string out) const

get the current dns addr when connection one mqtt server

参数
out{string&} store the result.
返回
{bool} return true if getting dns address successfully.

◆ get_server_addr()

bool acl::mqtt_aclient::get_server_addr ( string out) const

get the mqtt server addr after resolving the domain's address.

参数
out{string&} store the result.
返回
{bool} return true if getting server's address successfully.

◆ get_ssl_conf()

sslbase_conf* acl::mqtt_aclient::get_ssl_conf ( void  ) const
inline

get the ssl conf object passed in constructor.

返回
{sslbase_conf*} return NULL if not set.

在文件 mqtt_aclient.hpp34 行定义.

34  {
35  return ssl_conf_;
36  }

◆ message_await()

bool acl::mqtt_aclient::message_await ( void  )
protected

◆ on_body()

virtual bool acl::mqtt_aclient::on_body ( const mqtt_message )
protectedpure virtual

◆ on_connect_failed()

virtual void acl::mqtt_aclient::on_connect_failed ( void  )
inlineprotectedvirtual

在文件 mqtt_aclient.hpp132 行定义.

132 {}

◆ on_connect_timeout()

virtual void acl::mqtt_aclient::on_connect_timeout ( void  )
inlineprotectedvirtual

在文件 mqtt_aclient.hpp129 行定义.

129 {}

◆ on_disconnect()

virtual void acl::mqtt_aclient::on_disconnect ( void  )
inlineprotectedvirtual

在文件 mqtt_aclient.hpp138 行定义.

138 {};

◆ on_header()

virtual bool acl::mqtt_aclient::on_header ( const mqtt_header )
inlineprotectedvirtual

在文件 mqtt_aclient.hpp144 行定义.

144 { return true; };

◆ on_ns_failed()

virtual void acl::mqtt_aclient::on_ns_failed ( void  )
inlineprotectedvirtual

在文件 mqtt_aclient.hpp126 行定义.

126 {}

◆ on_open()

virtual bool acl::mqtt_aclient::on_open ( void  )
protectedpure virtual

◆ on_read_timeout()

virtual bool acl::mqtt_aclient::on_read_timeout ( void  )
inlineprotectedvirtual

在文件 mqtt_aclient.hpp135 行定义.

135 { return false; }

◆ open() [1/2]

bool acl::mqtt_aclient::open ( const char *  addr,
int  conn_timeout,
int  rw_timeout 
)

connect the remote mqtt server, when connected with the server, the callback on_connect() will be called

参数
addr{const char*} the mqtt server's addr with the format ip|port, or domain|port
conn_timeout{int} the timeout for connecting to the server
rw_timeout{int} the timeout read/write with the server
返回
bool {bool} if return false, you should call destroy() to delete the subclass object

◆ open() [2/2]

bool acl::mqtt_aclient::open ( aio_socket_stream conn)

called when connect or accept one connection

参数
conn{aio_socket_stream*}
返回
bool {bool} if return false, you should call destroy() to delete the subclass object

◆ open_callback()

bool acl::mqtt_aclient::open_callback ( void  )
inlineprotectedvirtual

实现了 acl::aio_open_callback.

在文件 mqtt_aclient.hpp107 行定义.

107 { return true; }

◆ read_callback()

bool acl::mqtt_aclient::read_callback ( char *  data,
int  len 
)
protectedvirtual

◆ read_wakeup()

bool acl::mqtt_aclient::read_wakeup ( void  )
protectedvirtual

◆ send()

bool acl::mqtt_aclient::send ( mqtt_message message)

send one mqtt message to one mqtt peer.

参数
message{mqtt_message&}
返回
{bool} return true if sending successfully, or false if some error happened.

◆ set_host()

void acl::mqtt_aclient::set_host ( const char *  host)

set the remote host name to specify the SSL SNI for SSL handshake, used to connect one mqtt server as a connection client.

参数
host{const char*} the host name

◆ timeout_callback()

bool acl::mqtt_aclient::timeout_callback ( void  )
protectedvirtual

该类的文档由以下文件生成: