MQTT API Reference
MQTT 3.1.1 client library
|
Go to the documentation of this file.
27 #ifndef IOT_MQTT_TYPES_H_
28 #define IOT_MQTT_TYPES_H_
31 #include "iot_config.h"
103 typedef enum IotMqttError
277 typedef enum IotMqttOperationType
303 typedef enum IotMqttQos
320 typedef enum IotMqttDisconnectReason
397 typedef struct IotMqttPublishInfo
443 typedef struct IotMqttCallbackParam
516 typedef struct IotMqttCallbackInfo
529 void ( *
function )(
void *,
550 typedef struct IotMqttSubscription
585 typedef struct IotMqttConnectInfo
687 #if IOT_MQTT_ENABLE_SERIALIZER_OVERRIDES == 1
715 typedef struct IotMqttSerializer
726 uint8_t ( * getPacketType )(
void * ,
738 size_t ( * getRemainingLength )(
void * pNetworkConnection,
749 void ( * freePacket )( uint8_t * );
790 void ( *publishSetDup )( uint8_t * ,
930 typedef struct IotMqttNetworkInfo
997 #if IOT_MQTT_ENABLE_SERIALIZER_OVERRIDES == 1
1057 #define IOT_MQTT_NETWORK_INFO_INITIALIZER { .createNetworkConnection = true }
1059 #define IOT_MQTT_SERIALIZER_INITIALIZER { 0 }
1061 #define IOT_MQTT_CONNECT_INFO_INITIALIZER { .cleanSession = true }
1063 #define IOT_MQTT_PUBLISH_INFO_INITIALIZER { .qos = IOT_MQTT_QOS_0 }
1065 #define IOT_MQTT_SUBSCRIPTION_INITIALIZER { .qos = IOT_MQTT_QOS_0 }
1067 #define IOT_MQTT_CALLBACK_INFO_INITIALIZER { 0 }
1069 #define IOT_MQTT_CONNECTION_INITIALIZER NULL
1071 #define IOT_MQTT_OPERATION_INITIALIZER NULL
1087 #define IOT_MQTT_FLAG_WAITABLE ( 0x00000001 )
1097 #define IOT_MQTT_FLAG_CLEANUP_ONLY ( 0x00000001 )
MQTT operation queued, awaiting result.
Definition: iot_mqtt_types.h:129
const IotNetworkInterface_t * pNetworkInterface
The network functions used by the new MQTT connection.
Definition: iot_mqtt_types.h:990
Definition: iot_mqtt_types.h:324
Definition: iot_mqtt_types.h:283
A blocking MQTT operation timed out.
Definition: iot_mqtt_types.h:217
Definition: iot_mqtt_types.h:282
IotMqttDisconnectReason_t disconnectReason
Why the MQTT connection was disconnected.
Definition: iot_mqtt_types.h:476
uint16_t keepAliveSeconds
Period of keep-alive messages. Set to 0 to disable keep-alive.
Definition: iot_mqtt_types.h:674
At least one parameter is invalid.
Definition: iot_mqtt_types.h:149
bool cleanSession
Whether this connection is a clean session.
Definition: iot_mqtt_types.h:632
uint32_t retryLimit
How many times to attempt retransmission.
Definition: iot_mqtt_types.h:409
A CONNECT or at least one subscription was refused by the server.
Definition: iot_mqtt_types.h:238
IotMqttQos_t
Quality of service levels for MQTT PUBLISH messages.
Definition: iot_mqtt_types.h:303
IotMqttError_t
Return codes of MQTT functions.
Definition: iot_mqtt_types.h:103
Information on a user-provided MQTT callback function.
Definition: iot_mqtt_types.h:516
IotMqttOperation_t reference
Reference to the operation that completed.
Definition: iot_mqtt_types.h:463
IotMqttCallbackInfo_t disconnectCallback
A callback function to invoke when this MQTT connection is disconnected.
Definition: iot_mqtt_types.h:995
const void * pPayload
Payload of PUBLISH.
Definition: iot_mqtt_types.h:405
struct _mqttOperation * IotMqttOperation_t
Opaque handle that references an in-progress MQTT operation.
Definition: iot_mqtt_types.h:88
bool awsIotMqttMode
Specifies if this MQTT connection is to an AWS IoT MQTT server.
Definition: iot_mqtt_types.h:601
bool retain
MQTT message retain flag.
Definition: iot_mqtt_types.h:400
const char * pPassword
Password for MQTT connection.
Definition: iot_mqtt_types.h:683
Definition: iot_mqtt_types.h:279
MQTT operation completed successfully.
Definition: iot_mqtt_types.h:119
IotMqttConnection_t mqttConnection
The MQTT connection associated with this completed operation, incoming PUBLISH, or disconnect.
Definition: iot_mqtt_types.h:455
IotMqttDisconnectReason_t
The reason that an MQTT connection (and its associated network connection) was disconnected.
Definition: iot_mqtt_types.h:320
MQTT operation failed because of memory allocation failure.
Definition: iot_mqtt_types.h:160
uint16_t topicNameLength
Length of IotMqttPublishInfo_t.pTopicName.
Definition: iot_mqtt_types.h:403
Definition: iot_mqtt_types.h:284
const char * pTopicName
Topic name of PUBLISH.
Definition: iot_mqtt_types.h:402
void * pNetworkConnection
An established transport-layer network connection.
Definition: iot_mqtt_types.h:981
Definition: iot_mqtt_types.h:280
uint32_t retryMs
If no response is received within this time, the message is retransmitted.
Definition: iot_mqtt_types.h:408
uint16_t topicFilterLength
Length of pTopicFilter.
Definition: iot_mqtt_types.h:471
struct _mqttConnection * IotMqttConnection_t
Opaque handle of an MQTT connection.
Definition: iot_mqtt_types.h:66
IotMqttCallbackInfo_t callback
Callback to invoke when a message is received.
Definition: iot_mqtt_types.h:567
Infomation on the transport-layer network connection for the new MQTT connection.
Definition: iot_mqtt_types.h:930
Function pointers for MQTT packet serializer overrides.
Definition: iot_mqtt_types.h:715
A QoS 1 PUBLISH received no response and the retry limit was reached.
Definition: iot_mqtt_types.h:252
IotMqttQos_t qos
QoS of message. Must be 0 or 1.
Definition: iot_mqtt_types.h:399
An API function was called before IotMqtt_Init.
Definition: iot_mqtt_types.h:267
Definition: iot_mqtt_types.h:307
IotMqttError_t result
Result of operation, e.g. succeeded or failed.
Definition: iot_mqtt_types.h:464
uint16_t clientIdentifierLength
Length of IotMqttConnectInfo_t.pClientIdentifier.
Definition: iot_mqtt_types.h:677
MQTT operation failed because the network was unusable.
Definition: iot_mqtt_types.h:177
size_t previousSubscriptionCount
The number of MQTT subscriptions present in a previous session, if any.
Definition: iot_mqtt_types.h:657
Definition: iot_mqtt_types.h:305
IotMqttOperationType_t
Types of MQTT operations.
Definition: iot_mqtt_types.h:277
const IotMqttSubscription_t * pPreviousSubscriptions
An array of MQTT subscriptions present in a previous session, if any.
Definition: iot_mqtt_types.h:644
const char * pTopicFilter
Topic filter of subscription.
Definition: iot_mqtt_types.h:559
Definition: iot_mqtt_types.h:323
const char * pUserName
Username for MQTT connection.
Definition: iot_mqtt_types.h:681
Information on an MQTT subscription.
Definition: iot_mqtt_types.h:550
Initialization failed.
Definition: iot_mqtt_types.h:137
size_t payloadLength
Length of IotMqttPublishInfo_t.pPayload. For LWT messages, this is limited to 65535.
Definition: iot_mqtt_types.h:406
bool createNetworkConnection
Whether a new network connection should be created.
Definition: iot_mqtt_types.h:947
Definition: iot_mqtt_types.h:306
uint16_t topicFilterLength
Length of IotMqttSubscription_t.pTopicFilter.
Definition: iot_mqtt_types.h:560
IotMqttPublishInfo_t info
PUBLISH message received from the server.
Definition: iot_mqtt_types.h:472
const char * pTopicFilter
Topic filter that matched the message.
Definition: iot_mqtt_types.h:470
Information on a PUBLISH message.
Definition: iot_mqtt_types.h:397
void * pNetworkCredentialInfo
Credentials for the MQTT server, passed as pCredentialInfo to IotNetworkInterface_t::create.
Definition: iot_mqtt_types.h:971
IotMqttQos_t qos
QoS of messages delivered on subscription.
Definition: iot_mqtt_types.h:557
Parameter to an MQTT callback function.
Definition: iot_mqtt_types.h:443
MQTT response packet received from the network is malformed.
Definition: iot_mqtt_types.h:205
uint16_t passwordLength
Length of IotMqttConnectInfo_t.pPassword.
Definition: iot_mqtt_types.h:684
MQTT operation could not be scheduled, i.e. enqueued for sending.
Definition: iot_mqtt_types.h:188
Definition: iot_mqtt_types.h:322
const IotMqttSerializer_t * pMqttSerializer
MQTT packet serializer overrides used by the new MQTT connection.
Definition: iot_mqtt_types.h:1005
Definition: iot_mqtt_types.h:285
const IotMqttPublishInfo_t * pWillInfo
A message to publish if the new MQTT connection is unexpectedly closed.
Definition: iot_mqtt_types.h:672
uint16_t userNameLength
Length of IotMqttConnectInfo_t.pUserName.
Definition: iot_mqtt_types.h:682
Definition: iot_mqtt_types.h:281
void * pCallbackContext
The first parameter to pass to the callback function to provide context.
Definition: iot_mqtt_types.h:518
const char * pClientIdentifier
MQTT client identifier.
Definition: iot_mqtt_types.h:676
Information on a new MQTT connection.
Definition: iot_mqtt_types.h:585
IotMqttOperationType_t type
Type of operation that completed.
Definition: iot_mqtt_types.h:462
void * pNetworkServerInfo
Information on the MQTT server, passed as pConnectionInfo to IotNetworkInterface_t::create.
Definition: iot_mqtt_types.h:961