MQTT C Client Libraries Internals
 All Data Structures Files Functions Variables Typedefs Macros Pages
Functions
MQTTPacketOut.c File Reference

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"
Include dependency graph for MQTTPacketOut.c:

Functions

int MQTTPacket_send_connect (Clients *client, int MQTTVersion)
 Send an MQTT CONNECT packet down a socket. More...
 
void * MQTTPacket_connack (unsigned char aHeader, char *data, size_t datalen)
 Function used in the new packets table to create connack packets. More...
 
int MQTTPacket_send_pingreq (networkHandles *net, const char *clientID)
 Send an MQTT PINGREQ packet down a socket. More...
 
int MQTTPacket_send_subscribe (List *topics, List *qoss, int msgid, int dup, networkHandles *net, const char *clientID)
 Send an MQTT subscribe packet down a socket. More...
 
void * MQTTPacket_suback (unsigned char aHeader, char *data, size_t datalen)
 Function used in the new packets table to create suback packets. More...
 
int MQTTPacket_send_unsubscribe (List *topics, int msgid, int dup, networkHandles *net, const char *clientID)
 Send an MQTT unsubscribe packet down a socket. More...
 

Detailed Description

functions to deal with reading and writing of MQTT packets from and to sockets

Some other related functions are in the MQTTPacket module

Function Documentation

void* MQTTPacket_connack ( unsigned char  aHeader,
char *  data,
size_t  datalen 
)

Function used in the new packets table to create connack packets.

Parameters
aHeaderthe MQTT header byte
datathe rest of the packet
datalenthe length of the rest of the packet
Returns
pointer to the packet structure

Here is the call graph for this function:

int MQTTPacket_send_connect ( Clients client,
int  MQTTVersion 
)

Send an MQTT CONNECT packet down a socket.

Parameters
clienta structure from which to get all the required values
MQTTVersionthe MQTT version to connect with
Returns
the completion code (e.g. TCPSOCKET_COMPLETE)

Here is the call graph for this function:

int MQTTPacket_send_pingreq ( networkHandles net,
const char *  clientID 
)

Send an MQTT PINGREQ packet down a socket.

Parameters
socketthe open socket to send the data to
clientIDthe string client identifier, only used for tracing
Returns
the completion code (e.g. TCPSOCKET_COMPLETE)

Here is the call graph for this function:

int MQTTPacket_send_subscribe ( List topics,
List qoss,
int  msgid,
int  dup,
networkHandles net,
const char *  clientID 
)

Send an MQTT subscribe packet down a socket.

Parameters
topicslist of topics
qosslist of corresponding QoSs
msgidthe MQTT message id to use
dupboolean - whether to set the MQTT DUP flag
socketthe open socket to send the data to
clientIDthe string client identifier, only used for tracing
Returns
the completion code (e.g. TCPSOCKET_COMPLETE)

Here is the call graph for this function:

int MQTTPacket_send_unsubscribe ( List topics,
int  msgid,
int  dup,
networkHandles net,
const char *  clientID 
)

Send an MQTT unsubscribe packet down a socket.

Parameters
topicslist of topics
msgidthe MQTT message id to use
dupboolean - whether to set the MQTT DUP flag
socketthe open socket to send the data to
clientIDthe string client identifier, only used for tracing
Returns
the completion code (e.g. TCPSOCKET_COMPLETE)

Here is the call graph for this function:

void* MQTTPacket_suback ( unsigned char  aHeader,
char *  data,
size_t  datalen 
)

Function used in the new packets table to create suback packets.

Parameters
aHeaderthe MQTT header byte
datathe rest of the packet
datalenthe length of the rest of the packet
Returns
pointer to the packet structure

Here is the call graph for this function: