this is fork and i will modify for STM32
Fork of AWS-test by
aws_iot_mqtt_client_common_internal.h File Reference
Internal MQTT functions not exposed to application. More...
Go to the source code of this file.
Data Structures | |
union | MQTTHeader |
Bitfields for the MQTT header byte. More... | |
Functions | |
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. | |
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) |
Serializes the ack packet into the supplied buffer. | |
IoT_Error_t | aws_iot_mqtt_internal_deserialize_ack (unsigned char *, unsigned char *, uint16_t *, unsigned char *, size_t) |
Deserializes the supplied (wire) buffer into an ack. | |
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. | |
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. | |
uint16_t | aws_iot_mqtt_internal_read_uint16_t (unsigned char **pptr) |
Calculates uint16 packet id from two bytes read from the input buffer Checks Endianness at runtime. | |
void | aws_iot_mqtt_internal_write_uint_16 (unsigned char **pptr, uint16_t anInt) |
Writes an integer as 2 bytes to an output buffer. | |
unsigned char | aws_iot_mqtt_internal_read_char (unsigned char **pptr) |
Reads one character from the input buffer. | |
void | aws_iot_mqtt_internal_write_char (unsigned char **pptr, unsigned char c) |
Writes one character to an output buffer. | |
IoT_Error_t | aws_iot_mqtt_internal_serialize_zero (unsigned char *pTxBuf, size_t txBufLen, MessageTypes packetType, size_t *pSerializedLength) |
Serializes a 0-length packet into the supplied buffer, ready for writing to a socket. | |
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) |
Deserializes the supplied (wire) buffer into publish data. |
Detailed Description
Internal MQTT functions not exposed to application.
Definition in file aws_iot_mqtt_client_common_internal.h.
Function Documentation
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.
- Parameters:
-
the buffer containing the message value the decoded length returned
- Returns:
- the number of bytes read from the socket
Definition at line 80 of file aws_iot_mqtt_client_common_internal.cpp.
IoT_Error_t aws_iot_mqtt_internal_deserialize_ack | ( | unsigned char * | pPacketType, |
unsigned char * | dup, | ||
uint16_t * | pPacketId, | ||
unsigned char * | pRxBuf, | ||
size_t | rxBuflen | ||
) |
Deserializes the supplied (wire) buffer into an ack.
- Parameters:
-
pPacketType returned integer - the MQTT packet type dup returned integer - the MQTT dup flag pPacketId returned integer - the MQTT packet identifier pRxBuf the raw buffer data, of the correct length determined by the remaining length field rxBuflen the length in bytes of the data in the supplied buffer
- Returns:
- An IoT Error Type defining successful/failed call
Definition at line 384 of file aws_iot_mqtt_client_publish.cpp.
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 | ||
) |
Deserializes the supplied (wire) buffer into publish data.
- Parameters:
-
dup returned uint8_t - the MQTT dup flag qos returned QoS type - the MQTT QoS value retained returned uint8_t - the MQTT retained flag pPacketId returned uint16_t - the MQTT packet identifier pTopicName returned String - the MQTT topic in the publish topicNameLen returned uint16_t - the length of the MQTT topic in the publish payload returned byte buffer - the MQTT publish payload payloadlen returned size_t - the length of the MQTT payload pRxBuf the raw buffer data, of the correct length determined by the remaining length field rxBufLen the length in bytes of the data in the supplied buffer
- Returns:
- An IoT Error Type defining successful/failed call
Definition at line 312 of file aws_iot_mqtt_client_publish.cpp.
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.
Used to ensure that Header bits are always initialized using the proper mappings. No Endianness issues here since the individual fields are all less than a byte. Also generates no warnings since all fields are initialized using hex constants
Definition at line 187 of file aws_iot_mqtt_client_common_internal.cpp.
unsigned char aws_iot_mqtt_internal_read_char | ( | unsigned char ** | pptr ) |
Reads one character from the input buffer.
- Parameters:
-
pptr pointer to the input buffer - incremented by the number of bytes used & returned
- Returns:
- the character read
Definition at line 156 of file aws_iot_mqtt_client_common_internal.cpp.
uint16_t aws_iot_mqtt_internal_read_uint16_t | ( | unsigned char ** | pptr ) |
Calculates uint16 packet id from two bytes read from the input buffer Checks Endianness at runtime.
- Parameters:
-
pptr pointer to the input buffer - incremented by the number of bytes used & returned
- Returns:
- the value calculated
Definition at line 128 of file aws_iot_mqtt_client_common_internal.cpp.
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 | ||
) |
Serializes the ack packet into the supplied buffer.
- Parameters:
-
pTxBuf the buffer into which the packet will be serialized txBufLen the length in bytes of the supplied buffer msgType the MQTT packet type dup the MQTT dup flag packetId the MQTT packet identifier pSerializedLen uint32_t - pointer to the variable that stores serialized len
- Returns:
- An IoT Error Type defining successful/failed call
Definition at line 146 of file aws_iot_mqtt_client_publish.cpp.
IoT_Error_t aws_iot_mqtt_internal_serialize_zero | ( | unsigned char * | pTxBuf, |
size_t | txBufLen, | ||
MessageTypes | packetType, | ||
size_t * | pSerializedLength | ||
) |
Serializes a 0-length packet into the supplied buffer, ready for writing to a socket.
- Parameters:
-
buf the buffer into which the packet will be serialized buflen the length in bytes of the supplied buffer, to avoid overruns packettype the message type serialized length
- Returns:
- IoT_Error_t indicating function execution status
Definition at line 650 of file aws_iot_mqtt_client_common_internal.cpp.
void aws_iot_mqtt_internal_write_char | ( | unsigned char ** | pptr, |
unsigned char | c | ||
) |
Writes one character to an output buffer.
- Parameters:
-
pptr pointer to the output buffer - incremented by the number of bytes used & returned c the character to write
Definition at line 167 of file aws_iot_mqtt_client_common_internal.cpp.
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.
- Parameters:
-
buf the buffer into which the encoded data is written length the length to be encoded
- Returns:
- the number of bytes written to buffer
Definition at line 56 of file aws_iot_mqtt_client_common_internal.cpp.
void aws_iot_mqtt_internal_write_uint_16 | ( | unsigned char ** | pptr, |
uint16_t | anInt | ||
) |
Writes an integer as 2 bytes to an output buffer.
- Parameters:
-
pptr pointer to the output buffer - incremented by the number of bytes used & returned anInt the integer to write
Definition at line 144 of file aws_iot_mqtt_client_common_internal.cpp.
Generated on Tue Jul 12 2022 11:16:38 by 1.7.2