Regenerate api documentation
[project/luci.git] / documentation / api / modules / nixio.TLSSocket.html
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
10 <body>
11 <div id="container">
12
13 <div id="product">
14         <div id="product_logo"></div>
15         <div id="product_name"><big><b></b></big></div>
16         <div id="product_description"></div>
17 </div> <!-- id="product" -->
18
19 <div id="main">
20
21 <div id="navigation">
22
23
24 <h1>LuaDoc</h1>
25 <ul>
26         
27         <li><a href="../index.html">Index</a></li>
28         
29 </ul>
30
31
32 <!-- Module list -->
33
34 <h1>Modules</h1>
35 <ul>
36
37         <li>
38                 <a href="../modules/luci.dispatcher.html">luci.dispatcher</a>
39         </li>
40
41         <li>
42                 <a href="../modules/luci.http.html">luci.http</a>
43         </li>
44
45         <li>
46                 <a href="../modules/luci.http.protocol.html">luci.http.protocol</a>
47         </li>
48
49         <li>
50                 <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a>
51         </li>
52
53         <li>
54                 <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a>
55         </li>
56
57         <li>
58                 <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a>
59         </li>
60
61         <li>
62                 <a href="../modules/luci.i18n.html">luci.i18n</a>
63         </li>
64
65         <li>
66                 <a href="../modules/luci.ip.html">luci.ip</a>
67         </li>
68
69         <li>
70                 <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
71         </li>
72
73         <li>
74                 <a href="../modules/luci.json.html">luci.json</a>
75         </li>
76
77         <li>
78                 <a href="../modules/luci.jsonc.html">luci.jsonc</a>
79         </li>
80
81         <li>
82                 <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
83         </li>
84
85         <li>
86                 <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
87         </li>
88
89         <li>
90                 <a href="../modules/luci.model.uci.html">luci.model.uci</a>
91         </li>
92
93         <li>
94                 <a href="../modules/luci.rpcc.html">luci.rpcc</a>
95         </li>
96
97         <li>
98                 <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
99         </li>
100
101         <li>
102                 <a href="../modules/luci.sys.html">luci.sys</a>
103         </li>
104
105         <li>
106                 <a href="../modules/luci.sys.init.html">luci.sys.init</a>
107         </li>
108
109         <li>
110                 <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
111         </li>
112
113         <li>
114                 <a href="../modules/luci.sys.net.html">luci.sys.net</a>
115         </li>
116
117         <li>
118                 <a href="../modules/luci.sys.process.html">luci.sys.process</a>
119         </li>
120
121         <li>
122                 <a href="../modules/luci.sys.user.html">luci.sys.user</a>
123         </li>
124
125         <li>
126                 <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
127         </li>
128
129         <li>
130                 <a href="../modules/luci.util.html">luci.util</a>
131         </li>
132
133         <li>
134                 <a href="../modules/nixio.html">nixio</a>
135         </li>
136
137         <li>
138                 <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
139         </li>
140
141         <li>
142                 <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
143         </li>
144
145         <li>
146                 <a href="../modules/nixio.File.html">nixio.File</a>
147         </li>
148
149         <li>
150                 <a href="../modules/nixio.README.html">nixio.README</a>
151         </li>
152
153         <li>
154                 <a href="../modules/nixio.Socket.html">nixio.Socket</a>
155         </li>
156
157         <li>
158                 <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
159         </li>
160
161         <li><strong>nixio.TLSSocket</strong></li>
162         
163         <li>
164                 <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
165         </li>
166
167         <li>
168                 <a href="../modules/nixio.bin.html">nixio.bin</a>
169         </li>
170
171         <li>
172                 <a href="../modules/nixio.bit.html">nixio.bit</a>
173         </li>
174
175         <li>
176                 <a href="../modules/nixio.crypto.html">nixio.crypto</a>
177         </li>
178
179         <li>
180                 <a href="../modules/nixio.fs.html">nixio.fs</a>
181         </li>
182
183 </ul>
184
185
186
187 <!-- File list -->
188
189
190
191
192
193
194
195 </div><!-- id="navigation" -->
196
197 <div id="content">
198
199 <h1>Object Instance <code>nixio.TLSSocket</code></h1>
200
201 <p>
202  TLS Socket Object. 
203  TLS Sockets contain the underlying socket and context in the fields 
204  "socket" and "context".</p>
205
206
207
208
209
210
211
212 <h2>Functions</h2>
213 <table class="function_list">
214
215         <tr>
216         <td class="name" nowrap><a href="#TLSSocket.accept">TLSSocket:accept</a>&nbsp;()</td>
217         <td class="summary">
218  Wait for a TLS handshake from a client.</td>
219         </tr>
220
221         <tr>
222         <td class="name" nowrap><a href="#TLSSocket.connect">TLSSocket:connect</a>&nbsp;()</td>
223         <td class="summary">
224  Initiate the TLS handshake as client with the server.</td>
225         </tr>
226
227         <tr>
228         <td class="name" nowrap><a href="#TLSSocket.read  ">TLSSocket:read  </a>&nbsp;(length)</td>
229         <td class="summary">
230  Receive a message on the socket (This is an alias for recv).</td>
231         </tr>
232
233         <tr>
234         <td class="name" nowrap><a href="#TLSSocket.recv">TLSSocket:recv</a>&nbsp;(length)</td>
235         <td class="summary">
236  Receive a message on the socket.</td>
237         </tr>
238
239         <tr>
240         <td class="name" nowrap><a href="#TLSSocket.send">TLSSocket:send</a>&nbsp;(buffer, offset, length)</td>
241         <td class="summary">
242  Send a message to the socket.</td>
243         </tr>
244
245         <tr>
246         <td class="name" nowrap><a href="#TLSSocket.shutdown">TLSSocket:shutdown</a>&nbsp;()</td>
247         <td class="summary">
248  Shut down the TLS connection.</td>
249         </tr>
250
251         <tr>
252         <td class="name" nowrap><a href="#TLSSocket.write">TLSSocket:write</a>&nbsp;(buffer, offset, length)</td>
253         <td class="summary">
254  Send a message on the socket (This is an alias for send).</td>
255         </tr>
256
257 </table>
258
259
260
261
262
263
264 <br/>
265 <br/>
266
267
268 <h2><a name="functions"></a>Functions</h2>
269 <dl class="function">
270
271
272
273 <dt><a name="TLSSocket.accept"></a><strong>TLSSocket:accept</strong>&nbsp;()</dt>
274 <dd>
275
276  Wait for a TLS handshake from a client.
277
278
279
280
281
282 <h3>Usage</h3>
283 <ul>
284         
285         <li>This function calls SSL_accept().
286         
287         <li>You have to call either connect or accept before transmitting data.
288         
289 </ul>
290
291
292
293 <h3>Return value:</h3>
294 true
295
296
297
298 <h3>See also:</h3>
299 <ul>
300         
301         <li><a href="#TLSSocket.connect">
302                 TLSSocket:connect
303         </a>
304         
305 </ul>
306
307 </dd>
308
309
310
311
312 <dt><a name="TLSSocket.connect"></a><strong>TLSSocket:connect</strong>&nbsp;()</dt>
313 <dd>
314
315  Initiate the TLS handshake as client with the server.
316
317
318
319
320
321 <h3>Usage</h3>
322 <ul>
323         
324         <li>This function calls SSL_connect().
325         
326         <li>You have to call either connect or accept before transmitting data.
327         
328 </ul>
329
330
331
332 <h3>Return value:</h3>
333 true
334
335
336
337 <h3>See also:</h3>
338 <ul>
339         
340         <li><a href="#TLSSocket.accept">
341                 TLSSocket:accept
342         </a>
343         
344 </ul>
345
346 </dd>
347
348
349
350
351 <dt><a name="TLSSocket.read  "></a><strong>TLSSocket:read  </strong>&nbsp;(length)</dt>
352 <dd>
353
354  Receive a message on the socket (This is an alias for recv). 
355  See the recv description for more details.
356
357
358 <h3>Parameters</h3>
359 <ul>
360         
361         <li>
362           length: Amount of data to read (in Bytes).
363         </li>
364         
365 </ul>
366
367
368
369
370
371
372 <h3>Return value:</h3>
373 buffer containing data successfully read
374
375
376
377 <h3>See also:</h3>
378 <ul>
379         
380         <li><a href="#TLSSocket.recv">
381                 TLSSocket:recv
382         </a>
383         
384 </ul>
385
386 </dd>
387
388
389
390
391 <dt><a name="TLSSocket.recv"></a><strong>TLSSocket:recv</strong>&nbsp;(length)</dt>
392 <dd>
393
394  Receive a message on the socket.
395
396
397 <h3>Parameters</h3>
398 <ul>
399         
400         <li>
401           length: Amount of data to read (in Bytes).
402         </li>
403         
404 </ul>
405
406
407
408
409 <h3>Usage</h3>
410 <ul>
411         
412         <li>This function calls SSL_read().
413         
414         <li><strong>Warning:</strong> It is not guaranteed that all requested data 
415  is read at once. 
416  You have to check the return value - the length of the buffer actually read - 
417  or use the safe IO functions in the high-level IO utility module.
418         
419         <li>The length of the return buffer is limited by the (compile time)  
420  nixio buffersize which is <em>nixio.const.buffersize</em> (8192 by default). 
421  Any read request greater than that will be safely truncated to this value.  
422         
423 </ul>
424
425
426
427 <h3>Return value:</h3>
428 buffer containing data successfully read
429
430
431
432 </dd>
433
434
435
436
437 <dt><a name="TLSSocket.send"></a><strong>TLSSocket:send</strong>&nbsp;(buffer, offset, length)</dt>
438 <dd>
439
440  Send a message to the socket.
441
442
443 <h3>Parameters</h3>
444 <ul>
445         
446         <li>
447           buffer: Buffer holding the data to be written.
448         </li>
449         
450         <li>
451           offset: Offset to start reading the buffer from. (optional)
452         </li>
453         
454         <li>
455           length: Length of chunk to read from the buffer. (optional)
456         </li>
457         
458 </ul>
459
460
461
462
463 <h3>Usage</h3>
464 <ul>
465         
466         <li>This function calls SSL_write().
467         
468         <li><strong>Warning:</strong> It is not guaranteed that all data 
469  in the buffer is written at once. 
470  You have to check the return value - the number of bytes actually written - 
471  or use the safe IO functions in the high-level IO utility module.
472         
473         <li>Unlike standard Lua indexing the lowest offset and default is 0.
474         
475 </ul>
476
477
478
479 <h3>Return value:</h3>
480 number of bytes written
481
482
483
484 </dd>
485
486
487
488
489 <dt><a name="TLSSocket.shutdown"></a><strong>TLSSocket:shutdown</strong>&nbsp;()</dt>
490 <dd>
491
492  Shut down the TLS connection.
493
494
495
496
497
498 <h3>Usage:</h3>
499 This function calls SSL_shutdown().
500
501
502
503 <h3>Return value:</h3>
504 true
505
506
507
508 </dd>
509
510
511
512
513 <dt><a name="TLSSocket.write"></a><strong>TLSSocket:write</strong>&nbsp;(buffer, offset, length)</dt>
514 <dd>
515
516  Send a message on the socket (This is an alias for send). 
517  See the send description for a detailed description.
518
519
520 <h3>Parameters</h3>
521 <ul>
522         
523         <li>
524           buffer: Buffer holding the data to be written.
525         </li>
526         
527         <li>
528           offset: Offset to start reading the buffer from. (optional)
529         </li>
530         
531         <li>
532           length: Length of chunk to read from the buffer. (optional)
533         </li>
534         
535 </ul>
536
537
538
539
540
541
542 <h3>Return value:</h3>
543 number of bytes written
544
545
546
547 <h3>See also:</h3>
548 <ul>
549         
550         <li><a href="#TLSSocket.send">
551                 TLSSocket:send
552         </a>
553         
554 </ul>
555
556 </dd>
557
558
559 </dl>
560
561
562
563
564
565 </div> <!-- id="content" -->
566
567 </div> <!-- id="main" -->
568
569 <div id="about">
570         <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>
571 </div> <!-- id="about" -->
572
573 </div> <!-- id="container" -->
574 </body>
575 </html>