nixio.TLSSocket.lua 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. --- TLS Socket Object.
  2. -- TLS Sockets contain the underlying socket and context in the fields
  3. -- "socket" and "context".
  4. -- @cstyle instance
  5. module "nixio.TLSSocket"
  6. --- Initiate the TLS handshake as client with the server.
  7. -- @class function
  8. -- @name TLSSocket.connect
  9. -- @usage This function calls SSL_connect().
  10. -- @usage You have to call either connect or accept before transmitting data.
  11. -- @see TLSSocket.accept
  12. -- @return true
  13. --- Wait for a TLS handshake from a client.
  14. -- @class function
  15. -- @name TLSSocket.accept
  16. -- @usage This function calls SSL_accept().
  17. -- @usage You have to call either connect or accept before transmitting data.
  18. -- @see TLSSocket.connect
  19. -- @return true
  20. --- Send a message to the socket.
  21. -- @class function
  22. -- @name TLSSocket.send
  23. -- @usage This function calls SSL_write().
  24. -- @usage <strong>Warning:</strong> It is not guaranteed that all data
  25. -- in the buffer is written at once.
  26. -- You have to check the return value - the number of bytes actually written -
  27. -- or use the safe IO functions in the high-level IO utility module.
  28. -- @usage Unlike standard Lua indexing the lowest offset and default is 0.
  29. -- @param buffer Buffer holding the data to be written.
  30. -- @param offset Offset to start reading the buffer from. (optional)
  31. -- @param length Length of chunk to read from the buffer. (optional)
  32. -- @return number of bytes written
  33. --- Send a message on the socket (This is an alias for send).
  34. -- See the send description for a detailed description.
  35. -- @class function
  36. -- @name TLSSocket.write
  37. -- @param buffer Buffer holding the data to be written.
  38. -- @param offset Offset to start reading the buffer from. (optional)
  39. -- @param length Length of chunk to read from the buffer. (optional)
  40. -- @see TLSSocket.send
  41. -- @return number of bytes written
  42. --- Receive a message on the socket.
  43. -- @class function
  44. -- @name TLSSocket.recv
  45. -- @usage This function calls SSL_read().
  46. -- @usage <strong>Warning:</strong> It is not guaranteed that all requested data
  47. -- is read at once.
  48. -- You have to check the return value - the length of the buffer actually read -
  49. -- or use the safe IO functions in the high-level IO utility module.
  50. -- @usage The length of the return buffer is limited by the (compile time)
  51. -- nixio buffersize which is <em>nixio.const.buffersize</em> (8192 by default).
  52. -- Any read request greater than that will be safely truncated to this value.
  53. -- @param length Amount of data to read (in Bytes).
  54. -- @return buffer containing data successfully read
  55. --- Receive a message on the socket (This is an alias for recv).
  56. -- See the recv description for more details.
  57. -- @class function
  58. -- @name TLSSocket.read
  59. -- @param length Amount of data to read (in Bytes).
  60. -- @see TLSSocket.recv
  61. -- @return buffer containing data successfully read
  62. --- Shut down the TLS connection.
  63. -- @class function
  64. -- @name TLSSocket.shutdown
  65. -- @usage This function calls SSL_shutdown().
  66. -- @return true