Microchip® Advanced Software Framework

pahomqtt/MQTTPacket/MQTTConnect.h File Reference

Data Structures

union  MQTTConnackFlags
 
union  MQTTConnectFlags
 
struct  MQTTPacket_connectData
 
struct  MQTTPacket_willOptions
 Defines the MQTT "Last Will and Testament" (LWT) settings for the connect packet. More...
 

Macros

#define DLLExport
 
#define DLLImport
 
#define MQTTPacket_connectData_initializer
 
#define MQTTPacket_willOptions_initializer   { {'M', 'Q', 'T', 'W'}, 0, {NULL, {0, NULL}}, {NULL, {0, NULL}}, 0, 0 }
 

Functions

DLLExport int MQTTDeserialize_connack (unsigned char *sessionPresent, unsigned char *connack_rc, unsigned char *buf, int buflen)
 Deserializes the supplied (wire) buffer into connack data - return code. More...
 
DLLExport int MQTTDeserialize_connect (MQTTPacket_connectData *data, unsigned char *buf, int len)
 Deserializes the supplied (wire) buffer into connect data structure. More...
 
DLLExport int MQTTSerialize_connack (unsigned char *buf, int buflen, unsigned char connack_rc, unsigned char sessionPresent)
 Serializes the connack packet into the supplied buffer. More...
 
DLLExport int MQTTSerialize_connect (unsigned char *buf, int buflen, MQTTPacket_connectData *options)
 Serializes the connect options into the buffer. More...
 
DLLExport int MQTTSerialize_disconnect (unsigned char *buf, int buflen)
 Serializes a disconnect packet into the supplied buffer, ready for writing to a socket. More...
 
DLLExport int MQTTSerialize_pingreq (unsigned char *buf, int buflen)
 Serializes a disconnect packet into the supplied buffer, ready for writing to a socket. More...
 

#define DLLExport
#define DLLImport
#define MQTTPacket_connectData_initializer
Value:
{ {'M', 'Q', 'T', 'C'}, 0, 4, {NULL, {0, NULL}}, 60, 1, 0, \
#define NULL
Definition: def.h:47
#define MQTTPacket_willOptions_initializer
Definition: pahomqtt/MQTTPacket/MQTTConnect.h:85

Referenced by aws_iot_mqtt_connect(), mqtt_connect_broker(), MQTTClient(), and MQTTConnect().

#define MQTTPacket_willOptions_initializer   { {'M', 'Q', 'T', 'W'}, 0, {NULL, {0, NULL}}, {NULL, {0, NULL}}, 0, 0 }

DLLExport int MQTTDeserialize_connack ( unsigned char *  sessionPresent,
unsigned char *  connack_rc,
unsigned char *  buf,
int  buflen 
)

Deserializes the supplied (wire) buffer into connack data - return code.

Parameters
sessionPresentthe session present flag returned (only for MQTT 3.1.1)
connack_rcreturned integer value of the connack return code
bufthe raw buffer data, of the correct length determined by the remaining length field
lenthe length in bytes of the data in the supplied buffer
Returns
error code. 1 is success, 0 is failure

References MQTTConnackFlags::all, MQTTHeader::bits, MQTTConnackFlags::bits, buf, MQTTHeader::byte, CONNACK, FUNC_ENTRY, FUNC_EXIT_RC, header, MQTTPacket_decodeBuf(), NULL, readChar(), MQTTConnackFlags::sessionpresent, and MQTTHeader::type.

Referenced by MQTTConnect(), and MQTTFormat_toClientString().

DLLExport int MQTTSerialize_connack ( unsigned char *  buf,
int  buflen,
unsigned char  connack_rc,
unsigned char  sessionPresent 
)

Serializes the connack packet into the supplied buffer.

Parameters
bufthe buffer into which the packet will be serialized
buflenthe length in bytes of the supplied buffer
connack_rcthe integer connack return code to be used
sessionPresentthe MQTT 3.1.1 sessionPresent flag
Returns
serialized length, or error if 0

References MQTTConnackFlags::all, MQTTHeader::bits, MQTTConnackFlags::bits, buf, MQTTHeader::byte, CONNACK, FUNC_ENTRY, FUNC_EXIT_RC, header, MQTTPACKET_BUFFER_TOO_SHORT, MQTTPacket_encode(), ptr, MQTTConnackFlags::sessionpresent, MQTTHeader::type, and writeChar().

DLLExport int MQTTSerialize_disconnect ( unsigned char *  buf,
int  buflen 
)

Serializes a disconnect packet into the supplied buffer, ready for writing to a socket.

Parameters
bufthe buffer into which the packet will be serialized
buflenthe length in bytes of the supplied buffer, to avoid overruns
Returns
serialized length, or error if 0

References DISCONNECT, and MQTTSerialize_zero().

Referenced by MQTTDisconnect().

DLLExport int MQTTSerialize_pingreq ( unsigned char *  buf,
int  buflen 
)

Serializes a disconnect packet into the supplied buffer, ready for writing to a socket.

Parameters
bufthe buffer into which the packet will be serialized
buflenthe length in bytes of the supplied buffer, to avoid overruns
Returns
serialized length, or error if 0

References MQTTSerialize_zero(), and PINGREQ.

Referenced by keepalive().