SSLAdapter
#include <icy/net/ssladapter.h>
class SSLAdapterDefined in src/net/include/icy/net/ssladapter.h:38
Friends
| Name | Description |
|---|---|
net::SSLSocket |
net::SSLSocket
friend class net::SSLSocketDefined in src/net/include/icy/net/ssladapter.h:107
Public Methods
| Return | Name | Description |
|---|---|---|
SSLAdapter | Constructs the SSLAdapter and associates it with the given socket. The socket pointer must remain valid for the lifetime of this adapter. | |
~SSLAdapter noexcept | ||
SSLAdapter | Deleted constructor. | |
SSLAdapter & | operator= | Deleted assignment operator. |
SSLAdapter | Deleted constructor. | |
SSLAdapter & | operator= | Deleted assignment operator. |
void | initClient | Initializes the SSL context as a client. |
void | initServer | Initializes the SSL context as a server. |
bool | initialized const | Returns true when SSL context has been initialized. |
bool | ready const | Returns true when the handshake is complete. |
void | handshake | Start/continue the SSL handshake process. |
int | available const | Returns the number of bytes available in the SSL buffer for immediate reading. |
void | shutdown | Issues an orderly SSL shutdown. |
void | flush | Flushes the SSL read/write buffers. |
void | setHostname | Set the expected peer hostname for certificate verification. Must be called before initClient() to enable hostname verification. |
void | addIncomingData | Feeds encrypted data received from the network into the SSL read BIO. Triggers a flush, which drives the handshake or decrypts and delivers plaintext to the socket via onRecv(). |
void | addOutgoingData | Queues plaintext data for encryption and transmission. |
void | addOutgoingData | Queues plaintext data for encryption and transmission. |
void | addOutgoingData | Moves plaintext data into the pending write buffer when possible. |
SSLAdapter
SSLAdapter(net::SSLSocket * socket)Defined in src/net/include/icy/net/ssladapter.h:44
Constructs the SSLAdapter and associates it with the given socket. The socket pointer must remain valid for the lifetime of this adapter.
Parameters
| Parameter | Type | Description |
|---|---|---|
socket | net::SSLSocket * | The owning SSLSocket that sends and receives raw data. |
~SSLAdapter
noexcept
~SSLAdapter() noexceptDefined in src/net/include/icy/net/ssladapter.h:45
SSLAdapter
SSLAdapter(const SSLAdapter &) = deleteDefined in src/net/include/icy/net/ssladapter.h:47
Deleted constructor.
operator=
SSLAdapter & operator=(const SSLAdapter &) = deleteDefined in src/net/include/icy/net/ssladapter.h:48
Deleted assignment operator.
SSLAdapter
SSLAdapter(SSLAdapter &&) = deleteDefined in src/net/include/icy/net/ssladapter.h:49
Deleted constructor.
operator=
SSLAdapter & operator=(SSLAdapter &&) = deleteDefined in src/net/include/icy/net/ssladapter.h:50
Deleted assignment operator.
initClient
void initClient()Defined in src/net/include/icy/net/ssladapter.h:53
Initializes the SSL context as a client.
initServer
void initServer()Defined in src/net/include/icy/net/ssladapter.h:56
Initializes the SSL context as a server.
initialized
const
bool initialized() constDefined in src/net/include/icy/net/ssladapter.h:59
Returns true when SSL context has been initialized.
ready
const
bool ready() constDefined in src/net/include/icy/net/ssladapter.h:62
Returns true when the handshake is complete.
handshake
void handshake()Defined in src/net/include/icy/net/ssladapter.h:65
Start/continue the SSL handshake process.
available
const
int available() constDefined in src/net/include/icy/net/ssladapter.h:69
Returns the number of bytes available in the SSL buffer for immediate reading.
shutdown
void shutdown()Defined in src/net/include/icy/net/ssladapter.h:72
Issues an orderly SSL shutdown.
flush
void flush()Defined in src/net/include/icy/net/ssladapter.h:75
Flushes the SSL read/write buffers.
setHostname
void setHostname(std::string_view hostname)Defined in src/net/include/icy/net/ssladapter.h:79
Set the expected peer hostname for certificate verification. Must be called before initClient() to enable hostname verification.
addIncomingData
void addIncomingData(const char * data, size_t len)Defined in src/net/include/icy/net/ssladapter.h:86
Feeds encrypted data received from the network into the SSL read BIO. Triggers a flush, which drives the handshake or decrypts and delivers plaintext to the socket via onRecv().
Parameters
| Parameter | Type | Description |
|---|---|---|
data | const char * | Pointer to the encrypted bytes. |
len | size_t | Number of bytes to feed. |
addOutgoingData
void addOutgoingData(std::string_view data)Defined in src/net/include/icy/net/ssladapter.h:90
Queues plaintext data for encryption and transmission.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | std::string_view | String view of the plaintext payload. |
addOutgoingData
void addOutgoingData(const char * data, size_t len)Defined in src/net/include/icy/net/ssladapter.h:95
Queues plaintext data for encryption and transmission.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | const char * | Pointer to the plaintext bytes. |
len | size_t | Number of bytes to queue. |
addOutgoingData
void addOutgoingData(Buffer && data)Defined in src/net/include/icy/net/ssladapter.h:98
Moves plaintext data into the pending write buffer when possible.
Protected Attributes
| Return | Name | Description |
|---|---|---|
net::SSLSocket * | _socket | |
SSL * | _ssl | |
BIO * | _readBIO | The incoming buffer we write encrypted SSL data into. |
BIO * | _writeBIO | The outgoing buffer we write to the socket. |
std::vector< char > | _bufferOut | The outgoing payload to be encrypted and sent. |
std::string | _hostname | Expected peer hostname for verification. |
_socket
net::SSLSocket * _socketType: net::SSLSocket *
Defined in src/net/include/icy/net/ssladapter.h:109
_ssl
SSL * _sslDefined in src/net/include/icy/net/ssladapter.h:110
_readBIO
BIO * _readBIODefined in src/net/include/icy/net/ssladapter.h:111
The incoming buffer we write encrypted SSL data into.
_writeBIO
BIO * _writeBIODefined in src/net/include/icy/net/ssladapter.h:112
The outgoing buffer we write to the socket.
_bufferOut
std::vector< char > _bufferOutDefined in src/net/include/icy/net/ssladapter.h:113
The outgoing payload to be encrypted and sent.
_hostname
std::string _hostnameDefined in src/net/include/icy/net/ssladapter.h:114
Expected peer hostname for verification.
Protected Methods
| Return | Name | Description |
|---|---|---|
void | handleError | |
void | flushReadBIO | |
void | flushWriteBIO |
handleError
void handleError(int rc)Defined in src/net/include/icy/net/ssladapter.h:101
flushReadBIO
void flushReadBIO()Defined in src/net/include/icy/net/ssladapter.h:103
flushWriteBIO
void flushWriteBIO()