MQTT C Client Libraries Internals
Functions | Variables
MQTTProtocolOut.c File Reference

Functions dealing with the MQTT protocol exchanges. More...

#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "MQTTProtocolOut.h"
#include "StackTrace.h"
#include "Heap.h"
#include "WebSocket.h"
#include "Base64.h"
Include dependency graph for MQTTProtocolOut.c:

Functions

size_t MQTTProtocol_addressPort (const char *uri, int *port, const char **topic, int default_port)
 Separates an address:port into two separate values. More...
 
void MQTTProtocol_specialChars (char *p0, char *p1, b64_size_t *basic_auth_in_len)
 Allow user or password characters to be expressed in the form of XX, XX being the hexadecimal value of the character. More...
 
int MQTTProtocol_setHTTPProxy (Clients *aClient, char *source, char **dest, char **auth_dest, char *prefix)
 
int MQTTProtocol_connect (const char *ip_address, Clients *aClient, int websocket, int MQTTVersion, MQTTProperties *connectProperties, MQTTProperties *willProperties)
 MQTT outgoing connect processing for a client. More...
 
int MQTTProtocol_handlePingresps (void *pack, int sock)
 Process an incoming pingresp packet for a socket. More...
 
int MQTTProtocol_subscribe (Clients *client, List *topics, List *qoss, int msgID, MQTTSubscribe_options *opts, MQTTProperties *props)
 MQTT outgoing subscribe processing for a client. More...
 
int MQTTProtocol_handleSubacks (void *pack, int sock)
 Process an incoming suback packet for a socket. More...
 
int MQTTProtocol_unsubscribe (Clients *client, List *topics, int msgID, MQTTProperties *props)
 MQTT outgoing unsubscribe processing for a client. More...
 
int MQTTProtocol_handleUnsubacks (void *pack, int sock)
 Process an incoming unsuback packet for a socket. More...
 

Variables

ClientStatesbstate
 

Detailed Description

Functions dealing with the MQTT protocol exchanges.

Some other related functions are in the MQTTProtocolClient module

Function Documentation

◆ MQTTProtocol_addressPort()

size_t MQTTProtocol_addressPort ( const char *  uri,
int *  port,
const char **  topic,
int  default_port 
)

Separates an address:port into two separate values.

Parameters
[in]urithe input string - hostname:port
[out]portthe returned port integer
[out]topicoptional topic portion of the address starting with '/'
Returns
the address string

◆ MQTTProtocol_connect()

int MQTTProtocol_connect ( const char *  ip_address,
Clients aClient,
int  websocket,
int  MQTTVersion,
MQTTProperties connectProperties,
MQTTProperties willProperties 
)

MQTT outgoing connect processing for a client.

Parameters
ip_addressthe TCP address:port to connect to
aClienta structure with all MQTT data needed
intssl
intMQTTVersion the MQTT version to connect with (3 or 4)
longtimeout how long to wait for a new socket to be created
Returns
return code

◆ MQTTProtocol_handlePingresps()

int MQTTProtocol_handlePingresps ( void *  pack,
int  sock 
)

Process an incoming pingresp packet for a socket.

Parameters
packpointer to the publish packet
sockthe socket on which the packet was received
Returns
completion code
Here is the call graph for this function:

◆ MQTTProtocol_handleSubacks()

int MQTTProtocol_handleSubacks ( void *  pack,
int  sock 
)

Process an incoming suback packet for a socket.

Parameters
packpointer to the publish packet
sockthe socket on which the packet was received
Returns
completion code
Here is the call graph for this function:

◆ MQTTProtocol_handleUnsubacks()

int MQTTProtocol_handleUnsubacks ( void *  pack,
int  sock 
)

Process an incoming unsuback packet for a socket.

Parameters
packpointer to the publish packet
sockthe socket on which the packet was received
Returns
completion code
Here is the call graph for this function:

◆ MQTTProtocol_specialChars()

void MQTTProtocol_specialChars ( char *  p0,
char *  p1,
b64_size_t *  basic_auth_in_len 
)

Allow user or password characters to be expressed in the form of XX, XX being the hexadecimal value of the character.

This will avoid problems when a user code or a password contains a '@' or another special character ('' included)

Parameters
p0output string
p1input string
basic_auth_in_len

◆ MQTTProtocol_subscribe()

int MQTTProtocol_subscribe ( Clients client,
List topics,
List qoss,
int  msgID,
MQTTSubscribe_options opts,
MQTTProperties props 
)

MQTT outgoing subscribe processing for a client.

Parameters
clientthe client structure
topicslist of topics
qosscorresponding list of QoSs
optsMQTT 5.0 subscribe options
propsMQTT 5.0 subscribe properties
Returns
completion code
Here is the call graph for this function:

◆ MQTTProtocol_unsubscribe()

int MQTTProtocol_unsubscribe ( Clients client,
List topics,
int  msgID,
MQTTProperties props 
)

MQTT outgoing unsubscribe processing for a client.

Parameters
clientthe client structure
topicslist of topics
Returns
completion code
Here is the call graph for this function: