User-facing functions for serializing and deserializing MQTT 5.0 packets. This header should be included for building a lighter weight MQTT client than the managed CSDK MQTT library API in core_mqtt.h, by using the serializer and de-serializer functions exposed in this file's API. More...
Go to the source code of this file.
Data Structures | |
| struct | MQTTFixedBuffer_t |
| Buffer passed to MQTT library. More... | |
| struct | MQTTConnectInfo_t |
| MQTT CONNECT packet parameters. More... | |
| struct | MQTTSubscribeInfo_t |
| MQTT SUBSCRIBE packet parameters. More... | |
| struct | MQTTPublishInfo_t |
| MQTT PUBLISH packet parameters. More... | |
| struct | MQTTPacketInfo_t |
| MQTT incoming packet parameters. More... | |
| struct | MQTTPropBuilder_t |
| Property builder for MQTT packets. More... | |
| struct | MQTTReasonCodeInfo_t |
| Struct to hold reason codes. More... | |
| struct | MQTTConnectionProperties_t |
| Struct to hold connect and connack properties. More... | |
| struct | MQTTUserProperty_t |
| Struct to hold user property. More... | |
Macros | |
| #define | MQTT_PACKET_TYPE_CONNECT ( ( uint8_t ) 0x10U ) |
| CONNECT (client-to-server). | |
| #define | MQTT_PACKET_TYPE_CONNACK ( ( uint8_t ) 0x20U ) |
| CONNACK (server-to-client). | |
| #define | MQTT_PACKET_TYPE_PUBLISH ( ( uint8_t ) 0x30U ) |
| PUBLISH (bidirectional). | |
| #define | MQTT_PACKET_TYPE_PUBACK ( ( uint8_t ) 0x40U ) |
| PUBACK (bidirectional). | |
| #define | MQTT_PACKET_TYPE_PUBREC ( ( uint8_t ) 0x50U ) |
| PUBREC (bidirectional). | |
| #define | MQTT_PACKET_TYPE_PUBREL ( ( uint8_t ) 0x62U ) |
| PUBREL (bidirectional). | |
| #define | MQTT_PACKET_TYPE_PUBCOMP ( ( uint8_t ) 0x70U ) |
| PUBCOMP (bidirectional). | |
| #define | MQTT_PACKET_TYPE_SUBSCRIBE ( ( uint8_t ) 0x82U ) |
| SUBSCRIBE (client-to-server). | |
| #define | MQTT_PACKET_TYPE_SUBACK ( ( uint8_t ) 0x90U ) |
| SUBACK (server-to-client). | |
| #define | MQTT_PACKET_TYPE_UNSUBSCRIBE ( ( uint8_t ) 0xA2U ) |
| UNSUBSCRIBE (client-to-server). | |
| #define | MQTT_PACKET_TYPE_UNSUBACK ( ( uint8_t ) 0xB0U ) |
| UNSUBACK (server-to-client). | |
| #define | MQTT_PACKET_TYPE_PINGREQ ( ( uint8_t ) 0xC0U ) |
| PINGREQ (client-to-server). | |
| #define | MQTT_PACKET_TYPE_PINGRESP ( ( uint8_t ) 0xD0U ) |
| PINGRESP (server-to-client). | |
| #define | MQTT_PACKET_TYPE_DISCONNECT ( ( uint8_t ) 0xE0U ) |
| DISCONNECT (client-to-server). | |
| #define | MQTT_PACKET_TYPE_AUTH ( ( uint8_t ) 0xF0U ) |
| AUTH (bidirectional). | |
| #define | MQTT_PUBLISH_ACK_PACKET_SIZE ( 4UL ) |
| The size of MQTT PUBACK, PUBREC, PUBREL, and PUBCOMP packets, per MQTT spec. | |
| #define | MQTT_SUBSCRIBE_QOS1 ( 0U ) |
| MQTT SUBSCRIBE QoS1 flag. | |
| #define | MQTT_SUBSCRIBE_QOS2 ( 1U ) |
| MQTT SUBSCRIBE QoS2 flag. | |
| #define | MQTT_SUBSCRIBE_NO_LOCAL ( 2U ) |
| MQTT SUBSCRIBE no local flag. | |
| #define | MQTT_SUBSCRIBE_RETAIN_AS_PUBLISHED ( 3U ) |
| MQTT SUBSCRIBE retain as published flag. | |
| #define | MQTT_SUBSCRIBE_RETAIN_HANDLING1 ( 4U ) |
| MQTT SUBSCRIBE Retain Handling Option 1. | |
| #define | MQTT_SUBSCRIBE_RETAIN_HANDLING2 ( 5U ) |
| Retain Handling Option 2 -> in core_mqtt_serializer.c. | |
| #define | MQTT_SESSION_EXPIRY_ID ( 0x11U ) |
| Session expiry id. | |
| #define | MQTT_RECEIVE_MAX_ID ( 0x21U ) |
| Receive maximum id. | |
| #define | MQTT_MAX_PACKET_SIZE_ID ( 0x27U ) |
| Maximum packet size id. | |
| #define | MQTT_TOPIC_ALIAS_MAX_ID ( 0x22U ) |
| Topic alias size id. | |
| #define | MQTT_REQUEST_RESPONSE_ID ( 0x19U ) |
| Request response id. | |
| #define | MQTT_REQUEST_PROBLEM_ID ( 0x17U ) |
| Request problem id. | |
| #define | MQTT_USER_PROPERTY_ID ( 0x26U ) |
| User property id. | |
| #define | MQTT_AUTH_METHOD_ID ( 0x15U ) |
| Authentication method id. | |
| #define | MQTT_AUTH_DATA_ID ( 0x16U ) |
| Authentication data id. | |
| #define | MQTT_WILL_DELAY_ID ( 0x18U ) |
| Will delay id. | |
| #define | MQTT_PAYLOAD_FORMAT_ID ( 0x01U ) |
| Payload format id. | |
| #define | MQTT_MSG_EXPIRY_ID ( 0x02U ) |
| Message Expiry id. | |
| #define | MQTT_CONTENT_TYPE_ID ( 0x03U ) |
| Content type id. | |
| #define | MQTT_RESPONSE_TOPIC_ID ( 0x08U ) |
| Response topic id. | |
| #define | MQTT_CORRELATION_DATA_ID ( 0x09U ) |
| Correlation data id. | |
| #define | MQTT_TOPIC_ALIAS_ID ( 0x23U ) |
| Topic alias id. | |
| #define | MQTT_MAX_QOS_ID ( 0x24U ) |
| Max qos id. | |
| #define | MQTT_RETAIN_AVAILABLE_ID ( 0x25U ) |
| Retain available id. | |
| #define | MQTT_ASSIGNED_CLIENT_ID ( 0x12U ) |
| Assigned client identifier id. | |
| #define | MQTT_REASON_STRING_ID ( 0x1FU ) |
| Reason string id. | |
| #define | MQTT_WILDCARD_ID ( 0x28U ) |
| Wildcard available id. | |
| #define | MQTT_SUB_AVAILABLE_ID ( 0x29U ) |
| Subscription available id. | |
| #define | MQTT_SHARED_SUB_ID ( 0x2AU ) |
| Shared subscription id. | |
| #define | MQTT_SERVER_KEEP_ALIVE_ID ( 0x13U ) |
| Server keep alive id. | |
| #define | MQTT_RESPONSE_INFO_ID ( 0x1AU ) |
| Response information id. | |
| #define | MQTT_SERVER_REF_ID ( 0x1CU ) |
| Server reference id. | |
| #define | MQTT_SUBSCRIPTION_ID_ID ( 0x0BU ) |
| Subscription ID id. | |
Functions | |
| MQTTStatus_t | MQTT_GetConnectPacketSize (const MQTTConnectInfo_t *pConnectInfo, const MQTTPublishInfo_t *pWillInfo, const MQTTPropBuilder_t *pConnectProperties, const MQTTPropBuilder_t *pWillProperties, uint32_t *pRemainingLength, uint32_t *pPacketSize) |
| Get the size and Remaining Length of an MQTT Version 5 CONNECT packet. | |
| MQTTStatus_t | MQTT_SerializeConnect (const MQTTConnectInfo_t *pConnectInfo, const MQTTPublishInfo_t *pWillInfo, const MQTTPropBuilder_t *pConnectProperties, const MQTTPropBuilder_t *pWillProperties, uint32_t remainingLength, const MQTTFixedBuffer_t *pFixedBuffer) |
Serialize an MQTT CONNECT packet in the given fixed buffer pFixedBuffer. | |
| MQTTStatus_t | MQTT_GetSubscribePacketSize (const MQTTSubscribeInfo_t *pSubscriptionList, size_t subscriptionCount, const MQTTPropBuilder_t *pSubscribeProperties, uint32_t *pRemainingLength, uint32_t *pPacketSize, uint32_t maxPacketSize) |
| Get packet size and Remaining Length of an MQTT SUBSCRIBE packet. | |
| MQTTStatus_t | MQTT_SerializeSubscribe (const MQTTSubscribeInfo_t *pSubscriptionList, size_t subscriptionCount, const MQTTPropBuilder_t *pSubscribeProperties, uint16_t packetId, uint32_t remainingLength, const MQTTFixedBuffer_t *pFixedBuffer) |
| Serialize an MQTT SUBSCRIBE packet in the given buffer. | |
| MQTTStatus_t | MQTT_GetUnsubscribePacketSize (const MQTTSubscribeInfo_t *pSubscriptionList, size_t subscriptionCount, const MQTTPropBuilder_t *pUnsubscribeProperties, uint32_t *pRemainingLength, uint32_t *pPacketSize, uint32_t maxPacketSize) |
| Get packet size and Remaining Length of an MQTT UNSUBSCRIBE packet. | |
| MQTTStatus_t | MQTT_SerializeUnsubscribe (const MQTTSubscribeInfo_t *pSubscriptionList, size_t subscriptionCount, const MQTTPropBuilder_t *pUnsubscribeProperties, uint16_t packetId, uint32_t remainingLength, const MQTTFixedBuffer_t *pFixedBuffer) |
| Serialize an MQTT UNSUBSCRIBE packet with properties in the given buffer. | |
| MQTTStatus_t | MQTT_GetPublishPacketSize (const MQTTPublishInfo_t *pPublishInfo, const MQTTPropBuilder_t *pPublishProperties, uint32_t *pRemainingLength, uint32_t *pPacketSize, uint32_t maxPacketSize) |
| Get the packet size and remaining length of an MQTT PUBLISH packet. | |
| MQTTStatus_t | MQTT_SerializePublish (const MQTTPublishInfo_t *pPublishInfo, const MQTTPropBuilder_t *pPublishProperties, uint16_t packetId, uint32_t remainingLength, const MQTTFixedBuffer_t *pFixedBuffer) |
| Serialize an MQTT PUBLISH packet in the given buffer. | |
| MQTTStatus_t | MQTT_SerializePublishHeaderWithoutTopic (const MQTTPublishInfo_t *pPublishInfo, uint32_t remainingLength, uint8_t *pBuffer, size_t *headerSize) |
| Serialize an MQTT PUBLISH packet header without the topic string in the given buffer. This function will add the topic string length to the provided buffer. This helps reduce an unnecessary copy of the topic string into the buffer. | |
| MQTTStatus_t | MQTT_SerializePublishHeader (const MQTTPublishInfo_t *pPublishInfo, const MQTTPropBuilder_t *pPublishProperties, uint16_t packetId, uint32_t remainingLength, const MQTTFixedBuffer_t *pFixedBuffer, size_t *pHeaderSize) |
| Serialize an MQTT PUBLISH packet header in the given buffer. | |
| MQTTStatus_t | MQTT_SerializeAck (const MQTTFixedBuffer_t *pFixedBuffer, uint8_t packetType, uint16_t packetId, const MQTTPropBuilder_t *pAckProperties, const MQTTSuccessFailReasonCode_t *pReasonCode) |
| Serialize an MQTT PUBACK, PUBREC, PUBREL, or PUBCOMP into the given buffer. | |
| MQTTStatus_t | MQTT_GetDisconnectPacketSize (const MQTTPropBuilder_t *pDisconnectProperties, uint32_t *pRemainingLength, uint32_t *pPacketSize, uint32_t maxPacketSize, const MQTTSuccessFailReasonCode_t *pReasonCode) |
| Get the size of an MQTT DISCONNECT packet. | |
| MQTTStatus_t | MQTT_SerializeDisconnect (const MQTTPropBuilder_t *pDisconnectProperties, const MQTTSuccessFailReasonCode_t *pReasonCode, uint32_t remainingLength, const MQTTFixedBuffer_t *pFixedBuffer) |
| Serialize an MQTT DISCONNECT packet into the given buffer. | |
| MQTTStatus_t | MQTT_GetPingreqPacketSize (uint32_t *pPacketSize) |
| Get the size of an MQTT PINGREQ packet. | |
| MQTTStatus_t | MQTT_SerializePingreq (const MQTTFixedBuffer_t *pFixedBuffer) |
| Serialize an MQTT PINGREQ packet into the given buffer. | |
| MQTTStatus_t | MQTT_DeserializePublish (const MQTTPacketInfo_t *pIncomingPacket, uint16_t *pPacketId, MQTTPublishInfo_t *pPublishInfo, MQTTPropBuilder_t *propBuffer, uint32_t maxPacketSize, uint16_t topicAliasMax) |
| Deserialize an MQTT PUBLISH packet. | |
| MQTTStatus_t | MQTT_DeserializeAck (const MQTTPacketInfo_t *pIncomingPacket, uint16_t *pPacketId, MQTTReasonCodeInfo_t *pReasonCode, MQTTPropBuilder_t *pPropBuffer, const MQTTConnectionProperties_t *pConnectProperties) |
| Deserialize an MQTT PUBACK, PUBREC, PUBREL, PUBCOMP, SUBACK, UNSUBACK, or PINGRESP. | |
| MQTTStatus_t | MQTT_DeserializeConnAck (const MQTTPacketInfo_t *pIncomingPacket, bool *pSessionPresent, MQTTPropBuilder_t *pPropBuffer, MQTTConnectionProperties_t *pConnectProperties) |
| Deserialize an MQTT CONNACK. | |
| MQTTStatus_t | MQTT_GetIncomingPacketTypeAndLength (TransportRecv_t readFunc, NetworkContext_t *pNetworkContext, MQTTPacketInfo_t *pIncomingPacket) |
| Extract the MQTT packet type and length from incoming packet. | |
| MQTTStatus_t | MQTT_ProcessIncomingPacketTypeAndLength (const uint8_t *pBuffer, const size_t *pIndex, MQTTPacketInfo_t *pIncomingPacket) |
| Extract the MQTT packet type and length from incoming packet. | |
| MQTTStatus_t | MQTT_UpdateDuplicatePublishFlag (uint8_t *pHeader, bool set) |
| Update the duplicate publish flag within the given header of the publish packet. | |
| MQTTStatus_t | MQTT_InitConnect (MQTTConnectionProperties_t *pConnectProperties) |
| Initialize an MQTTConnectionProperties_t. | |
| MQTTStatus_t | MQTTPropertyBuilder_Init (MQTTPropBuilder_t *pPropertyBuilder, uint8_t *buffer, size_t length) |
| Initialize the property builder. | |
| MQTTStatus_t | MQTT_ValidateWillProperties (const MQTTPropBuilder_t *pPropertyBuilder) |
| Validates the properties specified for WILL Properties in the MQTT CONNECT packet. | |
| MQTTStatus_t | MQTT_ValidateConnectProperties (const MQTTPropBuilder_t *pPropertyBuilder, bool *isRequestProblemInfoSet, uint32_t *pPacketMaxSizeValue) |
| Validate the properties in a CONNECT packet. | |
| 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. | |
| MQTTStatus_t | MQTT_ValidateSubscribeProperties (bool isSubscriptionIdAvailable, const MQTTPropBuilder_t *propBuilder) |
| Validates the properties of a SUBSCRIBE packet. | |
| MQTTStatus_t | updateContextWithConnectProps (const MQTTPropBuilder_t *pPropBuilder, MQTTConnectionProperties_t *pConnectProperties) |
| Updates the MQTT context with connect properties 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. | |
| MQTTStatus_t | MQTT_ValidatePublishProperties (uint16_t serverTopicAliasMax, const MQTTPropBuilder_t *propBuilder, uint16_t *topicAlias) |
| Validates the properties of a PUBLISH packet. | |
| MQTTStatus_t | MQTT_ValidatePublishParams (const MQTTPublishInfo_t *pPublishInfo, uint8_t retainAvailable, uint8_t maxQos, uint16_t topicAlias, uint32_t maxPacketSize) |
Validate the publish parameters present in the given publish structure pPublishInfo. | |
| MQTTStatus_t | MQTT_ValidatePublishAckProperties (const MQTTPropBuilder_t *pPropertyBuilder) |
| Validates the properties specified for an MQTT PUBLISH ACK packet. | |
| MQTTStatus_t | MQTT_ValidateUnsubscribeProperties (const MQTTPropBuilder_t *pPropertyBuilder) |
| Validates the properties specified for an MQTT UNSUBSCRIBE packet. | |
| MQTTStatus_t | MQTT_GetAckPacketSize (uint32_t *pRemainingLength, uint32_t *pPacketSize, uint32_t maxPacketSize, size_t ackPropertyLength) |
| Get the size of an outgoing PUBLISH ACK packet. | |
| MQTTStatus_t | MQTT_ValidateDisconnectProperties (uint32_t connectSessionExpiry, const MQTTPropBuilder_t *pPropertyBuilder) |
| Validates the properties specified for an MQTT DISCONNECT packet. | |
| MQTTStatus_t | MQTT_DeserializeDisconnect (const MQTTPacketInfo_t *pPacket, uint32_t maxPacketSize, MQTTReasonCodeInfo_t *pDisconnectInfo, MQTTPropBuilder_t *pPropBuffer) |
| Deserialize an MQTT Disconnect packet. | |
User-facing functions for serializing and deserializing MQTT 5.0 packets. This header should be included for building a lighter weight MQTT client than the managed CSDK MQTT library API in core_mqtt.h, by using the serializer and de-serializer functions exposed in this file's API.
| MQTTStatus_t MQTT_GetConnectPacketSize | ( | const MQTTConnectInfo_t * | pConnectInfo, |
| const MQTTPublishInfo_t * | pWillInfo, | ||
| const MQTTPropBuilder_t * | pConnectProperties, | ||
| const MQTTPropBuilder_t * | pWillProperties, | ||
| uint32_t * | pRemainingLength, | ||
| uint32_t * | pPacketSize | ||
| ) |
Get the size and Remaining Length of an MQTT Version 5 CONNECT packet.
This function must be called before MQTT_SerializeConnect in order to get the size of the MQTT CONNECT packet that is generated from MQTTConnectInfo_t, MQTTPublishInfo_t and optional MQTTPropBuilder_t. The size of the MQTTFixedBuffer_t supplied to MQTT_SerializeConnect must be at least pPacketSize. The provided pConnectInfo and pWillInfo are valid for serialization with MQTT_SerializeConnect only if this function returns MQTTSuccess. The remaining length returned in pRemainingLength and the packet size returned in pPacketSize are valid only if this function returns MQTTSuccess.
| [in] | pConnectInfo | MQTT CONNECT packet parameters. |
| [in] | pWillInfo | Last Will and Testament. Pass NULL if not used. |
| [in] | pConnectProperties | MQTT CONNECT properties builder. Pass NULL if not used. |
| [in] | pWillProperties | MQTT Will properties builder. Pass NULL if not used. |
| [out] | pRemainingLength | The Remaining Length of the MQTT CONNECT packet. |
| [out] | pPacketSize | The total size of the MQTT CONNECT packet. |
Example
| MQTTStatus_t MQTT_SerializeConnect | ( | const MQTTConnectInfo_t * | pConnectInfo, |
| const MQTTPublishInfo_t * | pWillInfo, | ||
| const MQTTPropBuilder_t * | pConnectProperties, | ||
| const MQTTPropBuilder_t * | pWillProperties, | ||
| uint32_t | remainingLength, | ||
| const MQTTFixedBuffer_t * | pFixedBuffer | ||
| ) |
Serialize an MQTT CONNECT packet in the given fixed buffer pFixedBuffer.
MQTT_GetConnectPacketSize should be called with pConnectInfo, pWillInfo, pConnectProperties, and pWillProperties before invoking this function to get the size of the required MQTTFixedBuffer_t and remainingLength. The remainingLength must be the same as returned by MQTT_GetConnectPacketSize. The MQTTFixedBuffer_t must be at least as large as the size returned by MQTT_GetConnectPacketSize.
| [in] | pConnectInfo | MQTT CONNECT packet parameters. |
| [in] | pWillInfo | Last Will and Testament. Pass NULL if not used. |
| [in] | pConnectProperties | MQTT CONNECT properties builder. Pass NULL if not used. |
| [in] | pWillProperties | MQTT Will properties builder. Pass NULL if not used. |
| [in] | remainingLength | Remaining Length provided by MQTT_GetConnectPacketSize. |
| [out] | pFixedBuffer | Buffer for packet serialization. |
Example
| MQTTStatus_t MQTT_GetSubscribePacketSize | ( | const MQTTSubscribeInfo_t * | pSubscriptionList, |
| size_t | subscriptionCount, | ||
| const MQTTPropBuilder_t * | pSubscribeProperties, | ||
| uint32_t * | pRemainingLength, | ||
| uint32_t * | pPacketSize, | ||
| uint32_t | maxPacketSize | ||
| ) |
Get packet size and Remaining Length of an MQTT SUBSCRIBE packet.
This function must be called before MQTT_SerializeSubscribe in order to get the size of the MQTT SUBSCRIBE packet that is generated from the list of MQTTSubscribeInfo_t and MQTTPropBuilder_t (optional subscribe properties). The size of the MQTTFixedBuffer_t supplied to MQTT_SerializeSubscribe must be at least pPacketSize. The provided pSubscriptionList is valid for serialization with MQTT_SerializeSubscribe only if this function returns MQTTSuccess. The remaining length returned in pRemainingLength and the packet size returned in pPacketSize are valid only if this function returns MQTTSuccess.
| [in] | pSubscriptionList | List of MQTT subscription info. |
| [in] | subscriptionCount | The number of elements in pSubscriptionList. |
| [in] | pSubscribeProperties | MQTT SUBSCRIBE properties builder. Pass NULL if not used. |
| [out] | pRemainingLength | The Remaining Length of the MQTT SUBSCRIBE packet. |
| [out] | pPacketSize | The total size of the MQTT SUBSCRIBE packet. |
| [in] | maxPacketSize | Maximum packet size. |
Example
| MQTTStatus_t MQTT_SerializeSubscribe | ( | const MQTTSubscribeInfo_t * | pSubscriptionList, |
| size_t | subscriptionCount, | ||
| const MQTTPropBuilder_t * | pSubscribeProperties, | ||
| uint16_t | packetId, | ||
| uint32_t | remainingLength, | ||
| const MQTTFixedBuffer_t * | pFixedBuffer | ||
| ) |
Serialize an MQTT SUBSCRIBE packet in the given buffer.
MQTT_GetSubscribePacketSize should be called with pSubscriptionList before invoking this function to get the size of the required MQTTFixedBuffer_t and remainingLength. The remainingLength must be the same as returned by MQTT_GetSubscribePacketSize. The MQTTFixedBuffer_t must be at least as large as the size returned by MQTT_GetSubscribePacketSize.
| [in] | pSubscriptionList | List of MQTT subscription info. |
| [in] | subscriptionCount | The number of elements in pSubscriptionList. |
| [in] | pSubscribeProperties | MQTT v5.0 properties for the SUBSCRIBE packet. Can be NULL if no properties are needed. |
| [in] | packetId | packet ID generated by MQTT_GetPacketId. |
| [in] | remainingLength | Remaining Length provided by MQTT_GetSubscribePacketSize. |
| [out] | pFixedBuffer | Buffer for packet serialization. |
Example
| MQTTStatus_t MQTT_GetUnsubscribePacketSize | ( | const MQTTSubscribeInfo_t * | pSubscriptionList, |
| size_t | subscriptionCount, | ||
| const MQTTPropBuilder_t * | pUnsubscribeProperties, | ||
| uint32_t * | pRemainingLength, | ||
| uint32_t * | pPacketSize, | ||
| uint32_t | maxPacketSize | ||
| ) |
Get packet size and Remaining Length of an MQTT UNSUBSCRIBE packet.
This function must be called before MQTT_SerializeUnsubscribe in order to get the size of the MQTT UNSUBSCRIBE packet that is generated from the list of MQTTSubscribeInfo_t and MQTTPropBuilder_t (optional unsubscribe properties). The size of the MQTTFixedBuffer_t supplied to MQTT_SerializeUnsubscribe must be at least pPacketSize. The provided pSubscriptionList is valid for serialization with MQTT_SerializeUnsubscribe only if this function returns MQTTSuccess. The remaining length returned in pRemainingLength and the packet size returned in pPacketSize are valid only if this function returns MQTTSuccess.
| [in] | pSubscriptionList | List of MQTT subscription info. |
| [in] | subscriptionCount | The number of elements in pSubscriptionList. |
| [in] | pUnsubscribeProperties | MQTT UNSUBSCRIBE properties builder. Pass NULL if not used. |
| [out] | pRemainingLength | The Remaining Length of the MQTT UNSUBSCRIBE packet. |
| [out] | pPacketSize | The total size of the MQTT UNSUBSCRIBE packet. |
| [in] | maxPacketSize | Maximum packet size. |
Example
| MQTTStatus_t MQTT_SerializeUnsubscribe | ( | const MQTTSubscribeInfo_t * | pSubscriptionList, |
| size_t | subscriptionCount, | ||
| const MQTTPropBuilder_t * | pUnsubscribeProperties, | ||
| uint16_t | packetId, | ||
| uint32_t | remainingLength, | ||
| const MQTTFixedBuffer_t * | pFixedBuffer | ||
| ) |
Serialize an MQTT UNSUBSCRIBE packet with properties in the given buffer.
MQTT_GetUnsubscribePacketSize should be called with pSubscriptionList and pUnsubscribeProperties before invoking this function to get the size of the required MQTTFixedBuffer_t and remainingLength. The remainingLength must be the same as returned by MQTT_GetUnsubscribePacketSize. The MQTTFixedBuffer_t must be at least as large as the size returned by MQTT_GetUnsubscribePacketSize.
| [in] | pSubscriptionList | List of MQTT subscription info to unsubscribe from. |
| [in] | subscriptionCount | The number of elements in pSubscriptionList. |
| [in] | pUnsubscribeProperties | MQTT 5.0 properties for the UNSUBSCRIBE packet. Can be NULL if no properties are needed. |
| [in] | packetId | Packet identifier used for the UNSUBSCRIBE packet. |
| [in] | remainingLength | Remaining Length provided by MQTT_GetUnsubscribePacketSize. |
| [out] | pFixedBuffer | Buffer where the serialized UNSUBSCRIBE packet will be written. |
Example
| MQTTStatus_t MQTT_GetPublishPacketSize | ( | const MQTTPublishInfo_t * | pPublishInfo, |
| const MQTTPropBuilder_t * | pPublishProperties, | ||
| uint32_t * | pRemainingLength, | ||
| uint32_t * | pPacketSize, | ||
| uint32_t | maxPacketSize | ||
| ) |
Get the packet size and remaining length of an MQTT PUBLISH packet.
MQTT_ValidatePublishParams should be called with pPublishInfo before invoking this function to validate the publish parameters. This function must be called before sendPublishWithoutCopy in order to get the size of the MQTT PUBLISH packet that is generated from MQTTPublishInfo_t and optional publish properties. The remaining length returned in pRemainingLength and the packet size returned in pPacketSize are valid only if this function returns MQTTSuccess.
| [in] | pPublishInfo | MQTT PUBLISH packet parameters. |
| [in] | pPublishProperties | MQTT PUBLISH properties builder. Pass NULL if not used. |
| [out] | pRemainingLength | The Remaining Length of the MQTT PUBLISH packet. |
| [out] | pPacketSize | The total size of the MQTT PUBLISH packet. |
| [in] | maxPacketSize | Maximum packet size allowed by the server. |
Example
| MQTTStatus_t MQTT_SerializePublish | ( | const MQTTPublishInfo_t * | pPublishInfo, |
| const MQTTPropBuilder_t * | pPublishProperties, | ||
| uint16_t | packetId, | ||
| uint32_t | remainingLength, | ||
| const MQTTFixedBuffer_t * | pFixedBuffer | ||
| ) |
Serialize an MQTT PUBLISH packet in the given buffer.
This function will serialize complete MQTT PUBLISH packet into the given buffer. If the PUBLISH payload can be sent separately, consider using MQTT_SerializePublishHeader, which will serialize only the PUBLISH header into the buffer.
MQTT_GetPublishPacketSize should be called with pPublishInfo before invoking this function to get the size of the required MQTTFixedBuffer_t and remainingLength. The remainingLength must be the same as returned by MQTT_GetPublishPacketSize. The MQTTFixedBuffer_t must be at least as large as the size returned by MQTT_GetPublishPacketSize.
| [in] | pPublishInfo | MQTT PUBLISH packet parameters. |
| [in] | pPublishProperties | MQTT v5.0 properties for the PUBLISH packet. Can be NULL if no properties are needed. |
| [in] | packetId | packet ID generated by MQTT_GetPacketId. |
| [in] | remainingLength | Remaining Length provided by MQTT_GetPublishPacketSize. |
| [out] | pFixedBuffer | Buffer for packet serialization. |
Example
| MQTTStatus_t MQTT_SerializePublishHeaderWithoutTopic | ( | const MQTTPublishInfo_t * | pPublishInfo, |
| uint32_t | remainingLength, | ||
| uint8_t * | pBuffer, | ||
| size_t * | headerSize | ||
| ) |
Serialize an MQTT PUBLISH packet header without the topic string in the given buffer. This function will add the topic string length to the provided buffer. This helps reduce an unnecessary copy of the topic string into the buffer.
| [in] | pPublishInfo | MQTT PUBLISH packet parameters. |
| [in] | remainingLength | Remaining Length provided by MQTT_GetPublishPacketSize. |
| [out] | pBuffer | Buffer for packet serialization. |
| [out] | headerSize | Size of the serialized MQTT PUBLISH header. |
| MQTTStatus_t MQTT_SerializePublishHeader | ( | const MQTTPublishInfo_t * | pPublishInfo, |
| const MQTTPropBuilder_t * | pPublishProperties, | ||
| uint16_t | packetId, | ||
| uint32_t | remainingLength, | ||
| const MQTTFixedBuffer_t * | pFixedBuffer, | ||
| size_t * | pHeaderSize | ||
| ) |
Serialize an MQTT PUBLISH packet header in the given buffer.
This function serializes PUBLISH header in to the given buffer. The payload for PUBLISH will not be copied over to the buffer. This will help reduce the memory needed for the buffer and avoid an unwanted copy operation of the PUBLISH payload into the buffer. If the payload also would need to be part of the serialized buffer, consider using MQTT_SerializePublish.
MQTT_GetPublishPacketSize should be called with pPublishInfo before invoking this function to get the size of the required MQTTFixedBuffer_t and remainingLength. The remainingLength must be the same as returned by MQTT_GetPublishPacketSize. The MQTTFixedBuffer_t must be at least as large as the size returned by MQTT_GetPublishPacketSize.
| [in] | pPublishInfo | MQTT PUBLISH packet parameters. |
| [in] | pPublishProperties | MQTT v5.0 properties for the PUBLISH packet. Can be NULL if no properties are needed. |
| [in] | packetId | packet ID generated by MQTT_GetPacketId. |
| [in] | remainingLength | Remaining Length provided by MQTT_GetPublishPacketSize. |
| [out] | pFixedBuffer | Buffer for packet serialization. |
| [out] | pHeaderSize | Size of the serialized MQTT PUBLISH header. |
Example
| MQTTStatus_t MQTT_SerializeAck | ( | const MQTTFixedBuffer_t * | pFixedBuffer, |
| uint8_t | packetType, | ||
| uint16_t | packetId, | ||
| const MQTTPropBuilder_t * | pAckProperties, | ||
| const MQTTSuccessFailReasonCode_t * | pReasonCode | ||
| ) |
Serialize an MQTT PUBACK, PUBREC, PUBREL, or PUBCOMP into the given buffer.
| [out] | pFixedBuffer | Buffer for packet serialization. |
| [in] | packetType | Byte of the corresponding packet fixed header per the MQTT spec. |
| [in] | packetId | Packet ID of the publish. |
| [in] | pAckProperties | Optional properties to be added to the ACK packet. |
| [in] | pReasonCode | Optional reason code to be added to the ACK packet. |
Example
| MQTTStatus_t MQTT_GetDisconnectPacketSize | ( | const MQTTPropBuilder_t * | pDisconnectProperties, |
| uint32_t * | pRemainingLength, | ||
| uint32_t * | pPacketSize, | ||
| uint32_t | maxPacketSize, | ||
| const MQTTSuccessFailReasonCode_t * | pReasonCode | ||
| ) |
Get the size of an MQTT DISCONNECT packet.
| [in] | pDisconnectProperties | MQTT DISCONNECT properties builder. Pass NULL if not used. |
| [out] | pRemainingLength | The Remaining Length of the MQTT DISCONNECT packet. |
| [out] | pPacketSize | The size of the MQTT DISCONNECT packet. |
| [in] | maxPacketSize | Maximum packet size allowed by the server. |
| [in] | pReasonCode | The reason code for the disconnect. Pass NULL if not used - only valid if the properties are NULL too. |
Example
| MQTTStatus_t MQTT_SerializeDisconnect | ( | const MQTTPropBuilder_t * | pDisconnectProperties, |
| const MQTTSuccessFailReasonCode_t * | pReasonCode, | ||
| uint32_t | remainingLength, | ||
| const MQTTFixedBuffer_t * | pFixedBuffer | ||
| ) |
Serialize an MQTT DISCONNECT packet into the given buffer.
The input MQTTFixedBuffer_t.size must be at least as large as the size returned by MQTT_GetDisconnectPacketSize. This function should only be called after MQTT_GetDisconnectPacketSize to ensure proper buffer sizing.
| [in] | pDisconnectProperties | MQTT v5.0 properties for the DISCONNECT packet. Can be NULL if no properties are needed. |
| [in] | pReasonCode | The reason code for the disconnect. For MQTT v5.0, this indicates why the connection is being terminated. If this is NULL, then the pDisconnectProperties must be NULL as well. |
| [in] | remainingLength | Remaining Length provided by MQTT_GetDisconnectPacketSize. |
| [out] | pFixedBuffer | Buffer for packet serialization. |
Example
| MQTTStatus_t MQTT_GetPingreqPacketSize | ( | uint32_t * | pPacketSize | ) |
Get the size of an MQTT PINGREQ packet.
| [out] | pPacketSize | The size of the MQTT PINGREQ packet. |
Example
| MQTTStatus_t MQTT_SerializePingreq | ( | const MQTTFixedBuffer_t * | pFixedBuffer | ) |
Serialize an MQTT PINGREQ packet into the given buffer.
The input MQTTFixedBuffer_t.size must be at least as large as the size returned by MQTT_GetPingreqPacketSize.
| [out] | pFixedBuffer | Buffer for packet serialization. |
Example
| MQTTStatus_t MQTT_DeserializePublish | ( | const MQTTPacketInfo_t * | pIncomingPacket, |
| uint16_t * | pPacketId, | ||
| MQTTPublishInfo_t * | pPublishInfo, | ||
| MQTTPropBuilder_t * | propBuffer, | ||
| uint32_t | maxPacketSize, | ||
| uint16_t | topicAliasMax | ||
| ) |
Deserialize an MQTT PUBLISH packet.
| [in] | pIncomingPacket | MQTTPacketInfo_t containing the buffer. |
| [out] | pPacketId | The packet ID obtained from the buffer. |
| [out] | pPublishInfo | Struct containing information about the publish. |
| [in] | propBuffer | Buffer to hold the properties. |
| [in] | maxPacketSize | Maximum packet size. |
| [in] | topicAliasMax | Maximum topic alias specified in the CONNECT packet. |
Example
| MQTTStatus_t MQTT_DeserializeAck | ( | const MQTTPacketInfo_t * | pIncomingPacket, |
| uint16_t * | pPacketId, | ||
| MQTTReasonCodeInfo_t * | pReasonCode, | ||
| MQTTPropBuilder_t * | pPropBuffer, | ||
| const MQTTConnectionProperties_t * | pConnectProperties | ||
| ) |
Deserialize an MQTT PUBACK, PUBREC, PUBREL, PUBCOMP, SUBACK, UNSUBACK, or PINGRESP.
| [in] | pIncomingPacket | MQTTPacketInfo_t containing the buffer. |
| [out] | pPacketId | The packet ID obtained from the buffer. |
| [out] | pReasonCode | Struct to store reason code(s) from the acknowledgment packet. Contains the success/failure status of the corresponding request. |
| [out] | pPropBuffer | Struct to store the deserialized acknowledgment properties. Will contain any MQTT v5.0 properties included in the ack packet. |
| [in,out] | pConnectProperties | Struct to store the deserialized connect/connack properties. |
Example
| MQTTStatus_t MQTT_DeserializeConnAck | ( | const MQTTPacketInfo_t * | pIncomingPacket, |
| bool * | pSessionPresent, | ||
| MQTTPropBuilder_t * | pPropBuffer, | ||
| MQTTConnectionProperties_t * | pConnectProperties | ||
| ) |
Deserialize an MQTT CONNACK.
| [in] | pIncomingPacket | MQTTPacketInfo_t containing the buffer. |
| [out] | pSessionPresent | Boolean flag from a CONNACK indicating present session. |
| [out] | pPropBuffer | Struct to store the deserialized acknowledgment properties. Will contain any MQTT v5.0 properties included in the ack packet. |
| [in,out] | pConnectProperties | Struct to store the deserialized connect/connack properties. This parameter cannot be NULL. |
| MQTTStatus_t MQTT_GetIncomingPacketTypeAndLength | ( | TransportRecv_t | readFunc, |
| NetworkContext_t * | pNetworkContext, | ||
| MQTTPacketInfo_t * | pIncomingPacket | ||
| ) |
Extract the MQTT packet type and length from incoming packet.
This function must be called for every incoming packet to retrieve the MQTTPacketInfo_t.type and MQTTPacketInfo_t.remainingLength. A MQTTPacketInfo_t is not valid until this routine has been invoked.
| [in] | readFunc | Transport layer read function pointer. |
| [in] | pNetworkContext | The network context pointer provided by the application. |
| [out] | pIncomingPacket | Pointer to MQTTPacketInfo_t structure. This is where type, remaining length and packet identifier are stored. |
pIncomingPacket is invalid, MQTTRecvFailed on transport receive failure, MQTTBadResponse if an invalid packet is read, and MQTTNoDataAvailable if there is nothing to read.Example
| MQTTStatus_t MQTT_ProcessIncomingPacketTypeAndLength | ( | const uint8_t * | pBuffer, |
| const size_t * | pIndex, | ||
| MQTTPacketInfo_t * | pIncomingPacket | ||
| ) |
Extract the MQTT packet type and length from incoming packet.
This function must be called for every incoming packet to retrieve the MQTTPacketInfo_t.type and MQTTPacketInfo_t.remainingLength. A MQTTPacketInfo_t is not valid until this routine has been invoked.
| [in] | pBuffer | The buffer holding the raw data to be processed |
| [in] | pIndex | Pointer to the index within the buffer to marking the end of raw data available. |
| [out] | pIncomingPacket | Structure used to hold the fields of the incoming packet. |
pIncomingPacket is invalid, MQTTBadResponse if an invalid packet is read, and MQTTNoDataAvailable if there is nothing to read. | MQTTStatus_t MQTT_UpdateDuplicatePublishFlag | ( | uint8_t * | pHeader, |
| bool | set | ||
| ) |
Update the duplicate publish flag within the given header of the publish packet.
| [in] | pHeader | The buffer holding the header content |
| [in] | set | If true then the flag will be set else cleared |
| MQTTStatus_t MQTT_InitConnect | ( | MQTTConnectionProperties_t * | pConnectProperties | ) |
Initialize an MQTTConnectionProperties_t.
| [in] | pConnectProperties | The connect properties to initialize. |
| MQTTStatus_t MQTTPropertyBuilder_Init | ( | MQTTPropBuilder_t * | pPropertyBuilder, |
| uint8_t * | buffer, | ||
| size_t | length | ||
| ) |
Initialize the property builder.
| [out] | pPropertyBuilder | Property builder to initialize. |
| [in] | buffer | Buffer to store the properties. |
| [in] | length | Length of the buffer. |
| MQTTStatus_t MQTT_ValidateWillProperties | ( | const MQTTPropBuilder_t * | pPropertyBuilder | ) |
Validates the properties specified for WILL Properties in the MQTT CONNECT packet.
| [in] | pPropertyBuilder | Pointer to the property builder structure containing will properties. |
| MQTTStatus_t MQTT_ValidateConnectProperties | ( | const MQTTPropBuilder_t * | pPropertyBuilder, |
| bool * | isRequestProblemInfoSet, | ||
| uint32_t * | pPacketMaxSizeValue | ||
| ) |
Validate the properties in a CONNECT packet.
| [in] | pPropertyBuilder | Pointer to the property builder structure containing connect packet properties. |
| [out] | isRequestProblemInfoSet | Whether the request problem info field is set in the properties. |
| [out] | pPacketMaxSizeValue | Optional pointer to get the Maximum Packet Size from the properties. If not required, NULL can be passed. |
| 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. |
| MQTTStatus_t MQTT_ValidateSubscribeProperties | ( | bool | isSubscriptionIdAvailable, |
| const MQTTPropBuilder_t * | propBuilder | ||
| ) |
Validates the properties of a SUBSCRIBE packet.
This function validates the properties in the property builder for a SUBSCRIBE packet.
| [in] | isSubscriptionIdAvailable | Boolean indicating if subscription identifiers are supported. |
| [in] | propBuilder | Pointer to the property builder structure. |
| MQTTStatus_t updateContextWithConnectProps | ( | const MQTTPropBuilder_t * | pPropBuilder, |
| MQTTConnectionProperties_t * | pConnectProperties | ||
| ) |
Updates the MQTT context with connect properties from the property builder.
This function processes the property builder and updates the connect properties in the MQTT context. It handles the conversion and validation of properties from the property builder to the connect properties structure.
| [in] | pPropBuilder | Pointer to the property builder containing MQTT properties. Must not be NULL. |
| [out] | pConnectProperties | Pointer to the connection properties structure to be updated. Must not be NULL. |
Example
This value shall get overwritten if the server sends a sessionExpiry in the CONNACK.
| 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. |
| MQTTStatus_t MQTT_ValidatePublishProperties | ( | uint16_t | serverTopicAliasMax, |
| const MQTTPropBuilder_t * | propBuilder, | ||
| uint16_t * | topicAlias | ||
| ) |
Validates the properties of a PUBLISH packet.
This function validates the properties in the property builder for a PUBLISH packet.
| [in] | serverTopicAliasMax | Maximum topic alias value allowed by the server. |
| [in] | propBuilder | Pointer to the property builder structure. |
| [out] | topicAlias | Pointer to store the topic alias value if present. |
| MQTTStatus_t MQTT_ValidatePublishParams | ( | const MQTTPublishInfo_t * | pPublishInfo, |
| uint8_t | retainAvailable, | ||
| uint8_t | maxQos, | ||
| uint16_t | topicAlias, | ||
| uint32_t | maxPacketSize | ||
| ) |
Validate the publish parameters present in the given publish structure pPublishInfo.
This function must be called before MQTT_GetPublishPacketSize in order to validate the publish parameters.
| [in] | pPublishInfo | MQTT publish packet parameters. |
| [in] | retainAvailable | Whether server allows retain or not. |
| [in] | maxQos | Maximum QoS supported by the server. |
| [in] | topicAlias | Topic alias in the PUBLISH packet. |
| [in] | maxPacketSize | Maximum packet size allowed by the server. |
Example
| MQTTStatus_t MQTT_ValidatePublishAckProperties | ( | const MQTTPropBuilder_t * | pPropertyBuilder | ) |
Validates the properties specified for an MQTT PUBLISH ACK packet.
| [in] | pPropertyBuilder | Pointer to the property builder structure containing unsubscribe properties. |
| MQTTStatus_t MQTT_ValidateUnsubscribeProperties | ( | const MQTTPropBuilder_t * | pPropertyBuilder | ) |
Validates the properties specified for an MQTT UNSUBSCRIBE packet.
| [in] | pPropertyBuilder | Pointer to the property builder structure containing unsubscribe properties. |
| MQTTStatus_t MQTT_GetAckPacketSize | ( | uint32_t * | pRemainingLength, |
| uint32_t * | pPacketSize, | ||
| uint32_t | maxPacketSize, | ||
| size_t | ackPropertyLength | ||
| ) |
Get the size of an outgoing PUBLISH ACK packet.
| [out] | pRemainingLength | The remaining length of the packet to be serialized. |
| [out] | pPacketSize | The size of the packet to be serialized. |
| [in] | maxPacketSize | Maximum packet size allowed by the server. |
| [in] | ackPropertyLength | The length of the properties. |
Example
| MQTTStatus_t MQTT_ValidateDisconnectProperties | ( | uint32_t | connectSessionExpiry, |
| const MQTTPropBuilder_t * | pPropertyBuilder | ||
| ) |
Validates the properties specified for an MQTT DISCONNECT packet.
| [in] | connectSessionExpiry | The session expiry interval that was specified in the CONNECT packet. Used to validate that the DISCONNECT session expiry is not non-zero while connectSessionExpiry is zero. |
| [in] | pPropertyBuilder | Pointer to the property builder structure containing subscribe properties. |
| MQTTStatus_t MQTT_DeserializeDisconnect | ( | const MQTTPacketInfo_t * | pPacket, |
| uint32_t | maxPacketSize, | ||
| MQTTReasonCodeInfo_t * | pDisconnectInfo, | ||
| MQTTPropBuilder_t * | pPropBuffer | ||
| ) |
Deserialize an MQTT Disconnect packet.
| [in] | pPacket | MQTTPacketInfo_t containing the buffer. |
| [in] | maxPacketSize | Maximum packet size allowed by the client. |
| [out] | pDisconnectInfo | Struct containing disconnect reason code |
| [out] | pPropBuffer | MQTTPropBuilder_t to store the deserialized properties. |
Example