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"
Go to the source code of this file.
Macros | |
#define | MAX_NO_OF_BUFFERS 9 |
Functions that apply to persistence operations.
Definition in file MQTTPersistence.c.
#define MAX_NO_OF_BUFFERS 9 |
Definition at line 614 of file MQTTPersistence.c.
int MQTTPersistence_clear | ( | Clients * | c | ) |
Clears the persistent store.
client | the client as Clients. |
Definition at line 161 of file MQTTPersistence.c.
int MQTTPersistence_close | ( | Clients * | c | ) |
Close persistent store.
client | the client as Clients. |
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.
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. |
Definition at line 47 of file MQTTPersistence.c.
int MQTTPersistence_initialize | ( | Clients * | c, |
const char * | serverURI | ||
) |
Open persistent store and restore any persisted messages.
client | the client as Clients. |
serverURI | the URI of the remote end. |
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.
list | the list to insert the message into. |
content | the message to add. |
size | size of the message. |
Definition at line 379 of file MQTTPersistence.c.
|
static |
Definition at line 767 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.
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. |
htype | MQTT packet type - PUBLISH or PUBREL |
msgId | the message ID. |
scr | 0 indicates message in the sending direction; 1 indicates message in the receiving direction. |
the | MQTT version being used (>= MQTTVERSION_5 means properties included) |
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.
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. |
Definition at line 508 of file MQTTPersistence.c.
int MQTTPersistence_restoreMessageQueue | ( | Clients * | c | ) |
Restores a queue of messages from persistence to memory
c | the client as Clients - the client object to restore the messages to |
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.
buffer | the persisted data. |
buflen | the 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.
client | the client as Clients. |
Definition at line 180 of file MQTTPersistence.c.
|
static |
Definition at line 695 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.
client | the client as Clients. |
Definition at line 556 of file MQTTPersistence.c.