|
AWS IoT Device SDK C:
MQTT
MQTT 3.1.1 client library
|
| Return to main page ↑ |
Implements functions that process MQTT operations. More...
#include "iot_config.h"#include <string.h>#include "private/iot_mqtt_internal.h"#include "platform/iot_clock.h"#include "platform/iot_threads.h"#include "iot_atomic.h"Data Structures | |
| struct | _operationMatchParam_t |
| First parameter to _mqttOperation_match. More... | |
Functions | |
| static bool | _mqttOperation_match (const IotLink_t *const pOperationLink, void *pMatch) |
| Match an MQTT operation by type and packet identifier. More... | |
| static bool | _checkRetryLimit (_mqttOperation_t *pOperation) |
| Check if an operation with retry has exceeded its retry limit. More... | |
| static bool | _scheduleNextRetry (_mqttOperation_t *pOperation) |
| Schedule the next send of an operation with retry. More... | |
| static IotMqttError_t | _scheduleCallback (_mqttOperation_t *pOperation) |
| Schedule a callback for a completed MQTT operation. More... | |
| static bool | _completePendingSend (_mqttOperation_t *pOperation, bool *pDestroyOperation) |
| Complete a pending send operation. More... | |
| static IotMqttError_t | _initializeOperation (_mqttConnection_t *pMqttConnection, _mqttOperation_t *pOperation, uint32_t flags, const IotMqttCallbackInfo_t *pCallbackInfo) |
| Initialize newly created MQTT operation. More... | |
| static bool | _sendPingRequest (_mqttConnection_t *pMqttConnection) |
| Send MQTT Ping Request to the broker. More... | |
| IotMqttError_t | _IotMqtt_CreateOperation (_mqttConnection_t *pMqttConnection, uint32_t flags, const IotMqttCallbackInfo_t *pCallbackInfo, _mqttOperation_t **pNewOperation) |
| Create a record for a new in-progress MQTT operation. More... | |
| bool | _IotMqtt_DecrementOperationReferences (_mqttOperation_t *pOperation, bool cancelJob) |
| Decrement the job reference count of an MQTT operation and optionally cancel its job. More... | |
| void | _IotMqtt_DestroyOperation (_mqttOperation_t *pOperation) |
| Free resources used to record an MQTT operation. This is called when the operation completes. More... | |
| void | _IotMqtt_ProcessKeepAlive (IotTaskPool_t pTaskPool, IotTaskPoolJob_t pKeepAliveJob, void *pContext) |
| Task pool routine for processing an MQTT connection's keep-alive. More... | |
| void | _IotMqtt_ProcessIncomingPublish (IotTaskPool_t pTaskPool, IotTaskPoolJob_t pPublishJob, void *pContext) |
| Task pool routine for processing an incoming PUBLISH message. More... | |
| void | _IotMqtt_ProcessSend (IotTaskPool_t pTaskPool, IotTaskPoolJob_t pSendJob, void *pContext) |
| Task pool routine for processing an MQTT operation to send. More... | |
| void | _IotMqtt_ProcessCompletedOperation (IotTaskPool_t pTaskPool, IotTaskPoolJob_t pOperationJob, void *pContext) |
| Task pool routine for processing a completed MQTT operation. More... | |
| IotMqttError_t | _IotMqtt_ScheduleOperation (_mqttOperation_t *pOperation, IotTaskPoolRoutine_t jobRoutine, uint32_t delay) |
| Schedule an operation for immediate processing. More... | |
| _mqttOperation_t * | _IotMqtt_FindOperation (_mqttConnection_t *pMqttConnection, IotMqttOperationType_t type, const uint16_t *pPacketIdentifier) |
| Search a list of MQTT operations pending responses using an operation name and packet identifier. Removes a matching operation from the list if found. More... | |
| void | _IotMqtt_Notify (_mqttOperation_t *pOperation) |
| Notify of a completed MQTT operation. More... | |
Implements functions that process MQTT operations.
|
static |
Match an MQTT operation by type and packet identifier.
| [in] | pOperationLink | Pointer to the link member of an _mqttOperation_t. |
| [in] | pMatch | Pointer to an _operationMatchParam_t. |
true if the operation matches the parameters in pArgument; false otherwise.
|
static |
Check if an operation with retry has exceeded its retry limit.
If a PUBLISH operation is available for retry, this function also sets any necessary DUP flags.
| [in] | pOperation | The operation to check. |
true if the operation may be retried; false otherwise.
|
static |
Schedule the next send of an operation with retry.
| [in] | pOperation | The operation to schedule. |
true if the reschedule succeeded; false otherwise.
|
static |
Schedule a callback for a completed MQTT operation.
| [in] | pOperation | The completed MQTT operation. |
IOT_MQTT_SUCCESS if the schedule was successful; IOT_MQTT_SCHEDULING_ERROR otherwise.
|
static |
Complete a pending send operation.
| [in] | pOperation | The pending MQTT send operation. |
| [out] | pDestroyOperation | Whether the operation should be destroyed afterwards. |
true if the operation is awaiting a response from the network; false if not.
|
static |
Initialize newly created MQTT operation.
| [in] | pMqttConnection | The MQTT connection associated with the operation. |
| [in] | pOperation | pointer to the new operation. |
| [in] | flags | Flags variable passed to a user-facing MQTT function. |
| [in] | pCallbackInfo | User-provided callback function and parameter. |
|
static |
Send MQTT Ping Request to the broker.
| [in] | pMqttConnection | The MQTT connection associated with the request. |
true if send is successful; false otherwise. | IotMqttError_t _IotMqtt_CreateOperation | ( | _mqttConnection_t * | pMqttConnection, |
| uint32_t | flags, | ||
| const IotMqttCallbackInfo_t * | pCallbackInfo, | ||
| _mqttOperation_t ** | pNewOperation | ||
| ) |
Create a record for a new in-progress MQTT operation.
| [in] | pMqttConnection | The MQTT connection to associate with the operation. |
| [in] | flags | Flags variable passed to a user-facing MQTT function. |
| [in] | pCallbackInfo | User-provided callback function and parameter. |
| [out] | pNewOperation | Set to point to the new operation on success. |
| bool _IotMqtt_DecrementOperationReferences | ( | _mqttOperation_t * | pOperation, |
| bool | cancelJob | ||
| ) |
Decrement the job reference count of an MQTT operation and optionally cancel its job.
Checks if the operation may be destroyed afterwards.
| [in] | pOperation | The MQTT operation with the job to cancel. |
| [in] | cancelJob | Whether to attempt cancellation of the operation's job. |
true if the the operation may be safely destroyed; false otherwise. | void _IotMqtt_DestroyOperation | ( | _mqttOperation_t * | pOperation | ) |
Free resources used to record an MQTT operation. This is called when the operation completes.
| [in] | pOperation | The operation which completed. |
| void _IotMqtt_ProcessKeepAlive | ( | IotTaskPool_t | pTaskPool, |
| IotTaskPoolJob_t | pKeepAliveJob, | ||
| void * | pContext | ||
| ) |
Task pool routine for processing an MQTT connection's keep-alive.
| [in] | pTaskPool | Pointer to the system task pool. |
| [in] | pKeepAliveJob | Pointer the an MQTT connection's keep-alive job. |
| [in] | pContext | Pointer to an MQTT connection, passed as an opaque context. |
| void _IotMqtt_ProcessIncomingPublish | ( | IotTaskPool_t | pTaskPool, |
| IotTaskPoolJob_t | pPublishJob, | ||
| void * | pContext | ||
| ) |
Task pool routine for processing an incoming PUBLISH message.
| [in] | pTaskPool | Pointer to the system task pool. |
| [in] | pPublishJob | Pointer to the incoming PUBLISH operation's job. |
| [in] | pContext | Pointer to the incoming PUBLISH operation, passed as an opaque context. |
| void _IotMqtt_ProcessSend | ( | IotTaskPool_t | pTaskPool, |
| IotTaskPoolJob_t | pSendJob, | ||
| void * | pContext | ||
| ) |
Task pool routine for processing an MQTT operation to send.
| [in] | pTaskPool | Pointer to the system task pool. |
| [in] | pSendJob | Pointer to an operation's job. |
| [in] | pContext | Pointer to the operation to send, passed as an opaque context. |
| void _IotMqtt_ProcessCompletedOperation | ( | IotTaskPool_t | pTaskPool, |
| IotTaskPoolJob_t | pOperationJob, | ||
| void * | pContext | ||
| ) |
Task pool routine for processing a completed MQTT operation.
| [in] | pTaskPool | Pointer to the system task pool. |
| [in] | pOperationJob | Pointer to the completed operation's job. |
| [in] | pContext | Pointer to the completed operation, passed as an opaque context. |
| IotMqttError_t _IotMqtt_ScheduleOperation | ( | _mqttOperation_t * | pOperation, |
| IotTaskPoolRoutine_t | jobRoutine, | ||
| uint32_t | delay | ||
| ) |
Schedule an operation for immediate processing.
| [in] | pOperation | The operation to schedule. |
| [in] | jobRoutine | The routine to run for the job. Must be either _IotMqtt_ProcessSend, _IotMqtt_ProcessCompletedOperation, or _IotMqtt_ProcessIncomingPublish. |
| [in] | delay | A delay before the operation job should be executed. Pass 0 to execute ASAP. |
| _mqttOperation_t* _IotMqtt_FindOperation | ( | _mqttConnection_t * | pMqttConnection, |
| IotMqttOperationType_t | type, | ||
| const uint16_t * | pPacketIdentifier | ||
| ) |
Search a list of MQTT operations pending responses using an operation name and packet identifier. Removes a matching operation from the list if found.
| [in] | pMqttConnection | The connection associated with the operation. |
| [in] | type | The operation type to look for. |
| [in] | pPacketIdentifier | A packet identifier to match. Pass NULL to ignore. |
NULL if no match was found. | void _IotMqtt_Notify | ( | _mqttOperation_t * | pOperation | ) |
Notify of a completed MQTT operation.
| [in] | pOperation | The MQTT operation which completed. |
Depending on the parameters passed to a user-facing MQTT function, the notification will cause IotMqtt_Wait to return or invoke a user-provided callback.