functions to deal with reading and writing of MQTT packets from and to sockets More...
#include "MQTTPacketOut.h"
#include "Log.h"
#include "StackTrace.h"
#include <string.h>
#include <stdlib.h>
#include "Heap.h"
Go to the source code of this file.
Functions | |
void * | MQTTPacket_connack (int MQTTVersion, unsigned char aHeader, char *data, size_t datalen) |
void | MQTTPacket_freeConnack (Connack *pack) |
int | MQTTPacket_send_connect (Clients *client, int MQTTVersion, MQTTProperties *connectProperties, MQTTProperties *willProperties) |
int | MQTTPacket_send_pingreq (networkHandles *net, const char *clientID) |
int | MQTTPacket_send_subscribe (List *topics, List *qoss, MQTTSubscribe_options *opts, MQTTProperties *props, int msgid, int dup, Clients *client) |
int | MQTTPacket_send_unsubscribe (List *topics, MQTTProperties *props, int msgid, int dup, Clients *client) |
void * | MQTTPacket_suback (int MQTTVersion, unsigned char aHeader, char *data, size_t datalen) |
void * | MQTTPacket_unsuback (int MQTTVersion, unsigned char aHeader, char *data, size_t datalen) |
functions to deal with reading and writing of MQTT packets from and to sockets
Some other related functions are in the MQTTPacket module
Definition in file MQTTPacketOut.c.
void* MQTTPacket_connack | ( | int | MQTTVersion, |
unsigned char | aHeader, | ||
char * | data, | ||
size_t | datalen | ||
) |
Function used in the new packets table to create connack packets.
MQTTVersion | MQTT 5 or less? |
aHeader | the MQTT header byte |
data | the rest of the packet |
datalen | the length of the rest of the packet |
Definition at line 142 of file MQTTPacketOut.c.
void MQTTPacket_freeConnack | ( | Connack * | pack | ) |
Free allocated storage for a connack packet.
pack | pointer to the connack packet structure |
Definition at line 187 of file MQTTPacketOut.c.
int MQTTPacket_send_connect | ( | Clients * | client, |
int | MQTTVersion, | ||
MQTTProperties * | connectProperties, | ||
MQTTProperties * | willProperties | ||
) |
Send an MQTT CONNECT packet down a socket for V5 or later
client | a structure from which to get all the required values |
MQTTVersion | the MQTT version to connect with |
connectProperties | MQTT V5 properties for the connect packet |
willProperties | MQTT V5 properties for the will message, if any |
Definition at line 48 of file MQTTPacketOut.c.
int MQTTPacket_send_pingreq | ( | networkHandles * | net, |
const char * | clientID | ||
) |
Send an MQTT PINGREQ packet down a socket.
socket | the open socket to send the data to |
clientID | the string client identifier, only used for tracing |
Definition at line 203 of file MQTTPacketOut.c.
int MQTTPacket_send_subscribe | ( | List * | topics, |
List * | qoss, | ||
MQTTSubscribe_options * | opts, | ||
MQTTProperties * | props, | ||
int | msgid, | ||
int | dup, | ||
Clients * | client | ||
) |
Send an MQTT subscribe packet down a socket.
topics | list of topics |
qoss | list of corresponding QoSs |
msgid | the MQTT message id to use |
dup | boolean - whether to set the MQTT DUP flag |
socket | the open socket to send the data to |
clientID | the string client identifier, only used for tracing |
Definition at line 228 of file MQTTPacketOut.c.
int MQTTPacket_send_unsubscribe | ( | List * | topics, |
MQTTProperties * | props, | ||
int | msgid, | ||
int | dup, | ||
Clients * | client | ||
) |
Send an MQTT unsubscribe packet down a socket.
topics | list of topics |
msgid | the MQTT message id to use |
dup | boolean - whether to set the MQTT DUP flag |
socket | the open socket to send the data to |
clientID | the string client identifier, only used for tracing |
Definition at line 359 of file MQTTPacketOut.c.
void* MQTTPacket_suback | ( | int | MQTTVersion, |
unsigned char | aHeader, | ||
char * | data, | ||
size_t | datalen | ||
) |
Function used in the new packets table to create suback packets.
MQTTVersion | the version of MQTT |
aHeader | the MQTT header byte |
data | the rest of the packet |
datalen | the length of the rest of the packet |
Definition at line 292 of file MQTTPacketOut.c.
void* MQTTPacket_unsuback | ( | int | MQTTVersion, |
unsigned char | aHeader, | ||
char * | data, | ||
size_t | datalen | ||
) |
Function used in the new packets table to create unsuback packets.
MQTTVersion | the version of MQTT |
aHeader | the MQTT header byte |
data | the rest of the packet |
datalen | the length of the rest of the packet |
Definition at line 408 of file MQTTPacketOut.c.