天嵌二次封装库使用手册  V2.1.2
MQTTProperties.h 文件参考
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

struct  MQTTLenString
 
struct  MQTTProperty
 
struct  MQTTProperties
 

宏定义

#define MQTT_INVALID_PROPERTY_ID   -2
 
#define MQTTProperties_initializer   {0, 0, 0, NULL}
 

类型定义

typedef struct MQTTProperties MQTTProperties
 

枚举

enum  MQTTPropertyCodes {
  MQTTPROPERTY_CODE_PAYLOAD_FORMAT_INDICATOR = 1, MQTTPROPERTY_CODE_MESSAGE_EXPIRY_INTERVAL = 2, MQTTPROPERTY_CODE_CONTENT_TYPE = 3, MQTTPROPERTY_CODE_RESPONSE_TOPIC = 8,
  MQTTPROPERTY_CODE_CORRELATION_DATA = 9, MQTTPROPERTY_CODE_SUBSCRIPTION_IDENTIFIER = 11, MQTTPROPERTY_CODE_SESSION_EXPIRY_INTERVAL = 17, MQTTPROPERTY_CODE_ASSIGNED_CLIENT_IDENTIFER = 18,
  MQTTPROPERTY_CODE_SERVER_KEEP_ALIVE = 19, MQTTPROPERTY_CODE_AUTHENTICATION_METHOD = 21, MQTTPROPERTY_CODE_AUTHENTICATION_DATA = 22, MQTTPROPERTY_CODE_REQUEST_PROBLEM_INFORMATION = 23,
  MQTTPROPERTY_CODE_WILL_DELAY_INTERVAL = 24, MQTTPROPERTY_CODE_REQUEST_RESPONSE_INFORMATION = 25, MQTTPROPERTY_CODE_RESPONSE_INFORMATION = 26, MQTTPROPERTY_CODE_SERVER_REFERENCE = 28,
  MQTTPROPERTY_CODE_REASON_STRING = 31, MQTTPROPERTY_CODE_RECEIVE_MAXIMUM = 33, MQTTPROPERTY_CODE_TOPIC_ALIAS_MAXIMUM = 34, MQTTPROPERTY_CODE_TOPIC_ALIAS = 35,
  MQTTPROPERTY_CODE_MAXIMUM_QOS = 36, MQTTPROPERTY_CODE_RETAIN_AVAILABLE = 37, MQTTPROPERTY_CODE_USER_PROPERTY = 38, MQTTPROPERTY_CODE_MAXIMUM_PACKET_SIZE = 39,
  MQTTPROPERTY_CODE_WILDCARD_SUBSCRIPTION_AVAILABLE = 40, MQTTPROPERTY_CODE_SUBSCRIPTION_IDENTIFIERS_AVAILABLE = 41, MQTTPROPERTY_CODE_SHARED_SUBSCRIPTION_AVAILABLE = 42
}
 
enum  MQTTPropertyTypes {
  MQTTPROPERTY_TYPE_BYTE, MQTTPROPERTY_TYPE_TWO_BYTE_INTEGER, MQTTPROPERTY_TYPE_FOUR_BYTE_INTEGER, MQTTPROPERTY_TYPE_VARIABLE_BYTE_INTEGER,
  MQTTPROPERTY_TYPE_BINARY_DATA, MQTTPROPERTY_TYPE_UTF_8_ENCODED_STRING, MQTTPROPERTY_TYPE_UTF_8_STRING_PAIR
}
 

函数

LIBMQTT_API const char * MQTTPropertyName (enum MQTTPropertyCodes value)
 
LIBMQTT_API int MQTTProperty_getType (enum MQTTPropertyCodes value)
 
int MQTTProperties_len (MQTTProperties *props)
 
LIBMQTT_API int MQTTProperties_add (MQTTProperties *props, const MQTTProperty *prop)
 
int MQTTProperties_write (char **pptr, const MQTTProperties *properties)
 
int MQTTProperties_read (MQTTProperties *properties, char **pptr, char *enddata)
 
LIBMQTT_API void MQTTProperties_free (MQTTProperties *properties)
 
LIBMQTT_API MQTTProperties MQTTProperties_copy (const MQTTProperties *props)
 
LIBMQTT_API int MQTTProperties_hasProperty (MQTTProperties *props, enum MQTTPropertyCodes propid)
 
