Classes | Macros | Functions
MQTTPersistence.h File Reference
#include "Clients.h"
#include "MQTTProperties.h"
Include dependency graph for MQTTPersistence.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MQTTPersistence_message
 
struct  MQTTPersistence_qEntry
 

Macros

#define PERSISTENCE_COMMAND_KEY   "c-"
 
#define PERSISTENCE_MAX_KEY_LENGTH   9
 
#define PERSISTENCE_MAX_STEM_LENGTH   3
 
#define PERSISTENCE_PUBLISH_RECEIVED   "r-"
 
#define PERSISTENCE_PUBLISH_SENT   "s-"
 
#define PERSISTENCE_PUBREL   "sc-"
 
#define PERSISTENCE_QUEUE_KEY   "q-"
 
#define PERSISTENCE_SEQNO_LIMIT   1000000 /*10^(PERSISTENCE_MAX_KEY_LENGTH - PERSISTENCE_MAX_STEM_LENGTH)*/
 
#define PERSISTENCE_V5_COMMAND_KEY   "c5-"
 
#define PERSISTENCE_V5_PUBLISH_RECEIVED   "r5-"
 
#define PERSISTENCE_V5_PUBLISH_SENT   "s5-"
 
#define PERSISTENCE_V5_PUBREL   "sc5-"
 
#define PERSISTENCE_V5_QUEUE_KEY   "q5-"
 

Functions

int MQTTPersistence_clear (Clients *c)
 
int MQTTPersistence_close (Clients *c)
 
int MQTTPersistence_create (MQTTClient_persistence **per, int type, void *pcontext)
 
int MQTTPersistence_initialize (Clients *c, const char *serverURI)
 
void MQTTPersistence_insertInOrder (List *list, void *content, size_t size)
 
int MQTTPersistence_persistQueueEntry (Clients *aclient, MQTTPersistence_qEntry *qe)
 
int MQTTPersistence_putPacket (int socket, char *buf0, size_t buf0len, int count, char **buffers, size_t *buflens, int htype, int msgId, int scr, int MQTTVersion)
 
int MQTTPersistence_remove (Clients *c, char *type, int qos, int msgId)
 
int MQTTPersistence_restoreMessageQueue (Clients *c)
 
void * MQTTPersistence_restorePacket (int MQTTVersion, char *buffer, size_t buflen)
 
int MQTTPersistence_restorePackets (Clients *c)
 
int MQTTPersistence_unpersistQueueEntry (Clients *client, MQTTPersistence_qEntry *qe)
 
void MQTTPersistence_wrapMsgID (Clients *c)
 

Macro Definition Documentation

#define PERSISTENCE_COMMAND_KEY   "c-"

Stem of the key for an async client command

Definition at line 45 of file MQTTPersistence.h.

#define PERSISTENCE_MAX_KEY_LENGTH   9

Maximum allowed length of a persistence key

Definition at line 55 of file MQTTPersistence.h.

#define PERSISTENCE_MAX_STEM_LENGTH   3

Maximum length of a stem for a persistence key

Definition at line 53 of file MQTTPersistence.h.

#define PERSISTENCE_PUBLISH_RECEIVED   "r-"

Stem of the key for a received PUBLISH QoS2

Definition at line 35 of file MQTTPersistence.h.

#define PERSISTENCE_PUBLISH_SENT   "s-"

Stem of the key for a sent PUBLISH QoS1 or QoS2

Definition at line 31 of file MQTTPersistence.h.

#define PERSISTENCE_PUBREL   "sc-"

Stem of the key for a sent PUBREL

Definition at line 33 of file MQTTPersistence.h.

#define PERSISTENCE_QUEUE_KEY   "q-"

Stem of the key for an client incoming message queue

Definition at line 49 of file MQTTPersistence.h.

#define PERSISTENCE_SEQNO_LIMIT   1000000 /*10^(PERSISTENCE_MAX_KEY_LENGTH - PERSISTENCE_MAX_STEM_LENGTH)*/

Maximum size of an integer sequence number appended to a persistence key

Definition at line 57 of file MQTTPersistence.h.

#define PERSISTENCE_V5_COMMAND_KEY   "c5-"

Stem of the key for an MQTT V5 async client command

Definition at line 47 of file MQTTPersistence.h.

#define PERSISTENCE_V5_PUBLISH_RECEIVED   "r5-"

Stem of the key for a received MQTT V5 PUBLISH QoS2

Definition at line 42 of file MQTTPersistence.h.

#define PERSISTENCE_V5_PUBLISH_SENT   "s5-"

Stem of the key for a sent MQTT V5 PUBLISH QoS1 or QoS2

Definition at line 38 of file MQTTPersistence.h.

#define PERSISTENCE_V5_PUBREL   "sc5-"

Stem of the key for a sent MQTT V5 PUBREL

Definition at line 40 of file MQTTPersistence.h.

#define PERSISTENCE_V5_QUEUE_KEY   "q5-"

