/*---------------------- MQTT internal data structures ----------------------*/\r
\r
/**\r
- * @brief Represents an MQTT connection.\r
- */\r
-typedef struct _mqttConnection\r
-{\r
- bool awsIotMqttMode; /**< @brief Specifies if this connection is to an AWS IoT MQTT server. */\r
- bool ownNetworkConnection; /**< @brief Whether this MQTT connection owns its network connection. */\r
- void * pNetworkConnection; /**< @brief References the transport-layer network connection. */\r
- const IotNetworkInterface_t * pNetworkInterface; /**< @brief Network interface provided to @ref mqtt_function_connect. */\r
- IotMqttCallbackInfo_t disconnectCallback; /**< @brief A function to invoke when this connection is disconnected. */\r
-\r
- #if IOT_MQTT_ENABLE_SERIALIZER_OVERRIDES == 1\r
- const IotMqttSerializer_t * pSerializer; /**< @brief MQTT packet serializer overrides. */\r
- #endif\r
-\r
- bool disconnected; /**< @brief Tracks if this connection has been disconnected. */\r
- IotMutex_t referencesMutex; /**< @brief Recursive mutex. Grants access to connection state and operation lists. */\r
- int32_t references; /**< @brief Counts callbacks and operations using this connection. */\r
- IotListDouble_t pendingProcessing; /**< @brief List of operations waiting to be processed by a task pool routine. */\r
- IotListDouble_t pendingResponse; /**< @brief List of processed operations awaiting a server response. */\r
-\r
- IotListDouble_t subscriptionList; /**< @brief Holds subscriptions associated with this connection. */\r
- IotMutex_t subscriptionMutex; /**< @brief Grants exclusive access to the subscription list. */\r
-\r
- bool keepAliveFailure; /**< @brief Failure flag for keep-alive operation. */\r
- uint32_t keepAliveMs; /**< @brief Keep-alive interval in milliseconds. Its max value (per spec) is 65,535,000. */\r
- uint32_t nextKeepAliveMs; /**< @brief Relative delay for next keep-alive job. */\r
- IotTaskPoolJobStorage_t keepAliveJobStorage; /**< @brief Task pool job for processing this connection's keep-alive. */\r
- IotTaskPoolJob_t keepAliveJob; /**< @brief Task pool job for processing this connection's keep-alive. */\r
- uint8_t * pPingreqPacket; /**< @brief An MQTT PINGREQ packet, allocated if keep-alive is active. */\r
- size_t pingreqPacketSize; /**< @brief The size of an allocated PINGREQ packet. */\r
-} _mqttConnection_t;\r
-\r
-/**\r
- * @brief Represents a subscription stored in an MQTT connection.\r
+ * @cond DOXYGEN_IGNORE\r
+ * Doxygen should ignore this section.\r
+ *\r
+ * Forward declaration of MQTT connection type.\r
*/\r
-typedef struct _mqttSubscription\r
-{\r
- IotLink_t link; /**< @brief List link member. */\r
-\r
- int32_t references; /**< @brief How many subscription callbacks are using this subscription. */\r
-\r
- /**\r
- * @brief Tracks whether @ref mqtt_function_unsubscribe has been called for\r
- * this subscription.\r
- *\r
- * If there are active subscription callbacks, @ref mqtt_function_unsubscribe\r
- * cannot remove this subscription. Instead, it will set this flag, which\r
- * schedules the removal of this subscription once all subscription callbacks\r
- * terminate.\r
- */\r
- bool unsubscribed;\r
-\r
- struct\r
- {\r
- uint16_t identifier; /**< @brief Packet identifier. */\r
- size_t order; /**< @brief Order in the packet's list of subscriptions. */\r
- } packetInfo; /**< @brief Information about the SUBSCRIBE packet that registered this subscription. */\r
-\r
- IotMqttCallbackInfo_t callback; /**< @brief Callback information for this subscription. */\r
-\r
- uint16_t topicFilterLength; /**< @brief Length of #_mqttSubscription_t.pTopicFilter. */\r
- char pTopicFilter[]; /**< @brief The subscription topic filter. */\r
-} _mqttSubscription_t;\r
+struct _mqttConnection;\r
+/** @endcond */\r
\r
/**\r
* @brief Internal structure representing a single MQTT operation, such as\r
typedef struct _mqttOperation\r
{\r
/* Pointers to neighboring queue elements. */\r
- IotLink_t link; /**< @brief List link member. */\r
+ IotLink_t link; /**< @brief List link member. */\r
\r
- bool incomingPublish; /**< @brief Set to true if this operation an incoming PUBLISH. */\r
- _mqttConnection_t * pMqttConnection; /**< @brief MQTT connection associated with this operation. */\r
+ bool incomingPublish; /**< @brief Set to true if this operation an incoming PUBLISH. */\r
+ struct _mqttConnection * pMqttConnection; /**< @brief MQTT connection associated with this operation. */\r
\r
- IotTaskPoolJobStorage_t jobStorage; /**< @brief Task pool job storage associated with this operation. */\r
- IotTaskPoolJob_t job; /**< @brief Task pool job associated with this operation. */\r
+ IotTaskPoolJobStorage_t jobStorage; /**< @brief Task pool job storage associated with this operation. */\r
+ IotTaskPoolJob_t job; /**< @brief Task pool job associated with this operation. */\r
\r
union\r
{\r
} notify; /**< @brief How to notify of this operation's completion. */\r
IotMqttError_t status; /**< @brief Result of this operation. This is reported once a response is received. */\r
\r
- struct\r
+ union\r
{\r
- uint32_t count;\r
- uint32_t limit;\r
- uint32_t nextPeriod;\r
- } retry;\r
+ struct\r
+ {\r
+ uint32_t count; /**< @brief Current number of retries. */\r
+ uint32_t limit; /**< @brief Maximum number of retries allowed. */\r
+ uint32_t nextPeriodMs; /**< @brief Next retry period. */\r
+ } retry; /**< @brief Additional information for PUBLISH retry. */\r
+\r
+ struct\r
+ {\r
+ uint32_t failure; /**< @brief Flag tracking keep-alive status. */\r
+ uint32_t keepAliveMs; /**< @brief Keep-alive interval in milliseconds. Its max value (per spec) is 65,535,000. */\r
+ uint32_t nextPeriodMs; /**< @brief Relative delay for next keep-alive job. */\r
+ } ping; /**< @brief Additional information for keep-alive pings. */\r
+ } periodic; /**< @brief Additional information for periodic operations. */\r
} operation;\r
\r
/* If incomingPublish is true, this struct is valid. */\r
} u; /**< @brief Valid member depends on _mqttOperation_t.incomingPublish. */\r
} _mqttOperation_t;\r
\r
+/**\r
+ * @brief Represents an MQTT connection.\r
+ */\r
+typedef struct _mqttConnection\r
+{\r
+ bool awsIotMqttMode; /**< @brief Specifies if this connection is to an AWS IoT MQTT server. */\r
+ bool ownNetworkConnection; /**< @brief Whether this MQTT connection owns its network connection. */\r
+ void * pNetworkConnection; /**< @brief References the transport-layer network connection. */\r
+ const IotNetworkInterface_t * pNetworkInterface; /**< @brief Network interface provided to @ref mqtt_function_connect. */\r
+ IotMqttCallbackInfo_t disconnectCallback; /**< @brief A function to invoke when this connection is disconnected. */\r
+\r
+ #if IOT_MQTT_ENABLE_SERIALIZER_OVERRIDES == 1\r
+ const IotMqttSerializer_t * pSerializer; /**< @brief MQTT packet serializer overrides. */\r
+ #endif\r
+\r
+ bool disconnected; /**< @brief Tracks if this connection has been disconnected. */\r
+ IotMutex_t referencesMutex; /**< @brief Recursive mutex. Grants access to connection state and operation lists. */\r
+ int32_t references; /**< @brief Counts callbacks and operations using this connection. */\r
+ IotListDouble_t pendingProcessing; /**< @brief List of operations waiting to be processed by a task pool routine. */\r
+ IotListDouble_t pendingResponse; /**< @brief List of processed operations awaiting a server response. */\r
+\r
+ IotListDouble_t subscriptionList; /**< @brief Holds subscriptions associated with this connection. */\r
+ IotMutex_t subscriptionMutex; /**< @brief Grants exclusive access to the subscription list. */\r
+\r
+ _mqttOperation_t pingreq; /**< @brief Operation used for MQTT keep-alive. */\r
+} _mqttConnection_t;\r
+\r
+/**\r
+ * @brief Represents a subscription stored in an MQTT connection.\r
+ */\r
+typedef struct _mqttSubscription\r
+{\r
+ IotLink_t link; /**< @brief List link member. */\r
+\r
+ int32_t references; /**< @brief How many subscription callbacks are using this subscription. */\r
+\r
+ /**\r
+ * @brief Tracks whether @ref mqtt_function_unsubscribe has been called for\r
+ * this subscription.\r
+ *\r
+ * If there are active subscription callbacks, @ref mqtt_function_unsubscribe\r
+ * cannot remove this subscription. Instead, it will set this flag, which\r
+ * schedules the removal of this subscription once all subscription callbacks\r
+ * terminate.\r
+ */\r
+ bool unsubscribed;\r
+\r
+ struct\r
+ {\r
+ uint16_t identifier; /**< @brief Packet identifier. */\r
+ size_t order; /**< @brief Order in the packet's list of subscriptions. */\r
+ } packetInfo; /**< @brief Information about the SUBSCRIBE packet that registered this subscription. */\r
+\r
+ IotMqttCallbackInfo_t callback; /**< @brief Callback information for this subscription. */\r
+\r
+ uint16_t topicFilterLength; /**< @brief Length of #_mqttSubscription_t.pTopicFilter. */\r
+ char pTopicFilter[]; /**< @brief The subscription topic filter. */\r
+} _mqttSubscription_t;\r
+\r
/**\r
* @brief Represents an MQTT packet received from the network.\r
*\r