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