forked from LiamBindle/MQTT-C
-
Notifications
You must be signed in to change notification settings - Fork 0
/
group__pal.html
201 lines (194 loc) · 9.84 KB
/
group__pal.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!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: Platform abstraction layer</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><!-- top -->
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">Platform abstraction layer</div> </div>
</div><!--header-->
<div class="contents">
<p>Documentation of the types and calls required to port MQTT-C to a new platform.
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga9111a3f19c6ff3e5c22c93b1066898f5"><td class="memItemLeft" align="right" valign="top">ssize_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pal.html#ga9111a3f19c6ff3e5c22c93b1066898f5">mqtt_pal_sendall</a> (mqtt_pal_socket_handle fd, const void *buf, size_t len, int flags)</td></tr>
<tr class="memdesc:ga9111a3f19c6ff3e5c22c93b1066898f5"><td class="mdescLeft"> </td><td class="mdescRight">Sends all the bytes in a buffer. <a href="#ga9111a3f19c6ff3e5c22c93b1066898f5">More...</a><br /></td></tr>
<tr class="separator:ga9111a3f19c6ff3e5c22c93b1066898f5"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga013a74368db595f9832c9fe717a84f4d"><td class="memItemLeft" align="right" valign="top">ssize_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pal.html#ga013a74368db595f9832c9fe717a84f4d">mqtt_pal_recvall</a> (mqtt_pal_socket_handle fd, void *buf, size_t bufsz, int flags)</td></tr>
<tr class="memdesc:ga013a74368db595f9832c9fe717a84f4d"><td class="mdescLeft"> </td><td class="mdescRight">Non-blocking receive all the byte available. <a href="#ga013a74368db595f9832c9fe717a84f4d">More...</a><br /></td></tr>
<tr class="separator:ga013a74368db595f9832c9fe717a84f4d"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Documentation of the types and calls required to port MQTT-C to a new platform. </p>
<p><a class="el" href="mqtt__pal_8h.html" title="Includes/supports the types/calls required by the MQTT-C client. ">mqtt_pal.h</a> is the <em>only</em> header file included in <a class="el" href="mqtt_8c.html" title="Implements the functionality of MQTT-C. ">mqtt.c</a>. Therefore, to port MQTT-C to a new platform the following types, functions, constants, and macros must be defined in <a class="el" href="mqtt__pal_8h.html" title="Includes/supports the types/calls required by the MQTT-C client. ">mqtt_pal.h</a>:</p><ul>
<li>Types:<ul>
<li><code>size_t</code>, <code>ssize_t</code> </li>
<li><code>uint8_t</code>, <code>uint16_t</code>, <code>uint32_t</code> </li>
<li><code>va_list</code> </li>
<li><code>mqtt_pal_time_t</code> : return type of <code>MQTT_PAL_TIME()</code> </li>
<li><code>mqtt_pal_mutex_t</code> : type of the argument that is passed to <code>MQTT_PAL_MUTEX_LOCK</code> and <code>MQTT_PAL_MUTEX_RELEASE</code> </li>
</ul>
</li>
<li>Functions:<ul>
<li><code>memcpy</code>, <code>strlen</code> </li>
<li><code>va_start</code>, <code>va_arg</code>, <code>va_end</code> </li>
</ul>
</li>
<li>Constants:<ul>
<li><code>INT_MIN</code> </li>
</ul>
</li>
</ul>
<p>Additionally, three macro's are required:</p><ul>
<li><code>MQTT_PAL_HTONS(s)</code> : host-to-network endian conversion for uint16_t.</li>
<li><code>MQTT_PAL_NTOHS(s)</code> : network-to-host endian conversion for uint16_t.</li>
<li><code>MQTT_PAL_TIME()</code> : returns [type: <code>mqtt_pal_time_t</code>] current time in seconds.</li>
<li><code>MQTT_PAL_MUTEX_LOCK(mtx_pointer)</code> : macro that locks the mutex pointed to by <code>mtx_pointer</code>.</li>
<li><code>MQTT_PAL_MUTEX_RELEASE(mtx_pointer)</code> : macro that unlocks the mutex pointed to by <code>mtx_pointer</code>.</li>
</ul>
<p>Lastly, <a class="el" href="group__pal.html#ga9111a3f19c6ff3e5c22c93b1066898f5">mqtt_pal_sendall</a> and <a class="el" href="group__pal.html#ga013a74368db595f9832c9fe717a84f4d">mqtt_pal_recvall</a>, must be implemented in <a class="el" href="mqtt__pal_8c.html" title="Implements mqtt_pal_sendall and mqtt_pal_recvall and any platform-specific helpers you'd like...">mqtt_pal.c</a> for sending and receiving data using the platforms socket calls. </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga013a74368db595f9832c9fe717a84f4d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga013a74368db595f9832c9fe717a84f4d">◆ </a></span>mqtt_pal_recvall()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">ssize_t mqtt_pal_recvall </td>
<td>(</td>
<td class="paramtype">mqtt_pal_socket_handle </td>
<td class="paramname"><em>fd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void * </td>
<td class="paramname"><em>buf</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>bufsz</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>flags</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Non-blocking receive all the byte available. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">fd</td><td>The file-descriptor (or handle) of the socket. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">buf</td><td>A pointer to the receive buffer. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">bufsz</td><td>The max number of bytes that can be put into <code>buf</code>. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">flags</td><td>Flags which are passed to the underlying socket.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of bytes received if successful, an <a class="el" href="group__api.html#gad0c901a8d30691ed0ca17915b691b7e7">MQTTErrors</a> otherwise. </dd></dl>
</div>
</div>
<a id="ga9111a3f19c6ff3e5c22c93b1066898f5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9111a3f19c6ff3e5c22c93b1066898f5">◆ </a></span>mqtt_pal_sendall()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">ssize_t mqtt_pal_sendall </td>
<td>(</td>
<td class="paramtype">mqtt_pal_socket_handle </td>
<td class="paramname"><em>fd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const void * </td>
<td class="paramname"><em>buf</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>flags</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sends all the bytes in a buffer. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">fd</td><td>The file-descriptor (or handle) of the socket. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">buf</td><td>A pointer to the first byte in the buffer to send. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">len</td><td>The number of bytes to send (starting at <code>buf</code>). </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">flags</td><td>Flags which are passed to the underlying socket.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of bytes sent if successful, an <a class="el" href="group__api.html#gad0c901a8d30691ed0ca17915b691b7e7">MQTTErrors</a> otherwise. </dd></dl>
</div>
</div>
</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>