Implements the user-facing functions to de-serialize user-properties. More...
#include <string.h>#include <inttypes.h>#include <stdbool.h>#include <assert.h>#include "core_mqtt_serializer.h"#include "private/core_mqtt_serializer_private.h"#include "core_mqtt_config_defaults.h"Functions | |
| static MQTTStatus_t | checkPropBuilderParams (const MQTTPropBuilder_t *mqttPropBuilder, const size_t *currentIndex) |
| Checks the parameters to all the internal/external 'get' property functions. | |
| static MQTTStatus_t | getPropUint8 (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint8_t propertyId, uint8_t *property) |
| Get a uint8 property value from the property builder. | |
| static MQTTStatus_t | getPropUint16 (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint8_t propertyId, uint16_t *property) |
| Get a uint16 property value from the property builder. | |
| static MQTTStatus_t | getPropUint32 (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint8_t propertyId, uint32_t *property) |
| Get a uint32 property value from the property builder. | |
| static MQTTStatus_t | getPropUtf8 (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint8_t propertyId, const char **property, size_t *propertyLength) |
| Get a UTF-8 string property value from the property builder. | |
| MQTTStatus_t | MQTT_GetNextPropertyType (const MQTTPropBuilder_t *pPropertyBuilder, const size_t *currentIndex, uint8_t *property) |
| Get the property type at the current index in the property builder. | |
| MQTTStatus_t | MQTT_SkipNextProperty (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex) |
| Skip the next property in the property builder without extracting its value. | |
| MQTTStatus_t | MQTTPropGet_UserProp (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, MQTTUserProperty_t *pUserProperty) |
| Get User Property from property builder. | |
| MQTTStatus_t | MQTTPropGet_SessionExpiry (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint32_t *pSessionExpiry) |
| Get Session Expiry Interval property from property builder. | |
| MQTTStatus_t | MQTTPropGet_ReceiveMax (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint16_t *pReceiveMax) |
| Get Receive Maximum property from property builder. | |
| MQTTStatus_t | MQTTPropGet_MaxQos (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint8_t *pMaxQos) |
| Get Maximum QoS property from property builder. | |
| MQTTStatus_t | MQTTPropGet_RetainAvailable (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint8_t *pRetainAvailable) |
| Get Retain Available property from property builder. | |
| MQTTStatus_t | MQTTPropGet_MaxPacketSize (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint32_t *pMaxPacketSize) |
| Get Maximum Packet Size property from property builder. | |
| MQTTStatus_t | MQTTPropGet_AssignedClientId (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, const char **pClientId, size_t *pClientIdLength) |
| Get Assigned Client Identifier property from property builder. | |
| MQTTStatus_t | MQTTPropGet_TopicAliasMax (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint16_t *pTopicAliasMax) |
| Get Topic Alias Maximum property from property builder. | |
| MQTTStatus_t | MQTTPropGet_ReasonString (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, const char **pReasonString, size_t *pReasonStringLength) |
| Get Reason String property from property builder. | |
| MQTTStatus_t | MQTTPropGet_WildcardId (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint8_t *pWildcardAvailable) |
| Get Wildcard Subscription Available property from property builder. | |
| MQTTStatus_t | MQTTPropGet_SubsIdAvailable (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint8_t *pSubsIdAvailable) |
| Get Subscription Identifier Available property from property builder. | |
| MQTTStatus_t | MQTTPropGet_SharedSubAvailable (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint8_t *pSharedSubAvailable) |
| Get Shared Subscription Available property from property builder. | |
| MQTTStatus_t | MQTTPropGet_ServerKeepAlive (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint16_t *pServerKeepAlive) |
| Get Server Keep Alive property from property builder. | |
| MQTTStatus_t | MQTTPropGet_ResponseInfo (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, const char **pResponseInfo, size_t *pResponseInfoLength) |
| Get Response Information property from property builder. | |
| MQTTStatus_t | MQTTPropGet_ServerRef (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, const char **pServerRef, size_t *pServerRefLength) |
| Get Server Reference property from property builder. | |
| MQTTStatus_t | MQTTPropGet_AuthMethod (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, const char **pAuthMethod, size_t *pAuthMethodLen) |
| Get Authentication Method property from property builder. | |
| MQTTStatus_t | MQTTPropGet_AuthData (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, const char **pAuthData, size_t *pAuthDataLen) |
| Get Authentication Data property from property builder. | |
| MQTTStatus_t | MQTTPropGet_PayloadFormatIndicator (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint8_t *pPayloadFormat) |
| Get Payload Format Indicator property from property builder. | |
| MQTTStatus_t | MQTTPropGet_MessageExpiryInterval (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint32_t *pMessageExpiry) |
| Get Message Expiry Interval property from property builder. | |
| MQTTStatus_t | MQTTPropGet_TopicAlias (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint16_t *pTopicAlias) |
| Get Topic Alias property from property builder. | |
| MQTTStatus_t | MQTTPropGet_ResponseTopic (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, const char **pResponseTopic, size_t *pResponseTopicLength) |
| Get Response Topic property from property builder. | |
| MQTTStatus_t | MQTTPropGet_CorrelationData (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, const char **pCorrelationData, size_t *pCorrelationDataLength) |
| Get Correlation Data property from property builder. | |
| MQTTStatus_t | MQTTPropGet_SubscriptionId (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, uint32_t *pSubscriptionId) |
| Get Subscription Identifier property from property builder. | |
| MQTTStatus_t | MQTTPropGet_ContentType (const MQTTPropBuilder_t *pPropertyBuilder, size_t *currentIndex, const char **pContentType, size_t *pContentTypeLength) |
| Get the Content Type property from the property builder. | |
Implements the user-facing functions to de-serialize user-properties.
|
inlinestatic |
Checks the parameters to all the internal/external 'get' property functions.
| [in] | mqttPropBuilder | The property builder struct. |
| [in] | currentIndex | The index of the property in the buffer. |
|
static |
Get a uint8 property value from the property builder.
This function extracts a uint8 property value from the property builder at the specified index and validates that it matches the expected property ID.
| [in] | pPropertyBuilder | Pointer to the property builder containing the properties. |
| [in,out] | currentIndex | Pointer to the current index in the property buffer. Updated to point past the property on success. |
| [in] | propertyId | Expected property ID to validate against. |
| [out] | property | Pointer to store the extracted uint8 property value. |
|
static |
Get a uint16 property value from the property builder.
This function extracts a uint16 property value from the property builder at the specified index and validates that it matches the expected property ID.
| [in] | pPropertyBuilder | Pointer to the property builder containing the properties. |
| [in,out] | currentIndex | Pointer to the current index in the property buffer. Updated to point past the property on success. |
| [in] | propertyId | Expected property ID to validate against. |
| [out] | property | Pointer to store the extracted uint16 property value. |
|
static |
Get a uint32 property value from the property builder.
This function extracts a uint32 property value from the property builder at the specified index and validates that it matches the expected property ID.
| [in] | pPropertyBuilder | Pointer to the property builder containing the properties. |
| [in,out] | currentIndex | Pointer to the current index in the property buffer. Updated to point past the property on success. |
| [in] | propertyId | Expected property ID to validate against. |
| [out] | property | Pointer to store the extracted uint32 property value. |
|
static |
Get a UTF-8 string property value from the property builder.
This function extracts a UTF-8 string property value from the property builder at the specified index and validates that it matches the expected property ID.
| [in] | pPropertyBuilder | Pointer to the property builder containing the properties. |
| [in,out] | currentIndex | Pointer to the current index in the property buffer. Updated to point past the property on success. |
| [in] | propertyId | Expected property ID to validate against. |
| [out] | property | Pointer to store the extracted UTF-8 string pointer. |
| [out] | propertyLength | Pointer to store the length of the extracted string. |
| MQTTStatus_t MQTT_GetNextPropertyType | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| const size_t * | currentIndex, | ||
| uint8_t * | property | ||
| ) |
Get the property type at the current index in the property builder.
This function retrieves the property identifier byte at the specified index and validates that it is a recognized MQTT v5 property type. The index is not advanced by this function - use the appropriate MQTTPropGet_* function to retrieve the property value and advance the index.
| [in] | pPropertyBuilder | Property builder containing the properties. |
| [in] | currentIndex | Current index in the property builder buffer. |
| [out] | property | Pointer to store the property type identifier. |
| MQTTStatus_t MQTT_SkipNextProperty | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex | ||
| ) |
Skip the next property in the property builder without extracting its value.
This function advances the current index past the property at the current position in the property buffer. It validates the property ID and ensures the property data is within bounds, but does not extract or return the property value. This is useful for iterating through properties when only specific properties need to be extracted.
| [in] | pPropertyBuilder | Pointer to the property builder containing the properties. |
| [in,out] | currentIndex | Pointer to the current index in the property buffer. On success, updated to point to the next property. |
Example
| MQTTStatus_t MQTTPropGet_UserProp | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| MQTTUserProperty_t * | pUserProperty | ||
| ) |
Get User Property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pUserProperty | Pointer to store the user property key-value pair. |
| MQTTStatus_t MQTTPropGet_SessionExpiry | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| uint32_t * | pSessionExpiry | ||
| ) |
Get Session Expiry Interval property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pSessionExpiry | Pointer to store the session expiry interval in seconds. |
| MQTTStatus_t MQTTPropGet_ReceiveMax | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| uint16_t * | pReceiveMax | ||
| ) |
Get Receive Maximum property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pReceiveMax | Pointer to store the receive maximum value. |
| MQTTStatus_t MQTTPropGet_MaxQos | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| uint8_t * | pMaxQos | ||
| ) |
Get Maximum QoS property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pMaxQos | Pointer to store the maximum QoS level (0, 1, or 2). |
| MQTTStatus_t MQTTPropGet_RetainAvailable | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| uint8_t * | pRetainAvailable | ||
| ) |
Get Retain Available property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pRetainAvailable | Pointer to store the retain available flag (0 or 1). |
| MQTTStatus_t MQTTPropGet_MaxPacketSize | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| uint32_t * | pMaxPacketSize | ||
| ) |
Get Maximum Packet Size property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pMaxPacketSize | Pointer to store the maximum packet size in bytes. |
| MQTTStatus_t MQTTPropGet_AssignedClientId | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| const char ** | pClientId, | ||
| size_t * | pClientIdLength | ||
| ) |
Get Assigned Client Identifier property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pClientId | Pointer to store the assigned client identifier string. |
| [out] | pClientIdLength | Pointer to store the client identifier length. |
| MQTTStatus_t MQTTPropGet_TopicAliasMax | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| uint16_t * | pTopicAliasMax | ||
| ) |
Get Topic Alias Maximum property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pTopicAliasMax | Pointer to store the topic alias maximum value. |
| MQTTStatus_t MQTTPropGet_ReasonString | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| const char ** | pReasonString, | ||
| size_t * | pReasonStringLength | ||
| ) |
Get Reason String property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pReasonString | Pointer to store the reason string. |
| [out] | pReasonStringLength | Pointer to store the reason string length. |
| MQTTStatus_t MQTTPropGet_WildcardId | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| uint8_t * | pWildcardAvailable | ||
| ) |
Get Wildcard Subscription Available property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pWildcardAvailable | Pointer to store the wildcard subscription available flag (0 or 1). |
| MQTTStatus_t MQTTPropGet_SubsIdAvailable | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| uint8_t * | pSubsIdAvailable | ||
| ) |
Get Subscription Identifier Available property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pSubsIdAvailable | Pointer to store the subscription identifier available flag (0 or 1). |
| MQTTStatus_t MQTTPropGet_SharedSubAvailable | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| uint8_t * | pSharedSubAvailable | ||
| ) |
Get Shared Subscription Available property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pSharedSubAvailable | Pointer to store the shared subscription available flag (0 or 1). |
| MQTTStatus_t MQTTPropGet_ServerKeepAlive | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| uint16_t * | pServerKeepAlive | ||
| ) |
Get Server Keep Alive property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pServerKeepAlive | Pointer to store the server keep alive interval in seconds. |
| MQTTStatus_t MQTTPropGet_ResponseInfo | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| const char ** | pResponseInfo, | ||
| size_t * | pResponseInfoLength | ||
| ) |
Get Response Information property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pResponseInfo | Pointer to store the response information string. |
| [out] | pResponseInfoLength | Pointer to store the response information length. |
| MQTTStatus_t MQTTPropGet_ServerRef | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| const char ** | pServerRef, | ||
| size_t * | pServerRefLength | ||
| ) |
Get Server Reference property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pServerRef | Pointer to store the server reference string. |
| [out] | pServerRefLength | Pointer to store the server reference length. |
| MQTTStatus_t MQTTPropGet_AuthMethod | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| const char ** | pAuthMethod, | ||
| size_t * | pAuthMethodLen | ||
| ) |
Get Authentication Method property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pAuthMethod | Pointer to store the authentication method string. |
| [out] | pAuthMethodLen | Pointer to store the authentication method length. |
| MQTTStatus_t MQTTPropGet_AuthData | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| const char ** | pAuthData, | ||
| size_t * | pAuthDataLen | ||
| ) |
Get Authentication Data property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pAuthData | Pointer to store the authentication data. |
| [out] | pAuthDataLen | Pointer to store the authentication data length. |
| MQTTStatus_t MQTTPropGet_PayloadFormatIndicator | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| uint8_t * | pPayloadFormat | ||
| ) |
Get Payload Format Indicator property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pPayloadFormat | Pointer to store the payload format indicator (0=unspecified, 1=UTF-8). |
| MQTTStatus_t MQTTPropGet_MessageExpiryInterval | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| uint32_t * | pMessageExpiry | ||
| ) |
Get Message Expiry Interval property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pMessageExpiry | Pointer to store the message expiry interval in seconds. |
| MQTTStatus_t MQTTPropGet_TopicAlias | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| uint16_t * | pTopicAlias | ||
| ) |
Get Topic Alias property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pTopicAlias | Pointer to store the topic alias value. |
| MQTTStatus_t MQTTPropGet_ResponseTopic | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| const char ** | pResponseTopic, | ||
| size_t * | pResponseTopicLength | ||
| ) |
Get Response Topic property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pResponseTopic | Pointer to store the response topic string. |
| [out] | pResponseTopicLength | Pointer to store the response topic length. |
| MQTTStatus_t MQTTPropGet_CorrelationData | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| const char ** | pCorrelationData, | ||
| size_t * | pCorrelationDataLength | ||
| ) |
Get Correlation Data property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pCorrelationData | Pointer to store the correlation data. |
| [out] | pCorrelationDataLength | Pointer to store the correlation data length. |
| MQTTStatus_t MQTTPropGet_SubscriptionId | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| uint32_t * | pSubscriptionId | ||
| ) |
Get Subscription Identifier property from property builder.
| [in] | pPropertyBuilder | Property builder to get property from. |
| [in,out] | currentIndex | Current index in the property builder buffer. Updated to next property on success. |
| [out] | pSubscriptionId | Pointer to store the subscription identifier (variable byte integer). |
| MQTTStatus_t MQTTPropGet_ContentType | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| size_t * | currentIndex, | ||
| const char ** | pContentType, | ||
| size_t * | pContentTypeLength | ||
| ) |
Get the Content Type property from the property builder.
This function extracts the Content Type property value from the property builder at the specified index. The Content Type property describes the content of the Application Message.
| [in] | pPropertyBuilder | Pointer to the property builder containing the properties. |
| [in,out] | currentIndex | Pointer to the current index in the property buffer. Updated to point past the property on success. |
| [out] | pContentType | Pointer to store the extracted Content Type string. |
| [out] | pContentTypeLength | Pointer to store the length of the Content Type string. |