RAII wrapper around an oveRTOS TLS session.
More...
#include <net_tls.hpp>
|
|
| Session (const Session &)=delete |
| |
|
Session & | operator= (const Session &)=delete |
| |
|
| Session (Session &&)=delete |
| |
|
Session & | operator= (Session &&)=delete |
| |
| Result< void > | handshake (ove_socket_t sock, const Config &cfg={}) noexcept |
| | Perform TLS handshake over an established TCP socket.
|
| |
| Result< size_t > | send (const void *data, size_t len) noexcept |
| | Send encrypted bytes over the TLS session.
|
| |
| Result< size_t > | recv (void *buf, size_t len) noexcept |
| | Receive decrypted bytes from the TLS session.
|
| |
|
void | close () |
| | Close the TLS session (sends close_notify and tears down state).
|
| |
RAII wrapper around an oveRTOS TLS session.
Initialises mbedTLS contexts on construction, frees them on destruction. Use handshake() to establish a TLS connection over an existing TCP socket.
◆ handshake()
| Result< void > ove::tls::Session::handshake |
( |
ove_socket_t |
sock, |
|
|
const Config & |
cfg = {} |
|
) |
| |
|
inlinenoexcept |
Perform TLS handshake over an established TCP socket.
- Returns
- Empty
Result<void> on success; unexpected Error on failure (cert validation, network error, etc.).
◆ send()
| Result< size_t > ove::tls::Session::send |
( |
const void * |
data, |
|
|
size_t |
len |
|
) |
| |
|
inlinenoexcept |
Send encrypted bytes over the TLS session.
- Parameters
-
| [in] | data | Buffer to send. |
| [in] | len | Buffer length in bytes. |
- Returns
- On success, the number of bytes actually sent. On failure, an
unexpected Error.
◆ recv()
| Result< size_t > ove::tls::Session::recv |
( |
void * |
buf, |
|
|
size_t |
len |
|
) |
| |
|
inlinenoexcept |
Receive decrypted bytes from the TLS session.
- Parameters
-
| [out] | buf | Destination buffer. |
| [in] | len | Buffer capacity in bytes. |
- Returns
- On success, the number of bytes received. On failure, an
unexpected Error (Error::NetClosed for a clean TLS shutdown).
The documentation for this class was generated from the following file: