MQTT API Reference
MQTT 3.1.1 client library
|
Function pointers for MQTT packet serializer overrides. More...
#include <iot_mqtt_types.h>
Data Fields | |
uint8_t(* | getPacketType )(void *, const IotNetworkInterface_t *) |
Get the MQTT packet type from a stream of bytes off the network. More... | |
size_t(* | getRemainingLength )(void *pNetworkConnection, const IotNetworkInterface_t *pNetworkInterface) |
Get the remaining length from a stream of bytes off the network. More... | |
void(* | freePacket )(uint8_t *) |
Free a packet generated by the serializer. More... | |
struct { | |
IotMqttError_t(* connect )(const IotMqttConnectInfo_t *, uint8_t **, size_t *) | |
CONNECT packet serializer function. More... | |
IotMqttError_t(* publish )(const IotMqttPublishInfo_t *, uint8_t **, size_t *, uint16_t *, uint8_t **) | |
PUBLISH packet serializer function. More... | |
void(* publishSetDup )(uint8_t *, uint8_t *, uint16_t *) | |
Set the DUP bit in a QoS 1 PUBLISH packet. More... | |
IotMqttError_t(* puback )(uint16_t, uint8_t **, size_t *) | |
PUBACK packet serializer function. More... | |
IotMqttError_t(* subscribe )(const IotMqttSubscription_t *, size_t, uint8_t **, size_t *, uint16_t *) | |
SUBSCRIBE packet serializer function. More... | |
IotMqttError_t(* unsubscribe )(const IotMqttSubscription_t *, size_t, uint8_t **, size_t *, uint16_t *) | |
UNSUBSCRIBE packet serializer function. More... | |
IotMqttError_t(* pingreq )(uint8_t **, size_t *) | |
PINGREQ packet serializer function. More... | |
IotMqttError_t(* disconnect )(uint8_t **, size_t *) | |
DISCONNECT packet serializer function. More... | |
} | serialize |
Overrides the packet serialization functions for a single connection. | |
struct { | |
IotMqttError_t(* connack )(struct _mqttPacket *) | |
CONNACK packet deserializer function. More... | |
IotMqttError_t(* publish )(struct _mqttPacket *) | |
PUBLISH packet deserializer function. More... | |
IotMqttError_t(* puback )(struct _mqttPacket *pPuback) | |
PUBACK packet deserializer function. More... | |
IotMqttError_t(* suback )(struct _mqttPacket *) | |
SUBACK packet deserializer function. More... | |
IotMqttError_t(* unsuback )(struct _mqttPacket *) | |
UNSUBACK packet deserializer function. More... | |
IotMqttError_t(* pingresp )(struct _mqttPacket *) | |
PINGRESP packet deserializer function. More... | |
} | deserialize |
Overrides the packet deserialization functions for a single connection. | |
Function pointers for MQTT packet serializer overrides.
These function pointers allow the MQTT serialization and deserialization functions to be overridden for an MQTT connection. The compile-time setting IOT_MQTT_ENABLE_SERIALIZER_OVERRIDES must be 1
to enable this functionality. See the IotMqttSerializer_t::serialize and IotMqttSerializer_t::deserialize members for a list of functions that can be overridden. In addition, the functions for freeing packets and determining the packet type can also be overridden. If IOT_MQTT_ENABLE_SERIALIZER_OVERRIDES is 1
, the serializer initialization and cleanup functions may be extended. See documentation of IOT_MQTT_ENABLE_SERIALIZER_OVERRIDES for more information.
If any function pointers that are NULL
, then the default implementation of that function will be used.
uint8_t( * IotMqttSerializer_t::getPacketType) (void *, const IotNetworkInterface_t *) |
Get the MQTT packet type from a stream of bytes off the network.
[in] | pNetworkConnection | Reference to the network connection. |
[in] | pNetworkInterface | Function pointers used to interact with the network. |
Default implementation: _IotMqtt_GetPacketType
size_t( * IotMqttSerializer_t::getRemainingLength) (void *pNetworkConnection, const IotNetworkInterface_t *pNetworkInterface) |
Get the remaining length from a stream of bytes off the network.
[in] | pNetworkConnection | Reference to the network connection. |
[in] | pNetworkInterface | Function pointers used to interact with the network. |
Default implementation: _IotMqtt_GetRemainingLength
void( * IotMqttSerializer_t::freePacket) (uint8_t *) |
Free a packet generated by the serializer.
This function pointer must be set if any other serializer override is set.
[in] | uint8_t* | The packet to free. |
Default implementation: _IotMqtt_FreePacket
IotMqttError_t( * IotMqttSerializer_t::connect) (const IotMqttConnectInfo_t *, uint8_t **, size_t *) |
CONNECT packet serializer function.
[in] | IotMqttConnectInfo_t* | User-provided CONNECT information. |
[out] | uint8_t** | Where the CONNECT packet is written. |
[out] | size_t* | Size of the CONNECT packet. |
Default implementation: _IotMqtt_SerializeConnect
IotMqttError_t( * IotMqttSerializer_t::publish) (struct _mqttPacket *) |
PUBLISH packet serializer function.
PUBLISH packet deserializer function.
[in] | IotMqttPublishInfo_t* | User-provided PUBLISH information. |
[out] | uint8_t** | Where the PUBLISH packet is written. |
[out] | size_t* | Size of the PUBLISH packet. |
[out] | uint16_t* | The packet identifier generated for this PUBLISH. |
[out] | uint8_t** | Where the high byte of the packet identifier is written. |
Default implementation: _IotMqtt_SerializePublish
[in,out] | _mqttPacket* | Pointer to an MQTT packet struct representing a PUBLISH. |
Default implementation: _IotMqtt_DeserializePublish
void( * IotMqttSerializer_t::publishSetDup) (uint8_t *, uint8_t *, uint16_t *) |
Set the DUP
bit in a QoS 1
PUBLISH packet.
[in] | uint8_t* | Pointer to the PUBLISH packet to modify. |
[in] | uint8_t* | The high byte of any packet identifier to modify. |
[out] | uint16_t* | New packet identifier (AWS IoT MQTT mode only). |
Default implementation: _IotMqtt_PublishSetDup
IotMqttError_t( * IotMqttSerializer_t::puback) (struct _mqttPacket *pPuback) |
PUBACK packet serializer function.
PUBACK packet deserializer function.
[in] | uint16_t | The packet identifier to place in PUBACK. |
[out] | uint8_t** | Where the PUBACK packet is written. |
[out] | size_t* | Size of the PUBACK packet. |
Default implementation: _IotMqtt_SerializePuback
[in,out] | _mqttPacket* | Pointer to an MQTT packet struct representing a PUBACK. |
Default implementation: _IotMqtt_DeserializePuback
IotMqttError_t( * IotMqttSerializer_t::subscribe) (const IotMqttSubscription_t *, size_t, uint8_t **, size_t *, uint16_t *) |
SUBSCRIBE packet serializer function.
[in] | IotMqttSubscription_t* | User-provided array of subscriptions. |
[in] | size_t | Number of elements in the subscription array. |
[out] | uint8_t** | Where the SUBSCRIBE packet is written. |
[out] | size_t* | Size of the SUBSCRIBE packet. |
[out] | uint16_t* | The packet identifier generated for this SUBSCRIBE. |
Default implementation: _IotMqtt_SerializeSubscribe
IotMqttError_t( * IotMqttSerializer_t::unsubscribe) (const IotMqttSubscription_t *, size_t, uint8_t **, size_t *, uint16_t *) |
UNSUBSCRIBE packet serializer function.
[in] | IotMqttSubscription_t* | User-provided array of subscriptions to remove. |
[in] | size_t | Number of elements in the subscription array. |
[out] | uint8_t** | Where the UNSUBSCRIBE packet is written. |
[out] | size_t* | Size of the UNSUBSCRIBE packet. |
[out] | uint16_t* | The packet identifier generated for this UNSUBSCRIBE. |
Default implementation: _IotMqtt_SerializeUnsubscribe
IotMqttError_t( * IotMqttSerializer_t::pingreq) (uint8_t **, size_t *) |
PINGREQ packet serializer function.
[out] | uint8_t** | Where the PINGREQ packet is written. |
[out] | size_t* | Size of the PINGREQ packet. |
Default implementation: _IotMqtt_SerializePingreq
IotMqttError_t( * IotMqttSerializer_t::disconnect) (uint8_t **, size_t *) |
DISCONNECT packet serializer function.
[out] | uint8_t** | Where the DISCONNECT packet is written. |
[out] | size_t* | Size of the DISCONNECT packet. |
Default implementation: _IotMqtt_SerializeDisconnect
IotMqttError_t( * IotMqttSerializer_t::connack) (struct _mqttPacket *) |
CONNACK packet deserializer function.
[in,out] | _mqttPacket* | Pointer to an MQTT packet struct representing a CONNACK. |
Default implementation: _IotMqtt_DeserializeConnack
IotMqttError_t( * IotMqttSerializer_t::suback) (struct _mqttPacket *) |
SUBACK packet deserializer function.
[in,out] | _mqttPacket* | Pointer to an MQTT packet struct representing a SUBACK. |
Default implementation: _IotMqtt_DeserializeSuback
IotMqttError_t( * IotMqttSerializer_t::unsuback) (struct _mqttPacket *) |
UNSUBACK packet deserializer function.
[in,out] | _mqttPacket* | Pointer to an MQTT packet struct representing an UNSUBACK. |
Default implementation: _IotMqtt_DeserializeUnsuback
IotMqttError_t( * IotMqttSerializer_t::pingresp) (struct _mqttPacket *) |
PINGRESP packet deserializer function.
[in,out] | _mqttPacket* | Pointer to an MQTT packet struct representing a PINGRESP. |
Default implementation: _IotMqtt_DeserializePingresp