MQTT C Client Libraries Internals: MQTTProtocolOut.c File Reference

| MQTT C Client Libraries Internals

Loading...
Searching...
No Matches
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 "Proxy.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.
int | MQTTProtocol_connect (const char *address, Clients *aClient, int unixsock, int websocket, int MQTTVersion, MQTTProperties *connectProperties, MQTTProperties *willProperties)
| MQTT outgoing connect processing for a client.
int | MQTTProtocol_handlePingresps (void *pack, SOCKET sock)
| Process an incoming pingresp packet for a socket.
int | MQTTProtocol_subscribe (Clients *client, List *topics, List *qoss, int msgID, MQTTSubscribe_options *opts, MQTTProperties *props)
| MQTT outgoing subscribe processing for a client.
int | MQTTProtocol_handleSubacks (void *pack, SOCKET sock)
| Process an incoming suback packet for a socket.
int | MQTTProtocol_unsubscribe (Clients *client, List *topics, int msgID, MQTTProperties *props)
| MQTT outgoing unsubscribe processing for a client.
int | MQTTProtocol_handleUnsubacks (void *pack, SOCKET sock)
| Process an incoming unsuback packet for a socket.
int | MQTTProtocol_handleDisconnects (void *pack, SOCKET sock)
| Process an incoming disconnect packet for a socket.

## Variables
ClientStates * | bstate

## 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] | uri | the input string - hostname:port
  [out] | port | the returned port integer
  [out] | topic | optional topic portion of the address starting with '/'

Returns
  the address string

## ◆ MQTTProtocol_connect()

int MQTTProtocol_connect | ( | const char * | address,
|  | Clients * | aClient,
|  | int | unixsock,
|  | int | websocket,
|  | int | MQTTVersion,
|  | MQTTProperties * | connectProperties,
|  | MQTTProperties * | willProperties )

MQTT outgoing connect processing for a client.

Parameters

  address | The address of the server. For TCP this is in the form 'address:port; for a UNIX socket it's the path to the socket file, etc.
  aClient | a structure with all MQTT data needed
  unixsock | Whether the address if for a UNIX-domain socket
  ssl | Whether we're connecting with SSL/TLS
  websocket | Whether we should use a websocket for the connection
  MQTTVersion | the MQTT version to connect with (3, 4, or 5)
  connectProperties | The connection properties
  willProperties | Properties for the LWT
  timeout | how long to wait for a new socket to be created

Returns
  return code

Here is the call graph for this function:

## ◆ MQTTProtocol_handleDisconnects()

int MQTTProtocol_handleDisconnects | ( | void * | pack,
|  | SOCKET | sock )

Process an incoming disconnect packet for a socket.

Parameters

  pack | pointer to the disconnect packet
  sock | the socket on which the packet was received

Returns
  completion code

Here is the call graph for this function:

## ◆ MQTTProtocol_handlePingresps()

int MQTTProtocol_handlePingresps | ( | void * | pack,
|  | SOCKET | sock )

Process an incoming pingresp packet for a socket.

Parameters

  pack | pointer to the publish packet
  sock | the 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,
|  | SOCKET | sock )

Process an incoming suback packet for a socket.

Parameters

  pack | pointer to the publish packet
  sock | the 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,
|  | SOCKET | sock )

Process an incoming unsuback packet for a socket.

Parameters

  pack | pointer to the publish packet
  sock | the socket on which the packet was received

Returns
  completion code

Here is the call graph for this function:

## ◆ 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

  client | the client structure
  topics | list of topics
  qoss | corresponding list of QoSs
  opts | MQTT 5.0 subscribe options
  props | MQTT 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

  client | the client structure
  topics | list of topics

Returns
  completion code

Here is the call graph for this function: