MQTT API Reference
MQTT 3.1.1 client library
IotMqttSerializer_t Struct Reference

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.
 

Detailed Description

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.

Field Documentation

◆ getPacketType

uint8_t( * IotMqttSerializer_t::getPacketType) (void *, const IotNetworkInterface_t *)

Get the MQTT packet type from a stream of bytes off the network.

Parameters
[in]pNetworkConnectionReference to the network connection.
[in]pNetworkInterfaceFunction pointers used to interact with the network.

Default implementation: _IotMqtt_GetPacketType

◆ getRemainingLength

size_t( * IotMqttSerializer_t::getRemainingLength) (void *pNetworkConnection, const IotNetworkInterface_t *pNetworkInterface)

Get the remaining length from a stream of bytes off the network.

Parameters
[in]pNetworkConnectionReference to the network connection.
[in]pNetworkInterfaceFunction pointers used to interact with the network.

Default implementation: _IotMqtt_GetRemainingLength

◆ freePacket

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.

Parameters
[in]uint8_t*The packet to free.

Default implementation: _IotMqtt_FreePacket

◆ connect

IotMqttError_t( * IotMqttSerializer_t::connect) (const IotMqttConnectInfo_t *, uint8_t **, size_t *)

CONNECT packet serializer function.

Parameters
[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

◆ publish

IotMqttError_t( * IotMqttSerializer_t::publish) (struct _mqttPacket *)

PUBLISH packet serializer function.

PUBLISH packet deserializer function.

Parameters
[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

Parameters
[in,out]_mqttPacket*Pointer to an MQTT packet struct representing a PUBLISH.

Default implementation: _IotMqtt_DeserializePublish

◆ publishSetDup

void( * IotMqttSerializer_t::publishSetDup) (uint8_t *, uint8_t *, uint16_t *)

Set the DUP bit in a QoS 1 PUBLISH packet.

Parameters
[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

◆ puback

IotMqttError_t( * IotMqttSerializer_t::puback) (struct _mqttPacket *pPuback)

PUBACK packet serializer function.

PUBACK packet deserializer function.

Parameters
[in]uint16_tThe 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

Parameters
[in,out]_mqttPacket*Pointer to an MQTT packet struct representing a PUBACK.

Default implementation: _IotMqtt_DeserializePuback

◆ subscribe

IotMqttError_t( * IotMqttSerializer_t::subscribe) (const IotMqttSubscription_t *, size_t, uint8_t **, size_t *, uint16_t *)

SUBSCRIBE packet serializer function.

Parameters
[in]IotMqttSubscription_t*User-provided array of subscriptions.
[in]size_tNumber 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

◆ unsubscribe

IotMqttError_t( * IotMqttSerializer_t::unsubscribe) (const IotMqttSubscription_t *, size_t, uint8_t **, size_t *, uint16_t *)

UNSUBSCRIBE packet serializer function.

Parameters
[in]IotMqttSubscription_t*User-provided array of subscriptions to remove.
[in]size_tNumber 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

◆ pingreq

IotMqttError_t( * IotMqttSerializer_t::pingreq) (uint8_t **, size_t *)

PINGREQ packet serializer function.

Parameters
[out]uint8_t**Where the PINGREQ packet is written.
[out]size_t*Size of the PINGREQ packet.

Default implementation: _IotMqtt_SerializePingreq

◆ disconnect

IotMqttError_t( * IotMqttSerializer_t::disconnect) (uint8_t **, size_t *)

DISCONNECT packet serializer function.

Parameters
[out]uint8_t**Where the DISCONNECT packet is written.
[out]size_t*Size of the DISCONNECT packet.

Default implementation: _IotMqtt_SerializeDisconnect

◆ connack

IotMqttError_t( * IotMqttSerializer_t::connack) (struct _mqttPacket *)

CONNACK packet deserializer function.

Parameters
[in,out]_mqttPacket*Pointer to an MQTT packet struct representing a CONNACK.

Default implementation: _IotMqtt_DeserializeConnack

◆ suback

IotMqttError_t( * IotMqttSerializer_t::suback) (struct _mqttPacket *)

SUBACK packet deserializer function.

Parameters
[in,out]_mqttPacket*Pointer to an MQTT packet struct representing a SUBACK.

Default implementation: _IotMqtt_DeserializeSuback

◆ unsuback

IotMqttError_t( * IotMqttSerializer_t::unsuback) (struct _mqttPacket *)

UNSUBACK packet deserializer function.

Parameters
[in,out]_mqttPacket*Pointer to an MQTT packet struct representing an UNSUBACK.

Default implementation: _IotMqtt_DeserializeUnsuback

◆ pingresp

IotMqttError_t( * IotMqttSerializer_t::pingresp) (struct _mqttPacket *)

PINGRESP packet deserializer function.

Parameters
[in,out]_mqttPacket*Pointer to an MQTT packet struct representing a PINGRESP.

Default implementation: _IotMqtt_DeserializePingresp


The documentation for this struct was generated from the following file: