MQTTClientPersistence_8h.html 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <meta name="generator" content="Doxygen 1.8.17"/>
  7. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  8. <title>MQTT C Client Libraries Internals: MQTTClientPersistence.h File Reference</title>
  9. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  10. <script type="text/javascript" src="jquery.js"></script>
  11. <script type="text/javascript" src="dynsections.js"></script>
  12. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  13. <script type="text/javascript" src="search/searchdata.js"></script>
  14. <script type="text/javascript" src="search/search.js"></script>
  15. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  19. <div id="titlearea">
  20. <table cellspacing="0" cellpadding="0">
  21. <tbody>
  22. <tr style="height: 56px;">
  23. <td id="projectlogo"><img alt="Logo" src="pahologo.png"/></td>
  24. <td id="projectalign" style="padding-left: 0.5em;">
  25. <div id="projectname">MQTT C Client Libraries Internals
  26. </div>
  27. </td>
  28. </tr>
  29. </tbody>
  30. </table>
  31. </div>
  32. <!-- end header part -->
  33. <!-- Generated by Doxygen 1.8.17 -->
  34. <script type="text/javascript">
  35. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  36. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  37. /* @license-end */
  38. </script>
  39. <script type="text/javascript" src="menudata.js"></script>
  40. <script type="text/javascript" src="menu.js"></script>
  41. <script type="text/javascript">
  42. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  43. $(function() {
  44. initMenu('',true,false,'search.php','Search');
  45. $(document).ready(function() { init_search(); });
  46. });
  47. /* @license-end */</script>
  48. <div id="main-nav"></div>
  49. <!-- window showing the filter options -->
  50. <div id="MSearchSelectWindow"
  51. onmouseover="return searchBox.OnSearchSelectShow()"
  52. onmouseout="return searchBox.OnSearchSelectHide()"
  53. onkeydown="return searchBox.OnSearchSelectKey(event)">
  54. </div>
  55. <!-- iframe showing the search results (closed by default) -->
  56. <div id="MSearchResultsWindow">
  57. <iframe src="javascript:void(0)" frameborder="0"
  58. name="MSearchResults" id="MSearchResults">
  59. </iframe>
  60. </div>
  61. </div><!-- top -->
  62. <div class="header">
  63. <div class="summary">
  64. <a href="#nested-classes">Data Structures</a> &#124;
  65. <a href="#define-members">Macros</a> &#124;
  66. <a href="#typedef-members">Typedefs</a> </div>
  67. <div class="headertitle">
  68. <div class="title">MQTTClientPersistence.h File Reference</div> </div>
  69. </div><!--header-->
  70. <div class="contents">
  71. <p>This structure represents a persistent data store, used to store outbound and inbound messages, in order to achieve reliable messaging.
  72. <a href="#details">More...</a></p>
  73. <div class="textblock"><div class="dynheader">
  74. This graph shows which files directly or indirectly include this file:</div>
  75. <div class="dyncontent">
  76. <div class="center"><img src="MQTTClientPersistence_8h__dep__incl.png" border="0" usemap="#MQTTClientPersistence_8hdep" alt=""/></div>
  77. <map name="MQTTClientPersistence_8hdep" id="MQTTClientPersistence_8hdep">
  78. <area shape="rect" title="This structure represents a persistent data store, used to store outbound and inbound messages,..." alt="" coords="9,5,180,32"/>
  79. <area shape="rect" href="MQTTPersistenceDefault_8c.html" title="A file system based persistence implementation." alt="" coords="5,80,184,107"/>
  80. </map>
  81. </div>
  82. </div><table class="memberdecls">
  83. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
  84. Data Structures</h2></td></tr>
  85. <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structMQTTClient__persistence.html">MQTTClient_persistence</a></td></tr>
  86. <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A structure containing the function pointers to a persistence implementation and the context or state that will be shared across all the persistence functions. <a href="structMQTTClient__persistence.html#details">More...</a><br /></td></tr>
  87. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  88. </table><table class="memberdecls">
  89. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
  90. Macros</h2></td></tr>
  91. <tr class="memitem:aaa948291718a9c06369b854b0f64bc32"><td class="memItemLeft" align="right" valign="top"><a id="aaa948291718a9c06369b854b0f64bc32"></a>
  92. #define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="MQTTClientPersistence_8h.html#aaa948291718a9c06369b854b0f64bc32">MQTTCLIENT_PERSISTENCE_DEFAULT</a>&#160;&#160;&#160;0</td></tr>
  93. <tr class="memdesc:aaa948291718a9c06369b854b0f64bc32"><td class="mdescLeft">&#160;</td><td class="mdescRight">This <em>persistence_type</em> value specifies the default file system-based persistence mechanism (see <a class="el" href="MQTTClient_8c.html#a9a0518d9ca924d12c1329dbe3de5f2b6" title="This function creates an MQTT client ready for connection to the specified server and using the speci...">MQTTClient_create()</a>). <br /></td></tr>
  94. <tr class="separator:aaa948291718a9c06369b854b0f64bc32"><td class="memSeparator" colspan="2">&#160;</td></tr>
  95. <tr class="memitem:ae01e089313a65ac4661ed216b6ac00fa"><td class="memItemLeft" align="right" valign="top"><a id="ae01e089313a65ac4661ed216b6ac00fa"></a>
  96. #define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="MQTTClientPersistence_8h.html#ae01e089313a65ac4661ed216b6ac00fa">MQTTCLIENT_PERSISTENCE_NONE</a>&#160;&#160;&#160;1</td></tr>
  97. <tr class="memdesc:ae01e089313a65ac4661ed216b6ac00fa"><td class="mdescLeft">&#160;</td><td class="mdescRight">This <em>persistence_type</em> value specifies a memory-based persistence mechanism (see <a class="el" href="MQTTClient_8c.html#a9a0518d9ca924d12c1329dbe3de5f2b6" title="This function creates an MQTT client ready for connection to the specified server and using the speci...">MQTTClient_create()</a>). <br /></td></tr>
  98. <tr class="separator:ae01e089313a65ac4661ed216b6ac00fa"><td class="memSeparator" colspan="2">&#160;</td></tr>
  99. <tr class="memitem:a5dc68b8616e4041e037bad94ce07681b"><td class="memItemLeft" align="right" valign="top"><a id="a5dc68b8616e4041e037bad94ce07681b"></a>
  100. #define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="MQTTClientPersistence_8h.html#a5dc68b8616e4041e037bad94ce07681b">MQTTCLIENT_PERSISTENCE_USER</a>&#160;&#160;&#160;2</td></tr>
  101. <tr class="memdesc:a5dc68b8616e4041e037bad94ce07681b"><td class="mdescLeft">&#160;</td><td class="mdescRight">This <em>persistence_type</em> value specifies an application-specific persistence mechanism (see <a class="el" href="MQTTClient_8c.html#a9a0518d9ca924d12c1329dbe3de5f2b6" title="This function creates an MQTT client ready for connection to the specified server and using the speci...">MQTTClient_create()</a>). <br /></td></tr>
  102. <tr class="separator:a5dc68b8616e4041e037bad94ce07681b"><td class="memSeparator" colspan="2">&#160;</td></tr>
  103. <tr class="memitem:ab716e21e53c84a5ad62aa962a2a8f7db"><td class="memItemLeft" align="right" valign="top"><a id="ab716e21e53c84a5ad62aa962a2a8f7db"></a>
  104. #define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="MQTTClientPersistence_8h.html#ab716e21e53c84a5ad62aa962a2a8f7db">MQTTCLIENT_PERSISTENCE_ERROR</a>&#160;&#160;&#160;-2</td></tr>
  105. <tr class="memdesc:ab716e21e53c84a5ad62aa962a2a8f7db"><td class="mdescLeft">&#160;</td><td class="mdescRight">Application-specific persistence functions must return this error code if there is a problem executing the function. <br /></td></tr>
  106. <tr class="separator:ab716e21e53c84a5ad62aa962a2a8f7db"><td class="memSeparator" colspan="2">&#160;</td></tr>
  107. </table><table class="memberdecls">
  108. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
  109. Typedefs</h2></td></tr>
  110. <tr class="memitem:a4c7d332bb16907058ae3b375488b6008"><td class="memItemLeft" align="right" valign="top">typedef int(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="MQTTClientPersistence_8h.html#a4c7d332bb16907058ae3b375488b6008">Persistence_open</a>) (void **handle, const char *clientID, const char *serverURI, void *context)</td></tr>
  111. <tr class="memdesc:a4c7d332bb16907058ae3b375488b6008"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the persistent store. <a href="MQTTClientPersistence_8h.html#a4c7d332bb16907058ae3b375488b6008">More...</a><br /></td></tr>
  112. <tr class="separator:a4c7d332bb16907058ae3b375488b6008"><td class="memSeparator" colspan="2">&#160;</td></tr>
  113. <tr class="memitem:a3582de2c87e89f617e8e553b2a0e279a"><td class="memItemLeft" align="right" valign="top">typedef int(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="MQTTClientPersistence_8h.html#a3582de2c87e89f617e8e553b2a0e279a">Persistence_close</a>) (void *handle)</td></tr>
  114. <tr class="memdesc:a3582de2c87e89f617e8e553b2a0e279a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Close the persistent store referred to by the handle. <a href="MQTTClientPersistence_8h.html#a3582de2c87e89f617e8e553b2a0e279a">More...</a><br /></td></tr>
  115. <tr class="separator:a3582de2c87e89f617e8e553b2a0e279a"><td class="memSeparator" colspan="2">&#160;</td></tr>
  116. <tr class="memitem:a44679cab77cfbd6e2a4639cdd27ac80c"><td class="memItemLeft" align="right" valign="top">typedef int(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="MQTTClientPersistence_8h.html#a44679cab77cfbd6e2a4639cdd27ac80c">Persistence_put</a>) (void *handle, char *key, int bufcount, char *buffers[], int buflens[])</td></tr>
  117. <tr class="memdesc:a44679cab77cfbd6e2a4639cdd27ac80c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Put the specified data into the persistent store. <a href="MQTTClientPersistence_8h.html#a44679cab77cfbd6e2a4639cdd27ac80c">More...</a><br /></td></tr>
  118. <tr class="separator:a44679cab77cfbd6e2a4639cdd27ac80c"><td class="memSeparator" colspan="2">&#160;</td></tr>
  119. <tr class="memitem:adc3aff3c570fa5509e9d6814a85ab867"><td class="memItemLeft" align="right" valign="top">typedef int(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="MQTTClientPersistence_8h.html#adc3aff3c570fa5509e9d6814a85ab867">Persistence_get</a>) (void *handle, char *key, char **buffer, int *buflen)</td></tr>
  120. <tr class="memdesc:adc3aff3c570fa5509e9d6814a85ab867"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieve the specified data from the persistent store. <a href="MQTTClientPersistence_8h.html#adc3aff3c570fa5509e9d6814a85ab867">More...</a><br /></td></tr>
  121. <tr class="separator:adc3aff3c570fa5509e9d6814a85ab867"><td class="memSeparator" colspan="2">&#160;</td></tr>
  122. <tr class="memitem:a73350bf7208658bf5434a59f7bdbae90"><td class="memItemLeft" align="right" valign="top">typedef int(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="MQTTClientPersistence_8h.html#a73350bf7208658bf5434a59f7bdbae90">Persistence_remove</a>) (void *handle, char *key)</td></tr>
  123. <tr class="memdesc:a73350bf7208658bf5434a59f7bdbae90"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove the data for the specified key from the store. <a href="MQTTClientPersistence_8h.html#a73350bf7208658bf5434a59f7bdbae90">More...</a><br /></td></tr>
  124. <tr class="separator:a73350bf7208658bf5434a59f7bdbae90"><td class="memSeparator" colspan="2">&#160;</td></tr>
  125. <tr class="memitem:a2601cc91eeabdbf9578f8dd45e4997a8"><td class="memItemLeft" align="right" valign="top">typedef int(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="MQTTClientPersistence_8h.html#a2601cc91eeabdbf9578f8dd45e4997a8">Persistence_keys</a>) (void *handle, char ***keys, int *nkeys)</td></tr>
  126. <tr class="memdesc:a2601cc91eeabdbf9578f8dd45e4997a8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the keys in this persistent data store. <a href="MQTTClientPersistence_8h.html#a2601cc91eeabdbf9578f8dd45e4997a8">More...</a><br /></td></tr>
  127. <tr class="separator:a2601cc91eeabdbf9578f8dd45e4997a8"><td class="memSeparator" colspan="2">&#160;</td></tr>
  128. <tr class="memitem:acee7097c1a0ab44b98c870f533687887"><td class="memItemLeft" align="right" valign="top">typedef int(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="MQTTClientPersistence_8h.html#acee7097c1a0ab44b98c870f533687887">Persistence_clear</a>) (void *handle)</td></tr>
  129. <tr class="memdesc:acee7097c1a0ab44b98c870f533687887"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clears the persistence store, so that it no longer contains any persisted data. <a href="MQTTClientPersistence_8h.html#acee7097c1a0ab44b98c870f533687887">More...</a><br /></td></tr>
  130. <tr class="separator:acee7097c1a0ab44b98c870f533687887"><td class="memSeparator" colspan="2">&#160;</td></tr>
  131. <tr class="memitem:a753a0f9a9c51284d63a907af19c7bbba"><td class="memItemLeft" align="right" valign="top">typedef int(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="MQTTClientPersistence_8h.html#a753a0f9a9c51284d63a907af19c7bbba">Persistence_containskey</a>) (void *handle, char *key)</td></tr>
  132. <tr class="memdesc:a753a0f9a9c51284d63a907af19c7bbba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns whether any data has been persisted using the specified key. <a href="MQTTClientPersistence_8h.html#a753a0f9a9c51284d63a907af19c7bbba">More...</a><br /></td></tr>
  133. <tr class="separator:a753a0f9a9c51284d63a907af19c7bbba"><td class="memSeparator" colspan="2">&#160;</td></tr>
  134. <tr class="memitem:ab865640a1cc53b68622004c5a2d29fae"><td class="memItemLeft" align="right" valign="top">typedef int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="MQTTClientPersistence_8h.html#ab865640a1cc53b68622004c5a2d29fae">MQTTPersistence_beforeWrite</a>(void *context, int bufcount, char *buffers[], int buflens[])</td></tr>
  135. <tr class="memdesc:ab865640a1cc53b68622004c5a2d29fae"><td class="mdescLeft">&#160;</td><td class="mdescRight">A callback which is invoked just before a write to persistence. <a href="MQTTClientPersistence_8h.html#ab865640a1cc53b68622004c5a2d29fae">More...</a><br /></td></tr>
  136. <tr class="separator:ab865640a1cc53b68622004c5a2d29fae"><td class="memSeparator" colspan="2">&#160;</td></tr>
  137. <tr class="memitem:af5a966a574c6ad7a35f1ebb7edd5c1c4"><td class="memItemLeft" align="right" valign="top">typedef int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="MQTTClientPersistence_8h.html#af5a966a574c6ad7a35f1ebb7edd5c1c4">MQTTPersistence_afterRead</a>(void *context, char **buffer, int *buflen)</td></tr>
  138. <tr class="memdesc:af5a966a574c6ad7a35f1ebb7edd5c1c4"><td class="mdescLeft">&#160;</td><td class="mdescRight">A callback which is invoked just after a read from persistence. <a href="MQTTClientPersistence_8h.html#af5a966a574c6ad7a35f1ebb7edd5c1c4">More...</a><br /></td></tr>
  139. <tr class="separator:af5a966a574c6ad7a35f1ebb7edd5c1c4"><td class="memSeparator" colspan="2">&#160;</td></tr>
  140. </table>
  141. <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
  142. <div class="textblock"><p>This structure represents a persistent data store, used to store outbound and inbound messages, in order to achieve reliable messaging. </p>
  143. <p>The MQTT Client persists QoS1 and QoS2 messages in order to meet the assurances of delivery associated with these qos levels. The messages are saved in persistent storage The type and context of the persistence implementation are specified when the MQTT client is created (see <a class="el" href="MQTTClient_8c.html#a9a0518d9ca924d12c1329dbe3de5f2b6" title="This function creates an MQTT client ready for connection to the specified server and using the speci...">MQTTClient_create()</a>). The default persistence type (<a class="el" href="MQTTClientPersistence_8h.html#aaa948291718a9c06369b854b0f64bc32" title="This persistence_type value specifies the default file system-based persistence mechanism (see MQTTCl...">MQTTCLIENT_PERSISTENCE_DEFAULT</a>) uses a file system-based persistence mechanism. The <em>persistence_context</em> argument passed to <a class="el" href="MQTTClient_8c.html#a9a0518d9ca924d12c1329dbe3de5f2b6" title="This function creates an MQTT client ready for connection to the specified server and using the speci...">MQTTClient_create()</a> when using the default peristence is a string representing the location of the persistence directory. If the context argument is NULL, the working directory will be used.</p>
  144. <p>To use memory-based persistence, an application passes <a class="el" href="MQTTClientPersistence_8h.html#ae01e089313a65ac4661ed216b6ac00fa" title="This persistence_type value specifies a memory-based persistence mechanism (see MQTTClient_create()).">MQTTCLIENT_PERSISTENCE_NONE</a> as the <em>persistence_type</em> to <a class="el" href="MQTTClient_8c.html#a9a0518d9ca924d12c1329dbe3de5f2b6" title="This function creates an MQTT client ready for connection to the specified server and using the speci...">MQTTClient_create()</a>. This can lead to message loss in certain situations, but can be appropriate in some cases (see qos).</p>
  145. <p>Client applications can provide their own persistence mechanism by passing <a class="el" href="MQTTClientPersistence_8h.html#a5dc68b8616e4041e037bad94ce07681b" title="This persistence_type value specifies an application-specific persistence mechanism (see MQTTClient_c...">MQTTCLIENT_PERSISTENCE_USER</a> as the <em>persistence_type</em>. To implement a custom persistence mechanism, the application must pass an initialized <a class="el" href="structMQTTClient__persistence.html" title="A structure containing the function pointers to a persistence implementation and the context or state...">MQTTClient_persistence</a> structure as the <em>persistence_context</em> argument to <a class="el" href="MQTTClient_8c.html#a9a0518d9ca924d12c1329dbe3de5f2b6" title="This function creates an MQTT client ready for connection to the specified server and using the speci...">MQTTClient_create()</a>.</p>
  146. <p>If the functions defined return an <a class="el" href="MQTTClientPersistence_8h.html#ab716e21e53c84a5ad62aa962a2a8f7db" title="Application-specific persistence functions must return this error code if there is a problem executin...">MQTTCLIENT_PERSISTENCE_ERROR</a> then the state of the persisted data should remain as it was prior to the function being called. For example, if <a class="el" href="MQTTClientPersistence_8h.html#a44679cab77cfbd6e2a4639cdd27ac80c" title="Put the specified data into the persistent store.">Persistence_put()</a> returns <a class="el" href="MQTTClientPersistence_8h.html#ab716e21e53c84a5ad62aa962a2a8f7db" title="Application-specific persistence functions must return this error code if there is a problem executin...">MQTTCLIENT_PERSISTENCE_ERROR</a>, then it is assumed tha tthe persistent store does not contain the data that was passed to the function. Similarly, if <a class="el" href="MQTTClientPersistence_8h.html#a73350bf7208658bf5434a59f7bdbae90" title="Remove the data for the specified key from the store.">Persistence_remove()</a> returns <a class="el" href="MQTTClientPersistence_8h.html#ab716e21e53c84a5ad62aa962a2a8f7db" title="Application-specific persistence functions must return this error code if there is a problem executin...">MQTTCLIENT_PERSISTENCE_ERROR</a> then it is assumed that the data to be removed is still held in the persistent store.</p>
  147. <p>It is up to the persistence implementation to log any error information that may be required to diagnose a persistence mechanism failure. </p>
  148. </div><h2 class="groupheader">Typedef Documentation</h2>
  149. <a id="af5a966a574c6ad7a35f1ebb7edd5c1c4"></a>
  150. <h2 class="memtitle"><span class="permalink"><a href="#af5a966a574c6ad7a35f1ebb7edd5c1c4">&#9670;&nbsp;</a></span>MQTTPersistence_afterRead</h2>
  151. <div class="memitem">
  152. <div class="memproto">
  153. <table class="memname">
  154. <tr>
  155. <td class="memname">typedef int MQTTPersistence_afterRead(void *context, char **buffer, int *buflen)</td>
  156. </tr>
  157. </table>
  158. </div><div class="memdoc">
  159. <p>A callback which is invoked just after a read from persistence. </p>
  160. <p>This can be used to transform the data, for instance to decrypt it. </p><dl class="params"><dt>Parameters</dt><dd>
  161. <table class="params">
  162. <tr><td class="paramname">context</td><td>The context as set in ::MQTTAsync_setAfterPersistenceRead </td></tr>
  163. <tr><td class="paramname">buffer</td><td>The address of a pointer to a buffer. </td></tr>
  164. <tr><td class="paramname">buflen</td><td>The address of an int that is the length of the buffer. </td></tr>
  165. </table>
  166. </dd>
  167. </dl>
  168. <dl class="section return"><dt>Returns</dt><dd>Return 0 if the function completes successfully, otherwise non 0. </dd></dl>
  169. </div>
  170. </div>
  171. <a id="ab865640a1cc53b68622004c5a2d29fae"></a>
  172. <h2 class="memtitle"><span class="permalink"><a href="#ab865640a1cc53b68622004c5a2d29fae">&#9670;&nbsp;</a></span>MQTTPersistence_beforeWrite</h2>
  173. <div class="memitem">
  174. <div class="memproto">
  175. <table class="memname">
  176. <tr>
  177. <td class="memname">typedef int MQTTPersistence_beforeWrite(void *context, int bufcount, char *buffers[], int buflens[])</td>
  178. </tr>
  179. </table>
  180. </div><div class="memdoc">
  181. <p>A callback which is invoked just before a write to persistence. </p>
  182. <p>This can be used to transform the data, for instance to encrypt it. </p><dl class="params"><dt>Parameters</dt><dd>
  183. <table class="params">
  184. <tr><td class="paramname">context</td><td>The context as set in ::MQTTAsync_setBeforePersistenceWrite </td></tr>
  185. <tr><td class="paramname">bufcount</td><td>The number of buffers to write to the persistence store. </td></tr>
  186. <tr><td class="paramname">buffers</td><td>An array of pointers to the data buffers. </td></tr>
  187. <tr><td class="paramname">buflens</td><td>An array of lengths of the data buffers. </td></tr>
  188. </table>
  189. </dd>
  190. </dl>
  191. <dl class="section return"><dt>Returns</dt><dd>Return 0 if the function completes successfully, otherwise non 0. </dd></dl>
  192. </div>
  193. </div>
  194. <a id="acee7097c1a0ab44b98c870f533687887"></a>
  195. <h2 class="memtitle"><span class="permalink"><a href="#acee7097c1a0ab44b98c870f533687887">&#9670;&nbsp;</a></span>Persistence_clear</h2>
  196. <div class="memitem">
  197. <div class="memproto">
  198. <table class="memname">
  199. <tr>
  200. <td class="memname">typedef int(* Persistence_clear) (void *handle)</td>
  201. </tr>
  202. </table>
  203. </div><div class="memdoc">
  204. <p>Clears the persistence store, so that it no longer contains any persisted data. </p>
  205. <dl class="params"><dt>Parameters</dt><dd>
  206. <table class="params">
  207. <tr><td class="paramname">handle</td><td>The handle pointer from a successful call to <a class="el" href="MQTTClientPersistence_8h.html#a4c7d332bb16907058ae3b375488b6008" title="Initialize the persistent store.">Persistence_open()</a>. </td></tr>
  208. </table>
  209. </dd>
  210. </dl>
  211. <dl class="section return"><dt>Returns</dt><dd>Return 0 if the function completes successfully, otherwise return <a class="el" href="MQTTClientPersistence_8h.html#ab716e21e53c84a5ad62aa962a2a8f7db" title="Application-specific persistence functions must return this error code if there is a problem executin...">MQTTCLIENT_PERSISTENCE_ERROR</a>. </dd></dl>
  212. </div>
  213. </div>
  214. <a id="a3582de2c87e89f617e8e553b2a0e279a"></a>
  215. <h2 class="memtitle"><span class="permalink"><a href="#a3582de2c87e89f617e8e553b2a0e279a">&#9670;&nbsp;</a></span>Persistence_close</h2>
  216. <div class="memitem">
  217. <div class="memproto">
  218. <table class="memname">
  219. <tr>
  220. <td class="memname">typedef int(* Persistence_close) (void *handle)</td>
  221. </tr>
  222. </table>
  223. </div><div class="memdoc">
  224. <p>Close the persistent store referred to by the handle. </p>
  225. <dl class="params"><dt>Parameters</dt><dd>
  226. <table class="params">
  227. <tr><td class="paramname">handle</td><td>The handle pointer from a successful call to <a class="el" href="MQTTClientPersistence_8h.html#a4c7d332bb16907058ae3b375488b6008" title="Initialize the persistent store.">Persistence_open()</a>. </td></tr>
  228. </table>
  229. </dd>
  230. </dl>
  231. <dl class="section return"><dt>Returns</dt><dd>Return 0 if the function completes successfully, otherwise return <a class="el" href="MQTTClientPersistence_8h.html#ab716e21e53c84a5ad62aa962a2a8f7db" title="Application-specific persistence functions must return this error code if there is a problem executin...">MQTTCLIENT_PERSISTENCE_ERROR</a>. </dd></dl>
  232. </div>
  233. </div>
  234. <a id="a753a0f9a9c51284d63a907af19c7bbba"></a>
  235. <h2 class="memtitle"><span class="permalink"><a href="#a753a0f9a9c51284d63a907af19c7bbba">&#9670;&nbsp;</a></span>Persistence_containskey</h2>
  236. <div class="memitem">
  237. <div class="memproto">
  238. <table class="memname">
  239. <tr>
  240. <td class="memname">typedef int(* Persistence_containskey) (void *handle, char *key)</td>
  241. </tr>
  242. </table>
  243. </div><div class="memdoc">
  244. <p>Returns whether any data has been persisted using the specified key. </p>
  245. <dl class="params"><dt>Parameters</dt><dd>
  246. <table class="params">
  247. <tr><td class="paramname">handle</td><td>The handle pointer from a successful call to <a class="el" href="MQTTClientPersistence_8h.html#a4c7d332bb16907058ae3b375488b6008" title="Initialize the persistent store.">Persistence_open()</a>. </td></tr>
  248. <tr><td class="paramname">key</td><td>The string to be tested for existence in the store. </td></tr>
  249. </table>
  250. </dd>
  251. </dl>
  252. <dl class="section return"><dt>Returns</dt><dd>Return 0 if the key was found in the store, otherwise return <a class="el" href="MQTTClientPersistence_8h.html#ab716e21e53c84a5ad62aa962a2a8f7db" title="Application-specific persistence functions must return this error code if there is a problem executin...">MQTTCLIENT_PERSISTENCE_ERROR</a>. </dd></dl>
  253. </div>
  254. </div>
  255. <a id="adc3aff3c570fa5509e9d6814a85ab867"></a>
  256. <h2 class="memtitle"><span class="permalink"><a href="#adc3aff3c570fa5509e9d6814a85ab867">&#9670;&nbsp;</a></span>Persistence_get</h2>
  257. <div class="memitem">
  258. <div class="memproto">
  259. <table class="memname">
  260. <tr>
  261. <td class="memname">typedef int(* Persistence_get) (void *handle, char *key, char **buffer, int *buflen)</td>
  262. </tr>
  263. </table>
  264. </div><div class="memdoc">
  265. <p>Retrieve the specified data from the persistent store. </p>
  266. <dl class="params"><dt>Parameters</dt><dd>
  267. <table class="params">
  268. <tr><td class="paramname">handle</td><td>The handle pointer from a successful call to <a class="el" href="MQTTClientPersistence_8h.html#a4c7d332bb16907058ae3b375488b6008" title="Initialize the persistent store.">Persistence_open()</a>. </td></tr>
  269. <tr><td class="paramname">key</td><td>A string that is the key for the data to be retrieved. This is the same key used to save the data to the store with <a class="el" href="MQTTClientPersistence_8h.html#a44679cab77cfbd6e2a4639cdd27ac80c" title="Put the specified data into the persistent store.">Persistence_put()</a>. </td></tr>
  270. <tr><td class="paramname">buffer</td><td>The address of a pointer to a buffer. This function sets the pointer to point at the retrieved data, if successful. </td></tr>
  271. <tr><td class="paramname">buflen</td><td>The address of an int that is set to the length of <em>buffer</em> by this function if successful. </td></tr>
  272. </table>
  273. </dd>
  274. </dl>
  275. <dl class="section return"><dt>Returns</dt><dd>Return 0 if the function completes successfully, otherwise return <a class="el" href="MQTTClientPersistence_8h.html#ab716e21e53c84a5ad62aa962a2a8f7db" title="Application-specific persistence functions must return this error code if there is a problem executin...">MQTTCLIENT_PERSISTENCE_ERROR</a>. </dd></dl>
  276. </div>
  277. </div>
  278. <a id="a2601cc91eeabdbf9578f8dd45e4997a8"></a>
  279. <h2 class="memtitle"><span class="permalink"><a href="#a2601cc91eeabdbf9578f8dd45e4997a8">&#9670;&nbsp;</a></span>Persistence_keys</h2>
  280. <div class="memitem">
  281. <div class="memproto">
  282. <table class="memname">
  283. <tr>
  284. <td class="memname">typedef int(* Persistence_keys) (void *handle, char ***keys, int *nkeys)</td>
  285. </tr>
  286. </table>
  287. </div><div class="memdoc">
  288. <p>Returns the keys in this persistent data store. </p>
  289. <dl class="params"><dt>Parameters</dt><dd>
  290. <table class="params">
  291. <tr><td class="paramname">handle</td><td>The handle pointer from a successful call to <a class="el" href="MQTTClientPersistence_8h.html#a4c7d332bb16907058ae3b375488b6008" title="Initialize the persistent store.">Persistence_open()</a>. </td></tr>
  292. <tr><td class="paramname">keys</td><td>The address of a pointer to pointers to strings. Assuming successful execution, this function allocates memory to hold the returned keys (strings used to store the data with <a class="el" href="MQTTClientPersistence_8h.html#a44679cab77cfbd6e2a4639cdd27ac80c" title="Put the specified data into the persistent store.">Persistence_put()</a>). It also allocates memory to hold an array of pointers to these strings. <em>keys</em> is set to point to the array of pointers to strings. </td></tr>
  293. <tr><td class="paramname">nkeys</td><td>A pointer to the number of keys in this persistent data store. This function sets the number of keys, if successful. </td></tr>
  294. </table>
  295. </dd>
  296. </dl>
  297. <dl class="section return"><dt>Returns</dt><dd>Return 0 if the function completes successfully, otherwise return <a class="el" href="MQTTClientPersistence_8h.html#ab716e21e53c84a5ad62aa962a2a8f7db" title="Application-specific persistence functions must return this error code if there is a problem executin...">MQTTCLIENT_PERSISTENCE_ERROR</a>. </dd></dl>
  298. </div>
  299. </div>
  300. <a id="a4c7d332bb16907058ae3b375488b6008"></a>
  301. <h2 class="memtitle"><span class="permalink"><a href="#a4c7d332bb16907058ae3b375488b6008">&#9670;&nbsp;</a></span>Persistence_open</h2>
  302. <div class="memitem">
  303. <div class="memproto">
  304. <table class="memname">
  305. <tr>
  306. <td class="memname">typedef int(* Persistence_open) (void **handle, const char *clientID, const char *serverURI, void *context)</td>
  307. </tr>
  308. </table>
  309. </div><div class="memdoc">
  310. <p>Initialize the persistent store. </p>
  311. <p>Either open the existing persistent store for this client ID or create a new one if one doesn't exist. If the persistent store is already open, return without taking any action.</p>
  312. <p>An application can use the same client identifier to connect to many different servers. The <em>clientid</em> in conjunction with the <em>serverURI</em> uniquely identifies the persistence store required.</p>
  313. <dl class="params"><dt>Parameters</dt><dd>
  314. <table class="params">
  315. <tr><td class="paramname">handle</td><td>The address of a pointer to a handle for this persistence implementation. This function must set handle to a valid reference to the persistence following a successful return. The handle pointer is passed as an argument to all the other persistence functions. It may include the context parameter and/or any other data for use by the persistence functions. </td></tr>
  316. <tr><td class="paramname">clientID</td><td>The client identifier for which the persistent store should be opened. </td></tr>
  317. <tr><td class="paramname">serverURI</td><td>The connection string specified when the MQTT client was created (see <a class="el" href="MQTTClient_8c.html#a9a0518d9ca924d12c1329dbe3de5f2b6" title="This function creates an MQTT client ready for connection to the specified server and using the speci...">MQTTClient_create()</a>). </td></tr>
  318. <tr><td class="paramname">context</td><td>A pointer to any data required to initialize the persistent store (see <a class="el" href="structMQTTClient__persistence.html" title="A structure containing the function pointers to a persistence implementation and the context or state...">MQTTClient_persistence</a>). </td></tr>
  319. </table>
  320. </dd>
  321. </dl>
  322. <dl class="section return"><dt>Returns</dt><dd>Return 0 if the function completes successfully, otherwise return <a class="el" href="MQTTClientPersistence_8h.html#ab716e21e53c84a5ad62aa962a2a8f7db" title="Application-specific persistence functions must return this error code if there is a problem executin...">MQTTCLIENT_PERSISTENCE_ERROR</a>. </dd></dl>
  323. </div>
  324. </div>
  325. <a id="a44679cab77cfbd6e2a4639cdd27ac80c"></a>
  326. <h2 class="memtitle"><span class="permalink"><a href="#a44679cab77cfbd6e2a4639cdd27ac80c">&#9670;&nbsp;</a></span>Persistence_put</h2>
  327. <div class="memitem">
  328. <div class="memproto">
  329. <table class="memname">
  330. <tr>
  331. <td class="memname">typedef int(* Persistence_put) (void *handle, char *key, int bufcount, char *buffers[], int buflens[])</td>
  332. </tr>
  333. </table>
  334. </div><div class="memdoc">
  335. <p>Put the specified data into the persistent store. </p>
  336. <dl class="params"><dt>Parameters</dt><dd>
  337. <table class="params">
  338. <tr><td class="paramname">handle</td><td>The handle pointer from a successful call to <a class="el" href="MQTTClientPersistence_8h.html#a4c7d332bb16907058ae3b375488b6008" title="Initialize the persistent store.">Persistence_open()</a>. </td></tr>
  339. <tr><td class="paramname">key</td><td>A string used as the key for the data to be put in the store. The key is later used to retrieve data from the store with <a class="el" href="MQTTClientPersistence_8h.html#adc3aff3c570fa5509e9d6814a85ab867" title="Retrieve the specified data from the persistent store.">Persistence_get()</a>. </td></tr>
  340. <tr><td class="paramname">bufcount</td><td>The number of buffers to write to the persistence store. </td></tr>
  341. <tr><td class="paramname">buffers</td><td>An array of pointers to the data buffers associated with this <em>key</em>. </td></tr>
  342. <tr><td class="paramname">buflens</td><td>An array of lengths of the data buffers. <em>buflen[n]</em> gives the length of <em>buffer[n]</em>. </td></tr>
  343. </table>
  344. </dd>
  345. </dl>
  346. <dl class="section return"><dt>Returns</dt><dd>Return 0 if the function completes successfully, otherwise return <a class="el" href="MQTTClientPersistence_8h.html#ab716e21e53c84a5ad62aa962a2a8f7db" title="Application-specific persistence functions must return this error code if there is a problem executin...">MQTTCLIENT_PERSISTENCE_ERROR</a>. </dd></dl>
  347. </div>
  348. </div>
  349. <a id="a73350bf7208658bf5434a59f7bdbae90"></a>
  350. <h2 class="memtitle"><span class="permalink"><a href="#a73350bf7208658bf5434a59f7bdbae90">&#9670;&nbsp;</a></span>Persistence_remove</h2>
  351. <div class="memitem">
  352. <div class="memproto">
  353. <table class="memname">
  354. <tr>
  355. <td class="memname">typedef int(* Persistence_remove) (void *handle, char *key)</td>
  356. </tr>
  357. </table>
  358. </div><div class="memdoc">
  359. <p>Remove the data for the specified key from the store. </p>
  360. <dl class="params"><dt>Parameters</dt><dd>
  361. <table class="params">
  362. <tr><td class="paramname">handle</td><td>The handle pointer from a successful call to <a class="el" href="MQTTClientPersistence_8h.html#a4c7d332bb16907058ae3b375488b6008" title="Initialize the persistent store.">Persistence_open()</a>. </td></tr>
  363. <tr><td class="paramname">key</td><td>A string that is the key for the data to be removed from the store. This is the same key used to save the data to the store with <a class="el" href="MQTTClientPersistence_8h.html#a44679cab77cfbd6e2a4639cdd27ac80c" title="Put the specified data into the persistent store.">Persistence_put()</a>. </td></tr>
  364. </table>
  365. </dd>
  366. </dl>
  367. <dl class="section return"><dt>Returns</dt><dd>Return 0 if the function completes successfully, otherwise return <a class="el" href="MQTTClientPersistence_8h.html#ab716e21e53c84a5ad62aa962a2a8f7db" title="Application-specific persistence functions must return this error code if there is a problem executin...">MQTTCLIENT_PERSISTENCE_ERROR</a>. </dd></dl>
  368. </div>
  369. </div>
  370. </div><!-- contents -->
  371. <!-- start footer part -->
  372. <hr class="footer"/><address class="footer"><small>
  373. Generated on Thu Sep 29 2022 11:34:46 for MQTT C Client Libraries Internals by &#160;<a href="http://www.doxygen.org/index.html">
  374. <img class="footer" src="doxygen.png" alt="doxygen"/>
  375. </a> 1.8.17
  376. </small></address>
  377. </body>
  378. </html>