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