forked from LiamBindle/MQTT-C
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mqtt_8h_source.html
117 lines (117 loc) · 89.5 KB
/
mqtt_8h_source.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MQTT-C: include/mqtt.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">MQTT-C
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">mqtt.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="mqtt_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="preprocessor">#ifndef __MQTT_H__</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="preprocessor">#define __MQTT_H__</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> </div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">/*</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">MIT License</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"></span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment">Copyright(c) 2018 Liam Bindle</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"></span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment">Permission is hereby granted, free of charge, to any person obtaining a copy</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">of this software and associated documentation files(the "Software"), to deal</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">in the Software without restriction, including without limitation the rights</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">to use, copy, modify, merge, publish, distribute, sublicense, and/or sell</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">copies of the Software, and to permit persons to whom the Software is</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">furnished to do so, subject to the following conditions :</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"></span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment">The above copyright notice and this permission notice shall be included in all</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment">copies or substantial portions of the Software.</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"></span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment">THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment">IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment">FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment">AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="comment">LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="comment">OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="comment">SOFTWARE.</span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="comment">*/</span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> </div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include <<a class="code" href="mqtt__pal_8h.html">mqtt_pal.h</a>></span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> </div><div class="line"><a name="l00115"></a><span class="lineno"><a class="line" href="group__unpackers.html#gacbd36b88ec7f62bc161b07e1a0aed679"> 115</a></span>  <span class="keyword">enum</span> <a class="code" href="group__unpackers.html#gacbd36b88ec7f62bc161b07e1a0aed679">MQTTControlPacketType</a> {</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  MQTT_CONTROL_CONNECT=1u,</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  MQTT_CONTROL_CONNACK=2u,</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  MQTT_CONTROL_PUBLISH=3u,</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  MQTT_CONTROL_PUBACK=4u,</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  MQTT_CONTROL_PUBREC=5u,</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  MQTT_CONTROL_PUBREL=6u,</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  MQTT_CONTROL_PUBCOMP=7u,</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  MQTT_CONTROL_SUBSCRIBE=8u,</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  MQTT_CONTROL_SUBACK=9u,</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  MQTT_CONTROL_UNSUBSCRIBE=10u,</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  MQTT_CONTROL_UNSUBACK=11u,</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  MQTT_CONTROL_PINGREQ=12u,</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  MQTT_CONTROL_PINGRESP=13u,</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  MQTT_CONTROL_DISCONNECT=14u</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span> };</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span> </div><div class="line"><a name="l00140"></a><span class="lineno"><a class="line" href="structmqtt__fixed__header.html"> 140</a></span> <span class="keyword">struct </span><a class="code" href="structmqtt__fixed__header.html">mqtt_fixed_header</a> {</div><div class="line"><a name="l00142"></a><span class="lineno"><a class="line" href="structmqtt__fixed__header.html#a9bdea10facdc20756c457f282d58cfa1"> 142</a></span>  <span class="keyword">enum</span> <a class="code" href="group__unpackers.html#gacbd36b88ec7f62bc161b07e1a0aed679">MQTTControlPacketType</a> <a class="code" href="structmqtt__fixed__header.html#a9bdea10facdc20756c457f282d58cfa1">control_type</a>;</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span> </div><div class="line"><a name="l00145"></a><span class="lineno"><a class="line" href="structmqtt__fixed__header.html#adee2e745059e4438cf74231191391ab1"> 145</a></span>  uint32_t <a class="code" href="structmqtt__fixed__header.html#adee2e745059e4438cf74231191391ab1">control_flags</a>: 4;</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span> </div><div class="line"><a name="l00148"></a><span class="lineno"><a class="line" href="structmqtt__fixed__header.html#ac01e888a49b83e3d34ca14f140b72d7a"> 148</a></span>  uint32_t <a class="code" href="structmqtt__fixed__header.html#ac01e888a49b83e3d34ca14f140b72d7a">remaining_length</a>;</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span> };</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span> </div><div class="line"><a name="l00159"></a><span class="lineno"><a class="line" href="group__packers.html#ga50781ed232e8fd19a071d07566579974"> 159</a></span> <span class="preprocessor">#define MQTT_PROTOCOL_LEVEL 0x04</span></div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span> </div><div class="line"><a name="l00165"></a><span class="lineno"><a class="line" href="mqtt_8h.html#a86c09e2666bd14722fa165ed904f78cb"> 165</a></span> <span class="preprocessor">#define __ALL_MQTT_ERRORS(MQTT_ERROR) \</span></div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_NULLPTR) \</span></div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_CONTROL_FORBIDDEN_TYPE) \</span></div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_CONTROL_INVALID_FLAGS) \</span></div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_CONTROL_WRONG_TYPE) \</span></div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_CONNECT_NULL_CLIENT_ID) \</span></div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_CONNECT_NULL_WILL_MESSAGE) \</span></div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_CONNECT_FORBIDDEN_WILL_QOS) \</span></div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_CONNACK_FORBIDDEN_FLAGS) \</span></div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_CONNACK_FORBIDDEN_CODE) \</span></div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_PUBLISH_FORBIDDEN_QOS) \</span></div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_SUBSCRIBE_TOO_MANY_TOPICS) \</span></div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_MALFORMED_RESPONSE) \</span></div><div class="line"><a name="l00178"></a><span class="lineno"> 178</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_UNSUBSCRIBE_TOO_MANY_TOPICS) \</span></div><div class="line"><a name="l00179"></a><span class="lineno"> 179</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_RESPONSE_INVALID_CONTROL_TYPE) \</span></div><div class="line"><a name="l00180"></a><span class="lineno"> 180</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_CONNECT_NOT_CALLED) \</span></div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_SEND_BUFFER_IS_FULL) \</span></div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_SOCKET_ERROR) \</span></div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_MALFORMED_REQUEST) \</span></div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_RECV_BUFFER_TOO_SMALL) \</span></div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_ACK_OF_UNKNOWN) \</span></div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_NOT_IMPLEMENTED) \</span></div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_CONNECTION_REFUSED) \</span></div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_SUBSCRIBE_FAILED) \</span></div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_CONNECTION_CLOSED) \</span></div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_INITIAL_RECONNECT) \</span></div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span> <span class="preprocessor"> MQTT_ERROR(MQTT_ERROR_INVALID_REMAINING_LENGTH)</span></div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span> </div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span> <span class="comment">/* todo: add more connection refused errors */</span></div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span> </div><div class="line"><a name="l00200"></a><span class="lineno"><a class="line" href="mqtt_8h.html#aed8760364c7992625d06c93d12b2496d"> 200</a></span> <span class="preprocessor">#define GENERATE_ENUM(ENUM) ENUM,</span></div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span> </div><div class="line"><a name="l00207"></a><span class="lineno"><a class="line" href="mqtt_8h.html#adf58d994c35f18ec84b628d8321f52e5"> 207</a></span> <span class="preprocessor">#define GENERATE_STRING(STRING) #STRING,</span></div><div class="line"><a name="l00208"></a><span class="lineno"> 208</span> </div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span> </div><div class="line"><a name="l00216"></a><span class="lineno"><a class="line" href="group__api.html#gad0c901a8d30691ed0ca17915b691b7e7"> 216</a></span> <span class="keyword">enum</span> <a class="code" href="group__api.html#gad0c901a8d30691ed0ca17915b691b7e7">MQTTErrors</a> {</div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  MQTT_ERROR_UNKNOWN=INT_MIN,</div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  <a class="code" href="mqtt_8h.html#a86c09e2666bd14722fa165ed904f78cb">__ALL_MQTT_ERRORS</a>(<a class="code" href="mqtt_8h.html#aed8760364c7992625d06c93d12b2496d">GENERATE_ENUM</a>)</div><div class="line"><a name="l00219"></a><span class="lineno"> 219</span>  MQTT_OK = 1</div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span> };</div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span> </div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="group__api.html#ga47b62bdd24e8b05957825d2419d7c848">mqtt_error_str</a>(<span class="keyword">enum</span> <a class="code" href="group__api.html#gad0c901a8d30691ed0ca17915b691b7e7">MQTTErrors</a> error);</div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span> </div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span> ssize_t <a class="code" href="mqtt_8h.html#a3968f3df67a7ded8f3e21faad10139c9">__mqtt_pack_uint16</a>(uint8_t *buf, uint16_t integer);</div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span> </div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span> uint16_t <a class="code" href="mqtt_8h.html#a053442c47812d3a3ef1b9525a2520c78">__mqtt_unpack_uint16</a>(<span class="keyword">const</span> uint8_t *buf);</div><div class="line"><a name="l00254"></a><span class="lineno"> 254</span> </div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span> ssize_t <a class="code" href="mqtt_8h.html#a223d30d2e6b84824ed995eda885d1e5d">__mqtt_pack_str</a>(uint8_t *buf, <span class="keyword">const</span> <span class="keywordtype">char</span>* str);</div><div class="line"><a name="l00266"></a><span class="lineno"> 266</span> </div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span> <span class="preprocessor">#define __mqtt_packed_cstrlen(x) (2 + strlen(x))</span></div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span> </div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span> <span class="comment">/* RESPONSES */</span></div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span> </div><div class="line"><a name="l00280"></a><span class="lineno"> 280</span> <span class="keyword">enum</span> <a class="code" href="group__unpackers.html#ga07e480dfa5738e60c54ad0447ddb1a25">MQTTConnackReturnCode</a> {</div><div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  MQTT_CONNACK_ACCEPTED = 0u,</div><div class="line"><a name="l00282"></a><span class="lineno"> 282</span>  MQTT_CONNACK_REFUSED_PROTOCOL_VERSION = 1u,</div><div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  MQTT_CONNACK_REFUSED_IDENTIFIER_REJECTED = 2u,</div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  MQTT_CONNACK_REFUSED_SERVER_UNAVAILABLE = 3u,</div><div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  MQTT_CONNACK_REFUSED_BAD_USER_NAME_OR_PASSWORD = 4u,</div><div class="line"><a name="l00286"></a><span class="lineno"> 286</span>  MQTT_CONNACK_REFUSED_NOT_AUTHORIZED = 5u</div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span> };</div><div class="line"><a name="l00288"></a><span class="lineno"> 288</span> </div><div class="line"><a name="l00297"></a><span class="lineno"> 297</span> <span class="keyword">struct </span><a class="code" href="structmqtt__response__connack.html">mqtt_response_connack</a> {</div><div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  uint8_t session_present_flag;</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span> </div><div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  <span class="keyword">enum</span> <a class="code" href="group__unpackers.html#ga07e480dfa5738e60c54ad0447ddb1a25">MQTTConnackReturnCode</a> return_code;</div><div class="line"><a name="l00310"></a><span class="lineno"> 310</span> };</div><div class="line"><a name="l00311"></a><span class="lineno"> 311</span> </div><div class="line"><a name="l00323"></a><span class="lineno"> 323</span> <span class="keyword">struct </span><a class="code" href="structmqtt__response__publish.html">mqtt_response_publish</a> {</div><div class="line"><a name="l00328"></a><span class="lineno"> 328</span>  uint8_t dup_flag;</div><div class="line"><a name="l00329"></a><span class="lineno"> 329</span> </div><div class="line"><a name="l00337"></a><span class="lineno"> 337</span>  uint8_t qos_level;</div><div class="line"><a name="l00338"></a><span class="lineno"> 338</span> </div><div class="line"><a name="l00340"></a><span class="lineno"> 340</span>  uint8_t retain_flag;</div><div class="line"><a name="l00341"></a><span class="lineno"> 341</span> </div><div class="line"><a name="l00343"></a><span class="lineno"> 343</span>  uint16_t topic_name_size;</div><div class="line"><a name="l00344"></a><span class="lineno"> 344</span> </div><div class="line"><a name="l00350"></a><span class="lineno"> 350</span>  <span class="keyword">const</span> <span class="keywordtype">void</span>* topic_name;</div><div class="line"><a name="l00351"></a><span class="lineno"> 351</span> </div><div class="line"><a name="l00353"></a><span class="lineno"> 353</span>  uint16_t packet_id;</div><div class="line"><a name="l00354"></a><span class="lineno"> 354</span> </div><div class="line"><a name="l00356"></a><span class="lineno"> 356</span>  <span class="keyword">const</span> <span class="keywordtype">void</span>* application_message;</div><div class="line"><a name="l00357"></a><span class="lineno"> 357</span> </div><div class="line"><a name="l00359"></a><span class="lineno"> 359</span>  <span class="keywordtype">size_t</span> application_message_size;</div><div class="line"><a name="l00360"></a><span class="lineno"> 360</span> };</div><div class="line"><a name="l00361"></a><span class="lineno"> 361</span> </div><div class="line"><a name="l00371"></a><span class="lineno"> 371</span> <span class="keyword">struct </span><a class="code" href="structmqtt__response__puback.html">mqtt_response_puback</a> {</div><div class="line"><a name="l00373"></a><span class="lineno"> 373</span>  uint16_t packet_id;</div><div class="line"><a name="l00374"></a><span class="lineno"> 374</span> };</div><div class="line"><a name="l00375"></a><span class="lineno"> 375</span> </div><div class="line"><a name="l00385"></a><span class="lineno"> 385</span> <span class="keyword">struct </span><a class="code" href="structmqtt__response__pubrec.html">mqtt_response_pubrec</a> {</div><div class="line"><a name="l00387"></a><span class="lineno"> 387</span>  uint16_t packet_id;</div><div class="line"><a name="l00388"></a><span class="lineno"> 388</span> };</div><div class="line"><a name="l00389"></a><span class="lineno"> 389</span> </div><div class="line"><a name="l00399"></a><span class="lineno"> 399</span> <span class="keyword">struct </span><a class="code" href="structmqtt__response__pubrel.html">mqtt_response_pubrel</a> {</div><div class="line"><a name="l00401"></a><span class="lineno"> 401</span>  uint16_t packet_id;</div><div class="line"><a name="l00402"></a><span class="lineno"> 402</span> };</div><div class="line"><a name="l00403"></a><span class="lineno"> 403</span> </div><div class="line"><a name="l00413"></a><span class="lineno"> 413</span> <span class="keyword">struct </span><a class="code" href="structmqtt__response__pubcomp.html">mqtt_response_pubcomp</a> {</div><div class="line"><a name="l00415"></a><span class="lineno"> 415</span>  uint16_t packet_id;</div><div class="line"><a name="l00416"></a><span class="lineno"> 416</span> };</div><div class="line"><a name="l00417"></a><span class="lineno"> 417</span> </div><div class="line"><a name="l00426"></a><span class="lineno"> 426</span> <span class="keyword">enum</span> <a class="code" href="group__unpackers.html#ga2d626b05e589a148ce2e9e97f41302ae">MQTTSubackReturnCodes</a> {</div><div class="line"><a name="l00427"></a><span class="lineno"> 427</span>  MQTT_SUBACK_SUCCESS_MAX_QOS_0 = 0u,</div><div class="line"><a name="l00428"></a><span class="lineno"> 428</span>  MQTT_SUBACK_SUCCESS_MAX_QOS_1 = 1u,</div><div class="line"><a name="l00429"></a><span class="lineno"> 429</span>  MQTT_SUBACK_SUCCESS_MAX_QOS_2 = 2u,</div><div class="line"><a name="l00430"></a><span class="lineno"> 430</span>  MQTT_SUBACK_FAILURE = 128u</div><div class="line"><a name="l00431"></a><span class="lineno"> 431</span> };</div><div class="line"><a name="l00432"></a><span class="lineno"> 432</span> </div><div class="line"><a name="l00441"></a><span class="lineno"> 441</span> <span class="keyword">struct </span><a class="code" href="structmqtt__response__suback.html">mqtt_response_suback</a> {</div><div class="line"><a name="l00443"></a><span class="lineno"> 443</span>  uint16_t packet_id;</div><div class="line"><a name="l00444"></a><span class="lineno"> 444</span> </div><div class="line"><a name="l00450"></a><span class="lineno"> 450</span>  <span class="keyword">const</span> uint8_t *return_codes;</div><div class="line"><a name="l00451"></a><span class="lineno"> 451</span> </div><div class="line"><a name="l00453"></a><span class="lineno"> 453</span>  <span class="keywordtype">size_t</span> num_return_codes;</div><div class="line"><a name="l00454"></a><span class="lineno"> 454</span> };</div><div class="line"><a name="l00455"></a><span class="lineno"> 455</span> </div><div class="line"><a name="l00464"></a><span class="lineno"> 464</span> <span class="keyword">struct </span><a class="code" href="structmqtt__response__unsuback.html">mqtt_response_unsuback</a> {</div><div class="line"><a name="l00466"></a><span class="lineno"> 466</span>  uint16_t packet_id;</div><div class="line"><a name="l00467"></a><span class="lineno"> 467</span> };</div><div class="line"><a name="l00468"></a><span class="lineno"> 468</span> </div><div class="line"><a name="l00479"></a><span class="lineno"> 479</span> <span class="keyword">struct </span><a class="code" href="structmqtt__response__pingresp.html">mqtt_response_pingresp</a> {</div><div class="line"><a name="l00480"></a><span class="lineno"> 480</span>  <span class="keywordtype">int</span> dummy;</div><div class="line"><a name="l00481"></a><span class="lineno"> 481</span> };</div><div class="line"><a name="l00482"></a><span class="lineno"> 482</span> </div><div class="line"><a name="l00487"></a><span class="lineno"> 487</span> <span class="keyword">struct </span><a class="code" href="structmqtt__response.html">mqtt_response</a> {</div><div class="line"><a name="l00489"></a><span class="lineno"> 489</span>  <span class="keyword">struct </span><a class="code" href="structmqtt__fixed__header.html">mqtt_fixed_header</a> fixed_header;</div><div class="line"><a name="l00490"></a><span class="lineno"> 490</span> </div><div class="line"><a name="l00499"></a><span class="lineno"> 499</span>  <span class="keyword">union </span>{</div><div class="line"><a name="l00500"></a><span class="lineno"> 500</span>  <span class="keyword">struct </span><a class="code" href="structmqtt__response__connack.html">mqtt_response_connack</a> connack;</div><div class="line"><a name="l00501"></a><span class="lineno"> 501</span>  <span class="keyword">struct </span><a class="code" href="structmqtt__response__publish.html">mqtt_response_publish</a> publish;</div><div class="line"><a name="l00502"></a><span class="lineno"> 502</span>  <span class="keyword">struct </span><a class="code" href="structmqtt__response__puback.html">mqtt_response_puback</a> puback;</div><div class="line"><a name="l00503"></a><span class="lineno"> 503</span>  <span class="keyword">struct </span><a class="code" href="structmqtt__response__pubrec.html">mqtt_response_pubrec</a> pubrec;</div><div class="line"><a name="l00504"></a><span class="lineno"> 504</span>  <span class="keyword">struct </span><a class="code" href="structmqtt__response__pubrel.html">mqtt_response_pubrel</a> pubrel;</div><div class="line"><a name="l00505"></a><span class="lineno"> 505</span>  <span class="keyword">struct </span><a class="code" href="structmqtt__response__pubcomp.html">mqtt_response_pubcomp</a> pubcomp;</div><div class="line"><a name="l00506"></a><span class="lineno"> 506</span>  <span class="keyword">struct </span><a class="code" href="structmqtt__response__suback.html">mqtt_response_suback</a> suback;</div><div class="line"><a name="l00507"></a><span class="lineno"> 507</span>  <span class="keyword">struct </span><a class="code" href="structmqtt__response__unsuback.html">mqtt_response_unsuback</a> unsuback;</div><div class="line"><a name="l00508"></a><span class="lineno"> 508</span>  <span class="keyword">struct </span><a class="code" href="structmqtt__response__pingresp.html">mqtt_response_pingresp</a> pingresp;</div><div class="line"><a name="l00509"></a><span class="lineno"> 509</span>  } decoded;</div><div class="line"><a name="l00510"></a><span class="lineno"> 510</span> };</div><div class="line"><a name="l00511"></a><span class="lineno"> 511</span> </div><div class="line"><a name="l00526"></a><span class="lineno"> 526</span> ssize_t <a class="code" href="group__unpackers.html#gad596aa5faf7f79e05fb15da33321db10">mqtt_unpack_fixed_header</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__response.html">mqtt_response</a> *response, <span class="keyword">const</span> uint8_t *buf, <span class="keywordtype">size_t</span> bufsz);</div><div class="line"><a name="l00527"></a><span class="lineno"> 527</span> </div><div class="line"><a name="l00544"></a><span class="lineno"> 544</span> ssize_t mqtt_unpack_connack_response (<span class="keyword">struct</span> <a class="code" href="structmqtt__response.html">mqtt_response</a> *<a class="code" href="structmqtt__response.html">mqtt_response</a>, <span class="keyword">const</span> uint8_t *buf);</div><div class="line"><a name="l00545"></a><span class="lineno"> 545</span> </div><div class="line"><a name="l00561"></a><span class="lineno"> 561</span> ssize_t mqtt_unpack_publish_response (<span class="keyword">struct</span> mqtt_response *mqtt_response, <span class="keyword">const</span> uint8_t *buf);</div><div class="line"><a name="l00562"></a><span class="lineno"> 562</span> </div><div class="line"><a name="l00579"></a><span class="lineno"> 579</span> ssize_t mqtt_unpack_pubxxx_response(<span class="keyword">struct</span> mqtt_response *mqtt_response, <span class="keyword">const</span> uint8_t *buf);</div><div class="line"><a name="l00580"></a><span class="lineno"> 580</span> </div><div class="line"><a name="l00596"></a><span class="lineno"> 596</span> ssize_t mqtt_unpack_suback_response(<span class="keyword">struct</span> mqtt_response *mqtt_response, <span class="keyword">const</span> uint8_t *buf);</div><div class="line"><a name="l00597"></a><span class="lineno"> 597</span> </div><div class="line"><a name="l00613"></a><span class="lineno"> 613</span> ssize_t mqtt_unpack_unsuback_response(<span class="keyword">struct</span> mqtt_response *mqtt_response, <span class="keyword">const</span> uint8_t *buf);</div><div class="line"><a name="l00614"></a><span class="lineno"> 614</span> </div><div class="line"><a name="l00628"></a><span class="lineno"> 628</span> ssize_t mqtt_unpack_response(<span class="keyword">struct</span> mqtt_response* response, <span class="keyword">const</span> uint8_t *buf, <span class="keywordtype">size_t</span> bufsz);</div><div class="line"><a name="l00629"></a><span class="lineno"> 629</span> </div><div class="line"><a name="l00630"></a><span class="lineno"> 630</span> <span class="comment">/* REQUESTS */</span></div><div class="line"><a name="l00631"></a><span class="lineno"> 631</span> </div><div class="line"><a name="l00646"></a><span class="lineno"> 646</span> ssize_t <a class="code" href="group__packers.html#ga52d369e6e7d44539aab6732375288623">mqtt_pack_fixed_header</a>(uint8_t *buf, <span class="keywordtype">size_t</span> bufsz, <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structmqtt__fixed__header.html">mqtt_fixed_header</a> *fixed_header);</div><div class="line"><a name="l00647"></a><span class="lineno"> 647</span> </div><div class="line"><a name="l00656"></a><span class="lineno"> 656</span> <span class="keyword">enum</span> <a class="code" href="group__packers.html#gad6fa84a96a940fe4eae6ffca1a6d945f">MQTTConnectFlags</a> {</div><div class="line"><a name="l00657"></a><span class="lineno"> 657</span>  MQTT_CONNECT_RESERVED = 1u,</div><div class="line"><a name="l00658"></a><span class="lineno"> 658</span>  MQTT_CONNECT_CLEAN_SESSION = 2u,</div><div class="line"><a name="l00659"></a><span class="lineno"> 659</span>  MQTT_CONNECT_WILL_FLAG = 4u,</div><div class="line"><a name="l00660"></a><span class="lineno"> 660</span>  MQTT_CONNECT_WILL_QOS_0 = (0u & 0x03) << 3,</div><div class="line"><a name="l00661"></a><span class="lineno"> 661</span>  MQTT_CONNECT_WILL_QOS_1 = (1u & 0x03) << 3,</div><div class="line"><a name="l00662"></a><span class="lineno"> 662</span>  MQTT_CONNECT_WILL_QOS_2 = (2u & 0x03) << 3,</div><div class="line"><a name="l00663"></a><span class="lineno"> 663</span>  MQTT_CONNECT_WILL_RETAIN = 32u,</div><div class="line"><a name="l00664"></a><span class="lineno"> 664</span>  MQTT_CONNECT_PASSWORD = 64u,</div><div class="line"><a name="l00665"></a><span class="lineno"> 665</span>  MQTT_CONNECT_USER_NAME = 128u</div><div class="line"><a name="l00666"></a><span class="lineno"> 666</span> };</div><div class="line"><a name="l00667"></a><span class="lineno"> 667</span> </div><div class="line"><a name="l00706"></a><span class="lineno"> 706</span> ssize_t <a class="code" href="group__packers.html#ga327bce82ca8cce7f45e50e0edeb60987">mqtt_pack_connection_request</a>(uint8_t* buf, <span class="keywordtype">size_t</span> bufsz, </div><div class="line"><a name="l00707"></a><span class="lineno"> 707</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* client_id,</div><div class="line"><a name="l00708"></a><span class="lineno"> 708</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* will_topic,</div><div class="line"><a name="l00709"></a><span class="lineno"> 709</span>  <span class="keyword">const</span> <span class="keywordtype">void</span>* will_message,</div><div class="line"><a name="l00710"></a><span class="lineno"> 710</span>  <span class="keywordtype">size_t</span> will_message_size,</div><div class="line"><a name="l00711"></a><span class="lineno"> 711</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* user_name,</div><div class="line"><a name="l00712"></a><span class="lineno"> 712</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* password,</div><div class="line"><a name="l00713"></a><span class="lineno"> 713</span>  uint8_t connect_flags,</div><div class="line"><a name="l00714"></a><span class="lineno"> 714</span>  uint16_t keep_alive);</div><div class="line"><a name="l00715"></a><span class="lineno"> 715</span> </div><div class="line"><a name="l00724"></a><span class="lineno"> 724</span> <span class="keyword">enum</span> <a class="code" href="group__packers.html#gad38a41e1c497f9bcd2477c005f280b23">MQTTPublishFlags</a> {</div><div class="line"><a name="l00725"></a><span class="lineno"> 725</span>  MQTT_PUBLISH_DUP = 8u,</div><div class="line"><a name="l00726"></a><span class="lineno"> 726</span>  MQTT_PUBLISH_QOS_0 = ((0u << 1) & 0x06),</div><div class="line"><a name="l00727"></a><span class="lineno"> 727</span>  MQTT_PUBLISH_QOS_1 = ((1u << 1) & 0x06),</div><div class="line"><a name="l00728"></a><span class="lineno"> 728</span>  MQTT_PUBLISH_QOS_2 = ((2u << 1) & 0x06),</div><div class="line"><a name="l00729"></a><span class="lineno"> 729</span>  MQTT_PUBLISH_QOS_MASK = ((3u << 1) & 0x06),</div><div class="line"><a name="l00730"></a><span class="lineno"> 730</span>  MQTT_PUBLISH_RETAIN = 0x01</div><div class="line"><a name="l00731"></a><span class="lineno"> 731</span> };</div><div class="line"><a name="l00732"></a><span class="lineno"> 732</span> </div><div class="line"><a name="l00756"></a><span class="lineno"> 756</span> ssize_t <a class="code" href="group__packers.html#gae7cb4c4d90ed04fe268f5f9a167e32b1">mqtt_pack_publish_request</a>(uint8_t *buf, <span class="keywordtype">size_t</span> bufsz,</div><div class="line"><a name="l00757"></a><span class="lineno"> 757</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* topic_name,</div><div class="line"><a name="l00758"></a><span class="lineno"> 758</span>  uint16_t packet_id,</div><div class="line"><a name="l00759"></a><span class="lineno"> 759</span>  <span class="keywordtype">void</span>* application_message,</div><div class="line"><a name="l00760"></a><span class="lineno"> 760</span>  <span class="keywordtype">size_t</span> application_message_size,</div><div class="line"><a name="l00761"></a><span class="lineno"> 761</span>  uint8_t publish_flags);</div><div class="line"><a name="l00762"></a><span class="lineno"> 762</span> </div><div class="line"><a name="l00791"></a><span class="lineno"> 791</span> ssize_t <a class="code" href="group__packers.html#ga9cbd954d6bffd8fb0a06a6e4d34e4949">mqtt_pack_pubxxx_request</a>(uint8_t *buf, <span class="keywordtype">size_t</span> bufsz, </div><div class="line"><a name="l00792"></a><span class="lineno"> 792</span>  <span class="keyword">enum</span> <a class="code" href="group__unpackers.html#gacbd36b88ec7f62bc161b07e1a0aed679">MQTTControlPacketType</a> <a class="code" href="structmqtt__fixed__header.html#a9bdea10facdc20756c457f282d58cfa1">control_type</a>,</div><div class="line"><a name="l00793"></a><span class="lineno"> 793</span>  uint16_t packet_id);</div><div class="line"><a name="l00794"></a><span class="lineno"> 794</span> </div><div class="line"><a name="l00802"></a><span class="lineno"> 802</span> <span class="preprocessor">#define MQTT_SUBSCRIBE_REQUEST_MAX_NUM_TOPICS 8</span></div><div class="line"><a name="l00803"></a><span class="lineno"> 803</span> </div><div class="line"><a name="l00826"></a><span class="lineno"> 826</span> ssize_t <a class="code" href="group__packers.html#ga38ee59ca9d618d53da7d7c9bf0397942">mqtt_pack_subscribe_request</a>(uint8_t *buf, <span class="keywordtype">size_t</span> bufsz, </div><div class="line"><a name="l00827"></a><span class="lineno"> 827</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> packet_id, </div><div class="line"><a name="l00828"></a><span class="lineno"> 828</span>  ...); <span class="comment">/* null terminated */</span></div><div class="line"><a name="l00829"></a><span class="lineno"> 829</span> </div><div class="line"><a name="l00837"></a><span class="lineno"> 837</span> <span class="preprocessor">#define MQTT_UNSUBSCRIBE_REQUEST_MAX_NUM_TOPICS 8</span></div><div class="line"><a name="l00838"></a><span class="lineno"> 838</span> </div><div class="line"><a name="l00860"></a><span class="lineno"> 860</span> ssize_t <a class="code" href="group__packers.html#gaa863cb90857670e8faa6b18a1103e0d6">mqtt_pack_unsubscribe_request</a>(uint8_t *buf, <span class="keywordtype">size_t</span> bufsz, </div><div class="line"><a name="l00861"></a><span class="lineno"> 861</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> packet_id, </div><div class="line"><a name="l00862"></a><span class="lineno"> 862</span>  ...); <span class="comment">/* null terminated */</span></div><div class="line"><a name="l00863"></a><span class="lineno"> 863</span> </div><div class="line"><a name="l00878"></a><span class="lineno"> 878</span> ssize_t <a class="code" href="group__packers.html#gac11b5cc5c6bbbf386c2515c823965a82">mqtt_pack_ping_request</a>(uint8_t *buf, <span class="keywordtype">size_t</span> bufsz);</div><div class="line"><a name="l00879"></a><span class="lineno"> 879</span> </div><div class="line"><a name="l00894"></a><span class="lineno"> 894</span> ssize_t <a class="code" href="group__packers.html#ga7842c85a0711df31f2e9ce31a9253999">mqtt_pack_disconnect</a>(uint8_t *buf, <span class="keywordtype">size_t</span> bufsz);</div><div class="line"><a name="l00895"></a><span class="lineno"> 895</span> </div><div class="line"><a name="l00896"></a><span class="lineno"> 896</span> </div><div class="line"><a name="l00901"></a><span class="lineno"> 901</span> <span class="keyword">enum</span> <a class="code" href="group__details.html#ga28b018ca5d1c81101d36f9c0d532a0d0">MQTTQueuedMessageState</a> {</div><div class="line"><a name="l00902"></a><span class="lineno"> 902</span>  MQTT_QUEUED_UNSENT,</div><div class="line"><a name="l00903"></a><span class="lineno"> 903</span>  MQTT_QUEUED_AWAITING_ACK,</div><div class="line"><a name="l00904"></a><span class="lineno"> 904</span>  MQTT_QUEUED_COMPLETE</div><div class="line"><a name="l00905"></a><span class="lineno"> 905</span> };</div><div class="line"><a name="l00906"></a><span class="lineno"> 906</span> </div><div class="line"><a name="l00911"></a><span class="lineno"> 911</span> <span class="keyword">struct </span><a class="code" href="structmqtt__queued__message.html">mqtt_queued_message</a> {</div><div class="line"><a name="l00913"></a><span class="lineno"> 913</span>  uint8_t *start;</div><div class="line"><a name="l00914"></a><span class="lineno"> 914</span> </div><div class="line"><a name="l00916"></a><span class="lineno"> 916</span>  <span class="keywordtype">size_t</span> size;</div><div class="line"><a name="l00917"></a><span class="lineno"> 917</span> </div><div class="line"><a name="l00919"></a><span class="lineno"> 919</span>  <span class="keyword">enum</span> <a class="code" href="group__details.html#ga28b018ca5d1c81101d36f9c0d532a0d0">MQTTQueuedMessageState</a> state;</div><div class="line"><a name="l00920"></a><span class="lineno"> 920</span> </div><div class="line"><a name="l00927"></a><span class="lineno"> 927</span>  mqtt_pal_time_t time_sent;</div><div class="line"><a name="l00928"></a><span class="lineno"> 928</span> </div><div class="line"><a name="l00932"></a><span class="lineno"> 932</span>  <span class="keyword">enum</span> <a class="code" href="group__unpackers.html#gacbd36b88ec7f62bc161b07e1a0aed679">MQTTControlPacketType</a> <a class="code" href="structmqtt__fixed__header.html#a9bdea10facdc20756c457f282d58cfa1">control_type</a>;</div><div class="line"><a name="l00933"></a><span class="lineno"> 933</span> </div><div class="line"><a name="l00940"></a><span class="lineno"> 940</span>  uint16_t packet_id;</div><div class="line"><a name="l00941"></a><span class="lineno"> 941</span> };</div><div class="line"><a name="l00942"></a><span class="lineno"> 942</span> </div><div class="line"><a name="l00950"></a><span class="lineno"> 950</span> <span class="keyword">struct </span><a class="code" href="structmqtt__message__queue.html">mqtt_message_queue</a> {</div><div class="line"><a name="l00956"></a><span class="lineno"> 956</span>  <span class="keywordtype">void</span> *mem_start;</div><div class="line"><a name="l00957"></a><span class="lineno"> 957</span> </div><div class="line"><a name="l00959"></a><span class="lineno"> 959</span>  <span class="keywordtype">void</span> *mem_end;</div><div class="line"><a name="l00960"></a><span class="lineno"> 960</span> </div><div class="line"><a name="l00967"></a><span class="lineno"> 967</span>  uint8_t *curr;</div><div class="line"><a name="l00968"></a><span class="lineno"> 968</span> </div><div class="line"><a name="l00977"></a><span class="lineno"> 977</span>  <span class="keywordtype">size_t</span> curr_sz;</div><div class="line"><a name="l00978"></a><span class="lineno"> 978</span>  </div><div class="line"><a name="l00984"></a><span class="lineno"> 984</span>  <span class="keyword">struct </span><a class="code" href="structmqtt__queued__message.html">mqtt_queued_message</a> *queue_tail;</div><div class="line"><a name="l00985"></a><span class="lineno"> 985</span> };</div><div class="line"><a name="l00986"></a><span class="lineno"> 986</span> </div><div class="line"><a name="l00997"></a><span class="lineno"> 997</span> <span class="keywordtype">void</span> mqtt_mq_init(<span class="keyword">struct</span> <a class="code" href="structmqtt__message__queue.html">mqtt_message_queue</a> *mq, <span class="keywordtype">void</span> *buf, <span class="keywordtype">size_t</span> bufsz);</div><div class="line"><a name="l00998"></a><span class="lineno"> 998</span> </div><div class="line"><a name="l01009"></a><span class="lineno"> 1009</span> <span class="keywordtype">void</span> mqtt_mq_clean(<span class="keyword">struct</span> <a class="code" href="structmqtt__message__queue.html">mqtt_message_queue</a> *mq);</div><div class="line"><a name="l01010"></a><span class="lineno"> 1010</span> </div><div class="line"><a name="l01027"></a><span class="lineno"> 1027</span> <span class="keyword">struct </span><a class="code" href="structmqtt__queued__message.html">mqtt_queued_message</a>* mqtt_mq_register(<span class="keyword">struct</span> <a class="code" href="structmqtt__message__queue.html">mqtt_message_queue</a> *mq, <span class="keywordtype">size_t</span> nbytes);</div><div class="line"><a name="l01028"></a><span class="lineno"> 1028</span> </div><div class="line"><a name="l01041"></a><span class="lineno"> 1041</span> <span class="keyword">struct </span><a class="code" href="structmqtt__queued__message.html">mqtt_queued_message</a>* mqtt_mq_find(<span class="keyword">struct</span> <a class="code" href="structmqtt__message__queue.html">mqtt_message_queue</a> *mq, <span class="keyword">enum</span> <a class="code" href="group__unpackers.html#gacbd36b88ec7f62bc161b07e1a0aed679">MQTTControlPacketType</a> <a class="code" href="structmqtt__fixed__header.html#a9bdea10facdc20756c457f282d58cfa1">control_type</a>, uint16_t *<a class="code" href="structmqtt__queued__message.html#ac20454e900b6d29e4d25edcdad57a99b">packet_id</a>);</div><div class="line"><a name="l01042"></a><span class="lineno"> 1042</span> </div><div class="line"><a name="l01052"></a><span class="lineno"> 1052</span> <span class="preprocessor">#define mqtt_mq_get(mq_ptr, index) (((struct mqtt_queued_message*) ((mq_ptr)->mem_end)) - 1 - index)</span></div><div class="line"><a name="l01053"></a><span class="lineno"> 1053</span> </div><div class="line"><a name="l01058"></a><span class="lineno"> 1058</span> <span class="preprocessor">#define mqtt_mq_length(mq_ptr) (((struct mqtt_queued_message*) ((mq_ptr)->mem_end)) - (mq_ptr)->queue_tail)</span></div><div class="line"><a name="l01059"></a><span class="lineno"> 1059</span> </div><div class="line"><a name="l01064"></a><span class="lineno"> 1064</span> <span class="preprocessor">#define mqtt_mq_currsz(mq_ptr) (mq_ptr->curr >= (uint8_t*) ((mq_ptr)->queue_tail - 1)) ? 0 : ((uint8_t*) ((mq_ptr)->queue_tail - 1)) - (mq_ptr)->curr</span></div><div class="line"><a name="l01065"></a><span class="lineno"> 1065</span> </div><div class="line"><a name="l01066"></a><span class="lineno"> 1066</span> <span class="comment">/* CLIENT */</span></div><div class="line"><a name="l01067"></a><span class="lineno"> 1067</span> </div><div class="line"><a name="l01074"></a><span class="lineno"> 1074</span> <span class="keyword">struct </span><a class="code" href="structmqtt__client.html">mqtt_client</a> {</div><div class="line"><a name="l01076"></a><span class="lineno"> 1076</span>  mqtt_pal_socket_handle socketfd;</div><div class="line"><a name="l01077"></a><span class="lineno"> 1077</span> </div><div class="line"><a name="l01079"></a><span class="lineno"> 1079</span>  uint16_t pid_lfsr;</div><div class="line"><a name="l01080"></a><span class="lineno"> 1080</span> </div><div class="line"><a name="l01082"></a><span class="lineno"> 1082</span>  uint16_t keep_alive;</div><div class="line"><a name="l01083"></a><span class="lineno"> 1083</span> </div><div class="line"><a name="l01088"></a><span class="lineno"> 1088</span>  <span class="keywordtype">int</span> number_of_keep_alives;</div><div class="line"><a name="l01089"></a><span class="lineno"> 1089</span> </div><div class="line"><a name="l01097"></a><span class="lineno"> 1097</span>  mqtt_pal_time_t time_of_last_send;</div><div class="line"><a name="l01098"></a><span class="lineno"> 1098</span> </div><div class="line"><a name="l01107"></a><span class="lineno"> 1107</span>  <span class="keyword">enum</span> <a class="code" href="group__api.html#gad0c901a8d30691ed0ca17915b691b7e7">MQTTErrors</a> error;</div><div class="line"><a name="l01108"></a><span class="lineno"> 1108</span> </div><div class="line"><a name="l01117"></a><span class="lineno"> 1117</span>  <span class="keywordtype">int</span> response_timeout;</div><div class="line"><a name="l01118"></a><span class="lineno"> 1118</span> </div><div class="line"><a name="l01120"></a><span class="lineno"> 1120</span>  <span class="keywordtype">int</span> number_of_timeouts;</div><div class="line"><a name="l01121"></a><span class="lineno"> 1121</span> </div><div class="line"><a name="l01128"></a><span class="lineno"> 1128</span>  <span class="keywordtype">double</span> typical_response_time;</div><div class="line"><a name="l01129"></a><span class="lineno"> 1129</span> </div><div class="line"><a name="l01141"></a><span class="lineno"> 1141</span>  void (*publish_response_callback)(<span class="keywordtype">void</span>** state, <span class="keyword">struct </span><a class="code" href="structmqtt__response__publish.html">mqtt_response_publish</a> *publish);</div><div class="line"><a name="l01142"></a><span class="lineno"> 1142</span> </div><div class="line"><a name="l01149"></a><span class="lineno"> 1149</span>  <span class="keywordtype">void</span>* publish_response_callback_state;</div><div class="line"><a name="l01150"></a><span class="lineno"> 1150</span> </div><div class="line"><a name="l01166"></a><span class="lineno"> 1166</span>  <span class="keyword">enum</span> <a class="code" href="group__api.html#gad0c901a8d30691ed0ca17915b691b7e7">MQTTErrors</a> (*inspector_callback)(<span class="keyword">struct </span><a class="code" href="structmqtt__client.html">mqtt_client</a>*);</div><div class="line"><a name="l01167"></a><span class="lineno"> 1167</span> </div><div class="line"><a name="l01175"></a><span class="lineno"> 1175</span>  void (*<a class="code" href="structmqtt__client.html#a144003c5296eeb2120c79c4c676db784">reconnect_callback</a>)(<span class="keyword">struct </span><a class="code" href="structmqtt__client.html">mqtt_client</a>*, <span class="keywordtype">void</span>**);</div><div class="line"><a name="l01176"></a><span class="lineno"> 1176</span> </div><div class="line"><a name="l01181"></a><span class="lineno"> 1181</span>  <span class="keywordtype">void</span>* <a class="code" href="structmqtt__client.html#aac9c9b9576ce7df2d2cd3e687ff598e9">reconnect_state</a>;</div><div class="line"><a name="l01182"></a><span class="lineno"> 1182</span> </div><div class="line"><a name="l01186"></a><span class="lineno"> 1186</span>  <span class="keyword">struct </span>{</div><div class="line"><a name="l01188"></a><span class="lineno"> 1188</span>  uint8_t *mem_start;</div><div class="line"><a name="l01189"></a><span class="lineno"> 1189</span> </div><div class="line"><a name="l01191"></a><span class="lineno"> 1191</span>  <span class="keywordtype">size_t</span> mem_size;</div><div class="line"><a name="l01192"></a><span class="lineno"> 1192</span> </div><div class="line"><a name="l01194"></a><span class="lineno"> 1194</span>  uint8_t *curr;</div><div class="line"><a name="l01195"></a><span class="lineno"> 1195</span> </div><div class="line"><a name="l01197"></a><span class="lineno"> 1197</span>  <span class="keywordtype">size_t</span> curr_sz;</div><div class="line"><a name="l01198"></a><span class="lineno"> 1198</span>  } recv_buffer;</div><div class="line"><a name="l01199"></a><span class="lineno"> 1199</span> </div><div class="line"><a name="l01206"></a><span class="lineno"> 1206</span>  mqtt_pal_mutex_t mutex;</div><div class="line"><a name="l01207"></a><span class="lineno"> 1207</span> </div><div class="line"><a name="l01209"></a><span class="lineno"> 1209</span>  <span class="keyword">struct </span><a class="code" href="structmqtt__message__queue.html">mqtt_message_queue</a> mq;</div><div class="line"><a name="l01210"></a><span class="lineno"> 1210</span> };</div><div class="line"><a name="l01211"></a><span class="lineno"> 1211</span> </div><div class="line"><a name="l01222"></a><span class="lineno"> 1222</span> uint16_t <a class="code" href="group__details.html#ga7ca75c661980d4af50493f59a386f378">__mqtt_next_pid</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client);</div><div class="line"><a name="l01223"></a><span class="lineno"> 1223</span> </div><div class="line"><a name="l01232"></a><span class="lineno"> 1232</span> ssize_t <a class="code" href="group__details.html#gacf553ca88f48350dbde0dc3b96e550f7">__mqtt_send</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client);</div><div class="line"><a name="l01233"></a><span class="lineno"> 1233</span> </div><div class="line"><a name="l01242"></a><span class="lineno"> 1242</span> ssize_t <a class="code" href="group__details.html#ga4d50a465c684a5ecd1c000f811fa601e">__mqtt_recv</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client);</div><div class="line"><a name="l01243"></a><span class="lineno"> 1243</span> </div><div class="line"><a name="l01270"></a><span class="lineno"> 1270</span> <span class="keyword">enum</span> <a class="code" href="group__api.html#gad0c901a8d30691ed0ca17915b691b7e7">MQTTErrors</a> <a class="code" href="group__api.html#gae3d3aafc7588ed53a90c9f66fc620a6e">mqtt_sync</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client);</div><div class="line"><a name="l01271"></a><span class="lineno"> 1271</span> </div><div class="line"><a name="l01305"></a><span class="lineno"> 1305</span> <span class="keyword">enum</span> <a class="code" href="group__api.html#gad0c901a8d30691ed0ca17915b691b7e7">MQTTErrors</a> <a class="code" href="group__api.html#gaa5dab8a06f016b09c7a5259274b3b3ce">mqtt_init</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client,</div><div class="line"><a name="l01306"></a><span class="lineno"> 1306</span>  mqtt_pal_socket_handle sockfd,</div><div class="line"><a name="l01307"></a><span class="lineno"> 1307</span>  uint8_t *sendbuf, <span class="keywordtype">size_t</span> sendbufsz,</div><div class="line"><a name="l01308"></a><span class="lineno"> 1308</span>  uint8_t *recvbuf, <span class="keywordtype">size_t</span> recvbufsz,</div><div class="line"><a name="l01309"></a><span class="lineno"> 1309</span>  <span class="keywordtype">void</span> (*publish_response_callback)(<span class="keywordtype">void</span>** state, <span class="keyword">struct</span> <a class="code" href="structmqtt__response__publish.html">mqtt_response_publish</a> *publish));</div><div class="line"><a name="l01310"></a><span class="lineno"> 1310</span> </div><div class="line"><a name="l01355"></a><span class="lineno"> 1355</span> <span class="keywordtype">void</span> <a class="code" href="group__api.html#ga4becaa66425469cf462b531aa7eb1ac9">mqtt_init_reconnect</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client,</div><div class="line"><a name="l01356"></a><span class="lineno"> 1356</span>  <span class="keywordtype">void</span> (*reconnect_callback)(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client, <span class="keywordtype">void</span>** state),</div><div class="line"><a name="l01357"></a><span class="lineno"> 1357</span>  <span class="keywordtype">void</span> *reconnect_state,</div><div class="line"><a name="l01358"></a><span class="lineno"> 1358</span>  <span class="keywordtype">void</span> (*publish_response_callback)(<span class="keywordtype">void</span>** state, <span class="keyword">struct</span> <a class="code" href="structmqtt__response__publish.html">mqtt_response_publish</a> *publish));</div><div class="line"><a name="l01359"></a><span class="lineno"> 1359</span> </div><div class="line"><a name="l01382"></a><span class="lineno"> 1382</span> <span class="keywordtype">void</span> <a class="code" href="group__api.html#gaf5ae4b5b880431ef1bcd72f343de9ac6">mqtt_reinit</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a>* client,</div><div class="line"><a name="l01383"></a><span class="lineno"> 1383</span>  mqtt_pal_socket_handle socketfd,</div><div class="line"><a name="l01384"></a><span class="lineno"> 1384</span>  uint8_t *sendbuf, <span class="keywordtype">size_t</span> sendbufsz,</div><div class="line"><a name="l01385"></a><span class="lineno"> 1385</span>  uint8_t *recvbuf, <span class="keywordtype">size_t</span> recvbufsz);</div><div class="line"><a name="l01386"></a><span class="lineno"> 1386</span> </div><div class="line"><a name="l01413"></a><span class="lineno"> 1413</span> <span class="keyword">enum</span> <a class="code" href="group__api.html#gad0c901a8d30691ed0ca17915b691b7e7">MQTTErrors</a> <a class="code" href="group__api.html#gadbe914e5a9d4f93314c4e7637cb4f7b3">mqtt_connect</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client,</div><div class="line"><a name="l01414"></a><span class="lineno"> 1414</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* client_id,</div><div class="line"><a name="l01415"></a><span class="lineno"> 1415</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* will_topic,</div><div class="line"><a name="l01416"></a><span class="lineno"> 1416</span>  <span class="keyword">const</span> <span class="keywordtype">void</span>* will_message,</div><div class="line"><a name="l01417"></a><span class="lineno"> 1417</span>  <span class="keywordtype">size_t</span> will_message_size,</div><div class="line"><a name="l01418"></a><span class="lineno"> 1418</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* user_name,</div><div class="line"><a name="l01419"></a><span class="lineno"> 1419</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* password,</div><div class="line"><a name="l01420"></a><span class="lineno"> 1420</span>  uint8_t connect_flags,</div><div class="line"><a name="l01421"></a><span class="lineno"> 1421</span>  uint16_t keep_alive);</div><div class="line"><a name="l01422"></a><span class="lineno"> 1422</span> </div><div class="line"><a name="l01423"></a><span class="lineno"> 1423</span> <span class="comment">/* </span></div><div class="line"><a name="l01424"></a><span class="lineno"> 1424</span> <span class="comment"> todo: will_message should be a void*</span></div><div class="line"><a name="l01425"></a><span class="lineno"> 1425</span> <span class="comment">*/</span></div><div class="line"><a name="l01426"></a><span class="lineno"> 1426</span> </div><div class="line"><a name="l01445"></a><span class="lineno"> 1445</span> <span class="keyword">enum</span> <a class="code" href="group__api.html#gad0c901a8d30691ed0ca17915b691b7e7">MQTTErrors</a> <a class="code" href="group__api.html#ga0d8fed24a799ab9b55eeb28f3cd2d0a8">mqtt_publish</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client,</div><div class="line"><a name="l01446"></a><span class="lineno"> 1446</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* topic_name,</div><div class="line"><a name="l01447"></a><span class="lineno"> 1447</span>  <span class="keywordtype">void</span>* application_message,</div><div class="line"><a name="l01448"></a><span class="lineno"> 1448</span>  <span class="keywordtype">size_t</span> application_message_size,</div><div class="line"><a name="l01449"></a><span class="lineno"> 1449</span>  uint8_t publish_flags);</div><div class="line"><a name="l01450"></a><span class="lineno"> 1450</span> </div><div class="line"><a name="l01460"></a><span class="lineno"> 1460</span> ssize_t <a class="code" href="group__details.html#gae09d4412a871ecec31377db55cc54228">__mqtt_puback</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client, uint16_t packet_id);</div><div class="line"><a name="l01461"></a><span class="lineno"> 1461</span> </div><div class="line"><a name="l01471"></a><span class="lineno"> 1471</span> ssize_t <a class="code" href="group__details.html#ga874c62f7a20b6adf13dbed2b4e2dd985">__mqtt_pubrec</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client, uint16_t packet_id);</div><div class="line"><a name="l01472"></a><span class="lineno"> 1472</span> </div><div class="line"><a name="l01482"></a><span class="lineno"> 1482</span> ssize_t <a class="code" href="group__details.html#ga427f9191ab9967b75e0a7a2f7fa0dca0">__mqtt_pubrel</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client, uint16_t packet_id);</div><div class="line"><a name="l01483"></a><span class="lineno"> 1483</span> </div><div class="line"><a name="l01493"></a><span class="lineno"> 1493</span> ssize_t <a class="code" href="group__details.html#ga86ddd2a08fbe4bd351dfd161db93303d">__mqtt_pubcomp</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client, uint16_t packet_id);</div><div class="line"><a name="l01494"></a><span class="lineno"> 1494</span> </div><div class="line"><a name="l01495"></a><span class="lineno"> 1495</span> </div><div class="line"><a name="l01509"></a><span class="lineno"> 1509</span> <span class="keyword">enum</span> <a class="code" href="group__api.html#gad0c901a8d30691ed0ca17915b691b7e7">MQTTErrors</a> <a class="code" href="group__api.html#gaea5da9b546f6e91eb77c9eff9c478de5">mqtt_subscribe</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client,</div><div class="line"><a name="l01510"></a><span class="lineno"> 1510</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* topic_name,</div><div class="line"><a name="l01511"></a><span class="lineno"> 1511</span>  <span class="keywordtype">int</span> max_qos_level);</div><div class="line"><a name="l01512"></a><span class="lineno"> 1512</span> </div><div class="line"><a name="l01524"></a><span class="lineno"> 1524</span> <span class="keyword">enum</span> <a class="code" href="group__api.html#gad0c901a8d30691ed0ca17915b691b7e7">MQTTErrors</a> <a class="code" href="group__api.html#ga08d16571dfefa690698c0cca5cca7a1d">mqtt_unsubscribe</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client,</div><div class="line"><a name="l01525"></a><span class="lineno"> 1525</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* topic_name);</div><div class="line"><a name="l01526"></a><span class="lineno"> 1526</span> </div><div class="line"><a name="l01537"></a><span class="lineno"> 1537</span> <span class="keyword">enum</span> <a class="code" href="group__api.html#gad0c901a8d30691ed0ca17915b691b7e7">MQTTErrors</a> <a class="code" href="group__api.html#gae472795684a1d973bfb89d075d17a29e">mqtt_ping</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client);</div><div class="line"><a name="l01538"></a><span class="lineno"> 1538</span> </div><div class="line"><a name="l01543"></a><span class="lineno"> 1543</span> <span class="keyword">enum</span> <a class="code" href="group__api.html#gad0c901a8d30691ed0ca17915b691b7e7">MQTTErrors</a> <a class="code" href="mqtt_8h.html#a444875d32fd56990f7c5a8251159d6bf">__mqtt_ping</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client);</div><div class="line"><a name="l01544"></a><span class="lineno"> 1544</span> </div><div class="line"><a name="l01557"></a><span class="lineno"> 1557</span> <span class="keyword">enum</span> <a class="code" href="group__api.html#gad0c901a8d30691ed0ca17915b691b7e7">MQTTErrors</a> <a class="code" href="group__api.html#ga95d9981735ab4495d3d65e8056611126">mqtt_disconnect</a>(<span class="keyword">struct</span> <a class="code" href="structmqtt__client.html">mqtt_client</a> *client);</div><div class="line"><a name="l01558"></a><span class="lineno"> 1558</span> </div><div class="line"><a name="l01559"></a><span class="lineno"> 1559</span> <span class="preprocessor">#endif</span></div><div class="ttc" id="group__unpackers_html_ga07e480dfa5738e60c54ad0447ddb1a25"><div class="ttname"><a href="group__unpackers.html#ga07e480dfa5738e60c54ad0447ddb1a25">MQTTConnackReturnCode</a></div><div class="ttdeci">MQTTConnackReturnCode</div><div class="ttdoc">An enumeration of the return codes returned in a CONNACK packet. </div><div class="ttdef"><b>Definition:</b> mqtt.h:279</div></div>
<div class="ttc" id="structmqtt__client_html_aac9c9b9576ce7df2d2cd3e687ff598e9"><div class="ttname"><a href="structmqtt__client.html#aac9c9b9576ce7df2d2cd3e687ff598e9">mqtt_client::reconnect_state</a></div><div class="ttdeci">void * reconnect_state</div><div class="ttdoc">A pointer to some state. A pointer to this member is passed to mqtt_client::reconnect_callback. </div><div class="ttdef"><b>Definition:</b> mqtt.h:1180</div></div>
<div class="ttc" id="group__unpackers_html_gacbd36b88ec7f62bc161b07e1a0aed679"><div class="ttname"><a href="group__unpackers.html#gacbd36b88ec7f62bc161b07e1a0aed679">MQTTControlPacketType</a></div><div class="ttdeci">MQTTControlPacketType</div><div class="ttdoc">An enumeration of the MQTT control packet types. </div><div class="ttdef"><b>Definition:</b> mqtt.h:115</div></div>
<div class="ttc" id="group__details_html_ga28b018ca5d1c81101d36f9c0d532a0d0"><div class="ttname"><a href="group__details.html#ga28b018ca5d1c81101d36f9c0d532a0d0">MQTTQueuedMessageState</a></div><div class="ttdeci">MQTTQueuedMessageState</div><div class="ttdoc">An enumeration of queued message states. </div><div class="ttdef"><b>Definition:</b> mqtt.h:900</div></div>
<div class="ttc" id="structmqtt__client_html_a144003c5296eeb2120c79c4c676db784"><div class="ttname"><a href="structmqtt__client.html#a144003c5296eeb2120c79c4c676db784">mqtt_client::reconnect_callback</a></div><div class="ttdeci">void(* reconnect_callback)(struct mqtt_client *, void **)</div><div class="ttdoc">A callback that is called whenever the client is in an error state. </div><div class="ttdef"><b>Definition:</b> mqtt.h:1174</div></div>
<div class="ttc" id="group__api_html_gaf5ae4b5b880431ef1bcd72f343de9ac6"><div class="ttname"><a href="group__api.html#gaf5ae4b5b880431ef1bcd72f343de9ac6">mqtt_reinit</a></div><div class="ttdeci">void mqtt_reinit(struct mqtt_client *client, mqtt_pal_socket_handle socketfd, uint8_t *sendbuf, size_t sendbufsz, uint8_t *recvbuf, size_t recvbufsz)</div><div class="ttdoc">Safely assign/reassign a socket and buffers to an new/existing client.This function also clears the c...</div></div>
<div class="ttc" id="mqtt_8h_html_a444875d32fd56990f7c5a8251159d6bf"><div class="ttname"><a href="mqtt_8h.html#a444875d32fd56990f7c5a8251159d6bf">__mqtt_ping</a></div><div class="ttdeci">enum MQTTErrors __mqtt_ping(struct mqtt_client *client)</div><div class="ttdoc">Ping the broker without locking/unlocking the mutex. </div></div>
<div class="ttc" id="group__details_html_ga4d50a465c684a5ecd1c000f811fa601e"><div class="ttname"><a href="group__details.html#ga4d50a465c684a5ecd1c000f811fa601e">__mqtt_recv</a></div><div class="ttdeci">ssize_t __mqtt_recv(struct mqtt_client *client)</div><div class="ttdoc">Handles ingress client traffic. </div></div>
<div class="ttc" id="structmqtt__response__unsuback_html"><div class="ttname"><a href="structmqtt__response__unsuback.html">mqtt_response_unsuback</a></div><div class="ttdoc">The brokers response to a UNSUBSCRIBE request. </div><div class="ttdef"><b>Definition:</b> mqtt.h:463</div></div>
<div class="ttc" id="structmqtt__response__connack_html"><div class="ttname"><a href="structmqtt__response__connack.html">mqtt_response_connack</a></div><div class="ttdoc">A connection response datastructure. </div><div class="ttdef"><b>Definition:</b> mqtt.h:296</div></div>
<div class="ttc" id="group__api_html_gaa5dab8a06f016b09c7a5259274b3b3ce"><div class="ttname"><a href="group__api.html#gaa5dab8a06f016b09c7a5259274b3b3ce">mqtt_init</a></div><div class="ttdeci">enum MQTTErrors mqtt_init(struct mqtt_client *client, mqtt_pal_socket_handle sockfd, uint8_t *sendbuf, size_t sendbufsz, uint8_t *recvbuf, size_t recvbufsz, void(*publish_response_callback)(void **state, struct mqtt_response_publish *publish))</div><div class="ttdoc">Initializes an MQTT client.This function must be called before any other API function calls...</div></div>
<div class="ttc" id="structmqtt__queued__message_html_ac20454e900b6d29e4d25edcdad57a99b"><div class="ttname"><a href="structmqtt__queued__message.html#ac20454e900b6d29e4d25edcdad57a99b">mqtt_queued_message::packet_id</a></div><div class="ttdeci">uint16_t packet_id</div><div class="ttdoc">The packet id of the message. </div><div class="ttdef"><b>Definition:</b> mqtt.h:939</div></div>
<div class="ttc" id="group__details_html_gacf553ca88f48350dbde0dc3b96e550f7"><div class="ttname"><a href="group__details.html#gacf553ca88f48350dbde0dc3b96e550f7">__mqtt_send</a></div><div class="ttdeci">ssize_t __mqtt_send(struct mqtt_client *client)</div><div class="ttdoc">Handles egress client traffic. </div></div>
<div class="ttc" id="group__packers_html_ga9cbd954d6bffd8fb0a06a6e4d34e4949"><div class="ttname"><a href="group__packers.html#ga9cbd954d6bffd8fb0a06a6e4d34e4949">mqtt_pack_pubxxx_request</a></div><div class="ttdeci">ssize_t mqtt_pack_pubxxx_request(uint8_t *buf, size_t bufsz, enum MQTTControlPacketType control_type, uint16_t packet_id)</div><div class="ttdoc">Serialize a PUBACK, PUBREC, PUBREL, or PUBCOMP packet and put it in buf. </div></div>
<div class="ttc" id="structmqtt__response__pingresp_html"><div class="ttname"><a href="structmqtt__response__pingresp.html">mqtt_response_pingresp</a></div><div class="ttdoc">The response to a ping request. </div><div class="ttdef"><b>Definition:</b> mqtt.h:478</div></div>
<div class="ttc" id="group__details_html_ga7ca75c661980d4af50493f59a386f378"><div class="ttname"><a href="group__details.html#ga7ca75c661980d4af50493f59a386f378">__mqtt_next_pid</a></div><div class="ttdeci">uint16_t __mqtt_next_pid(struct mqtt_client *client)</div><div class="ttdoc">Generate a new next packet ID.Packet ID&#39;s are generated using a max-length LFSR. </div></div>
<div class="ttc" id="structmqtt__response__pubrec_html"><div class="ttname"><a href="structmqtt__response__pubrec.html">mqtt_response_pubrec</a></div><div class="ttdoc">The response packet to a PUBLISH packet with QoS level 2. </div><div class="ttdef"><b>Definition:</b> mqtt.h:384</div></div>
<div class="ttc" id="mqtt_8h_html_a053442c47812d3a3ef1b9525a2520c78"><div class="ttname"><a href="mqtt_8h.html#a053442c47812d3a3ef1b9525a2520c78">__mqtt_unpack_uint16</a></div><div class="ttdeci">uint16_t __mqtt_unpack_uint16(const uint8_t *buf)</div><div class="ttdoc">Unpack a MQTT 16 bit integer to a native 16 bit integer. </div></div>
<div class="ttc" id="structmqtt__response__pubrel_html"><div class="ttname"><a href="structmqtt__response__pubrel.html">mqtt_response_pubrel</a></div><div class="ttdoc">The response to a PUBREC packet. </div><div class="ttdef"><b>Definition:</b> mqtt.h:398</div></div>
<div class="ttc" id="group__api_html_ga4becaa66425469cf462b531aa7eb1ac9"><div class="ttname"><a href="group__api.html#ga4becaa66425469cf462b531aa7eb1ac9">mqtt_init_reconnect</a></div><div class="ttdeci">void mqtt_init_reconnect(struct mqtt_client *client, void(*reconnect_callback)(struct mqtt_client *client, void **state), void *reconnect_state, void(*publish_response_callback)(void **state, struct mqtt_response_publish *publish))</div><div class="ttdoc">Initializes an MQTT client and enables automatic reconnections.An alternative to mqtt_init that allow...</div></div>
<div class="ttc" id="mqtt_8h_html_a86c09e2666bd14722fa165ed904f78cb"><div class="ttname"><a href="mqtt_8h.html#a86c09e2666bd14722fa165ed904f78cb">__ALL_MQTT_ERRORS</a></div><div class="ttdeci">#define __ALL_MQTT_ERRORS(MQTT_ERROR)</div><div class="ttdoc">A macro used to declare the enum MQTTErrors and associated error messages (the members of the num) at...</div><div class="ttdef"><b>Definition:</b> mqtt.h:165</div></div>
<div class="ttc" id="mqtt_8h_html_a223d30d2e6b84824ed995eda885d1e5d"><div class="ttname"><a href="mqtt_8h.html#a223d30d2e6b84824ed995eda885d1e5d">__mqtt_pack_str</a></div><div class="ttdeci">ssize_t __mqtt_pack_str(uint8_t *buf, const char *str)</div><div class="ttdoc">Pack a MQTT string, given a c-string str. </div></div>
<div class="ttc" id="group__api_html_gae472795684a1d973bfb89d075d17a29e"><div class="ttname"><a href="group__api.html#gae472795684a1d973bfb89d075d17a29e">mqtt_ping</a></div><div class="ttdeci">enum MQTTErrors mqtt_ping(struct mqtt_client *client)</div><div class="ttdoc">Ping the broker. </div></div>
<div class="ttc" id="structmqtt__fixed__header_html_a9bdea10facdc20756c457f282d58cfa1"><div class="ttname"><a href="structmqtt__fixed__header.html#a9bdea10facdc20756c457f282d58cfa1">mqtt_fixed_header::control_type</a></div><div class="ttdeci">enum MQTTControlPacketType control_type</div><div class="ttdef"><b>Definition:</b> mqtt.h:142</div></div>
<div class="ttc" id="group__api_html_ga08d16571dfefa690698c0cca5cca7a1d"><div class="ttname"><a href="group__api.html#ga08d16571dfefa690698c0cca5cca7a1d">mqtt_unsubscribe</a></div><div class="ttdeci">enum MQTTErrors mqtt_unsubscribe(struct mqtt_client *client, const char *topic_name)</div><div class="ttdoc">Unsubscribe from a topic. </div></div>
<div class="ttc" id="group__packers_html_ga7842c85a0711df31f2e9ce31a9253999"><div class="ttname"><a href="group__packers.html#ga7842c85a0711df31f2e9ce31a9253999">mqtt_pack_disconnect</a></div><div class="ttdeci">ssize_t mqtt_pack_disconnect(uint8_t *buf, size_t bufsz)</div><div class="ttdoc">Serialize a DISCONNECT and put it into buf. </div></div>
<div class="ttc" id="structmqtt__response__publish_html"><div class="ttname"><a href="structmqtt__response__publish.html">mqtt_response_publish</a></div><div class="ttdoc">A publish packet received from the broker.A publish packet is received from the broker when a client ...</div><div class="ttdef"><b>Definition:</b> mqtt.h:322</div></div>
<div class="ttc" id="structmqtt__fixed__header_html_ac01e888a49b83e3d34ca14f140b72d7a"><div class="ttname"><a href="structmqtt__fixed__header.html#ac01e888a49b83e3d34ca14f140b72d7a">mqtt_fixed_header::remaining_length</a></div><div class="ttdeci">uint32_t remaining_length</div><div class="ttdef"><b>Definition:</b> mqtt.h:148</div></div>
<div class="ttc" id="mqtt_8h_html_a3968f3df67a7ded8f3e21faad10139c9"><div class="ttname"><a href="mqtt_8h.html#a3968f3df67a7ded8f3e21faad10139c9">__mqtt_pack_uint16</a></div><div class="ttdeci">ssize_t __mqtt_pack_uint16(uint8_t *buf, uint16_t integer)</div><div class="ttdoc">Pack a MQTT 16 bit integer, given a native 16 bit integer . </div></div>
<div class="ttc" id="group__api_html_gad0c901a8d30691ed0ca17915b691b7e7"><div class="ttname"><a href="group__api.html#gad0c901a8d30691ed0ca17915b691b7e7">MQTTErrors</a></div><div class="ttdeci">MQTTErrors</div><div class="ttdoc">An enumeration of error codes. Error messages can be retrieved by calling mqtt_error_str. </div><div class="ttdef"><b>Definition:</b> mqtt.h:216</div></div>
<div class="ttc" id="group__packers_html_ga38ee59ca9d618d53da7d7c9bf0397942"><div class="ttname"><a href="group__packers.html#ga38ee59ca9d618d53da7d7c9bf0397942">mqtt_pack_subscribe_request</a></div><div class="ttdeci">ssize_t mqtt_pack_subscribe_request(uint8_t *buf, size_t bufsz, unsigned int packet_id,...)</div><div class="ttdoc">Serialize a SUBSCRIBE packet and put it in buf. </div></div>
<div class="ttc" id="structmqtt__response__puback_html"><div class="ttname"><a href="structmqtt__response__puback.html">mqtt_response_puback</a></div><div class="ttdoc">A publish acknowledgement for messages that were published with QoS level 1. </div><div class="ttdef"><b>Definition:</b> mqtt.h:370</div></div>
<div class="ttc" id="group__packers_html_ga327bce82ca8cce7f45e50e0edeb60987"><div class="ttname"><a href="group__packers.html#ga327bce82ca8cce7f45e50e0edeb60987">mqtt_pack_connection_request</a></div><div class="ttdeci">ssize_t mqtt_pack_connection_request(uint8_t *buf, size_t bufsz, const char *client_id, const char *will_topic, const void *will_message, size_t will_message_size, const char *user_name, const char *password, uint8_t connect_flags, uint16_t keep_alive)</div><div class="ttdoc">Serialize a connection request into a buffer. </div></div>
<div class="ttc" id="group__packers_html_gac11b5cc5c6bbbf386c2515c823965a82"><div class="ttname"><a href="group__packers.html#gac11b5cc5c6bbbf386c2515c823965a82">mqtt_pack_ping_request</a></div><div class="ttdeci">ssize_t mqtt_pack_ping_request(uint8_t *buf, size_t bufsz)</div><div class="ttdoc">Serialize a PINGREQ and put it into buf. </div></div>
<div class="ttc" id="group__details_html_ga874c62f7a20b6adf13dbed2b4e2dd985"><div class="ttname"><a href="group__details.html#ga874c62f7a20b6adf13dbed2b4e2dd985">__mqtt_pubrec</a></div><div class="ttdeci">ssize_t __mqtt_pubrec(struct mqtt_client *client, uint16_t packet_id)</div><div class="ttdoc">Acknowledge an ingree publish with QOS==2. </div></div>
<div class="ttc" id="group__unpackers_html_gad596aa5faf7f79e05fb15da33321db10"><div class="ttname"><a href="group__unpackers.html#gad596aa5faf7f79e05fb15da33321db10">mqtt_unpack_fixed_header</a></div><div class="ttdeci">ssize_t mqtt_unpack_fixed_header(struct mqtt_response *response, const uint8_t *buf, size_t bufsz)</div><div class="ttdoc">Deserialize the contents of buf into an mqtt_fixed_header object. </div></div>
<div class="ttc" id="group__api_html_gaea5da9b546f6e91eb77c9eff9c478de5"><div class="ttname"><a href="group__api.html#gaea5da9b546f6e91eb77c9eff9c478de5">mqtt_subscribe</a></div><div class="ttdeci">enum MQTTErrors mqtt_subscribe(struct mqtt_client *client, const char *topic_name, int max_qos_level)</div><div class="ttdoc">Subscribe to a topic. </div></div>
<div class="ttc" id="group__details_html_ga86ddd2a08fbe4bd351dfd161db93303d"><div class="ttname"><a href="group__details.html#ga86ddd2a08fbe4bd351dfd161db93303d">__mqtt_pubcomp</a></div><div class="ttdeci">ssize_t __mqtt_pubcomp(struct mqtt_client *client, uint16_t packet_id)</div><div class="ttdoc">Acknowledge an ingree PUBREL packet. </div></div>
<div class="ttc" id="group__api_html_ga47b62bdd24e8b05957825d2419d7c848"><div class="ttname"><a href="group__api.html#ga47b62bdd24e8b05957825d2419d7c848">mqtt_error_str</a></div><div class="ttdeci">const char * mqtt_error_str(enum MQTTErrors error)</div><div class="ttdoc">Returns an error message for error code, error. </div></div>
<div class="ttc" id="mqtt_8h_html_aed8760364c7992625d06c93d12b2496d"><div class="ttname"><a href="mqtt_8h.html#aed8760364c7992625d06c93d12b2496d">GENERATE_ENUM</a></div><div class="ttdeci">#define GENERATE_ENUM(ENUM)</div><div class="ttdoc">A macro used to generate the enum MQTTErrors from __ALL_MQTT_ERRORS. </div><div class="ttdef"><b>Definition:</b> mqtt.h:200</div></div>
<div class="ttc" id="group__api_html_ga0d8fed24a799ab9b55eeb28f3cd2d0a8"><div class="ttname"><a href="group__api.html#ga0d8fed24a799ab9b55eeb28f3cd2d0a8">mqtt_publish</a></div><div class="ttdeci">enum MQTTErrors mqtt_publish(struct mqtt_client *client, const char *topic_name, void *application_message, size_t application_message_size, uint8_t publish_flags)</div><div class="ttdoc">Publish an application message.Publishes an application message to the MQTT broker. </div></div>
<div class="ttc" id="group__packers_html_gaa863cb90857670e8faa6b18a1103e0d6"><div class="ttname"><a href="group__packers.html#gaa863cb90857670e8faa6b18a1103e0d6">mqtt_pack_unsubscribe_request</a></div><div class="ttdeci">ssize_t mqtt_pack_unsubscribe_request(uint8_t *buf, size_t bufsz, unsigned int packet_id,...)</div><div class="ttdoc">Serialize a UNSUBSCRIBE packet and put it in buf. </div></div>
<div class="ttc" id="group__details_html_gae09d4412a871ecec31377db55cc54228"><div class="ttname"><a href="group__details.html#gae09d4412a871ecec31377db55cc54228">__mqtt_puback</a></div><div class="ttdeci">ssize_t __mqtt_puback(struct mqtt_client *client, uint16_t packet_id)</div><div class="ttdoc">Acknowledge an ingree publish with QOS==1. </div></div>
<div class="ttc" id="structmqtt__fixed__header_html_adee2e745059e4438cf74231191391ab1"><div class="ttname"><a href="structmqtt__fixed__header.html#adee2e745059e4438cf74231191391ab1">mqtt_fixed_header::control_flags</a></div><div class="ttdeci">uint32_t control_flags</div><div class="ttdef"><b>Definition:</b> mqtt.h:145</div></div>
<div class="ttc" id="mqtt__pal_8h_html"><div class="ttname"><a href="mqtt__pal_8h.html">mqtt_pal.h</a></div><div class="ttdoc">Includes/supports the types/calls required by the MQTT-C client. </div></div>
<div class="ttc" id="group__packers_html_gad38a41e1c497f9bcd2477c005f280b23"><div class="ttname"><a href="group__packers.html#gad38a41e1c497f9bcd2477c005f280b23">MQTTPublishFlags</a></div><div class="ttdeci">MQTTPublishFlags</div><div class="ttdoc">An enumeration of the PUBLISH flags. </div><div class="ttdef"><b>Definition:</b> mqtt.h:723</div></div>
<div class="ttc" id="group__api_html_gadbe914e5a9d4f93314c4e7637cb4f7b3"><div class="ttname"><a href="group__api.html#gadbe914e5a9d4f93314c4e7637cb4f7b3">mqtt_connect</a></div><div class="ttdeci">enum MQTTErrors mqtt_connect(struct mqtt_client *client, const char *client_id, const char *will_topic, const void *will_message, size_t will_message_size, const char *user_name, const char *password, uint8_t connect_flags, uint16_t keep_alive)</div><div class="ttdoc">Establishes a session with the MQTT broker. </div></div>
<div class="ttc" id="group__packers_html_ga52d369e6e7d44539aab6732375288623"><div class="ttname"><a href="group__packers.html#ga52d369e6e7d44539aab6732375288623">mqtt_pack_fixed_header</a></div><div class="ttdeci">ssize_t mqtt_pack_fixed_header(uint8_t *buf, size_t bufsz, const struct mqtt_fixed_header *fixed_header)</div><div class="ttdoc">Serialize an mqtt_fixed_header and write it to buf. </div></div>
<div class="ttc" id="group__api_html_gae3d3aafc7588ed53a90c9f66fc620a6e"><div class="ttname"><a href="group__api.html#gae3d3aafc7588ed53a90c9f66fc620a6e">mqtt_sync</a></div><div class="ttdeci">enum MQTTErrors mqtt_sync(struct mqtt_client *client)</div><div class="ttdoc">Function that does the actual sending and receiving of traffic from the network.All the other functio...</div></div>
<div class="ttc" id="structmqtt__response__suback_html"><div class="ttname"><a href="structmqtt__response__suback.html">mqtt_response_suback</a></div><div class="ttdoc">The response to a subscription request. </div><div class="ttdef"><b>Definition:</b> mqtt.h:440</div></div>
<div class="ttc" id="group__api_html_ga95d9981735ab4495d3d65e8056611126"><div class="ttname"><a href="group__api.html#ga95d9981735ab4495d3d65e8056611126">mqtt_disconnect</a></div><div class="ttdeci">enum MQTTErrors mqtt_disconnect(struct mqtt_client *client)</div><div class="ttdoc">Terminate the session with the MQTT broker. </div></div>
<div class="ttc" id="group__details_html_ga427f9191ab9967b75e0a7a2f7fa0dca0"><div class="ttname"><a href="group__details.html#ga427f9191ab9967b75e0a7a2f7fa0dca0">__mqtt_pubrel</a></div><div class="ttdeci">ssize_t __mqtt_pubrel(struct mqtt_client *client, uint16_t packet_id)</div><div class="ttdoc">Acknowledge an ingree PUBREC packet. </div></div>
<div class="ttc" id="structmqtt__message__queue_html"><div class="ttname"><a href="structmqtt__message__queue.html">mqtt_message_queue</a></div><div class="ttdoc">A message queue. </div><div class="ttdef"><b>Definition:</b> mqtt.h:949</div></div>
<div class="ttc" id="group__unpackers_html_ga2d626b05e589a148ce2e9e97f41302ae"><div class="ttname"><a href="group__unpackers.html#ga2d626b05e589a148ce2e9e97f41302ae">MQTTSubackReturnCodes</a></div><div class="ttdeci">MQTTSubackReturnCodes</div><div class="ttdoc">An enumeration of subscription acknowledgement return codes. </div><div class="ttdef"><b>Definition:</b> mqtt.h:425</div></div>
<div class="ttc" id="group__packers_html_gad6fa84a96a940fe4eae6ffca1a6d945f"><div class="ttname"><a href="group__packers.html#gad6fa84a96a940fe4eae6ffca1a6d945f">MQTTConnectFlags</a></div><div class="ttdeci">MQTTConnectFlags</div><div class="ttdoc">An enumeration of CONNECT packet flags. </div><div class="ttdef"><b>Definition:</b> mqtt.h:655</div></div>
<div class="ttc" id="structmqtt__response_html"><div class="ttname"><a href="structmqtt__response.html">mqtt_response</a></div><div class="ttdoc">A struct used to deserialize/interpret an incoming packet from the broker. </div><div class="ttdef"><b>Definition:</b> mqtt.h:486</div></div>
<div class="ttc" id="group__packers_html_gae7cb4c4d90ed04fe268f5f9a167e32b1"><div class="ttname"><a href="group__packers.html#gae7cb4c4d90ed04fe268f5f9a167e32b1">mqtt_pack_publish_request</a></div><div class="ttdeci">ssize_t mqtt_pack_publish_request(uint8_t *buf, size_t bufsz, const char *topic_name, uint16_t packet_id, void *application_message, size_t application_message_size, uint8_t publish_flags)</div><div class="ttdoc">Serialize a PUBLISH request and put it in buf. </div></div>
<div class="ttc" id="structmqtt__response__pubcomp_html"><div class="ttname"><a href="structmqtt__response__pubcomp.html">mqtt_response_pubcomp</a></div><div class="ttdoc">The response to a PUBREL packet. </div><div class="ttdef"><b>Definition:</b> mqtt.h:412</div></div>
<div class="ttc" id="structmqtt__client_html"><div class="ttname"><a href="structmqtt__client.html">mqtt_client</a></div><div class="ttdoc">An MQTT client. </div><div class="ttdef"><b>Definition:</b> mqtt.h:1073</div></div>
<div class="ttc" id="structmqtt__queued__message_html"><div class="ttname"><a href="structmqtt__queued__message.html">mqtt_queued_message</a></div><div class="ttdoc">A message in a mqtt_message_queue. </div><div class="ttdef"><b>Definition:</b> mqtt.h:910</div></div>
<div class="ttc" id="structmqtt__fixed__header_html"><div class="ttname"><a href="structmqtt__fixed__header.html">mqtt_fixed_header</a></div><div class="ttdoc">The fixed header of an MQTT control packet. </div><div class="ttdef"><b>Definition:</b> mqtt.h:140</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>