acl  3.5.3.0
acl::mqtt_header类 参考

#include <mqtt_header.hpp>

+ acl::mqtt_header 的协作图:

Public 成员函数

 mqtt_header (mqtt_type_t type)
 
 mqtt_header (const mqtt_header &header)
 
virtual ~mqtt_header (void)
 
bool build_header (string &out)
 
int update (const char *data, int dlen)
 
bool finished (void) const
 
void reset (void)
 
mqtt_headerset_type (mqtt_type_t type)
 
mqtt_headerset_header_flags (char flags)
 
mqtt_headerset_remaing_length (unsigned len)
 
mqtt_headerset_qos (mqtt_qos_t qos)
 
mqtt_headerset_dup (bool yes)
 
mqtt_headerset_remain (bool yes)
 
mqtt_type_t get_type (void) const
 
unsigned char get_header_flags (void) const
 
unsigned get_remaining_length (void) const
 
mqtt_qos_t get_qos (void) const
 
bool is_dup (void) const
 
bool is_remain (void) const
 
int update_header_type (const char *data, int dlen)
 
int update_header_len (const char *data, int dlen)
 

详细描述

mqtt message header class, used for building or parsing mqtt header data.

在文件 mqtt_header.hpp71 行定义.

构造及析构函数说明

◆ mqtt_header() [1/2]

acl::mqtt_header::mqtt_header ( mqtt_type_t  type)

mqtt header constructor, usually for building mqtt message.

参数
type{mqtt_type_t}

◆ mqtt_header() [2/2]

acl::mqtt_header::mqtt_header ( const mqtt_header header)

mqtt header constructor, usually for parsing mqtt message.

参数
header{const mqtt_header&} will be copied internal.

◆ ~mqtt_header()

virtual acl::mqtt_header::~mqtt_header ( void  )
virtual

成员函数说明

◆ build_header()

bool acl::mqtt_header::build_header ( string out)

build mqtt header data after initializing the header object by calling the setting methods below like set_xxx.

参数
out{string&} store mqtt header data.
返回
{bool} return true if build header successfully.

◆ finished()

bool acl::mqtt_header::finished ( void  ) const
inline

check if the mqtt header has completed.

返回
{bool}

在文件 mqtt_header.hpp113 行定义.

113  {
114  return finished_;
115  }

◆ get_header_flags()

unsigned char acl::mqtt_header::get_header_flags ( void  ) const
inline

get the mqtt header flags.

返回
{unsigned char}

在文件 mqtt_header.hpp177 行定义.

177  {
178  return hflags_;
179  }

◆ get_qos()

mqtt_qos_t acl::mqtt_header::get_qos ( void  ) const

get the mqtt message's qos.

返回
{mqtt_qos_t}

◆ get_remaining_length()

unsigned acl::mqtt_header::get_remaining_length ( void  ) const
inline

get the length of the mqtt message body.

返回
{unsigned}

在文件 mqtt_header.hpp185 行定义.

185  {
186  return dlen_;
187  }

◆ get_type()

mqtt_type_t acl::mqtt_header::get_type ( void  ) const
inline

get the mqtt message type.

返回
{mqtt_type_t}

在文件 mqtt_header.hpp169 行定义.

169  {
170  return type_;
171  }

◆ is_dup()

bool acl::mqtt_header::is_dup ( void  ) const

check if the duplicated flag has been set in header.

返回
{bool}

◆ is_remain()

bool acl::mqtt_header::is_remain ( void  ) const

check if the remain flag has been set in header.

返回
{bool}

◆ reset()

void acl::mqtt_header::reset ( void  )

reset the status of the mqtt header object for reusing the object.

◆ set_dup()

mqtt_header& acl::mqtt_header::set_dup ( bool  yes)

set if the mqtt message be sent duplicated.

参数
yes{bool}
返回
{mqtt_header&}

◆ set_header_flags()

mqtt_header& acl::mqtt_header::set_header_flags ( char  flags)

set the mqtt header flags.

参数
flags{char}
返回
{mqtt_header&}

◆ set_qos()

mqtt_header& acl::mqtt_header::set_qos ( mqtt_qos_t  qos)

set the qos of the mqtt message.

参数
qos{mqtt_qos_t}
返回
{mqtt_header&}

◆ set_remain()

mqtt_header& acl::mqtt_header::set_remain ( bool  yes)

set the remain flag in mqtt header.

参数
yes{bool}
返回
{mqtt_header&}

◆ set_remaing_length()

mqtt_header& acl::mqtt_header::set_remaing_length ( unsigned  len)

set the length of the mqtt message body.

参数
len{unsigned}
返回
{mqtt_header&}

◆ set_type()

mqtt_header& acl::mqtt_header::set_type ( mqtt_type_t  type)

set the mqtt message type in mqtt header

参数
type{mqtt_type_t}
返回
{mqtt_header&}

◆ update()

int acl::mqtt_header::update ( const char *  data,
int  dlen 
)

parsing mqtt header data in streaming mode.

参数
data{const char*} the mqtt header data, not NULL.
dlen{int} the length of data, must > 0
返回
{int} return the length of the left data not consumed:

0: the header has completed and the length of left data can

be used as mqtt body or next mqtt message; 0: the data input has been consumed, you can call finished() to check if the mqtt header has completed. -1: some error happened when parsing the input data.

◆ update_header_len()

int acl::mqtt_header::update_header_len ( const char *  data,
int  dlen 
)

◆ update_header_type()

int acl::mqtt_header::update_header_type ( const char *  data,
int  dlen 
)

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