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"
Functions |
int | MQTTPacket_send_connect (Clients *client, int MQTTVersion) |
| Send an MQTT CONNECT packet down a socket.
|
void * | MQTTPacket_connack (unsigned char aHeader, char *data, size_t datalen) |
| Function used in the new packets table to create connack packets.
|
int | MQTTPacket_send_pingreq (networkHandles *net, const char *clientID) |
| Send an MQTT PINGREQ packet down a socket.
|
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.
|
void * | MQTTPacket_suback (unsigned char aHeader, char *data, size_t datalen) |
| Function used in the new packets table to create suback packets.
|
int | MQTTPacket_send_unsubscribe (List *topics, int msgid, int dup, networkHandles *net, const char *clientID) |
| Send an MQTT unsubscribe packet down a socket.
|
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:
-
| aHeader | the MQTT header byte |
| data | the rest of the packet |
| datalen | the length of the rest of the packet |
- Returns:
- pointer to the packet structure
int MQTTPacket_send_connect |
( |
Clients * |
client, |
|
|
int |
MQTTVersion | |
|
) |
| | |
Send an MQTT CONNECT packet down a socket.
- Parameters:
-
| client | a structure from which to get all the required values |
| MQTTVersion | the MQTT version to connect with |
- Returns:
- the completion code (e.g. TCPSOCKET_COMPLETE)
int MQTTPacket_send_pingreq |
( |
networkHandles * |
net, |
|
|
const char * |
clientID | |
|
) |
| | |
Send an MQTT PINGREQ packet down a socket.
- Parameters:
-
| socket | the open socket to send the data to |
| clientID | the string client identifier, only used for tracing |
- Returns:
- the completion code (e.g. TCPSOCKET_COMPLETE)
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:
-
| 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 |
- Returns:
- the completion code (e.g. TCPSOCKET_COMPLETE)
int MQTTPacket_send_unsubscribe |
( |
List * |
topics, |
|
|
int |
msgid, |
|
|
int |
dup, |
|
|
networkHandles * |
net, |
|
|
const char * |
clientID | |
|
) |
| | |
Send an MQTT unsubscribe packet down a socket.
- Parameters:
-
| 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 |
- Returns:
- the completion code (e.g. TCPSOCKET_COMPLETE)
void* MQTTPacket_suback |
( |
unsigned char |
aHeader, |
|
|
char * |
data, |
|
|
size_t |
datalen | |
|
) |
| | |
Function used in the new packets table to create suback packets.
- Parameters:
-
| aHeader | the MQTT header byte |
| data | the rest of the packet |
| datalen | the length of the rest of the packet |
- Returns:
- pointer to the packet structure