MQTTPersistence.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  * Ian Craggs - async client updates
16  * Ian Craggs - fix for bug 432903 - queue persistence
17  * Ian Craggs - MQTT V5 updates
18  *******************************************************************************/
19 
20 #if !defined(MQTTPERSISTENCE_H)
21 #define MQTTPERSISTENCE_H
22 
23 #if defined(__cplusplus)
24  extern "C" {
25 #endif
26 
27 #include "Clients.h"
28 #include "MQTTProperties.h"
29 
31 #define PERSISTENCE_PUBLISH_SENT "s-"
32 
33 #define PERSISTENCE_PUBREL "sc-"
34 
35 #define PERSISTENCE_PUBLISH_RECEIVED "r-"
36 
38 #define PERSISTENCE_V5_PUBLISH_SENT "s5-"
39 
40 #define PERSISTENCE_V5_PUBREL "sc5-"
41 
42 #define PERSISTENCE_V5_PUBLISH_RECEIVED "r5-"
43 
45 #define PERSISTENCE_COMMAND_KEY "c-"
46 
47 #define PERSISTENCE_V5_COMMAND_KEY "c5-"
48 
49 #define PERSISTENCE_QUEUE_KEY "q-"
50 
51 #define PERSISTENCE_V5_QUEUE_KEY "q5-"
52 
53 #define PERSISTENCE_MAX_STEM_LENGTH 3
54 
55 #define PERSISTENCE_MAX_KEY_LENGTH 9
56 
57 #define PERSISTENCE_SEQNO_LIMIT 1000000 /*10^(PERSISTENCE_MAX_KEY_LENGTH - PERSISTENCE_MAX_STEM_LENGTH)*/
58 
59 int MQTTPersistence_create(MQTTClient_persistence** per, int type, void* pcontext);
60 int MQTTPersistence_initialize(Clients* c, const char* serverURI);
64 void* MQTTPersistence_restorePacket(int MQTTVersion, char* buffer, size_t buflen);
65 void MQTTPersistence_insertInOrder(List* list, void* content, size_t size);
66 int MQTTPersistence_putPacket(int socket, char* buf0, size_t buf0len, int count,
67  char** buffers, size_t* buflens, int htype, int msgId, int scr, int MQTTVersion);
68 int MQTTPersistence_remove(Clients* c, char* type, int qos, int msgId);
70 
71 typedef struct
72 {
73  char struct_id[4];
76  void* payload;
77  int qos;
78  int retained;
79  int dup;
80  int msgid;
83 
84 typedef struct
85 {
87  char* topicName;
88  int topicLen;
89  unsigned int seqno; /* only used on restore */
91 
95 #ifdef __cplusplus
96  }
97 #endif
98 
99 #endif
int MQTTPersistence_close(Clients *c)
int MQTTPersistence_create(MQTTClient_persistence **per, int type, void *pcontext)
void * MQTTPersistence_restorePacket(int MQTTVersion, char *buffer, size_t buflen)
int MQTTPersistence_restorePackets(Clients *c)
int MQTTPersistence_unpersistQueueEntry(Clients *client, MQTTPersistence_qEntry *qe)
int MQTTPersistence_persistQueueEntry(Clients *aclient, MQTTPersistence_qEntry *qe)
constexpr size_t count()
Definition: core.h:960
int MQTTPersistence_clear(Clients *c)
int qos
Definition: test6.c:56
int MQTTPersistence_remove(Clients *c, char *type, int qos, int msgId)
MQTTAsync client
Definition: test6.c:276
void MQTTPersistence_wrapMsgID(Clients *c)
MQTTProperties properties
MQTTClient c
Definition: test10.c:1656
int MQTTPersistence_initialize(Clients *c, const char *serverURI)
A structure containing the function pointers to a persistence implementation and the context or state...
MQTTPersistence_message * msg
void MQTTPersistence_insertInOrder(List *list, void *content, size_t size)
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_restoreMessageQueue(Clients *c)


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:09