Stem of the key for an MQTT V5 incoming message queue

Definition at line 51 of file MQTTPersistence.h.

Function Documentation

int MQTTPersistence_clear ( Clients c)

Clears the persistent store.

Parameters
clientthe client as Clients.
Returns
0 if success, MQTTCLIENT_PERSISTENCE_ERROR otherwise.

Definition at line 161 of file MQTTPersistence.c.

int MQTTPersistence_close ( Clients c)

Close persistent store.

Parameters
clientthe client as Clients.
Returns
0 if success, MQTTCLIENT_PERSISTENCE_ERROR otherwise.

Definition at line 133 of file MQTTPersistence.c.

int MQTTPersistence_create ( MQTTClient_persistence **  persistence,
int  type,
void *  pcontext 
)

Creates a MQTTClient_persistence structure representing a persistence implementation.

Parameters
persistencethe MQTTClient_persistence structure.
typethe type of the persistence implementation. See MQTTClient_create.
pcontextthe context for this persistence implementation. See MQTTClient_create.
Returns
0 if success, MQTTCLIENT_PERSISTENCE_ERROR otherwise.

Definition at line 47 of file MQTTPersistence.c.

int MQTTPersistence_initialize ( Clients c,
const char *  serverURI 
)

Open persistent store and restore any persisted messages.

Parameters
clientthe client as Clients.
serverURIthe URI of the remote end.
Returns
0 if success, MQTTCLIENT_PERSISTENCE_ERROR otherwise.

Definition at line 111 of file MQTTPersistence.c.

void MQTTPersistence_insertInOrder ( List list,
void *  content,
size_t  size 
)

Inserts the specified message into the list, maintaining message ID order.

Parameters
listthe list to insert the message into.
contentthe message to add.
sizesize of the message.

Definition at line 379 of file MQTTPersistence.c.

int MQTTPersistence_persistQueueEntry ( Clients aclient,
MQTTPersistence_qEntry qe 
)

Definition at line 615 of file MQTTPersistence.c.

int MQTTPersistence_putPacket ( int  socket,
char *  buf0,
size_t  buf0len,
int  count,
char **  buffers,
size_t *  buflens,
int  htype,
int  msgId,
int  scr,
int  MQTTVersion 
)

Adds a record to the persistent store. This function must not be called for QoS0 messages.

Parameters
socketthe socket of the client.
buf0fixed header.
buf0lenlength of the fixed header.
countnumber of buffers representing the variable header and/or the payload.
buffersthe buffers representing the variable header and/or the payload.
buflenslength of the buffers representing the variable header and/or the payload.
htypeMQTT packet type - PUBLISH or PUBREL
msgIdthe message ID.
scr0 indicates message in the sending direction; 1 indicates message in the receiving direction.
theMQTT version being used (>= MQTTVERSION_5 means properties included)
Returns
0 if success, MQTTCLIENT_PERSISTENCE_ERROR otherwise.

Definition at line 412 of file MQTTPersistence.c.

int MQTTPersistence_remove ( Clients c,
char *  type,
int  qos,
int  msgId 
)

Deletes a record from the persistent store.

Parameters
clientthe client as Clients.
typethe type of the persisted record: PERSISTENCE_PUBLISH_SENT, PERSISTENCE_PUBREL or PERSISTENCE_PUBLISH_RECEIVED.
qosthe qos field of the message.
msgIdthe message ID.
Returns
0 if success, MQTTCLIENT_PERSISTENCE_ERROR otherwise.

Definition at line 508 of file MQTTPersistence.c.

int MQTTPersistence_restoreMessageQueue ( Clients c)

Restores a queue of messages from persistence to memory

Parameters
cthe client as Clients - the client object to restore the messages to
Returns
return code, 0 if successful

Definition at line 788 of file MQTTPersistence.c.

void* MQTTPersistence_restorePacket ( int  MQTTVersion,
char *  buffer,
size_t  buflen 
)

Returns a MQTT packet restored from persisted data.

Parameters
bufferthe persisted data.
buflenthe number of bytes of the data buffer.

Definition at line 341 of file MQTTPersistence.c.

int MQTTPersistence_restorePackets ( Clients c)

Restores the persisted records to the outbound and inbound message queues of the client.

Parameters
clientthe client as Clients.
Returns
0 if success, MQTTCLIENT_PERSISTENCE_ERROR otherwise.

Definition at line 180 of file MQTTPersistence.c.

int MQTTPersistence_unpersistQueueEntry ( Clients client,
MQTTPersistence_qEntry qe 
)

Definition at line 597 of file MQTTPersistence.c.

void MQTTPersistence_wrapMsgID ( Clients client)

Checks whether the message IDs wrapped by looking for the largest gap between two consecutive message IDs in the outboundMsgs queue.

Parameters
clientthe client as Clients.

Definition at line 556 of file MQTTPersistence.c.



plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 04:02:49