MQTT C Client Libraries Internals
Functions
MQTTPersistenceDefault.c File Reference

A file system based persistence implementation. More...

#include "OsWrapper.h"
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
#include "MQTTClientPersistence.h"
#include "MQTTPersistenceDefault.h"
#include "StackTrace.h"
#include "Heap.h"
Include dependency graph for MQTTPersistenceDefault.c:

Functions

int keysUnix (char *, char ***, int *)
 
int clearUnix (char *)
 
int containskeyUnix (char *, char *)
 
int pstopen (void **handle, const char *clientID, const char *serverURI, void *context)
 Create persistence directory for the client: context/clientID-serverURI. More...
 
int pstmkdir (char *pPathname)
 Function to create a directory. More...
 
int pstput (void *handle, char *key, int bufcount, char *buffers[], int buflens[])
 Write wire message to the client persistence directory. More...
 
int pstget (void *handle, char *key, char **buffer, int *buflen)
 Retrieve a wire message from the client persistence directory. More...
 
int pstremove (void *handle, char *key)
 Delete a persisted message from the client persistence directory. More...
 
int pstclose (void *handle)
 Delete client persistence directory (if empty). More...
 
int pstcontainskey (void *handle, char *key)
 Returns whether if a wire message is persisted in the client persistence directory. More...
 
int pstclear (void *handle)
 Delete all the persisted message in the client persistence directory. More...
 
int pstkeys (void *handle, char ***keys, int *nkeys)
 Returns the keys (file names w/o the extension) in the client persistence directory. More...
 

Detailed Description

A file system based persistence implementation.

A directory is specified when the MQTT client is created. When the persistence is then opened (see Persistence_open), a sub-directory is made beneath the base for this particular client ID and connection key. This allows one persistence base directory to be shared by multiple clients.

Function Documentation

◆ pstclear()

int pstclear ( void *  handle)

Delete all the persisted message in the client persistence directory.

See Persistence_clear

◆ pstclose()

int pstclose ( void *  handle)

Delete client persistence directory (if empty).

See Persistence_close

◆ pstcontainskey()

int pstcontainskey ( void *  handle,
char *  key 
)

Returns whether if a wire message is persisted in the client persistence directory.

See Persistence_containskey

◆ pstget()

int pstget ( void *  handle,
char *  key,
char **  buffer,
int *  buflen 
)

Retrieve a wire message from the client persistence directory.

See Persistence_get

◆ pstkeys()

int pstkeys ( void *  handle,
char ***  keys,
int *  nkeys 
)

Returns the keys (file names w/o the extension) in the client persistence directory.

See Persistence_keys

◆ pstmkdir()

int pstmkdir ( char *  pPathname)

Function to create a directory.

Returns 0 on success or if the directory already exists.

◆ pstopen()

int pstopen ( void **  handle,
const char *  clientID,
const char *  serverURI,
void *  context 
)

Create persistence directory for the client: context/clientID-serverURI.

See Persistence_open

Here is the call graph for this function:

◆ pstput()

int pstput ( void *  handle,
char *  key,
int  bufcount,
char *  buffers[],
int  buflens[] 
)

Write wire message to the client persistence directory.

See Persistence_put

Here is the call graph for this function:

◆ pstremove()

int pstremove ( void *  handle,
char *  key 
)

Delete a persisted message from the client persistence directory.

See Persistence_remove