LIBMQTT_API int MQTTProperties_propertyCount (MQTTProperties *props, enum MQTTPropertyCodes propid)
 
LIBMQTT_API int MQTTProperties_getNumericValue (MQTTProperties *props, enum MQTTPropertyCodes propid)
 
LIBMQTT_API int MQTTProperties_getNumericValueAt (MQTTProperties *props, enum MQTTPropertyCodes propid, int index)
 
LIBMQTT_API MQTTPropertyMQTTProperties_getProperty (MQTTProperties *props, enum MQTTPropertyCodes propid)
 
LIBMQTT_API MQTTPropertyMQTTProperties_getPropertyAt (MQTTProperties *props, enum MQTTPropertyCodes propid, int index)
 

宏定义说明

#define MQTT_INVALID_PROPERTY_ID   -2

在文件 MQTTProperties.h22 行定义.

#define MQTTProperties_initializer   {0, 0, 0, NULL}

在文件 MQTTProperties.h120 行定义.

类型定义说明

MQTT version 5 property list

枚举类型说明

The one byte MQTT V5 property indicator

枚举值
MQTTPROPERTY_CODE_PAYLOAD_FORMAT_INDICATOR 

The value is 1

MQTTPROPERTY_CODE_MESSAGE_EXPIRY_INTERVAL 

The value is 2

MQTTPROPERTY_CODE_CONTENT_TYPE 

The value is 3

MQTTPROPERTY_CODE_RESPONSE_TOPIC 

The value is 8

MQTTPROPERTY_CODE_CORRELATION_DATA 

The value is 9

MQTTPROPERTY_CODE_SUBSCRIPTION_IDENTIFIER 

The value is 11

MQTTPROPERTY_CODE_SESSION_EXPIRY_INTERVAL 

The value is 17

MQTTPROPERTY_CODE_ASSIGNED_CLIENT_IDENTIFER 

The value is 18

MQTTPROPERTY_CODE_SERVER_KEEP_ALIVE 

The value is 19

MQTTPROPERTY_CODE_AUTHENTICATION_METHOD 

The value is 21

MQTTPROPERTY_CODE_AUTHENTICATION_DATA 

The value is 22

MQTTPROPERTY_CODE_REQUEST_PROBLEM_INFORMATION 

The value is 23

MQTTPROPERTY_CODE_WILL_DELAY_INTERVAL 

The value is 24

MQTTPROPERTY_CODE_REQUEST_RESPONSE_INFORMATION 

The value is 25

MQTTPROPERTY_CODE_RESPONSE_INFORMATION 

The value is 26

MQTTPROPERTY_CODE_SERVER_REFERENCE 

The value is 28

MQTTPROPERTY_CODE_REASON_STRING 

The value is 31

MQTTPROPERTY_CODE_RECEIVE_MAXIMUM 

The value is 33

MQTTPROPERTY_CODE_TOPIC_ALIAS_MAXIMUM 

The value is 34

MQTTPROPERTY_CODE_TOPIC_ALIAS 

The value is 35

MQTTPROPERTY_CODE_MAXIMUM_QOS 

The value is 36

MQTTPROPERTY_CODE_RETAIN_AVAILABLE 

The value is 37

MQTTPROPERTY_CODE_USER_PROPERTY 

The value is 38

MQTTPROPERTY_CODE_MAXIMUM_PACKET_SIZE 

The value is 39

MQTTPROPERTY_CODE_WILDCARD_SUBSCRIPTION_AVAILABLE 

The value is 40

MQTTPROPERTY_CODE_SUBSCRIPTION_IDENTIFIERS_AVAILABLE 

The value is 41

MQTTPROPERTY_CODE_SHARED_SUBSCRIPTION_AVAILABLE 

The value is 241

在文件 MQTTProperties.h25 行定义.

The one byte MQTT V5 property type

枚举值
MQTTPROPERTY_TYPE_BYTE 
MQTTPROPERTY_TYPE_TWO_BYTE_INTEGER 
MQTTPROPERTY_TYPE_FOUR_BYTE_INTEGER 
MQTTPROPERTY_TYPE_VARIABLE_BYTE_INTEGER 
MQTTPROPERTY_TYPE_BINARY_DATA 
MQTTPROPERTY_TYPE_UTF_8_ENCODED_STRING 
MQTTPROPERTY_TYPE_UTF_8_STRING_PAIR 

