28 #ifndef IOT_MQTT_HELPER_H_ 29 #define IOT_MQTT_HELPER_H_ 48 #define UINT16_HIGH_BYTE( x ) ( ( uint8_t ) ( ( x ) >> 8 ) ) 49 #define UINT16_LOW_BYTE( x ) ( ( uint8_t ) ( ( x ) & 0x00ffU ) ) 56 #define UINT16_DECODE( ptr ) \ 57 ( uint16_t ) ( ( ( ( uint16_t ) ( *( ptr ) ) ) << 8 ) | \ 58 ( ( uint16_t ) ( *( ( ptr ) + 1 ) ) ) ) 66 #define UINT8_SET_BIT( x, position ) ( ( x ) = ( uint8_t ) ( ( x ) | ( 0x01U << ( position ) ) ) ) 74 #define UINT8_CHECK_BIT( x, position ) ( ( ( x ) &( 0x01U << ( position ) ) ) == ( 0x01U << ( position ) ) ) 82 #ifndef AWS_IOT_MQTT_ENABLE_METRICS 83 #define AWS_IOT_MQTT_ENABLE_METRICS ( 1 ) 111 size_t * pRemainingLength,
112 size_t * pPacketSize );
125 size_t remainingLength,
127 size_t connectPacketSize );
144 size_t subscriptionCount,
145 size_t * pRemainingLength,
146 size_t * pPacketSize );
160 size_t subscriptionCount,
161 size_t remainingLength,
162 uint16_t * pPacketIdentifier,
164 size_t subscribePacketSize );
178 size_t subscriptionCount,
179 size_t remainingLength,
180 uint16_t * pPacketIdentifier,
182 size_t unsubscribePacketSize );
196 size_t * pRemainingLength,
197 size_t * pPacketSize );
212 size_t remainingLength,
213 uint16_t * pPacketIdentifier,
214 uint8_t ** pPacketIdentifierHigh,
216 size_t publishPacketSize );
IotMqttError_t
Return codes of MQTT functions.
Definition: iot_mqtt_types.h:106
This file contains MQTT 3.1.1 specific defines. This is a common header to be included for building a...
IotMqttError_t _IotMqtt_ProcessPublishFlags(uint8_t publishFlags, IotMqttPublishInfo_t *pOutput)
Process incoming publish flags.
Definition: iot_mqtt_helper.c:918
size_t _IotMqtt_RemainingLengthEncodedSize(size_t length)
Calculate the number of bytes required to encode an MQTT "Remaining length" field.
Definition: iot_mqtt_helper.c:336
uint16_t _IotMqtt_NextPacketIdentifier(void)
Generate and return a 2-byte packet identifier.
Definition: iot_mqtt_helper.c:372
void _IotMqtt_SerializeUnsubscribeCommon(const IotMqttSubscription_t *pSubscriptionList, size_t subscriptionCount, size_t remainingLength, uint16_t *pPacketIdentifier, uint8_t *pPacket, size_t unsubscribePacketSize)
Generate an UNSUBSCRIBE packet from the given parameters.
Definition: iot_mqtt_helper.c:868
bool _IotMqtt_IncomingPacketValid(uint8_t packetType)
Check if an incoming packet type is valid.
Definition: iot_mqtt_helper.c:588
bool _IotMqtt_ConnectPacketSize(const IotMqttConnectInfo_t *pConnectInfo, size_t *pRemainingLength, size_t *pPacketSize)
Calculate the size and "Remaining length" of a CONNECT packet generated from the given parameters...
Definition: iot_mqtt_helper.c:386
Information on a PUBLISH message.
Definition: iot_mqtt_types.h:395
MQTT subscription.
Definition: iot_mqtt_types.h:553
void _IotMqtt_SerializeConnectCommon(const IotMqttConnectInfo_t *pConnectInfo, size_t remainingLength, uint8_t *pPacket, size_t connectPacketSize)
Generate a CONNECT packet from the given parameters.
Definition: iot_mqtt_helper.c:456
MQTT connection details.
Definition: iot_mqtt_types.h:589
bool _IotMqtt_PublishPacketSize(const IotMqttPublishInfo_t *pPublishInfo, size_t *pRemainingLength, size_t *pPacketSize)
Calculate the size and "Remaining length" of a PUBLISH packet generated from the given parameters...
Definition: iot_mqtt_helper.c:722
void _IotMqtt_SerializeSubscribeCommon(const IotMqttSubscription_t *pSubscriptionList, size_t subscriptionCount, size_t remainingLength, uint16_t *pPacketIdentifier, uint8_t *pPacket, size_t subscribePacketSize)
Generate a SUBSCRIBE packet from the given parameters.
Definition: iot_mqtt_helper.c:615
bool _IotMqtt_SubscriptionPacketSize(IotMqttOperationType_t type, const IotMqttSubscription_t *pSubscriptionList, size_t subscriptionCount, size_t *pRemainingLength, size_t *pPacketSize)
Calculate the size and "Remaining length" of a SUBSCRIBE or UNSUBSCRIBE packet generated from the giv...
Definition: iot_mqtt_helper.c:669
IotMqttOperationType_t
Types of MQTT operations.
Definition: iot_mqtt_types.h:280
void _IotMqtt_SerializePublishCommon(const IotMqttPublishInfo_t *pPublishInfo, size_t remainingLength, uint16_t *pPacketIdentifier, uint8_t **pPacketIdentifierHigh, uint8_t *pPacket, size_t publishPacketSize)
Generate a PUBLISH packet from the given parameters.
Definition: iot_mqtt_helper.c:780