|
AWS IoT Device SDK C:
MQTT
MQTT 3.1.1 client library
|
| Return to main page ↑ |
Implements functions involving transport layer connections. More...
#include "iot_config.h"#include <string.h>#include "private/iot_mqtt_internal.h"#include "platform/iot_threads.h"#include "iot_atomic.h"Functions | |
| static bool | _incomingPacketValid (uint8_t packetType) |
| Check if an incoming packet type is valid. More... | |
| static IotMqttError_t | _allocateAndReceivePacket (IotNetworkConnection_t pNetworkConnection, const _mqttConnection_t *pMqttConnection, _mqttPacket_t *pIncomingPacket) |
| Allocate space for an incoming MQTT packet received from the network. More... | |
| static IotMqttError_t | _getIncomingPacket (IotNetworkConnection_t pNetworkConnection, const _mqttConnection_t *pMqttConnection, _mqttPacket_t *pIncomingPacket) |
| Get an incoming MQTT packet from the network. More... | |
| static IotMqttError_t | _deserializeAck (_mqttConnection_t *pMqttConnection, _mqttPacket_t *pIncomingPacket, IotMqttDeserialize_t _deserializer, IotMqttOperationType_t opType, const uint16_t *pPacketIdentifier) |
| Deserialize a CONNACK, PUBACK, SUBACK, or UNSUBACK packet. More... | |
| static IotMqttError_t | _deserializePublishPacket (_mqttConnection_t *pMqttConnection, _mqttPacket_t *pIncomingPacket) |
| Deserialize a PUBLISH packet. More... | |
| static IotMqttError_t | _deserializePingResp (_mqttConnection_t *pMqttConnection, _mqttPacket_t *pIncomingPacket) |
| Deserialize a PINGRESP packet. More... | |
| static IotMqttError_t | _deserializeIncomingPacket (_mqttConnection_t *pMqttConnection, _mqttPacket_t *pIncomingPacket) |
| Deserialize a packet received from the network. More... | |
| static void | _sendPuback (_mqttConnection_t *pMqttConnection, uint16_t packetIdentifier) |
| Send a PUBACK for a received QoS 1 PUBLISH packet. More... | |
| static void | _flushPacket (IotNetworkConnection_t pNetworkConnection, const _mqttConnection_t *pMqttConnection, size_t length) |
| Flush a packet from the stream of incoming data. More... | |
| bool | _IotMqtt_GetNextByte (IotNetworkConnection_t pNetworkConnection, const IotNetworkInterface_t *pNetworkInterface, uint8_t *pIncomingByte) |
| Read the next available byte on a network connection. More... | |
| void | _IotMqtt_CloseNetworkConnection (IotMqttDisconnectReason_t disconnectReason, _mqttConnection_t *pMqttConnection) |
| Closes the network connection associated with an MQTT connection. More... | |
| void | IotMqtt_ReceiveCallback (IotNetworkConnection_t pNetworkConnection, void *pReceiveContext) |
| Network receive callback for the MQTT library. More... | |
Implements functions involving transport layer connections.
|
static |
Check if an incoming packet type is valid.
| [in] | packetType | The packet type to check. |
true if the packet type is valid; false otherwise.
|
static |
Allocate space for an incoming MQTT packet received from the network.
| [in] | pNetworkConnection | Network connection to be used for receive. |
| [in] | pMqttConnection | The associated MQTT connection. |
| [out] | pIncomingPacket | Output parameter for the incoming packet. |
|
static |
Get an incoming MQTT packet from the network.
| [in] | pNetworkConnection | Network connection to use for receive, which may be different from the network connection associated with the MQTT connection. |
| [in] | pMqttConnection | The associated MQTT connection. |
| [out] | pIncomingPacket | Output parameter for the incoming packet. |
|
static |
Deserialize a CONNACK, PUBACK, SUBACK, or UNSUBACK packet.
| [in] | pMqttConnection | The associated MQTT connection. |
| [in] | pIncomingPacket | The packet received from the network. |
| [in] | _deserializer | The deserialization function for the packet. |
| [in] | opType | The type of operation corresponding to the packet. |
| [in] | pPacketIdentifier | Address of incoming packet's packet identifier; NULL for a CONNACK. |
|
static |
Deserialize a PUBLISH packet.
| [in] | pMqttConnection | The associated MQTT connection. |
| [in] | pIncomingPacket | The packet received from the network. |
|
static |
Deserialize a PINGRESP packet.
| [in] | pMqttConnection | The associated MQTT connection. |
| [in] | pIncomingPacket | The packet received from the network. |
|
static |
Deserialize a packet received from the network.
| [in] | pMqttConnection | The associated MQTT connection. |
| [in] | pIncomingPacket | The packet received from the network. |
|
static |
Send a PUBACK for a received QoS 1 PUBLISH packet.
| [in] | pMqttConnection | Which connection the PUBACK should be sent over. |
| [in] | packetIdentifier | Which packet identifier to include in PUBACK. |
|
static |
Flush a packet from the stream of incoming data.
This function is called when memory for a packet cannot be allocated. The packet is flushed from the stream of incoming data so that the next packet may be read.
| [in] | pNetworkConnection | Network connection to use for receive, which may be different from the network connection associated with the MQTT connection. |
| [in] | pMqttConnection | The associated MQTT connection. |
| [in] | length | The length of the packet to flush. |
| bool _IotMqtt_GetNextByte | ( | IotNetworkConnection_t | pNetworkConnection, |
| const IotNetworkInterface_t * | pNetworkInterface, | ||
| uint8_t * | pIncomingByte | ||
| ) |
Read the next available byte on a network connection.
| [in] | pNetworkConnection | Reference to the network connection. |
| [in] | pNetworkInterface | Function pointers used to interact with the network. |
| [out] | pIncomingByte | The byte read from the network. |
true if a byte was successfully received from the network; false otherwise. | void _IotMqtt_CloseNetworkConnection | ( | IotMqttDisconnectReason_t | disconnectReason, |
| _mqttConnection_t * | pMqttConnection | ||
| ) |
Closes the network connection associated with an MQTT connection.
A network disconnect function must be set in the network interface for the network connection to be closed.
| [in] | disconnectReason | A reason to pass to the connection's disconnect callback. |
| [in] | pMqttConnection | The MQTT connection with the network connection to close. |
| void IotMqtt_ReceiveCallback | ( | IotNetworkConnection_t | pNetworkConnection, |
| void * | pReceiveContext | ||
| ) |
Network receive callback for the MQTT library.
This function should be called by the system whenever data is available for the MQTT library.
| [in] | pNetworkConnection | The network connection associated with the MQTT connection, passed by the network stack. |
| [in] | pReceiveContext | A pointer to the MQTT connection handle for which the packet was received. |