group__wsstatus.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <meta name="generator" content="Doxygen 1.8.11"/>
  7. <title>libwebsockets: Websocket status APIs</title>
  8. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  9. <script type="text/javascript" src="jquery.js"></script>
  10. <script type="text/javascript" src="dynsections.js"></script>
  11. <link href="navtree.css" rel="stylesheet" type="text/css"/>
  12. <script type="text/javascript" src="resize.js"></script>
  13. <script type="text/javascript" src="navtreedata.js"></script>
  14. <script type="text/javascript" src="navtree.js"></script>
  15. <script type="text/javascript">
  16. $(document).ready(initResizable);
  17. $(window).load(resizeHeight);
  18. </script>
  19. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  20. </head>
  21. <body>
  22. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  23. <div id="titlearea">
  24. <table cellspacing="0" cellpadding="0">
  25. <tbody>
  26. <tr style="height: 56px;">
  27. <td id="projectlogo"><img alt="Logo" src="libwebsockets.org-logo.png"/></td>
  28. <td id="projectalign" style="padding-left: 0.5em;">
  29. <div id="projectname">libwebsockets
  30. </div>
  31. <div id="projectbrief">Lightweight C library for HTML5 websockets</div>
  32. </td>
  33. </tr>
  34. </tbody>
  35. </table>
  36. </div>
  37. <!-- end header part -->
  38. <!-- Generated by Doxygen 1.8.11 -->
  39. <div id="navrow1" class="tabs">
  40. <ul class="tablist">
  41. <li><a href="index.html"><span>Main&#160;Page</span></a></li>
  42. <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
  43. <li class="current"><a href="modules.html"><span>Modules</span></a></li>
  44. <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
  45. <li><a href="files.html"><span>Files</span></a></li>
  46. </ul>
  47. </div>
  48. </div><!-- top -->
  49. <div id="side-nav" class="ui-resizable side-nav-resizable">
  50. <div id="nav-tree">
  51. <div id="nav-tree-contents">
  52. <div id="nav-sync" class="sync"></div>
  53. </div>
  54. </div>
  55. <div id="splitbar" style="-moz-user-select:none;"
  56. class="ui-resizable-handle">
  57. </div>
  58. </div>
  59. <script type="text/javascript">
  60. $(document).ready(function(){initNavTree('group__wsstatus.html','');});
  61. </script>
  62. <div id="doc-content">
  63. <div class="header">
  64. <div class="summary">
  65. <a href="#func-members">Functions</a> </div>
  66. <div class="headertitle">
  67. <div class="title">Websocket status APIs</div> </div>
  68. </div><!--header-->
  69. <div class="contents">
  70. <table class="memberdecls">
  71. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
  72. Functions</h2></td></tr>
  73. <tr class="memitem:ga2bb3655329b4651cd06f79ee3a764421"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wsstatus.html#ga2bb3655329b4651cd06f79ee3a764421">lws_send_pipe_choked</a> (struct lws *wsi)</td></tr>
  74. <tr class="separator:ga2bb3655329b4651cd06f79ee3a764421"><td class="memSeparator" colspan="2">&#160;</td></tr>
  75. <tr class="memitem:ga08e9ee165fca503fd9427d55cfecac37"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wsstatus.html#ga08e9ee165fca503fd9427d55cfecac37">lws_is_final_fragment</a> (struct lws *wsi)</td></tr>
  76. <tr class="separator:ga08e9ee165fca503fd9427d55cfecac37"><td class="memSeparator" colspan="2">&#160;</td></tr>
  77. <tr class="memitem:ga3df5045656dfb6b0e63a38de2dca79d2"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN unsigned char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wsstatus.html#ga3df5045656dfb6b0e63a38de2dca79d2">lws_get_reserved_bits</a> (struct lws *wsi)</td></tr>
  78. <tr class="separator:ga3df5045656dfb6b0e63a38de2dca79d2"><td class="memSeparator" colspan="2">&#160;</td></tr>
  79. <tr class="memitem:gaeca4afc94b1f026034f99cbba37e2f85"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wsstatus.html#gaeca4afc94b1f026034f99cbba37e2f85">lws_partial_buffered</a> (struct lws *wsi)</td></tr>
  80. <tr class="separator:gaeca4afc94b1f026034f99cbba37e2f85"><td class="memSeparator" colspan="2">&#160;</td></tr>
  81. <tr class="memitem:gaccd9c59336efad8af0554f79cc5966fd"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wsstatus.html#gaccd9c59336efad8af0554f79cc5966fd">lws_frame_is_binary</a> (struct lws *wsi)</td></tr>
  82. <tr class="separator:gaccd9c59336efad8af0554f79cc5966fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
  83. <tr class="memitem:ga26a140623d202dd2bf2004deb6994baa"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wsstatus.html#ga26a140623d202dd2bf2004deb6994baa">lws_is_ssl</a> (struct lws *wsi)</td></tr>
  84. <tr class="separator:ga26a140623d202dd2bf2004deb6994baa"><td class="memSeparator" colspan="2">&#160;</td></tr>
  85. <tr class="memitem:ga4ad226d5e01024b4046f4a5a37199aa1"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wsstatus.html#ga4ad226d5e01024b4046f4a5a37199aa1">lws_is_cgi</a> (struct lws *wsi)</td></tr>
  86. <tr class="separator:ga4ad226d5e01024b4046f4a5a37199aa1"><td class="memSeparator" colspan="2">&#160;</td></tr>
  87. </table>
  88. <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
  89. <h2>Websocket connection status APIs</h2>
  90. <p>These provide information about ws connection or message status </p>
  91. <h2 class="groupheader">Function Documentation</h2>
  92. <a class="anchor" id="gaccd9c59336efad8af0554f79cc5966fd"></a>
  93. <div class="memitem">
  94. <div class="memproto">
  95. <table class="memname">
  96. <tr>
  97. <td class="memname">LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_frame_is_binary </td>
  98. <td>(</td>
  99. <td class="paramtype">struct lws *&#160;</td>
  100. <td class="paramname"><em>wsi</em></td><td>)</td>
  101. <td></td>
  102. </tr>
  103. </table>
  104. </div><div class="memdoc">
  105. <p><code>#include &lt;<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>&gt;</code></p>
  106. <p><a class="el" href="group__wsstatus.html#gaccd9c59336efad8af0554f79cc5966fd">lws_frame_is_binary()</a>: true if the current frame was sent in binary mode</p>
  107. <dl class="params"><dt>Parameters</dt><dd>
  108. <table class="params">
  109. <tr><td class="paramname">wsi</td><td>the connection we are inquiring about</td></tr>
  110. </table>
  111. </dd>
  112. </dl>
  113. <p>This is intended to be called from the LWS_CALLBACK_RECEIVE callback if it's interested to see if the frame it's dealing with was sent in binary mode. </p>
  114. </div>
  115. </div>
  116. <a class="anchor" id="ga3df5045656dfb6b0e63a38de2dca79d2"></a>
  117. <div class="memitem">
  118. <div class="memproto">
  119. <table class="memname">
  120. <tr>
  121. <td class="memname">LWS_VISIBLE LWS_EXTERN unsigned char lws_get_reserved_bits </td>
  122. <td>(</td>
  123. <td class="paramtype">struct lws *&#160;</td>
  124. <td class="paramname"><em>wsi</em></td><td>)</td>
  125. <td></td>
  126. </tr>
  127. </table>
  128. </div><div class="memdoc">
  129. <p><code>#include &lt;<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>&gt;</code></p>
  130. <p><a class="el" href="group__wsstatus.html#ga3df5045656dfb6b0e63a38de2dca79d2">lws_get_reserved_bits()</a> - access reserved bits of ws frame </p><dl class="params"><dt>Parameters</dt><dd>
  131. <table class="params">
  132. <tr><td class="paramname">wsi</td><td>lws connection </td></tr>
  133. </table>
  134. </dd>
  135. </dl>
  136. </div>
  137. </div>
  138. <a class="anchor" id="ga4ad226d5e01024b4046f4a5a37199aa1"></a>
  139. <div class="memitem">
  140. <div class="memproto">
  141. <table class="memname">
  142. <tr>
  143. <td class="memname">LWS_VISIBLE LWS_EXTERN int lws_is_cgi </td>
  144. <td>(</td>
  145. <td class="paramtype">struct lws *&#160;</td>
  146. <td class="paramname"><em>wsi</em></td><td>)</td>
  147. <td></td>
  148. </tr>
  149. </table>
  150. </div><div class="memdoc">
  151. <p><code>#include &lt;<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>&gt;</code></p>
  152. <p><a class="el" href="group__wsstatus.html#ga4ad226d5e01024b4046f4a5a37199aa1">lws_is_cgi()</a> - find out if this wsi is running a cgi process </p><dl class="params"><dt>Parameters</dt><dd>
  153. <table class="params">
  154. <tr><td class="paramname">wsi</td><td>lws connection </td></tr>
  155. </table>
  156. </dd>
  157. </dl>
  158. </div>
  159. </div>
  160. <a class="anchor" id="ga08e9ee165fca503fd9427d55cfecac37"></a>
  161. <div class="memitem">
  162. <div class="memproto">
  163. <table class="memname">
  164. <tr>
  165. <td class="memname">LWS_VISIBLE LWS_EXTERN int lws_is_final_fragment </td>
  166. <td>(</td>
  167. <td class="paramtype">struct lws *&#160;</td>
  168. <td class="paramname"><em>wsi</em></td><td>)</td>
  169. <td></td>
  170. </tr>
  171. </table>
  172. </div><div class="memdoc">
  173. <p><code>#include &lt;<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>&gt;</code></p>
  174. <p><a class="el" href="group__wsstatus.html#ga08e9ee165fca503fd9427d55cfecac37">lws_is_final_fragment()</a> - tests if last part of ws message </p><dl class="params"><dt>Parameters</dt><dd>
  175. <table class="params">
  176. <tr><td class="paramname">wsi</td><td>lws connection </td></tr>
  177. </table>
  178. </dd>
  179. </dl>
  180. </div>
  181. </div>
  182. <a class="anchor" id="ga26a140623d202dd2bf2004deb6994baa"></a>
  183. <div class="memitem">
  184. <div class="memproto">
  185. <table class="memname">
  186. <tr>
  187. <td class="memname">LWS_VISIBLE LWS_EXTERN int lws_is_ssl </td>
  188. <td>(</td>
  189. <td class="paramtype">struct lws *&#160;</td>
  190. <td class="paramname"><em>wsi</em></td><td>)</td>
  191. <td></td>
  192. </tr>
  193. </table>
  194. </div><div class="memdoc">
  195. <p><code>#include &lt;<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>&gt;</code></p>
  196. <p><a class="el" href="group__wsstatus.html#ga26a140623d202dd2bf2004deb6994baa">lws_is_ssl()</a> - Find out if connection is using SSL </p><dl class="params"><dt>Parameters</dt><dd>
  197. <table class="params">
  198. <tr><td class="paramname">wsi</td><td>websocket connection to check <pre class="fragment"> Returns 0 if the connection is not using SSL, 1 if using SSL and
  199. using verified cert, and 2 if using SSL but the cert was not
  200. checked (appears for client wsi told to skip check on connection)</pre> </td></tr>
  201. </table>
  202. </dd>
  203. </dl>
  204. </div>
  205. </div>
  206. <a class="anchor" id="gaeca4afc94b1f026034f99cbba37e2f85"></a>
  207. <div class="memitem">
  208. <div class="memproto">
  209. <table class="memname">
  210. <tr>
  211. <td class="memname">LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_partial_buffered </td>
  212. <td>(</td>
  213. <td class="paramtype">struct lws *&#160;</td>
  214. <td class="paramname"><em>wsi</em></td><td>)</td>
  215. <td></td>
  216. </tr>
  217. </table>
  218. </div><div class="memdoc">
  219. <p><code>#include &lt;<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>&gt;</code></p>
  220. <p><a class="el" href="group__wsstatus.html#gaeca4afc94b1f026034f99cbba37e2f85">lws_partial_buffered()</a> - find out if lws buffered the last write </p><dl class="params"><dt>Parameters</dt><dd>
  221. <table class="params">
  222. <tr><td class="paramname">wsi</td><td>websocket connection to check</td></tr>
  223. </table>
  224. </dd>
  225. </dl>
  226. <p>Returns 1 if you cannot use lws_write because the last write on this connection is still buffered, and can't be cleared without returning to the service loop and waiting for the connection to be writeable again.</p>
  227. <p>If you will try to do &gt;1 lws_write call inside a single WRITEABLE callback, you must check this after every write and bail if set, ask for a new writeable callback and continue writing from there.</p>
  228. <p>This is never set at the start of a writeable callback, but any write may set it. </p>
  229. </div>
  230. </div>
  231. <a class="anchor" id="ga2bb3655329b4651cd06f79ee3a764421"></a>
  232. <div class="memitem">
  233. <div class="memproto">
  234. <table class="memname">
  235. <tr>
  236. <td class="memname">LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_send_pipe_choked </td>
  237. <td>(</td>
  238. <td class="paramtype">struct lws *&#160;</td>
  239. <td class="paramname"><em>wsi</em></td><td>)</td>
  240. <td></td>
  241. </tr>
  242. </table>
  243. </div><div class="memdoc">
  244. <p><code>#include &lt;<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>&gt;</code></p>
  245. <p><a class="el" href="group__wsstatus.html#ga2bb3655329b4651cd06f79ee3a764421">lws_send_pipe_choked()</a> - tests if socket is writable or not </p><dl class="params"><dt>Parameters</dt><dd>
  246. <table class="params">
  247. <tr><td class="paramname">wsi</td><td>lws connection</td></tr>
  248. </table>
  249. </dd>
  250. </dl>
  251. <p>Allows you to check if you can write more on the socket </p>
  252. </div>
  253. </div>
  254. </div><!-- contents -->
  255. </div><!-- doc-content -->
  256. <!-- start footer part -->
  257. <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  258. <ul>
  259. <li class="footer">Generated by
  260. <a href="http://www.doxygen.org/index.html">
  261. <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  262. </ul>
  263. </div>
  264. </body>
  265. </html>