SSLSocket
#include <icy/net/sslsocket.h>
class SSLSocketDefined in src/net/include/icy/net/sslsocket.h:30
- Inherits
TCPSocket
List of all members
| Name | Kind | Owner |
|---|---|---|
SSLAdapter | friend | Declared here |
SSLSocket | function | Declared here |
SSLSocket | function | Declared here |
SSLSocket | function | Declared here |
~SSLSocket | function | Declared here |
connect | function | Declared here |
connect | function | Declared here |
bind | function | Declared here |
listen | function | Declared here |
shutdown | function | Declared here |
close | function | Declared here |
send | function | Declared here |
sendOwned | function | Declared here |
send | function | Declared here |
sendOwned | function | Declared here |
setHostname | function | Declared here |
useContext | function | Declared here |
context | function | Declared here |
useSession | function | Declared here |
currentSession | function | Declared here |
sessionWasReused | function | Declared here |
available | function | Declared here |
peerCertificate | function | Declared here |
transport | function | Declared here |
acceptConnection | function | Declared here |
onConnect | function | Declared here |
onRead | function | Declared here |
_sslContext | variable | Declared here |
_sslSession | variable | Declared here |
_sslAdapter | variable | Declared here |
Ptr | typedef | Declared here |
Vec | typedef | Declared here |
AcceptConnection | variable | Inherited from TCPSocket |
TCPSocket | function | Inherited from TCPSocket |
~TCPSocket | function | Inherited from TCPSocket |
TCPSocket | function | Inherited from TCPSocket |
operator= | function | Inherited from TCPSocket |
TCPSocket | function | Inherited from TCPSocket |
operator= | function | Inherited from TCPSocket |
shutdown | function | Inherited from TCPSocket |
close | function | Inherited from TCPSocket |
connect | function | Inherited from TCPSocket |
connect | function | Inherited from TCPSocket |
send | function | Inherited from TCPSocket |
sendOwned | function | Inherited from TCPSocket |
send | function | Inherited from TCPSocket |
sendOwned | function | Inherited from TCPSocket |
bind | function | Inherited from TCPSocket |
listen | function | Inherited from TCPSocket |
acceptConnection | function | Inherited from TCPSocket |
setReusePort | function | Inherited from TCPSocket |
setNoDelay | function | Inherited from TCPSocket |
setKeepAlive | function | Inherited from TCPSocket |
setSimultaneousAccepts | function | Inherited from TCPSocket |
setMode | function | Inherited from TCPSocket |
mode | function | Inherited from TCPSocket |
setError | function | Inherited from TCPSocket |
error | function | Inherited from TCPSocket |
closed | function | Inherited from TCPSocket |
address | function | Inherited from TCPSocket |
peerAddress | function | Inherited from TCPSocket |
transport | function | Inherited from TCPSocket |
loop | function | Inherited from TCPSocket |
onConnect | function | Inherited from TCPSocket |
onRead | function | Inherited from TCPSocket |
onRecv | function | Inherited from TCPSocket |
onError | function | Inherited from TCPSocket |
onClose | function | Inherited from TCPSocket |
_mode | variable | Inherited from TCPSocket |
_peerAddress | variable | Inherited from TCPSocket |
_peerAddressCached | variable | Inherited from TCPSocket |
init | function | Inherited from TCPSocket |
reset | function | Inherited from TCPSocket |
Ptr | typedef | Inherited from TCPSocket |
Vec | typedef | Inherited from TCPSocket |
Read | variable | Inherited from Stream |
Stream | function | Inherited from Stream |
~Stream | function | Inherited from Stream |
close | function | Inherited from Stream |
shutdown | function | Inherited from Stream |
write | function | Inherited from Stream |
writeOwned | function | Inherited from Stream |
setHighWaterMark | function | Inherited from Stream |
write | function | Inherited from Stream |
stream | function | Inherited from Stream |
_buffer | variable | Inherited from Stream |
_started | variable | Inherited from Stream |
_highWaterMark | variable | Inherited from Stream |
_writeReqFree | variable | Inherited from Stream |
_ownedWriteReqFree | variable | Inherited from Stream |
readStart | function | Inherited from Stream |
readStop | function | Inherited from Stream |
onRead | function | Inherited from Stream |
allocWriteReq | function | Inherited from Stream |
freeWriteReq | function | Inherited from Stream |
allocOwnedWriteReq | function | Inherited from Stream |
freeOwnedWriteReq | function | Inherited from Stream |
canQueueWrite | function | Inherited from Stream |
Handle | typedef | Inherited from Stream |
Handle | function | Inherited from Handle |
~Handle | function | Inherited from Handle |
init | function | Inherited from Handle |
invoke | function | Inherited from Handle |
invokeOrThrow | function | Inherited from Handle |
close | function | Inherited from Handle |
ref | function | Inherited from Handle |
unref | function | Inherited from Handle |
initialized | function | Inherited from Handle |
active | function | Inherited from Handle |
closing | function | Inherited from Handle |
closed | function | Inherited from Handle |
error | function | Inherited from Handle |
setError | function | Inherited from Handle |
setUVError | function | Inherited from Handle |
setAndThrowError | function | Inherited from Handle |
throwLastError | function | Inherited from Handle |
loop | function | Inherited from Handle |
reset | function | Inherited from Handle |
get | function | Inherited from Handle |
tid | function | Inherited from Handle |
context | function | Inherited from Handle |
rawPtr | function | Inherited from Handle |
setCloseCleanup | function | Inherited from Handle |
clearCloseCleanup | function | Inherited from Handle |
assertThread | function | Inherited from Handle |
_loop | variable | Inherited from Handle |
_context | variable | Inherited from Handle |
_tid | variable | Inherited from Handle |
_error | variable | Inherited from Handle |
onError | function | Inherited from Handle |
onClose | function | Inherited from Handle |
Handle | function | Inherited from Handle |
operator= | function | Inherited from Handle |
Handle | function | Inherited from Handle |
operator= | function | Inherited from Handle |
Type | typedef | Inherited from Handle |
opaque | variable | Inherited from Socket |
Socket | function | Inherited from Socket |
~Socket | function | Inherited from Socket |
Socket | function | Inherited from Socket |
operator= | function | Inherited from Socket |
Socket | function | Inherited from Socket |
operator= | function | Inherited from Socket |
connect | function | Inherited from Socket |
connect | function | Inherited from Socket |
bind | function | Inherited from Socket |
listen | function | Inherited from Socket |
shutdown | function | Inherited from Socket |
sendOwned | function | Inherited from Socket |
sendOwned | function | Inherited from Socket |
close | function | Inherited from Socket |
address | function | Inherited from Socket |
peerAddress | function | Inherited from Socket |
transport | function | Inherited from Socket |
setError | function | Inherited from Socket |
error | function | Inherited from Socket |
closed | function | Inherited from Socket |
loop | function | Inherited from Socket |
_af | variable | Inherited from Socket |
init | function | Inherited from Socket |
reset | function | Inherited from Socket |
Ptr | typedef | Inherited from Socket |
Vec | typedef | Inherited from Socket |
priority | variable | Inherited from SocketAdapter |
SocketAdapter | function | Inherited from SocketAdapter |
~SocketAdapter | function | Inherited from SocketAdapter |
send | function | Inherited from SocketAdapter |
send | function | Inherited from SocketAdapter |
sendOwned | function | Inherited from SocketAdapter |
sendOwned | function | Inherited from SocketAdapter |
sendPacket | function | Inherited from SocketAdapter |
sendPacket | function | Inherited from SocketAdapter |
sendPacket | function | Inherited from SocketAdapter |
setSender | function | Inherited from SocketAdapter |
sender | function | Inherited from SocketAdapter |
addReceiver | function | Inherited from SocketAdapter |
removeReceiver | function | Inherited from SocketAdapter |
hasReceiver | function | Inherited from SocketAdapter |
receivers | function | Inherited from SocketAdapter |
onSocketConnect | function | Inherited from SocketAdapter |
onSocketRecv | function | Inherited from SocketAdapter |
onSocketError | function | Inherited from SocketAdapter |
onSocketClose | function | Inherited from SocketAdapter |
_sender | variable | Inherited from SocketAdapter |
_receivers | variable | Inherited from SocketAdapter |
_dirty | variable | Inherited from SocketAdapter |
_dispatchDepth | variable | Inherited from SocketAdapter |
cleanupReceivers | function | Inherited from SocketAdapter |
Inherited from TCPSocket
| Kind | Name | Description |
|---|---|---|
variable | AcceptConnection | Fired when a new client connection is accepted; carries a shared_ptr to the new socket. |
function | TCPSocket | Constructs the TCPSocket and initializes the underlying libuv handle. |
function | ~TCPSocket virtual noexcept | |
function | TCPSocket | Deleted constructor. |
function | operator= | Deleted assignment operator. |
function | TCPSocket | Deleted constructor. |
function | operator= | Deleted assignment operator. |
function | shutdown virtual override | Sends a TCP shutdown request; the socket closes after the peer acknowledges. |
function | close virtual override | Closes the socket immediately, releasing all associated resources. |
function | connect virtual override | Connects to peerAddress using a libuv connect request. On success, calls onConnect(); on failure, calls setUVError(). |
function | connect virtual override | Resolves host via DNS (or maps "localhost"), then connects. |
function | send virtual override | Writes len bytes to the connected peer. |
function | sendOwned virtual override | Sends an owned payload buffer to the connected peer. |
function | send virtual override | Writes len bytes; peerAddress is ignored for TCP (connected stream). |
function | sendOwned virtual override | |
function | bind virtual override | Binds the socket to address. Resets and reinitializes the handle if the address family changes. |
function | listen virtual override | Starts listening for incoming connections with the given backlog. |
function | acceptConnection virtual | Accepts the next pending client connection and fires AcceptConnection. |
function | setReusePort | Enables SO_REUSEPORT on Linux kernel >= 3.9 for multi-thread load balancing. Must be called after bind(). No-op and returns false on unsupported platforms. |
function | setNoDelay | Enables or disables TCP_NODELAY (Nagle's algorithm). |
function | setKeepAlive | Enables or disables TCP keep-alive probes. |
function | setSimultaneousAccepts | Enables or disables simultaneous accepts on Windows. No-op and returns false on non-Windows platforms. |
function | setMode | Sets the socket mode (ServerSide or ClientSide). |
function | mode const | Returns the current socket mode. |
function | setError virtual override | Sets the socket error; ignores the call if an error is already recorded. Setting an error causes the socket to close. |
function | error virtual const override | Returns the current socket error, if any. |
function | closed virtual const override | Returns true if the native socket handle is closed. |
function | address virtual const override | Returns the IP address and port number of the socket. A wildcard address is returned if the socket is not connected. |
function | peerAddress virtual const override | Returns the IP address and port number of the peer socket. A wildcard address is returned if the socket is not connected. |
function | transport virtual const override | Returns the TCP transport protocol. |
function | loop virtual const override | Returns the event loop associated with this socket. |
function | onConnect virtual | Called by the stream layer when the TCP connection is established. |
function | onRead virtual override | Called by the stream layer with raw received bytes; wraps them in a MutableBuffer. |
function | onRecv virtual | Dispatches a received buffer to all socket adapters via onSocketRecv. |
function | onError virtual override | Dispatches the error to adapters and closes the socket. |
function | onClose virtual override | Dispatches the close event to all socket adapters. |
variable | _mode | |
variable | _peerAddress | Cached peer address (avoids syscall per recv) |
variable | _peerAddressCached | True once _peerAddress is set at connect/accept. |
function | init virtual override | Initializes the underlying socket context. |
function | reset virtual override | Resets the socket context for reuse. |
typedef | Ptr | |
typedef | Vec |
Inherited from Stream
| Kind | Name | Description |
|---|---|---|
variable | Read | Emitted when data has been received from the peer. |
function | Stream inline | Construct the stream bound to loop with a 64 KiB read buffer. |
function | ~Stream virtual inline | Destroy the stream, stopping reads and freeing pooled write requests. |
function | close virtual inline override | Closes and resets the stream handle. This will close the active socket/pipe and destroy the handle. |
function | shutdown inline | Send a TCP/pipe shutdown request to the connected peer. |
function | write inline | Write len bytes from data to the stream. |
function | writeOwned inline | Write an owned payload buffer to the stream. |
function | setHighWaterMark inline | Set the high water mark for the write queue (default 16MB). When the write queue exceeds this size, write() returns false. |
function | write inline | Write len bytes from data together with a stream handle over an IPC pipe (uses uv_write2). |
function | stream inline | Return the underlying uv_stream_t pointer cast from the native handle. |
variable | _buffer | |
variable | _started | |
variable | _highWaterMark | 16MB default write queue limit |
variable | _writeReqFree | Freelist for write requests. |
variable | _ownedWriteReqFree | Freelist for owned write requests. |
function | readStart virtual inline | Begin reading from the stream by registering libuv read callbacks. |
function | readStop virtual inline | Stop reading from the stream. |
function | onRead virtual inline | Called by handleRead when len bytes of data arrive. |
function | allocWriteReq inline | Return a uv_write_t from the freelist, or allocate a new one if the pool is empty. |
function | freeWriteReq inline | Return req to the freelist, or delete it if the pool is at capacity. |
function | allocOwnedWriteReq inline | |
function | freeOwnedWriteReq inline | |
function | canQueueWrite inline | |
typedef | Handle |
Inherited from Handle
| Kind | Name | Description |
|---|---|---|
function | Handle inline | Construct the handle bound to the given event loop. |
function | ~Handle virtual inline | |
function | init inline | Initialize the underlying libuv handle by calling f with the loop, the raw handle pointer, and any additional args. |
function | invoke inline | Invoke a libuv function f with args on the initialized handle. |
function | invokeOrThrow inline | Invoke a libuv function f with args, throwing on failure. |
function | close virtual inline | Close and destroy the handle. |
function | ref inline | Re-reference the handle with the event loop after a previous unref(). |
function | unref inline | Unreference the handle from the event loop. |
function | initialized const inline | Return true if the handle has been successfully initialized via init(). |
function | active virtual const inline | Return true when the handle is active (libuv uv_is_active). |
function | closing virtual const inline | Return true if uv_close has been called and the handle is awaiting its close callback (libuv uv_is_closing). |
function | closed virtual const inline | Return true if the handle has been fully closed (context released). |
function | error const inline | Return the last error set on this handle, or a default-constructed Error if no error has occurred. |
function | setError virtual inline | Set the error state and invoke onError(). |
function | setUVError inline | Translate a libuv error code into an Error and call setError(). |
function | setAndThrowError inline | Set the error state from a libuv error code and throw a std::runtime_error. |
function | throwLastError inline | Throw a std::runtime_error if the handle currently holds an error. |
function | loop const inline | Return the event loop this handle is bound to. |
function | reset inline | Close the current handle (if open) and allocate a fresh Context, leaving the handle ready to be re-initialized via init(). |
function | get const inline | Return the raw libuv handle pointer cast to Handle. |
function | tid const inline | Return the ID of the thread that constructed this handle. |
function | context const inline | Return the raw Context that owns the libuv handle memory. |
function | rawPtr const inline | Return the raw libuv handle pointer without retaining the Context. |
function | setCloseCleanup inline | |
function | clearCloseCleanup inline | |
function | assertThread const inline | Throw std::logic_error if called from any thread other than the thread that constructed this handle. |
variable | _loop | |
variable | _context | |
variable | _tid | |
variable | _error | |
function | onError virtual inline | Called by setError() after the error state has been updated. |
function | onClose virtual inline | Called by close() after the context has been released. |
function | Handle | NonCopyable and NonMovable. |
function | operator= | Deleted assignment operator. |
function | Handle | Deleted constructor. |
function | operator= | Deleted assignment operator. |
typedef | Type | Define the native handle type. |
Inherited from Socket
| Kind | Name | Description |
|---|---|---|
variable | opaque | Optional client data. |
function | Socket | Defaulted constructor. |
function | ~Socket virtual noexcept | Defaulted destructor. |
function | Socket | Deleted constructor. |
function | operator= | Deleted assignment operator. |
function | Socket | Deleted constructor. |
function | operator= | Deleted assignment operator. |
function | connect virtual | Connects to the given peer IP address. |
function | connect virtual | Resolves and connects to the given host address. |
function | bind virtual | Bind a local address to the socket. The address may be IPv4 or IPv6 (if supported). |
function | listen virtual inline | Listens the socket on the given address. |
function | shutdown virtual inline | Sends the shutdown packet which should result is socket closure via callback. |
function | sendOwned virtual | Sends an owned payload buffer to the connected peer. |
function | sendOwned virtual | |
function | close virtual | Closes the underlying socket. |
function | address virtual const | The locally bound address. |
function | peerAddress virtual const | The connected peer address. |
function | transport virtual const | The transport protocol: TCP, UDP or SSLTCP. |
function | setError virtual | Sets the socket error. |
function | error virtual const | Return the socket error if any. |
function | closed virtual const | Returns true if the native socket handle is closed. |
function | loop virtual const | Returns the socket event loop. |
variable | _af | |
function | init virtual | Initializes the underlying socket context. |
function | reset virtual | Resets the socket context for reuse. |
typedef | Ptr | |
typedef | Vec |
Inherited from SocketAdapter
| Kind | Name | Description |
|---|---|---|
variable | priority | The priority of this adapter for STL sort operations. |
function | SocketAdapter | Creates the SocketAdapter. |
function | ~SocketAdapter virtual noexcept | Destroys the SocketAdapter. |
function | send virtual | Sends the given data buffer to the connected peer. Returns the number of bytes sent or -1 on error. No exception will be thrown. For TCP sockets the given peer address must match the connected peer address. |
function | send virtual | |
function | sendOwned virtual | Sends an owned payload buffer to the connected peer. |
function | sendOwned virtual | |
function | sendPacket virtual | Sends the given packet to the connected peer. Returns the number of bytes sent or -1 on error. No exception will be thrown. For TCP sockets the given peer address must match the connected peer address. |
function | sendPacket virtual | |
function | sendPacket virtual | Sends the given packet to the connected peer. This method provides delegate compatibility, and unlike other send methods throws an exception if the underlying socket is closed. |
function | setSender virtual | Sets the pointer to the outgoing data adapter. Send methods proxy data to this adapter by default. |
function | sender | Returns the output SocketAdapter pointer. |
function | addReceiver virtual | Sets the pointer to the incoming data adapter. Events proxy data to this adapter by default. |
function | removeReceiver virtual | Remove the given receiver. |
function | hasReceiver virtual | Returns true if the given receiver is connected. |
function | receivers | Returns all currently registered input SocketAdapter pointers. Dead (removed) entries are excluded from the returned list. |
function | onSocketConnect virtual | Called when the socket establishes a connection. Forwards the event to all registered receivers in priority order. Override to intercept before the application sees the event. |
function | onSocketRecv virtual | Called when data is received from the socket. Forwards the event to all registered receivers in priority order. |
function | onSocketError virtual | Called when the socket encounters an error. Forwards the event to all registered receivers in priority order. |
function | onSocketClose virtual | Called when the socket is closed. Forwards the event to all registered receivers in priority order. |
variable | _sender | |
variable | _receivers | |
variable | _dirty | |
variable | _dispatchDepth | |
function | cleanupReceivers virtual |
Friends
| Name | Description |
|---|---|
net::SSLAdapter |
net::SSLAdapter
friend class net::SSLAdapterDefined in src/net/include/icy/net/sslsocket.h:169
Public Methods
| Return | Name | Description |
|---|---|---|
SSLSocket | Constructs an SSLSocket that acquires its context from SSLManager on first use. | |
SSLSocket | Constructs an SSLSocket with an explicit SSL context. | |
SSLSocket | Constructs an SSLSocket with an explicit context and a prior session for resumption. | |
~SSLSocket virtual noexcept | ||
void | connect virtual override | Initialize the SSLSocket with the given SSLContext. |
void | connect virtual override | Resolves host and initiates a secure connection. |
void | bind virtual override | Binds the socket to address for server-side use. Throws std::logic_error if the context is not a server context. |
void | listen virtual override | Starts listening for incoming connections. Throws std::logic_error if the context is not a server context. |
bool | shutdown virtual override | Shuts down the connection by attempting an orderly SSL shutdown, then actually shutting down the TCP connection. |
void | close virtual override | Closes the socket forcefully. |
ssize_t | send virtual override | Encrypts and sends len bytes to the connected peer. |
ssize_t | sendOwned virtual override | Sends an owned payload buffer to the connected peer. |
ssize_t | send virtual override | Encrypts and sends len bytes, ignoring peerAddress (TCP is connected). |
ssize_t | sendOwned virtual override | |
void | setHostname | Set the expected peer hostname for certificate verification and SNI. Must be called before connect() to enable hostname verification. |
void | useContext | Use the given SSL context for this socket. |
SSLContext::Ptr | context const | Returns the SSL context used for this socket. |
void | useSession | Sets the SSL session to use for the next connection. Setting a previously saved Session object is necessary to enable session caching. |
SSLSession::Ptr | currentSession | Returns the SSL session of the current connection, for reuse in a future connection (if session caching is enabled). |
bool | sessionWasReused | Returns true if a reused session was negotiated during the handshake. |
int | available const | Returns the number of bytes available from the SSL buffer for immediate reading. |
X509 * | peerCertificate const | Returns the peer's X.509 certificate, or nullptr if no certificate was presented. |
net::TransportType | transport virtual const override | Returns the SSLTCP transport protocol identifier. |
void | acceptConnection virtual override | Accepts a pending client connection, initializes the server-side SSL context on the new socket, and fires the AcceptConnection signal. |
void | onConnect virtual override | Called when the TCP connection is established; starts reading and initiates the client-side SSL handshake. |
void | onRead virtual override | Feeds raw encrypted bytes from the network into the SSL adapter. Called by the stream layer when ciphertext arrives from the peer. |
SSLSocket
SSLSocket(uv::Loop * loop = uv::defaultLoop())Defined in src/net/include/icy/net/sslsocket.h:38
Constructs an SSLSocket that acquires its context from SSLManager on first use.
Parameters
| Parameter | Type | Description |
|---|---|---|
loop | uv::Loop * | Event loop to use; defaults to the default loop. |
SSLSocket
SSLSocket(SSLContext::Ptr sslContext, uv::Loop * loop = uv::defaultLoop())Defined in src/net/include/icy/net/sslsocket.h:43
Constructs an SSLSocket with an explicit SSL context.
Parameters
| Parameter | Type | Description |
|---|---|---|
sslContext | SSLContext::Ptr | The SSL context to use for this connection. |
loop | uv::Loop * | Event loop to use; defaults to the default loop. |
SSLSocket
SSLSocket(SSLContext::Ptr sslContext, SSLSession::Ptr session, uv::Loop * loop = uv::defaultLoop())Defined in src/net/include/icy/net/sslsocket.h:49
Constructs an SSLSocket with an explicit context and a prior session for resumption.
Parameters
| Parameter | Type | Description |
|---|---|---|
sslContext | SSLContext::Ptr | The SSL context to use for this connection. |
session | SSLSession::Ptr | A previously saved session to attempt resumption with. |
loop | uv::Loop * | Event loop to use; defaults to the default loop. |
~SSLSocket
virtual noexcept
virtual ~SSLSocket() noexceptDefined in src/net/include/icy/net/sslsocket.h:52
connect
virtual override
virtual void connect(const Address & peerAddress) overrideDefined in src/net/include/icy/net/sslsocket.h:61
Initialize the SSLSocket with the given SSLContext.
Initiates a secure connection to the peer at the given address.
The SSL handshake begins automatically once the TCP connection is established.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
peerAddress | const Address & | The remote address to connect to. |
connect
virtual override
virtual void connect(std::string_view host, uint16_t port) overrideDefined in src/net/include/icy/net/sslsocket.h:69
Resolves host and initiates a secure connection.
Sets the hostname on the SSL adapter for SNI and certificate verification before resolving and connecting.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
host | std::string_view | Hostname or IP address string. |
port | uint16_t | Destination port. |
bind
virtual override
virtual void bind(const net::Address & address, unsigned flags = 0) overrideDefined in src/net/include/icy/net/sslsocket.h:75
Binds the socket to address for server-side use. Throws std::logic_error if the context is not a server context.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
address | const net::Address & | Local address to bind to. |
flags | unsigned | Optional bind flags (passed to uv_tcp_bind). |
listen
virtual override
virtual void listen(int backlog = 64) overrideDefined in src/net/include/icy/net/sslsocket.h:80
Starts listening for incoming connections. Throws std::logic_error if the context is not a server context.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
backlog | int | Maximum number of pending connections. |
shutdown
virtual override
virtual bool shutdown() overrideDefined in src/net/include/icy/net/sslsocket.h:85
Shuts down the connection by attempting an orderly SSL shutdown, then actually shutting down the TCP connection.
Reimplements
close
virtual override
virtual void close() overrideDefined in src/net/include/icy/net/sslsocket.h:88
Closes the socket forcefully.
Reimplements
send
virtual override
virtual ssize_t send(const char * data, size_t len, int flags = 0) overrideDefined in src/net/include/icy/net/sslsocket.h:95
Encrypts and sends len bytes to the connected peer.
Returns
Number of plaintext bytes accepted, or -1 on error.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
data | const char * | Pointer to the plaintext payload. |
len | size_t | Number of bytes to send. |
flags | int | Reserved; currently unused. |
sendOwned
virtual override
virtual ssize_t sendOwned(Buffer && buffer, int flags = 0) overrideDefined in src/net/include/icy/net/sslsocket.h:96
Sends an owned payload buffer to the connected peer.
Reimplements
send
virtual override
virtual ssize_t send(const char * data, size_t len, const net::Address & peerAddress, int flags = 0) overrideDefined in src/net/include/icy/net/sslsocket.h:104
Encrypts and sends len bytes, ignoring peerAddress (TCP is connected).
Returns
Number of plaintext bytes accepted, or -1 on error.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
data | const char * | Pointer to the plaintext payload. |
len | size_t | Number of bytes to send. |
peerAddress | const net::Address & | Ignored for SSL/TCP; present for interface conformance. |
flags | int | Reserved; currently unused. |
sendOwned
virtual override
virtual ssize_t sendOwned(Buffer && buffer, const net::Address & peerAddress, int flags = 0) overrideDefined in src/net/include/icy/net/sslsocket.h:106
Reimplements
setHostname
void setHostname(std::string_view hostname)Defined in src/net/include/icy/net/sslsocket.h:111
Set the expected peer hostname for certificate verification and SNI. Must be called before connect() to enable hostname verification.
useContext
void useContext(SSLContext::Ptr context)Defined in src/net/include/icy/net/sslsocket.h:114
Use the given SSL context for this socket.
context
const
SSLContext::Ptr context() constDefined in src/net/include/icy/net/sslsocket.h:117
Returns the SSL context used for this socket.
useSession
void useSession(SSLSession::Ptr session)Defined in src/net/include/icy/net/sslsocket.h:127
Sets the SSL session to use for the next connection. Setting a previously saved Session object is necessary to enable session caching.
To remove the currently set session, a nullptr pointer can be given.
Must be called before connect() to be effective.
currentSession
SSLSession::Ptr currentSession()Defined in src/net/include/icy/net/sslsocket.h:134
Returns the SSL session of the current connection, for reuse in a future connection (if session caching is enabled).
If no connection is established, returns nullptr.
sessionWasReused
bool sessionWasReused()Defined in src/net/include/icy/net/sslsocket.h:138
Returns true if a reused session was negotiated during the handshake.
available
const
int available() constDefined in src/net/include/icy/net/sslsocket.h:142
Returns the number of bytes available from the SSL buffer for immediate reading.
peerCertificate
const
X509 * peerCertificate() constDefined in src/net/include/icy/net/sslsocket.h:145
Returns the peer's X.509 certificate, or nullptr if no certificate was presented.
transport
virtual const override
virtual net::TransportType transport() const overrideDefined in src/net/include/icy/net/sslsocket.h:148
Returns the SSLTCP transport protocol identifier.
Reimplements
acceptConnection
virtual override
virtual void acceptConnection() overrideDefined in src/net/include/icy/net/sslsocket.h:152
Accepts a pending client connection, initializes the server-side SSL context on the new socket, and fires the AcceptConnection signal.
Reimplements
onConnect
virtual override
virtual void onConnect() overrideDefined in src/net/include/icy/net/sslsocket.h:156
Called when the TCP connection is established; starts reading and initiates the client-side SSL handshake.
Reimplements
onRead
virtual override
virtual void onRead(const char * data, size_t len) overrideDefined in src/net/include/icy/net/sslsocket.h:162
Feeds raw encrypted bytes from the network into the SSL adapter. Called by the stream layer when ciphertext arrives from the peer.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
data | const char * | Pointer to the encrypted bytes. |
len | size_t | Number of bytes received. |
Protected Attributes
| Return | Name | Description |
|---|---|---|
net::SSLContext::Ptr | _sslContext | |
net::SSLSession::Ptr | _sslSession | |
net::SSLAdapter | _sslAdapter |
_sslContext
net::SSLContext::Ptr _sslContextType: net::SSLContext::Ptr
Defined in src/net/include/icy/net/sslsocket.h:165
_sslSession
net::SSLSession::Ptr _sslSessionType: net::SSLSession::Ptr
Defined in src/net/include/icy/net/sslsocket.h:166
_sslAdapter
net::SSLAdapter _sslAdapterType: net::SSLAdapter
Defined in src/net/include/icy/net/sslsocket.h:167
Public Types
Ptr
using Ptr = std::shared_ptr< SSLSocket >Type: std::shared_ptr< SSLSocket >
Defined in src/net/include/icy/net/sslsocket.h:33
Vec
using Vec = std::vector< Ptr >Type: std::vector< Ptr >
