39 #ifndef AWS_IOT_SDK_SRC_IOT_COMMON_INTERNAL_H 40 #define AWS_IOT_SDK_SRC_IOT_COMMON_INTERNAL_H 50 #include "aws_iot_log.h" 54 typedef enum msgTypes {
73 #define MQTT_HEADER_FIELD_TYPE(_byte) ((_byte >> 4) & 0x0F) 74 #define MQTT_HEADER_FIELD_DUP(_byte) ((_byte & (1 << 3)) >> 3) 75 #define MQTT_HEADER_FIELD_QOS(_byte) ((_byte & (3 << 1)) >> 1) 76 #define MQTT_HEADER_FIELD_RETAIN(_byte) ((_byte & (1 << 0)) >> 0) 86 QoS qos, uint8_t dup, uint8_t retained);
90 uint32_t *pSerializedLen);
92 uint16_t *,
unsigned char *,
size_t);
98 uint32_t *readBytesLen);
114 uint8_t *retained, uint16_t *pPacketId,
115 char **pTopicName, uint16_t *topicNameLen,
116 unsigned char **payload,
size_t *payloadLen,
117 unsigned char *pRxBuf,
size_t rxBufLen);
122 #ifdef _ENABLE_THREAD_SUPPORT_
uint16_t aws_iot_mqtt_internal_read_uint16_t(unsigned char **pptr)
Calculates uint16 packet id from two bytes read from the input buffer.
Definition: aws_iot_mqtt_client_common_internal.c:140
IoT_Error_t aws_iot_mqtt_set_client_state(AWS_IoT_Client *pClient, ClientState expectedCurrentState, ClientState newState)
Change the state in an MQTT client.
Definition: aws_iot_mqtt_client.c:132
MessageTypes
Definition: aws_iot_mqtt_client_common_internal.h:54
IoT_Error_t aws_iot_mqtt_internal_serialize_ack(unsigned char *pTxBuf, size_t txBufLen, MessageTypes msgType, uint8_t dup, uint16_t packetId, uint32_t *pSerializedLen)
Definition: aws_iot_mqtt_client_publish.c:146
size_t aws_iot_mqtt_internal_write_len_to_buffer(unsigned char *buf, uint32_t length)
Encodes the message length according to the MQTT algorithm.
Definition: aws_iot_mqtt_client_common_internal.c:57
IoT_Error_t aws_iot_mqtt_internal_wait_for_read(AWS_IoT_Client *pClient, uint8_t packetType, Timer *pTimer)
Wait until a packet is read from the network.
Definition: aws_iot_mqtt_client_common_internal.c:725
Interface definition for MQTT client.
uint32_t aws_iot_mqtt_internal_get_final_packet_length_from_remaining_length(uint32_t rem_len)
Calculates the length of the "remaining length" encoding.
Definition: aws_iot_mqtt_client_common_internal.c:117
IoT_Error_t aws_iot_mqtt_internal_deserialize_publish(uint8_t *dup, QoS *qos, uint8_t *retained, uint16_t *pPacketId, char **pTopicName, uint16_t *topicNameLen, unsigned char **payload, size_t *payloadLen, unsigned char *pRxBuf, size_t rxBufLen)
Definition: aws_iot_mqtt_client_publish.c:295
ClientState
MQTT Client State Type.
Definition: aws_iot_mqtt_client.h:203
void aws_iot_mqtt_internal_write_uint_16(unsigned char **pptr, uint16_t anInt)
Writes an integer as 2 bytes to an output buffer.
Definition: aws_iot_mqtt_client_common_internal.c:157
void aws_iot_mqtt_internal_write_char(unsigned char **pptr, unsigned char c)
Writes one character to an output buffer.
Definition: aws_iot_mqtt_client_common_internal.c:182
IoT_Error_t aws_iot_mqtt_internal_decode_remaining_length_from_buffer(unsigned char *buf, uint32_t *decodedLen, uint32_t *readBytesLen)
Decodes the message length according to the MQTT algorithm.
Definition: aws_iot_mqtt_client_common_internal.c:84
void aws_iot_mqtt_internal_write_utf8_string(unsigned char **pptr, const char *string, uint16_t stringLen)
Writes a UTF-8 string into an MQTT packet.
Definition: aws_iot_mqtt_client_common_internal.c:194
IoT_Error_t aws_iot_mqtt_internal_flushBuffers(AWS_IoT_Client *pClient)
Flush incoming data from the MQTT client.
Definition: aws_iot_mqtt_client_common_internal.c:709
IoT_Error_t aws_iot_mqtt_internal_deserialize_ack(unsigned char *, unsigned char *, uint16_t *, unsigned char *, size_t)
Definition: aws_iot_mqtt_client_publish.c:366
IoT_Error_t aws_iot_mqtt_internal_send_packet(AWS_IoT_Client *pClient, size_t length, Timer *pTimer)
Send an MQTT packet on the network.
Definition: aws_iot_mqtt_client_common_internal.c:308
IoT_Error_t aws_iot_mqtt_internal_serialize_zero(unsigned char *pTxBuf, size_t txBufLen, MessageTypes packetType, size_t *pSerializedLength)
Definition: aws_iot_mqtt_client_common_internal.c:757
IoT_Error_t aws_iot_mqtt_internal_cycle_read(AWS_IoT_Client *pClient, Timer *pTimer, uint8_t *pPacketType)
Read an MQTT packet from the network.
Definition: aws_iot_mqtt_client_common_internal.c:636
IoT_Error_t aws_iot_mqtt_client_lock_mutex(AWS_IoT_Client *pClient, IoT_Mutex_t *pMutex)
Lock a mutex in the MQTT client.
Definition: aws_iot_mqtt_client.c:84
IoT_Error_t aws_iot_mqtt_client_unlock_mutex(AWS_IoT_Client *pClient, IoT_Mutex_t *pMutex)
Unlock a mutex in the MQTT client.
Definition: aws_iot_mqtt_client.c:114
IoT_Error_t aws_iot_mqtt_internal_init_header(MQTTHeader *pHeader, MessageTypes message_type, QoS qos, uint8_t dup, uint8_t retained)
Initialize the MQTTHeader structure.
Definition: aws_iot_mqtt_client_common_internal.c:218
QoS
Quality of Service Type.
Definition: aws_iot_mqtt_client.h:76
unsigned char aws_iot_mqtt_internal_read_char(unsigned char **pptr)
Reads one character from the input buffer.
Definition: aws_iot_mqtt_client_common_internal.c:170