Paho MQTT C Client Library: MQTTClientPersistence.h Source File

| Paho MQTT C Client Library

Loading...
Searching...
No Matches
MQTTClientPersistence.h
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright (c) 2009, 2020 IBM Corp.
3 *
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v2.0
6 * and Eclipse Distribution License v1.0 which accompany this distribution.
7 *
8 * The Eclipse Public License is available at
9 * https://www.eclipse.org/legal/epl-2.0/
10 * and the Eclipse Distribution License is available at
11 * http://www.eclipse.org/org/documents/edl-v10.php.
12 *
13 * Contributors:
14 * Ian Craggs - initial API and implementation and/or initial documentation
15 *******************************************************************************/
16
55
56/*
58*/
59#if !defined(MQTTCLIENTPERSISTENCE_H)
60#define MQTTCLIENTPERSISTENCE_H
61/*
63*/
64
69#define MQTTCLIENT_PERSISTENCE_DEFAULT 0
74#define MQTTCLIENT_PERSISTENCE_NONE 1
79#define MQTTCLIENT_PERSISTENCE_USER 2
80
85#define MQTTCLIENT_PERSISTENCE_ERROR -2
86
113 typedef int (*Persistence_open)(void** handle, const char* clientID, const char* serverURI, void* context);
114
123 typedef int (*Persistence_close)(void* handle);
124
140 typedef int (*Persistence_put)(void* handle, char* key, int bufcount, char* buffers[], int buflens[]);
141
156 typedef int (*Persistence_get)(void* handle, char* key, char** buffer, int* buflen);
157
169 typedef int (*Persistence_remove)(void* handle, char* key);
170
186 typedef int (*Persistence_keys)(void* handle, char*** keys, int* nkeys);
187
197 typedef int (*Persistence_clear)(void* handle);
198
208 typedef int (*Persistence_containskey)(void* handle, char* key);
209
215 typedef struct {
219 void* context;
223 Persistence_open popen;
227 Persistence_close pclose;
231 Persistence_put pput;
235 Persistence_get pget;
239 Persistence_remove premove;
243 Persistence_keys pkeys;
247 Persistence_clear pclear;
251 Persistence_containskey pcontainskey;
252} MQTTClient_persistence;
253
254
264 typedef int MQTTPersistence_beforeWrite(void* context, int bufcount, char* buffers[], int buflens[]);
265
266
275 typedef int MQTTPersistence_afterRead(void* context, char** buffer, int* buflen);
276
277#endif
Persistence_keys
int(* Persistence_keys)(void *handle, char ***keys, int *nkeys)
Returns the keys in this persistent data store.
Definition MQTTClientPersistence.h:186
Persistence_close
int(* Persistence_close)(void *handle)
Close the persistent store referred to by the handle.
Definition MQTTClientPersistence.h:123
Persistence_put
int(* Persistence_put)(void *handle, char *key, int bufcount, char *buffers[], int buflens[])
Put the specified data into the persistent store.
Definition MQTTClientPersistence.h:140
Persistence_open
int(* Persistence_open)(void **handle, const char *clientID, const char *serverURI, void *context)
Initialize the persistent store.
Definition MQTTClientPersistence.h:113
Persistence_remove
int(* Persistence_remove)(void *handle, char *key)
Remove the data for the specified key from the store.
Definition MQTTClientPersistence.h:169
Persistence_containskey
int(* Persistence_containskey)(void *handle, char *key)
Returns whether any data has been persisted using the specified key.
Definition MQTTClientPersistence.h:208
MQTTPersistence_beforeWrite
int MQTTPersistence_beforeWrite(void *context, int bufcount, char *buffers[], int buflens[])
Definition MQTTClientPersistence.h:264
Persistence_clear
int(* Persistence_clear)(void *handle)
Clears the persistence store, so that it no longer contains any persisted data.
Definition MQTTClientPersistence.h:197
Persistence_get
int(* Persistence_get)(void *handle, char *key, char **buffer, int *buflen)
Retrieve the specified data from the persistent store.
Definition MQTTClientPersistence.h:156
MQTTPersistence_afterRead
int MQTTPersistence_afterRead(void *context, char **buffer, int *buflen)
Definition MQTTClientPersistence.h:275
MQTTClient_persistence
A structure containing the function pointers to a persistence implementation and the context or state...
Definition MQTTClientPersistence.h:215
MQTTClient_persistence::popen
Persistence_open popen
Definition MQTTClientPersistence.h:223
MQTTClient_persistence::pkeys
Persistence_keys pkeys
Definition MQTTClientPersistence.h:243
MQTTClient_persistence::pput
Persistence_put pput
Definition MQTTClientPersistence.h:231
MQTTClient_persistence::pget
Persistence_get pget
Definition MQTTClientPersistence.h:235
MQTTClient_persistence::premove
Persistence_remove premove
Definition MQTTClientPersistence.h:239
MQTTClient_persistence::pclose
Persistence_close pclose
Definition MQTTClientPersistence.h:227
MQTTClient_persistence::pclear
Persistence_clear pclear
Definition MQTTClientPersistence.h:247
MQTTClient_persistence::pcontainskey
Persistence_containskey pcontainskey
Definition MQTTClientPersistence.h:251
MQTTClient_persistence::context
void * context
Definition MQTTClientPersistence.h:219