Implements the user-facing functions to serialize user-properties. More...
#include <string.h>#include <stdbool.h>#include <assert.h>#include <inttypes.h>#include "core_mqtt_serializer.h"#include "private/core_mqtt_serializer_private.h"#include "core_mqtt_config_defaults.h"Functions | |
| static bool | isValidPropertyInPacketType (const uint8_t *mqttPacketType, uint8_t propBitLocation) |
| Check whether the provided property is allowed for a packet type. | |
| static MQTTStatus_t | addPropUint8 (MQTTPropBuilder_t *pPropertyBuilder, uint8_t property, uint8_t propId, uint8_t fieldPosition, const uint8_t *pOptionalMqttPacketType) |
| Add a uint8 property to the property builder. | |
| static MQTTStatus_t | addPropUint16 (MQTTPropBuilder_t *pPropertyBuilder, uint16_t property, uint8_t propId, uint8_t fieldPosition, const uint8_t *pOptionalMqttPacketType) |
| Add a uint16 property to the property builder. | |
| static MQTTStatus_t | addPropUint32 (MQTTPropBuilder_t *pPropertyBuilder, uint32_t property, uint8_t propId, uint8_t fieldPosition, const uint8_t *pOptionalMqttPacketType) |
| Add a uint32 property to the property builder. | |
| static MQTTStatus_t | addPropUtf8 (MQTTPropBuilder_t *pPropertyBuilder, const char *property, size_t propertyLength, uint8_t propId, uint8_t fieldPosition, const uint8_t *pOptionalMqttPacketType) |
| Add a UTF-8 string property to the property builder. | |
| MQTTStatus_t | MQTTPropAdd_SubscriptionId (MQTTPropBuilder_t *pPropertyBuilder, uint32_t subscriptionId, const uint8_t *pOptionalMqttPacketType) |
| Adds a Subscription Identifier property to the MQTT property builder. | |
| MQTTStatus_t | MQTTPropAdd_UserProp (MQTTPropBuilder_t *pPropertyBuilder, const MQTTUserProperty_t *userProperty, const uint8_t *pOptionalMqttPacketType) |
| Adds User Property to the MQTT property builder. | |
| MQTTStatus_t | MQTTPropAdd_SessionExpiry (MQTTPropBuilder_t *pPropertyBuilder, uint32_t sessionExpiry, const uint8_t *pOptionalMqttPacketType) |
| Adds Session Expiry Interval property to the MQTT property builder. | |
| MQTTStatus_t | MQTTPropAdd_ReceiveMax (MQTTPropBuilder_t *pPropertyBuilder, uint16_t receiveMax, const uint8_t *pOptionalMqttPacketType) |
| Adds Receive Maximum property to the MQTT property builder. | |
| MQTTStatus_t | MQTTPropAdd_MaxPacketSize (MQTTPropBuilder_t *pPropertyBuilder, uint32_t maxPacketSize, const uint8_t *pOptionalMqttPacketType) |
| Adds Maximum Packet Size property to the MQTT property builder. | |
| MQTTStatus_t | MQTTPropAdd_TopicAliasMax (MQTTPropBuilder_t *pPropertyBuilder, uint16_t topicAliasMax, const uint8_t *pOptionalMqttPacketType) |
| Adds Topic Alias Maximum property to the MQTT property builder. | |
| MQTTStatus_t | MQTTPropAdd_RequestRespInfo (MQTTPropBuilder_t *pPropertyBuilder, bool requestResponseInfo, const uint8_t *pOptionalMqttPacketType) |
| Adds Request Response Information property to the MQTT property builder. | |
| MQTTStatus_t | MQTTPropAdd_RequestProbInfo (MQTTPropBuilder_t *pPropertyBuilder, bool requestProblemInfo, const uint8_t *pOptionalMqttPacketType) |
| Adds Request Problem Information property to the MQTT property builder. | |
| MQTTStatus_t | MQTTPropAdd_AuthMethod (MQTTPropBuilder_t *pPropertyBuilder, const char *authMethod, size_t authMethodLength, const uint8_t *pOptionalMqttPacketType) |
| Adds Authentication Method property to the MQTT property builder. | |
| MQTTStatus_t | MQTTPropAdd_AuthData (MQTTPropBuilder_t *pPropertyBuilder, const char *authData, size_t authDataLength, const uint8_t *pOptionalMqttPacketType) |
| Adds Authentication Data property to the MQTT property builder. | |
| MQTTStatus_t | MQTTPropAdd_PayloadFormat (MQTTPropBuilder_t *pPropertyBuilder, bool payloadFormat, const uint8_t *pOptionalMqttPacketType) |
| Adds Payload Format Indicator property to the MQTT property builder. | |
| MQTTStatus_t | MQTTPropAdd_MessageExpiry (MQTTPropBuilder_t *pPropertyBuilder, uint32_t messageExpiry, const uint8_t *pOptionalMqttPacketType) |
| Adds Message Expiry Interval property to the MQTT property builder. | |
| MQTTStatus_t | MQTTPropAdd_WillDelayInterval (MQTTPropBuilder_t *pPropertyBuilder, uint32_t willDelayInterval, const uint8_t *pOptionalMqttPacketType) |
| Adds Will Delay Interval property to the MQTT property builder. | |
| MQTTStatus_t | MQTTPropAdd_TopicAlias (MQTTPropBuilder_t *pPropertyBuilder, uint16_t topicAlias, const uint8_t *pOptionalMqttPacketType) |
| Adds Topic Alias property to the MQTT property builder. | |
| MQTTStatus_t | MQTTPropAdd_ResponseTopic (MQTTPropBuilder_t *pPropertyBuilder, const char *responseTopic, size_t responseTopicLength, const uint8_t *pOptionalMqttPacketType) |
| Adds Response Topic property to the MQTT property builder. | |
| MQTTStatus_t | MQTTPropAdd_CorrelationData (MQTTPropBuilder_t *pPropertyBuilder, const void *pCorrelationData, size_t correlationLength, const uint8_t *pOptionalMqttPacketType) |
| Adds Correlation Data property to the MQTT property builder. | |
| MQTTStatus_t | MQTTPropAdd_ContentType (MQTTPropBuilder_t *pPropertyBuilder, const char *contentType, size_t contentTypeLength, const uint8_t *pOptionalMqttPacketType) |
| Adds Content Type property to the MQTT property builder. | |
| MQTTStatus_t | MQTTPropAdd_ReasonString (MQTTPropBuilder_t *pPropertyBuilder, const char *pReasonString, size_t reasonStringLength, const uint8_t *pOptionalMqttPacketType) |
| Adds Reason String property to the MQTT property builder. | |
Implements the user-facing functions to serialize user-properties.
|
static |
Check whether the provided property is allowed for a packet type.
| [in] | mqttPacketType | Packet type to check. |
| [in] | propBitLocation | Bit location of the property. |
|
static |
Add a uint8 property to the property builder.
This function adds a uint8 property to the property builder with validation for packet type compatibility and buffer space.
| [in,out] | pPropertyBuilder | Pointer to the property builder to add the property to. |
| [in] | property | The uint8 property value to add. |
| [in] | propId | The property ID for this property. |
| [in] | fieldPosition | The bit position in the fieldSet for duplicate checking. |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for validation. Can be NULL to skip packet type validation. |
|
static |
Add a uint16 property to the property builder.
This function adds a uint16 property to the property builder with validation for packet type compatibility and buffer space.
| [in,out] | pPropertyBuilder | Pointer to the property builder to add the property to. |
| [in] | property | The uint16 property value to add. |
| [in] | propId | The property ID for this property. |
| [in] | fieldPosition | The bit position in the fieldSet for duplicate checking. |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for validation. Can be NULL to skip packet type validation. |
|
static |
Add a uint32 property to the property builder.
This function adds a uint32 property to the property builder with validation for packet type compatibility and buffer space.
| [in,out] | pPropertyBuilder | Pointer to the property builder to add the property to. |
| [in] | property | The uint32 property value to add. |
| [in] | propId | The property ID for this property. |
| [in] | fieldPosition | The bit position in the fieldSet for duplicate checking. |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for validation. Can be NULL to skip packet type validation. |
|
static |
Add a UTF-8 string property to the property builder.
This function adds a UTF-8 string property to the property builder with validation for packet type compatibility and buffer space.
| [in,out] | pPropertyBuilder | Pointer to the property builder to add the property to. |
| [in] | property | The UTF-8 string property value to add. |
| [in] | propertyLength | The length of the UTF-8 string property. |
| [in] | propId | The property ID for this property. |
| [in] | fieldPosition | The bit position in the fieldSet for duplicate checking. |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for validation. Can be NULL to skip packet type validation. |
| MQTTStatus_t MQTTPropAdd_SubscriptionId | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| uint32_t | subscriptionId, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds a Subscription Identifier property to the MQTT property builder.
This function adds a Subscription Identifier property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure where the Subscription Identifier will be added. Must not be NULL. |
| [in] | subscriptionId | The Subscription Identifier value to be added. Must be greater than 0. |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for which the property is being added. The function will check whether the given property can be added to the packet type if it is provided. |
Example
| MQTTStatus_t MQTTPropAdd_UserProp | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| const MQTTUserProperty_t * | userProperty, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds User Property to the MQTT property builder.
This function adds User Property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure. |
| [in] | userProperty | The User Property to be added. |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for which the property is being added. The function will check whether the given property can be added to the packet type if it is provided. |
| MQTTStatus_t MQTTPropAdd_SessionExpiry | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| uint32_t | sessionExpiry, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds Session Expiry Interval property to the MQTT property builder.
This function adds Session Expiry Interval property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure. |
| [in] | sessionExpiry | The Session Expiry Interval in seconds. |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for validation. Can be NULL to skip packet type validation. |
| MQTTStatus_t MQTTPropAdd_ReceiveMax | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| uint16_t | receiveMax, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds Receive Maximum property to the MQTT property builder.
This function adds Receive Maximum property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure. |
| [in] | receiveMax | The maximum number of QoS 1 and QoS 2 messages allowed to be received simultaneously. |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for which the property is being added. The function will check whether the given property can be added to the packet type if it is provided. |
| MQTTStatus_t MQTTPropAdd_MaxPacketSize | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| uint32_t | maxPacketSize, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds Maximum Packet Size property to the MQTT property builder.
This function adds Maximum Packet Size property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure. |
| [in] | maxPacketSize | The maximum packet size the client is willing to accept. |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for which the property is being added. The function will check whether the given property can be added to the packet type if it is provided. |
| MQTTStatus_t MQTTPropAdd_TopicAliasMax | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| uint16_t | topicAliasMax, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds Topic Alias Maximum property to the MQTT property builder.
This function adds Topic Alias Maximum property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure. |
| [in] | topicAliasMax | The maximum value of topic alias accepted by the client. |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for which the property is being added. The function will check whether the given property can be added to the packet type if it is provided. |
| MQTTStatus_t MQTTPropAdd_RequestRespInfo | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| bool | requestResponseInfo, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds Request Response Information property to the MQTT property builder.
This function adds Request Response Information property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure. |
| [in] | requestResponseInfo | Boolean indicating whether response information is requested. |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for which the property is being added. The function will check whether the given property can be added to the packet type if it is provided. |
| MQTTStatus_t MQTTPropAdd_RequestProbInfo | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| bool | requestProblemInfo, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds Request Problem Information property to the MQTT property builder.
This function adds Request Problem Information property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure. |
| [in] | requestProblemInfo | Boolean indicating whether problem information is requested. |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for which the property is being added. The function will check whether the given property can be added to the packet type if it is provided. |
| MQTTStatus_t MQTTPropAdd_AuthMethod | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| const char * | authMethod, | ||
| size_t | authMethodLength, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds Authentication Method property to the MQTT property builder.
This function adds Authentication Method property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure. |
| [in] | authMethod | Pointer to the authentication method string. |
| [in] | authMethodLength | Length of the authentication method string (must be less than 65536). |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for which the property is being added. The function will check whether the given property can be added to the packet type if it is provided. |
| MQTTStatus_t MQTTPropAdd_AuthData | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| const char * | authData, | ||
| size_t | authDataLength, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds Authentication Data property to the MQTT property builder.
This function adds Authentication Data property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure. |
| [in] | authData | Pointer to the authentication data. |
| [in] | authDataLength | Length of the authentication data (must be less than 65536). |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for which the property is being added. The function will check whether the given property can be added to the packet type if it is provided. |
| MQTTStatus_t MQTTPropAdd_PayloadFormat | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| bool | payloadFormat, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds Payload Format Indicator property to the MQTT property builder.
This function adds Payload Format Indicator property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure. |
| [in] | payloadFormat | Boolean indicating the payload format (true for UTF-8, false for unspecified bytes). |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for which the property is being added. The function will check whether the given property can be added to the packet type if it is provided. |
| MQTTStatus_t MQTTPropAdd_MessageExpiry | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| uint32_t | messageExpiry, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds Message Expiry Interval property to the MQTT property builder.
This function adds Message Expiry Interval property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure. |
| [in] | messageExpiry | The message expiry interval in seconds. |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for which the property is being added. The function will check whether the given property can be added to the packet type if it is provided. |
| MQTTStatus_t MQTTPropAdd_WillDelayInterval | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| uint32_t | willDelayInterval, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds Will Delay Interval property to the MQTT property builder.
This function adds Message Expiry Interval property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure. |
| [in] | willDelayInterval | Will Delay Interval in seconds. |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for which the property is being added. The function will check whether the given property can be added to the packet type if it is provided. |
| MQTTStatus_t MQTTPropAdd_TopicAlias | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| uint16_t | topicAlias, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds Topic Alias property to the MQTT property builder.
This function adds Topic Alias property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure. |
| [in] | topicAlias | The topic alias value. |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for which the property is being added. The function will check whether the given property can be added to the packet type if it is provided. |
| MQTTStatus_t MQTTPropAdd_ResponseTopic | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| const char * | responseTopic, | ||
| size_t | responseTopicLength, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds Response Topic property to the MQTT property builder.
This function adds Response Topic property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure. |
| [in] | responseTopic | Pointer to the response topic string. |
| [in] | responseTopicLength | Length of the response topic string (must be less than 65536). |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for which the property is being added. The function will check whether the given property can be added to the packet type if it is provided. |
| MQTTStatus_t MQTTPropAdd_CorrelationData | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| const void * | pCorrelationData, | ||
| size_t | correlationLength, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds Correlation Data property to the MQTT property builder.
This function adds Correlation Data property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure. |
| [in] | pCorrelationData | Pointer to the correlation data. |
| [in] | correlationLength | Length of the correlation data (must be less than 65536). |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for which the property is being added. The function will check whether the given property can be added to the packet type if it is provided. |
| MQTTStatus_t MQTTPropAdd_ContentType | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| const char * | contentType, | ||
| size_t | contentTypeLength, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds Content Type property to the MQTT property builder.
This function adds Content Type property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure. |
| [in] | contentType | Pointer to the content type string. |
| [in] | contentTypeLength | Length of the content type string (must be less than 65536). |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for which the property is being added. The function will check whether the given property can be added to the packet type if it is provided. |
| MQTTStatus_t MQTTPropAdd_ReasonString | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| const char * | pReasonString, | ||
| size_t | reasonStringLength, | ||
| const uint8_t * | pOptionalMqttPacketType | ||
| ) |
Adds Reason String property to the MQTT property builder.
This function adds Reason String property to the property builder.
| [out] | pPropertyBuilder | Pointer to the property builder structure. |
| [in] | pReasonString | Pointer to the reason string. |
| [in] | reasonStringLength | Length of the reason string (must be less than 65536). |
| [in] | pOptionalMqttPacketType | Optional MQTT packet type for which the property is being added. The function will check whether the given property can be added to the packet type if it is provided. |