acl
3.5.3.0
|
#include <mqtt_message.hpp>
Public 成员函数 | |
mqtt_message (mqtt_type_t type) | |
mqtt_message (const mqtt_header &header) | |
virtual | ~mqtt_message (void) |
virtual bool | to_string (string &out)=0 |
virtual int | update (const char *data, int dlen)=0 |
virtual bool | finished (void) const |
mqtt_header & | get_header (void) |
const mqtt_header & | get_header (void) const |
静态 Public 成员函数 | |
static mqtt_message * | create_message (const mqtt_header &header) |
Protected 成员函数 | |
void | pack_add (unsigned char ch, string &out) |
void | pack_add (unsigned short n, string &out) |
void | pack_add (const string &s, string &out) |
bool | unpack_short (const char *data, size_t len, unsigned short &out) |
Protected 属性 | |
mqtt_header | header_ |
the pure virtual class for creating one mqtt message object from or to mqtt message data, all subclass of it should implement the pure virtual method. Any subclass of it can be used to parse mqtt data to create mqtt message, or serialize to string data from mqtt message.
在文件 mqtt_message.hpp 第 14 行定义.
acl::mqtt_message::mqtt_message | ( | mqtt_type_t | type | ) |
create message object to be used for sending message to peer.
type | {mqtt_type_t} |
acl::mqtt_message::mqtt_message | ( | const mqtt_header & | header | ) |
create message object after receiving message data from peer, because the mqtt message includes header and body, so we parse the protocol data in two steps: frist parsing the mqtt header, and then parsing the mqtt body.
header | {const mqtt_header&} created from the mqtt data and passed to the message object to be created. |
|
virtual |
virtual destructor.
|
static |
create mqtt message object with the specified mqtt header after parsing the mqtt data.
header | {const mqtt_header&} |
|
inlinevirtual |
check if the current mqtt object been parsing from mqtt data has been completed.
被 acl::mqtt_publish, acl::mqtt_connack, acl::mqtt_subscribe, acl::mqtt_suback, acl::mqtt_ack, acl::mqtt_unsubscribe, acl::mqtt_connect, acl::mqtt_disconnect, acl::mqtt_pingreq , 以及 acl::mqtt_pingresp 重载.
在文件 mqtt_message.hpp 第 66 行定义.
|
inline |
get the current mqtt message header in variable mode in order to change some information of the header.
在文件 mqtt_message.hpp 第 75 行定义.
|
inline |
get the current mqtt message header in invariable mode, just for getting some information from it.
在文件 mqtt_message.hpp 第 84 行定义.
|
protected |
|
protected |
|
pure virtual |
the subclass should implement this method to build mqtt message data, this is used as the mqtt message serialize.
out | {string&} used to store the mqtt data. |
在 acl::mqtt_publish, acl::mqtt_connack, acl::mqtt_subscribe, acl::mqtt_suback, acl::mqtt_ack, acl::mqtt_unsubscribe, acl::mqtt_connect, acl::mqtt_disconnect, acl::mqtt_pingreq , 以及 acl::mqtt_pingresp 内被实现.
|
protected |
|
pure virtual |
the subclass should implement this method to parse mqtt data, this is used as the mqtt message deserialize.
data | {char*} mqtt message data received from socket. |
dlen | {int} the length of data. |
data is for the next message object; -1: some error happened when parsing the mqtt message data; 0: all the data passed in has been consumed by the current mqtt message object, the object maybe complete or not, you should call finished() to check if the object has been completed.0: the current mqtt message object has been finished, the left
在 acl::mqtt_publish, acl::mqtt_connack, acl::mqtt_subscribe, acl::mqtt_suback, acl::mqtt_ack, acl::mqtt_unsubscribe, acl::mqtt_connect, acl::mqtt_disconnect, acl::mqtt_pingreq , 以及 acl::mqtt_pingresp 内被实现.
|
protected |
在文件 mqtt_message.hpp 第 99 行定义.