在文件 MQTTProperties.h64 行定义.

函数说明

LIBMQTT_API int MQTTProperties_add ( MQTTProperties props,
const MQTTProperty prop 
)

Add a property pointer to the property array. There is no memory allocation.

参数
propsThe property list to add the property to.
propThe property to add to the list.
返回
0 on success, -1 on failure.
LIBMQTT_API MQTTProperties MQTTProperties_copy ( const MQTTProperties props)

Copy the contents of a property list, allocating additional memory if needed.

参数
propspointer to the property list.
返回
the duplicated property list.
LIBMQTT_API void MQTTProperties_free ( MQTTProperties properties)

Free all memory allocated to the property list, including any to individual properties.

参数
propertiespointer to the property list.
LIBMQTT_API int MQTTProperties_getNumericValue ( MQTTProperties props,
enum MQTTPropertyCodes  propid 
)

Returns the integer value of a specific property. The property given must be a numeric type.

参数
propspointer to the property list.
propidthe property id to check for.
返回
the integer value of the property. -9999999 on failure.
LIBMQTT_API int MQTTProperties_getNumericValueAt ( MQTTProperties props,
enum MQTTPropertyCodes  propid,
int  index 
)

Returns the integer value of a specific property when it's not the only instance. The property given must be a numeric type.

参数
propspointer to the property list.
propidthe property id to check for.
indexthe instance number, starting at 0.
返回
the integer value of the property. -9999999 on failure.
LIBMQTT_API MQTTProperty* MQTTProperties_getProperty ( MQTTProperties props,
enum MQTTPropertyCodes  propid 
)

Returns a pointer to the property structure for a specific property.

参数
propspointer to the property list.
propidthe property id to check for.
返回
the pointer to the property structure if found. NULL if not found.
LIBMQTT_API MQTTProperty* MQTTProperties_getPropertyAt ( MQTTProperties props,
enum MQTTPropertyCodes  propid,
int  index 
)

Returns a pointer to the property structure for a specific property when it's not the only instance.

参数
propspointer to the property list.
propidthe property id to check for.
indexthe instance number, starting at 0.
返回
the pointer to the property structure if found. NULL if not found.
LIBMQTT_API int MQTTProperties_hasProperty ( MQTTProperties props,
enum MQTTPropertyCodes  propid 
)

Checks if property list contains a specific property.

参数
propspointer to the property list.
propidthe property id to check for.
返回
1 if found, 0 if not.
int MQTTProperties_len ( MQTTProperties props)

Returns the length of the properties structure when serialized ready for network transmission.

参数
propsan MQTT V5 property structure.
返回
the length in bytes of the properties when serialized.
LIBMQTT_API int MQTTProperties_propertyCount ( MQTTProperties props,
enum MQTTPropertyCodes  propid 
)

Returns the number of instances of a property id. Most properties can exist only once. User properties and subscription ids can exist more than once.

参数
propspointer to the property list.
propidthe property id to check for.
返回
the number of times found. Can be 0.
int MQTTProperties_read ( MQTTProperties properties,
char **  pptr,
char *  enddata 
)

Reads a property list from a character buffer into an array.

参数
propertiespointer to the property list to be filled. Should be initalized but empty.
pptrpointer to the character buffer.
enddatapointer to the end of the character buffer so we don't read beyond.
返回
1 if the properties were read successfully.
int MQTTProperties_write ( char **  pptr,
const MQTTProperties properties 
)

Serialize the given property list to a character buffer, e.g. for writing to the network.

参数
pptrpointer to the buffer - move the pointer as we add data
propertiespointer to the property list, can be NULL
返回
whether the write succeeded or not: number of bytes written, or < 0 on failure.
LIBMQTT_API int MQTTProperty_getType ( enum MQTTPropertyCodes  value)

Returns the MQTT V5 type code of an MQTT V5 property.

参数
valuean MQTT V5 property code.
返回
the MQTT V5 type code of the input property. -1 if the code was not found.
LIBMQTT_API const char* MQTTPropertyName ( enum MQTTPropertyCodes  value)

Returns a printable string description of an MQTT V5 property code.

参数
valuean MQTT V5 property code.
返回
the printable string description of the input property code. NULL if the code was not found.