Paho MQTT C Client Library
Data Structures | Macros | Typedefs | Enumerations | Functions
MQTTProperties.h File Reference
#include "MQTTExportDeclarations.h"

Go to the source code of this file.

Data Structures

struct  MQTTLenString
 
struct  MQTTProperty
 
struct  MQTTProperties
 

Macros

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

Typedefs

typedef struct MQTTProperties MQTTProperties
 

Enumerations

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
}
 

Functions

const char * MQTTPropertyName (enum MQTTPropertyCodes value)
 
int MQTTProperty_getType (enum MQTTPropertyCodes value)
 
int MQTTProperties_len (MQTTProperties *props)
 
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)
 
void MQTTProperties_free (MQTTProperties *properties)
 
MQTTProperties MQTTProperties_copy (const MQTTProperties *props)
 
int MQTTProperties_hasProperty (MQTTProperties *props, enum MQTTPropertyCodes propid)
 
int MQTTProperties_propertyCount (MQTTProperties *props, enum MQTTPropertyCodes propid)
 
int MQTTProperties_getNumericValue (MQTTProperties *props, enum MQTTPropertyCodes propid)
 
int MQTTProperties_getNumericValueAt (MQTTProperties *props, enum MQTTPropertyCodes propid, int index)
 
MQTTPropertyMQTTProperties_getProperty (MQTTProperties *props, enum MQTTPropertyCodes propid)
 
MQTTPropertyMQTTProperties_getPropertyAt (MQTTProperties *props, enum MQTTPropertyCodes propid, int index)
 

Macro Definition Documentation

◆ MQTT_INVALID_PROPERTY_ID

#define MQTT_INVALID_PROPERTY_ID   -2

◆ MQTTProperties_initializer

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

Typedef Documentation

◆ MQTTProperties

MQTT version 5 property list

Enumeration Type Documentation

◆ MQTTPropertyCodes

The one byte MQTT V5 property indicator

Enumerator
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

◆ MQTTPropertyTypes

The one byte MQTT V5 property type

Enumerator
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 

Function Documentation

◆ MQTTPropertyName()

const char* MQTTPropertyName ( enum MQTTPropertyCodes  value)

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

Parameters
valuean MQTT V5 property code.
Returns
the printable string description of the input property code. NULL if the code was not found.

◆ MQTTProperty_getType()

int MQTTProperty_getType ( enum MQTTPropertyCodes  value)

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

Parameters
valuean MQTT V5 property code.
Returns
the MQTT V5 type code of the input property. -1 if the code was not found.

◆ MQTTProperties_len()

int MQTTProperties_len ( MQTTProperties props)

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

Parameters
propsan MQTT V5 property structure.
Returns
the length in bytes of the properties when serialized.

◆ MQTTProperties_add()

int MQTTProperties_add ( MQTTProperties props,
const MQTTProperty prop 
)

Add a property pointer to the property array. Memory is allocated in this function, so MQTTClient_create or MQTTAsync_create must be called first to initialize the internal heap tracking. Alternatively MQTTAsync_global_init() can be called first or build with the HIGH_PERFORMANCE option which disables the heap tracking.

Parameters
propsThe property list to add the property to.
propThe property to add to the list.
Returns
0 on success, -1 on failure.

◆ MQTTProperties_write()

int MQTTProperties_write ( char **  pptr,
const MQTTProperties properties 
)

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

Parameters
pptrpointer to the buffer - move the pointer as we add data
propertiespointer to the property list, can be NULL
Returns
whether the write succeeded or not: number of bytes written, or < 0 on failure.

◆ MQTTProperties_read()

int MQTTProperties_read ( MQTTProperties properties,
char **  pptr,
char *  enddata 
)

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

Parameters
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.
Returns
1 if the properties were read successfully.

◆ MQTTProperties_free()

void MQTTProperties_free ( MQTTProperties properties)

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

Parameters
propertiespointer to the property list.

◆ MQTTProperties_copy()

MQTTProperties MQTTProperties_copy ( const MQTTProperties props)

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

Parameters
propspointer to the property list.
Returns
the duplicated property list.

◆ MQTTProperties_hasProperty()

int MQTTProperties_hasProperty ( MQTTProperties props,
enum MQTTPropertyCodes  propid 
)

Checks if property list contains a specific property.

Parameters
propspointer to the property list.
propidthe property id to check for.
Returns
1 if found, 0 if not.

◆ MQTTProperties_propertyCount()

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.

Parameters
propspointer to the property list.
propidthe property id to check for.
Returns
the number of times found. Can be 0.

◆ MQTTProperties_getNumericValue()

int MQTTProperties_getNumericValue ( MQTTProperties props,
enum MQTTPropertyCodes  propid 
)

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

Parameters
propspointer to the property list.
propidthe property id to check for.
Returns
the integer value of the property. -9999999 on failure.

◆ MQTTProperties_getNumericValueAt()

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.

Parameters
propspointer to the property list.
propidthe property id to check for.
indexthe instance number, starting at 0.
Returns
the integer value of the property. -9999999 on failure.

◆ MQTTProperties_getProperty()

MQTTProperty* MQTTProperties_getProperty ( MQTTProperties props,
enum MQTTPropertyCodes  propid 
)

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

Parameters
propspointer to the property list.
propidthe property id to check for.
Returns
the pointer to the property structure if found. NULL if not found.

◆ MQTTProperties_getPropertyAt()

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.

Parameters
propspointer to the property list.
propidthe property id to check for.
indexthe instance number, starting at 0.
Returns
the pointer to the property structure if found. NULL if not found.