Handles all SSL activity for a TCP connection. More...
#include <Session.h>
Public Types | |
using | InitDelegate = Delegate< void(Session &session)> |
Public Member Functions | |
~Session () | |
const SessionId * | getSessionId () const |
If available, return the current SSL Session ID. More... | |
bool | onAccept (TcpConnection *client, tcp_pcb *tcp) |
Called when a client connection is made via server TCP socket. More... | |
void | setConnection (Connection *connection) |
Called by TcpConnection to set the established SSL connection. More... | |
Connection * | getConnection () |
Get the currently active SSL connection object. More... | |
bool | onConnect (tcp_pcb *tcp) |
Handle connection event. More... | |
bool | isConnected () const |
Determine if an SSL connection has been fully established. More... | |
void | close () |
End the session. More... | |
int | read (InputBuffer &input, uint8_t *&output) |
Read data from SSL connection. More... | |
int | write (const uint8_t *data, size_t length) |
Write data to SSL connection. More... | |
bool | validateCertificate () |
Called by SSL adapter when certificate validation is required. More... | |
void | handshakeComplete (bool success) |
Called by SSL adapter when handshake has been completed. More... | |
size_t | printTo (Print &p) const |
For debugging. More... | |
Public Attributes | |
String | hostName |
Used for SNI https://en.wikipedia.org/wiki/Server_Name_Indication. More... | |
KeyCertPair | keyCert |
Required for server, optional for client. More... | |
Options | options |
Various connection options. More... | |
MaxBufferSize | maxBufferSize = MaxBufferSize::Default |
Controls SSL RAM usage. More... | |
const CipherSuites::Array * | cipherSuites = &CipherSuites::basic |
int | cacheSize = 10 |
Set session caching. More... | |
ValidatorList | validators |
List of certificate validators used by Client. More... | |
Detailed Description
Handles all SSL activity for a TCP connection.
A session is created for every TCP connection where useSsl
is specified. It is then passed to any registered session initialisation callbacks for customisation.
Member Typedef Documentation
◆ InitDelegate
using Ssl::Session::InitDelegate = Delegate<void(Session& session)> |
Constructor & Destructor Documentation
◆ ~Session()
|
inline |
Member Function Documentation
◆ close()
void Ssl::Session::close | ( | ) |
End the session.
SSL typically sends a closing handshake at this point
◆ getConnection()
|
inline |
Get the currently active SSL connection object.
- Return values
-
Connection*
◆ getSessionId()
|
inline |
If available, return the current SSL Session ID.
- Return values
-
SessionId* If connection hasn't been established, may return Null
◆ handshakeComplete()
void Ssl::Session::handshakeComplete | ( | bool | success | ) |
Called by SSL adapter when handshake has been completed.
- Parameters
-
success Indicates if handshake was successful
- Note
- SSL Internal method
◆ isConnected()
|
inline |
Determine if an SSL connection has been fully established.
- Return values
-
bool Connection state
◆ onAccept()
bool Ssl::Session::onAccept | ( | TcpConnection * | client, |
tcp_pcb * | tcp | ||
) |
Called when a client connection is made via server TCP socket.
- Parameters
-
client The client TCP socket tcp The low-level TCP connection to use for reading and writing
- Return values
-
bool true if the connection may proceed, false to abort
◆ onConnect()
bool Ssl::Session::onConnect | ( | tcp_pcb * | tcp | ) |
Handle connection event.
- Parameters
-
tcp
- Return values
-
bool true on success, false to abort the connection
◆ printTo()
size_t Ssl::Session::printTo | ( | Print & | p | ) | const |
For debugging.
◆ read()
int Ssl::Session::read | ( | InputBuffer & | input, |
uint8_t *& | output | ||
) |
Read data from SSL connection.
- Parameters
-
input Source encrypted data output Points to decrypted content
- Return values
-
int Size of decrypted data returned, or negative on error
◆ setConnection()
|
inline |
Called by TcpConnection to set the established SSL connection.
- Parameters
-
connection The server connection
◆ validateCertificate()
bool Ssl::Session::validateCertificate | ( | ) |
Called by SSL adapter when certificate validation is required.
- Return values
-
bool true if validation is success, false to abort connection
- Note
- SSL Internal method
◆ write()
int Ssl::Session::write | ( | const uint8_t * | data, |
size_t | length | ||
) |
Write data to SSL connection.
- Parameters
-
data length
- Return values
-
int Quantity of bytes actually written, or tcp error code
Member Data Documentation
◆ cacheSize
int Ssl::Session::cacheSize = 10 |
Set session caching.
Server: Number of cached client sessions. Suggested value: 10.
Client: Number of cached session ids. Suggested value: 1.
◆ cipherSuites
const CipherSuites::Array* Ssl::Session::cipherSuites = &CipherSuites::basic |
Configure supported cipher suites. Default is basic.
◆ hostName
String Ssl::Session::hostName |
Used for SNI https://en.wikipedia.org/wiki/Server_Name_Indication.
◆ keyCert
KeyCertPair Ssl::Session::keyCert |
Required for server, optional for client.
◆ maxBufferSize
MaxBufferSize Ssl::Session::maxBufferSize = MaxBufferSize::Default |
Controls SSL RAM usage.
◆ options
Options Ssl::Session::options |
Various connection options.
◆ validators
ValidatorList Ssl::Session::validators |
List of certificate validators used by Client.
The documentation for this class was generated from the following file: