MQTTPersistence.c File Reference

Functions that apply to persistence operations. More...

#include <stdio.h>
#include <string.h>
#include "MQTTPersistence.h"
#include "MQTTPersistenceDefault.h"
#include "MQTTProtocolClient.h"
#include "Heap.h"
#include "StackTrace.h"
Include dependency graph for MQTTPersistence.c:

Functions

static MQTTPersistence_qEntryMQTTPersistence_restoreQueueEntry (char *buffer, size_t buflen)
static void MQTTPersistence_insertInSeqOrder (List *list, MQTTPersistence_qEntry *qEntry, size_t size)
int MQTTPersistence_create (MQTTClient_persistence **persistence, int type, void *pcontext)
 Creates a MQTTClient_persistence structure representing a persistence implementation.
int MQTTPersistence_initialize (Clients *c, const char *serverURI)
 Open persistent store and restore any persisted messages.
int MQTTPersistence_close (Clients *c)
 Close persistent store.
int MQTTPersistence_clear (Clients *c)
 Clears the persistent store.
int MQTTPersistence_restore (Clients *c)
 Restores the persisted records to the outbound and inbound message queues of the client.
void * MQTTPersistence_restorePacket (char *buffer, size_t buflen)
 Returns a MQTT packet restored from persisted data.
void MQTTPersistence_insertInOrder (List *list, void *content, size_t size)
 Inserts the specified message into the list, maintaining message ID order.
int MQTTPersistence_put (int socket, char *buf0, size_t buf0len, int count, char **buffers, size_t *buflens, int htype, int msgId, int scr)
 Adds a record to the persistent store.
int MQTTPersistence_remove (Clients *c, char *type, int qos, int msgId)
 Deletes a record from the persistent store.
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.
int MQTTPersistence_unpersistQueueEntry (Clients *client, MQTTPersistence_qEntry *qe)
int MQTTPersistence_persistQueueEntry (Clients *aclient, MQTTPersistence_qEntry *qe)
int MQTTPersistence_restoreMessageQueue (Clients *c)
 Restores a queue of messages from persistence to memory.

Detailed Description

Functions that apply to persistence operations.


Function Documentation

int MQTTPersistence_clear ( Clients c  ) 

Clears the persistent store.

Parameters:
client the client as Clients.
Returns:
0 if success, MQTTCLIENT_PERSISTENCE_ERROR otherwise.
int MQTTPersistence_close ( Clients c  ) 

Close persistent store.

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

Here is the call graph for this function:

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

Creates a MQTTClient_persistence structure representing a persistence implementation.

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

Here is the call graph for this function:

int MQTTPersistence_initialize ( Clients c,
const char *  serverURI 
)

Open persistent store and restore any persisted messages.

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

Here is the call graph for this function:

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

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

Parameters:
list the list to insert the message into.
content the message to add.
size size of the message.

Here is the call graph for this function:

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

Adds a record to the persistent store.

This function must not be called for QoS0 messages.

Parameters:
socket the socket of the client.
buf0 fixed header.
buf0len length of the fixed header.
count number of buffers representing the variable header and/or the payload.
buffers the buffers representing the variable header and/or the payload.
buflens length of the buffers representing the variable header and/or the payload.
msgId the message ID.
scr 0 indicates message in the sending direction; 1 indicates message in the receiving direction.
Returns:
0 if success, MQTTCLIENT_PERSISTENCE_ERROR otherwise.

Here is the call graph for this function:

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

Deletes a record from the persistent store.

Parameters:
client the client as Clients.
type the type of the persisted record: PERSISTENCE_PUBLISH_SENT, PERSISTENCE_PUBREL or PERSISTENCE_PUBLISH_RECEIVED.
qos the qos field of the message.
msgId the message ID.
Returns:
0 if success, MQTTCLIENT_PERSISTENCE_ERROR otherwise.
int MQTTPersistence_restore ( Clients c  ) 

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

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

Here is the call graph for this function:

int MQTTPersistence_restoreMessageQueue ( Clients c  ) 

Restores a queue of messages from persistence to memory.

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

Here is the call graph for this function:

void* MQTTPersistence_restorePacket ( char *  buffer,
size_t  buflen 
)

Returns a MQTT packet restored from persisted data.

Parameters:
buffer the persisted data.
buflen the number of bytes of the data buffer.
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:
client the client as Clients.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Defines

Generated on 2 Jun 2018 for MQTT C Client Libraries Internals by  doxygen 1.6.1