nixio.TLSSocket.html 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html>
  4. <head>
  5. <title>Reference</title>
  6. <link rel="stylesheet" href="../luadoc.css" type="text/css" />
  7. <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
  8. </head>
  9. <body>
  10. <div id="container">
  11. <div id="product">
  12. <div id="product_logo"></div>
  13. <div id="product_name"><big><b></b></big></div>
  14. <div id="product_description"></div>
  15. </div> <!-- id="product" -->
  16. <div id="main">
  17. <div id="navigation">
  18. <h1>LuaDoc</h1>
  19. <ul>
  20. <li><a href="../index.html">Index</a></li>
  21. </ul>
  22. <!-- Module list -->
  23. <h1>Modules</h1>
  24. <ul>
  25. <li>
  26. <a href="../modules/luci.dispatcher.html">luci.dispatcher</a>
  27. </li>
  28. <li>
  29. <a href="../modules/luci.http.html">luci.http</a>
  30. </li>
  31. <li>
  32. <a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
  33. </li>
  34. <li>
  35. <a href="../modules/luci.http.date.html">luci.http.date</a>
  36. </li>
  37. <li>
  38. <a href="../modules/luci.http.mime.html">luci.http.mime</a>
  39. </li>
  40. <li>
  41. <a href="../modules/luci.i18n.html">luci.i18n</a>
  42. </li>
  43. <li>
  44. <a href="../modules/luci.ip.html">luci.ip</a>
  45. </li>
  46. <li>
  47. <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
  48. </li>
  49. <li>
  50. <a href="../modules/luci.json.html">luci.json</a>
  51. </li>
  52. <li>
  53. <a href="../modules/luci.jsonc.html">luci.jsonc</a>
  54. </li>
  55. <li>
  56. <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
  57. </li>
  58. <li>
  59. <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
  60. </li>
  61. <li>
  62. <a href="../modules/luci.model.uci.html">luci.model.uci</a>
  63. </li>
  64. <li>
  65. <a href="../modules/luci.rpcc.html">luci.rpcc</a>
  66. </li>
  67. <li>
  68. <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
  69. </li>
  70. <li>
  71. <a href="../modules/luci.sys.html">luci.sys</a>
  72. </li>
  73. <li>
  74. <a href="../modules/luci.sys.init.html">luci.sys.init</a>
  75. </li>
  76. <li>
  77. <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
  78. </li>
  79. <li>
  80. <a href="../modules/luci.sys.net.html">luci.sys.net</a>
  81. </li>
  82. <li>
  83. <a href="../modules/luci.sys.process.html">luci.sys.process</a>
  84. </li>
  85. <li>
  86. <a href="../modules/luci.sys.user.html">luci.sys.user</a>
  87. </li>
  88. <li>
  89. <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
  90. </li>
  91. <li>
  92. <a href="../modules/luci.util.html">luci.util</a>
  93. </li>
  94. <li>
  95. <a href="../modules/nixio.html">nixio</a>
  96. </li>
  97. <li>
  98. <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
  99. </li>
  100. <li>
  101. <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
  102. </li>
  103. <li>
  104. <a href="../modules/nixio.File.html">nixio.File</a>
  105. </li>
  106. <li>
  107. <a href="../modules/nixio.README.html">nixio.README</a>
  108. </li>
  109. <li>
  110. <a href="../modules/nixio.Socket.html">nixio.Socket</a>
  111. </li>
  112. <li>
  113. <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
  114. </li>
  115. <li><strong>nixio.TLSSocket</strong></li>
  116. <li>
  117. <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
  118. </li>
  119. <li>
  120. <a href="../modules/nixio.bin.html">nixio.bin</a>
  121. </li>
  122. <li>
  123. <a href="../modules/nixio.bit.html">nixio.bit</a>
  124. </li>
  125. <li>
  126. <a href="../modules/nixio.crypto.html">nixio.crypto</a>
  127. </li>
  128. <li>
  129. <a href="../modules/nixio.fs.html">nixio.fs</a>
  130. </li>
  131. </ul>
  132. <!-- File list -->
  133. </div><!-- id="navigation" -->
  134. <div id="content">
  135. <h1>Object Instance <code>nixio.TLSSocket</code></h1>
  136. <p>
  137. TLS Socket Object.
  138. TLS Sockets contain the underlying socket and context in the fields
  139. "socket" and "context".</p>
  140. <h2>Functions</h2>
  141. <table class="function_list">
  142. <tr>
  143. <td class="name" nowrap><a href="#TLSSocket.accept">TLSSocket:accept</a>&nbsp;()</td>
  144. <td class="summary">
  145. Wait for a TLS handshake from a client.</td>
  146. </tr>
  147. <tr>
  148. <td class="name" nowrap><a href="#TLSSocket.connect">TLSSocket:connect</a>&nbsp;()</td>
  149. <td class="summary">
  150. Initiate the TLS handshake as client with the server.</td>
  151. </tr>
  152. <tr>
  153. <td class="name" nowrap><a href="#TLSSocket.read ">TLSSocket:read </a>&nbsp;(length)</td>
  154. <td class="summary">
  155. Receive a message on the socket (This is an alias for recv).</td>
  156. </tr>
  157. <tr>
  158. <td class="name" nowrap><a href="#TLSSocket.recv">TLSSocket:recv</a>&nbsp;(length)</td>
  159. <td class="summary">
  160. Receive a message on the socket.</td>
  161. </tr>
  162. <tr>
  163. <td class="name" nowrap><a href="#TLSSocket.send">TLSSocket:send</a>&nbsp;(buffer, offset, length)</td>
  164. <td class="summary">
  165. Send a message to the socket.</td>
  166. </tr>
  167. <tr>
  168. <td class="name" nowrap><a href="#TLSSocket.shutdown">TLSSocket:shutdown</a>&nbsp;()</td>
  169. <td class="summary">
  170. Shut down the TLS connection.</td>
  171. </tr>
  172. <tr>
  173. <td class="name" nowrap><a href="#TLSSocket.write">TLSSocket:write</a>&nbsp;(buffer, offset, length)</td>
  174. <td class="summary">
  175. Send a message on the socket (This is an alias for send).</td>
  176. </tr>
  177. </table>
  178. <br/>
  179. <br/>
  180. <h2><a name="functions"></a>Functions</h2>
  181. <dl class="function">
  182. <dt><a name="TLSSocket.accept"></a><strong>TLSSocket:accept</strong>&nbsp;()</dt>
  183. <dd>
  184. Wait for a TLS handshake from a client.
  185. <h3>Usage</h3>
  186. <ul>
  187. <li>This function calls SSL_accept().
  188. <li>You have to call either connect or accept before transmitting data.
  189. </ul>
  190. <h3>Return value:</h3>
  191. true
  192. <h3>See also:</h3>
  193. <ul>
  194. <li><a href="#TLSSocket.connect">
  195. TLSSocket:connect
  196. </a>
  197. </ul>
  198. </dd>
  199. <dt><a name="TLSSocket.connect"></a><strong>TLSSocket:connect</strong>&nbsp;()</dt>
  200. <dd>
  201. Initiate the TLS handshake as client with the server.
  202. <h3>Usage</h3>
  203. <ul>
  204. <li>This function calls SSL_connect().
  205. <li>You have to call either connect or accept before transmitting data.
  206. </ul>
  207. <h3>Return value:</h3>
  208. true
  209. <h3>See also:</h3>
  210. <ul>
  211. <li><a href="#TLSSocket.accept">
  212. TLSSocket:accept
  213. </a>
  214. </ul>
  215. </dd>
  216. <dt><a name="TLSSocket.read "></a><strong>TLSSocket:read </strong>&nbsp;(length)</dt>
  217. <dd>
  218. Receive a message on the socket (This is an alias for recv).
  219. See the recv description for more details.
  220. <h3>Parameters</h3>
  221. <ul>
  222. <li>
  223. length: Amount of data to read (in Bytes).
  224. </li>
  225. </ul>
  226. <h3>Return value:</h3>
  227. buffer containing data successfully read
  228. <h3>See also:</h3>
  229. <ul>
  230. <li><a href="#TLSSocket.recv">
  231. TLSSocket:recv
  232. </a>
  233. </ul>
  234. </dd>
  235. <dt><a name="TLSSocket.recv"></a><strong>TLSSocket:recv</strong>&nbsp;(length)</dt>
  236. <dd>
  237. Receive a message on the socket.
  238. <h3>Parameters</h3>
  239. <ul>
  240. <li>
  241. length: Amount of data to read (in Bytes).
  242. </li>
  243. </ul>
  244. <h3>Usage</h3>
  245. <ul>
  246. <li>This function calls SSL_read().
  247. <li><strong>Warning:</strong> It is not guaranteed that all requested data
  248. is read at once.
  249. You have to check the return value - the length of the buffer actually read -
  250. or use the safe IO functions in the high-level IO utility module.
  251. <li>The length of the return buffer is limited by the (compile time)
  252. nixio buffersize which is <em>nixio.const.buffersize</em> (8192 by default).
  253. Any read request greater than that will be safely truncated to this value.
  254. </ul>
  255. <h3>Return value:</h3>
  256. buffer containing data successfully read
  257. </dd>
  258. <dt><a name="TLSSocket.send"></a><strong>TLSSocket:send</strong>&nbsp;(buffer, offset, length)</dt>
  259. <dd>
  260. Send a message to the socket.
  261. <h3>Parameters</h3>
  262. <ul>
  263. <li>
  264. buffer: Buffer holding the data to be written.
  265. </li>
  266. <li>
  267. offset: Offset to start reading the buffer from. (optional)
  268. </li>
  269. <li>
  270. length: Length of chunk to read from the buffer. (optional)
  271. </li>
  272. </ul>
  273. <h3>Usage</h3>
  274. <ul>
  275. <li>This function calls SSL_write().
  276. <li><strong>Warning:</strong> It is not guaranteed that all data
  277. in the buffer is written at once.
  278. You have to check the return value - the number of bytes actually written -
  279. or use the safe IO functions in the high-level IO utility module.
  280. <li>Unlike standard Lua indexing the lowest offset and default is 0.
  281. </ul>
  282. <h3>Return value:</h3>
  283. number of bytes written
  284. </dd>
  285. <dt><a name="TLSSocket.shutdown"></a><strong>TLSSocket:shutdown</strong>&nbsp;()</dt>
  286. <dd>
  287. Shut down the TLS connection.
  288. <h3>Usage:</h3>
  289. This function calls SSL_shutdown().
  290. <h3>Return value:</h3>
  291. true
  292. </dd>
  293. <dt><a name="TLSSocket.write"></a><strong>TLSSocket:write</strong>&nbsp;(buffer, offset, length)</dt>
  294. <dd>
  295. Send a message on the socket (This is an alias for send).
  296. See the send description for a detailed description.
  297. <h3>Parameters</h3>
  298. <ul>
  299. <li>
  300. buffer: Buffer holding the data to be written.
  301. </li>
  302. <li>
  303. offset: Offset to start reading the buffer from. (optional)
  304. </li>
  305. <li>
  306. length: Length of chunk to read from the buffer. (optional)
  307. </li>
  308. </ul>
  309. <h3>Return value:</h3>
  310. number of bytes written
  311. <h3>See also:</h3>
  312. <ul>
  313. <li><a href="#TLSSocket.send">
  314. TLSSocket:send
  315. </a>
  316. </ul>
  317. </dd>
  318. </dl>
  319. </div> <!-- id="content" -->
  320. </div> <!-- id="main" -->
  321. <div id="about">
  322. <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
  323. </div> <!-- id="about" -->
  324. </div> <!-- id="container" -->
  325. </body>
  326. </html>