Home
Net module

SSLSocket

SSL socket implementation.

SSLSocket

#include <icy/net/sslsocket.h>
class SSLSocket

Defined in src/net/include/icy/net/sslsocket.h:30

Inherits: TCPSocket

SSL socket implementation.

List of all members

NameKindOwner
SSLAdapterfriendDeclared here
SSLSocketfunctionDeclared here
SSLSocketfunctionDeclared here
SSLSocketfunctionDeclared here
~SSLSocketfunctionDeclared here
connectfunctionDeclared here
connectfunctionDeclared here
bindfunctionDeclared here
listenfunctionDeclared here
shutdownfunctionDeclared here
closefunctionDeclared here
sendfunctionDeclared here
sendOwnedfunctionDeclared here
sendfunctionDeclared here
sendOwnedfunctionDeclared here
setHostnamefunctionDeclared here
useContextfunctionDeclared here
contextfunctionDeclared here
useSessionfunctionDeclared here
currentSessionfunctionDeclared here
sessionWasReusedfunctionDeclared here
availablefunctionDeclared here
peerCertificatefunctionDeclared here
transportfunctionDeclared here
acceptConnectionfunctionDeclared here
onConnectfunctionDeclared here
onReadfunctionDeclared here
_sslContextvariableDeclared here
_sslSessionvariableDeclared here
_sslAdaptervariableDeclared here
PtrtypedefDeclared here
VectypedefDeclared here
AcceptConnectionvariableInherited from TCPSocket
TCPSocketfunctionInherited from TCPSocket
~TCPSocketfunctionInherited from TCPSocket
TCPSocketfunctionInherited from TCPSocket
operator=functionInherited from TCPSocket
TCPSocketfunctionInherited from TCPSocket
operator=functionInherited from TCPSocket
shutdownfunctionInherited from TCPSocket
closefunctionInherited from TCPSocket
connectfunctionInherited from TCPSocket
connectfunctionInherited from TCPSocket
sendfunctionInherited from TCPSocket
sendOwnedfunctionInherited from TCPSocket
sendfunctionInherited from TCPSocket
sendOwnedfunctionInherited from TCPSocket
bindfunctionInherited from TCPSocket
listenfunctionInherited from TCPSocket
acceptConnectionfunctionInherited from TCPSocket
setReusePortfunctionInherited from TCPSocket
setNoDelayfunctionInherited from TCPSocket
setKeepAlivefunctionInherited from TCPSocket
setSimultaneousAcceptsfunctionInherited from TCPSocket
setModefunctionInherited from TCPSocket
modefunctionInherited from TCPSocket
setErrorfunctionInherited from TCPSocket
errorfunctionInherited from TCPSocket
closedfunctionInherited from TCPSocket
addressfunctionInherited from TCPSocket
peerAddressfunctionInherited from TCPSocket
transportfunctionInherited from TCPSocket
loopfunctionInherited from TCPSocket
onConnectfunctionInherited from TCPSocket
onReadfunctionInherited from TCPSocket
onRecvfunctionInherited from TCPSocket
onErrorfunctionInherited from TCPSocket
onClosefunctionInherited from TCPSocket
_modevariableInherited from TCPSocket
_peerAddressvariableInherited from TCPSocket
initfunctionInherited from TCPSocket
resetfunctionInherited from TCPSocket
PtrtypedefInherited from TCPSocket
VectypedefInherited from TCPSocket
ReadvariableInherited from Stream
StreamfunctionInherited from Stream
~StreamfunctionInherited from Stream
closefunctionInherited from Stream
shutdownfunctionInherited from Stream
writefunctionInherited from Stream
writeOwnedfunctionInherited from Stream
setHighWaterMarkfunctionInherited from Stream
writefunctionInherited from Stream
streamfunctionInherited from Stream
_buffervariableInherited from Stream
_startedvariableInherited from Stream
_highWaterMarkvariableInherited from Stream
_writeReqFreevariableInherited from Stream
_ownedWriteReqFreevariableInherited from Stream
readStartfunctionInherited from Stream
readStopfunctionInherited from Stream
onReadfunctionInherited from Stream
allocWriteReqfunctionInherited from Stream
freeWriteReqfunctionInherited from Stream
allocOwnedWriteReqfunctionInherited from Stream
freeOwnedWriteReqfunctionInherited from Stream
canQueueWritefunctionInherited from Stream
HandletypedefInherited from Stream
HandlefunctionInherited from Handle
~HandlefunctionInherited from Handle
initfunctionInherited from Handle
invokefunctionInherited from Handle
invokeOrThrowfunctionInherited from Handle
closefunctionInherited from Handle
reffunctionInherited from Handle
unreffunctionInherited from Handle
initializedfunctionInherited from Handle
activefunctionInherited from Handle
closingfunctionInherited from Handle
closedfunctionInherited from Handle
errorfunctionInherited from Handle
setErrorfunctionInherited from Handle
setUVErrorfunctionInherited from Handle
setAndThrowErrorfunctionInherited from Handle
throwLastErrorfunctionInherited from Handle
loopfunctionInherited from Handle
resetfunctionInherited from Handle
getfunctionInherited from Handle
tidfunctionInherited from Handle
contextfunctionInherited from Handle
setCloseCleanupfunctionInherited from Handle
clearCloseCleanupfunctionInherited from Handle
assertThreadfunctionInherited from Handle
_loopvariableInherited from Handle
_contextvariableInherited from Handle
_tidvariableInherited from Handle
_errorvariableInherited from Handle
onErrorfunctionInherited from Handle
onClosefunctionInherited from Handle
HandlefunctionInherited from Handle
operator=functionInherited from Handle
HandlefunctionInherited from Handle
operator=functionInherited from Handle
TypetypedefInherited from Handle
opaquevariableInherited from Socket
SocketfunctionInherited from Socket
~SocketfunctionInherited from Socket
SocketfunctionInherited from Socket
operator=functionInherited from Socket
SocketfunctionInherited from Socket
operator=functionInherited from Socket
connectfunctionInherited from Socket
connectfunctionInherited from Socket
bindfunctionInherited from Socket
listenfunctionInherited from Socket
shutdownfunctionInherited from Socket
sendOwnedfunctionInherited from Socket
sendOwnedfunctionInherited from Socket
closefunctionInherited from Socket
addressfunctionInherited from Socket
peerAddressfunctionInherited from Socket
transportfunctionInherited from Socket
setErrorfunctionInherited from Socket
errorfunctionInherited from Socket
closedfunctionInherited from Socket
loopfunctionInherited from Socket
_afvariableInherited from Socket
initfunctionInherited from Socket
resetfunctionInherited from Socket
PtrtypedefInherited from Socket
VectypedefInherited from Socket
priorityvariableInherited from SocketAdapter
SocketAdapterfunctionInherited from SocketAdapter
~SocketAdapterfunctionInherited from SocketAdapter
sendfunctionInherited from SocketAdapter
sendfunctionInherited from SocketAdapter
sendOwnedfunctionInherited from SocketAdapter
sendOwnedfunctionInherited from SocketAdapter
sendPacketfunctionInherited from SocketAdapter
sendPacketfunctionInherited from SocketAdapter
sendPacketfunctionInherited from SocketAdapter
setSenderfunctionInherited from SocketAdapter
senderfunctionInherited from SocketAdapter
addReceiverfunctionInherited from SocketAdapter
removeReceiverfunctionInherited from SocketAdapter
hasReceiverfunctionInherited from SocketAdapter
receiversfunctionInherited from SocketAdapter
onSocketConnectfunctionInherited from SocketAdapter
onSocketRecvfunctionInherited from SocketAdapter
onSocketErrorfunctionInherited from SocketAdapter
onSocketClosefunctionInherited from SocketAdapter
_sendervariableInherited from SocketAdapter
_receiversvariableInherited from SocketAdapter
_dirtyvariableInherited from SocketAdapter
cleanupReceiversfunctionInherited from SocketAdapter

Inherited from TCPSocket

KindNameDescription
variableAcceptConnectionFired when a new client connection is accepted; carries a shared_ptr to the new socket.
functionTCPSocketConstructs the TCPSocket and initializes the underlying libuv handle.
function~TCPSocket virtual noexcept
functionTCPSocketDeleted constructor.
functionoperator=Deleted assignment operator.
functionTCPSocketDeleted constructor.
functionoperator=Deleted assignment operator.
functionshutdown virtual overrideSends a TCP shutdown request; the socket closes after the peer acknowledges.
functionclose virtual overrideCloses the socket immediately, releasing all associated resources.
functionconnect virtual overrideConnects to peerAddress using a libuv connect request. On success, calls onConnect(); on failure, calls setUVError().
functionconnect virtual overrideResolves host via DNS (or maps "localhost"), then connects.
functionsend virtual overrideWrites len bytes to the connected peer.
functionsendOwned virtual overrideSends an owned payload buffer to the connected peer.
functionsend virtual overrideWrites len bytes; peerAddress is ignored for TCP (connected stream).
functionsendOwned virtual override
functionbind virtual overrideBinds the socket to address. Resets and reinitializes the handle if the address family changes.
functionlisten virtual overrideStarts listening for incoming connections with the given backlog.
functionacceptConnection virtualAccepts the next pending client connection and fires AcceptConnection.
functionsetReusePortEnables 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.
functionsetNoDelayEnables or disables TCP_NODELAY (Nagle's algorithm).
functionsetKeepAliveEnables or disables TCP keep-alive probes.
functionsetSimultaneousAcceptsEnables or disables simultaneous accepts on Windows. No-op and returns false on non-Windows platforms.
functionsetModeSets the socket mode (ServerSide or ClientSide).
functionmode constReturns the current socket mode.
functionsetError virtual overrideSets the socket error; ignores the call if an error is already recorded. Setting an error causes the socket to close.
functionerror virtual const overrideReturns the current socket error, if any.
functionclosed virtual const overrideReturns true if the native socket handle is closed.
functionaddress virtual const overrideReturns the IP address and port number of the socket. A wildcard address is returned if the socket is not connected.
functionpeerAddress virtual const overrideReturns the IP address and port number of the peer socket. A wildcard address is returned if the socket is not connected.
functiontransport virtual const overrideReturns the TCP transport protocol.
functionloop virtual const overrideReturns the event loop associated with this socket.
functiononConnect virtualCalled by the stream layer when the TCP connection is established.
functiononRead virtual overrideCalled by the stream layer with raw received bytes; wraps them in a MutableBuffer.
functiononRecv virtualDispatches a received buffer to all socket adapters via onSocketRecv.
functiononError virtual overrideDispatches the error to adapters and closes the socket.
functiononClose virtual overrideDispatches the close event to all socket adapters.
variable_mode
variable_peerAddressCached peer address (avoids syscall per recv)
functioninit virtual overrideInitializes the underlying socket context.
functionreset virtual overrideResets the socket context for reuse.
typedefPtr
typedefVec

Inherited from Stream

KindNameDescription
variableReadEmitted when data has been received from the peer.
functionStream inlineConstruct the stream bound to loop with a 64 KiB read buffer.
function~Stream virtual inlineDestroy the stream, stopping reads and freeing pooled write requests.
functionclose virtual inline overrideCloses and resets the stream handle. This will close the active socket/pipe and destroy the handle.
functionshutdown inlineSend a TCP/pipe shutdown request to the connected peer.
functionwrite inlineWrite len bytes from data to the stream.
functionwriteOwned inlineWrite an owned payload buffer to the stream.
functionsetHighWaterMark inlineSet the high water mark for the write queue (default 16MB). When the write queue exceeds this size, write() returns false.
functionwrite inlineWrite len bytes from data together with a stream handle over an IPC pipe (uses uv_write2).
functionstream inlineReturn the underlying uv_stream_t pointer cast from the native handle.
variable_buffer
variable_started
variable_highWaterMark16MB default write queue limit
variable_writeReqFreeFreelist for write requests.
variable_ownedWriteReqFreeFreelist for owned write requests.
functionreadStart virtual inlineBegin reading from the stream by registering libuv read callbacks.
functionreadStop virtual inlineStop reading from the stream.
functiononRead virtual inlineCalled by handleRead when len bytes of data arrive.
functionallocWriteReq inlineReturn a uv_write_t from the freelist, or allocate a new one if the pool is empty.
functionfreeWriteReq inlineReturn req to the freelist, or delete it if the pool is at capacity.
functionallocOwnedWriteReq inline
functionfreeOwnedWriteReq inline
functioncanQueueWrite inline
typedefHandle

Inherited from Handle

KindNameDescription
functionHandle inlineConstruct the handle bound to the given event loop.
function~Handle virtual inline
functioninit inlineInitialize the underlying libuv handle by calling f with the loop, the raw handle pointer, and any additional args.
functioninvoke inlineInvoke a libuv function f with args on the initialized handle.
functioninvokeOrThrow inlineInvoke a libuv function f with args, throwing on failure.
functionclose virtual inlineClose and destroy the handle.
functionref inlineRe-reference the handle with the event loop after a previous [unref()](icy-uv-Handle.html#unref).
functionunref inlineUnreference the handle from the event loop.
functioninitialized const inlineReturn true if the handle has been successfully initialized via [init()](icy-uv-Handle.html#init-8).
functionactive virtual const inlineReturn true when the handle is active (libuv uv_is_active).
functionclosing virtual const inlineReturn true if uv_close has been called and the handle is awaiting its close callback (libuv uv_is_closing).
functionclosed virtual const inlineReturn true if the handle has been fully closed (context released).
functionerror const inlineReturn the last error set on this handle, or a default-constructed [Error](icy-Error.html#error) if no error has occurred.
functionsetError virtual inlineSet the error state and invoke [onError()](icy-uv-Handle.html#onerror).
functionsetUVError inlineTranslate a libuv error code into an [Error](icy-Error.html#error) and call [setError()](icy-uv-Handle.html#seterror-1).
functionsetAndThrowError inlineSet the error state from a libuv error code and throw a std::runtime_error.
functionthrowLastError inlineThrow a std::runtime_error if the handle currently holds an error.
functionloop const inlineReturn the event loop this handle is bound to.
functionreset inlineClose the current handle (if open) and allocate a fresh [Context](icy-uv-Context.html#context-2), leaving the handle ready to be re-initialized via [init()](icy-uv-Handle.html#init-8).
functionget const inlineReturn the raw libuv handle pointer cast to [Handle](icy-uv-Handle.html#handle-6).
functiontid const inlineReturn the ID of the thread that constructed this handle.
functioncontext const inlineReturn the raw [Context](icy-uv-Context.html#context-2) that owns the libuv handle memory.
functionsetCloseCleanup inline
functionclearCloseCleanup inline
functionassertThread const inlineThrow std::logic_error if called from any thread other than the thread that constructed this handle.
variable_loop
variable_context
variable_tid
variable_error
functiononError virtual inlineCalled by [setError()](icy-uv-Handle.html#seterror-1) after the error state has been updated.
functiononClose virtual inlineCalled by [close()](icy-uv-Handle.html#close-18) after the context has been released.
functionHandleNonCopyable and NonMovable.
functionoperator=Deleted assignment operator.
functionHandleDeleted constructor.
functionoperator=Deleted assignment operator.
typedefTypeDefine the native handle type.

Inherited from Socket

KindNameDescription
variableopaqueOptional client data.
functionSocketDefaulted constructor.
function~Socket virtual noexceptDefaulted destructor.
functionSocketDeleted constructor.
functionoperator=Deleted assignment operator.
functionSocketDeleted constructor.
functionoperator=Deleted assignment operator.
functionconnect virtualConnects to the given peer IP address.
functionconnect virtualResolves and connects to the given host address.
functionbind virtualBind a local address to the socket. The address may be IPv4 or IPv6 (if supported).
functionlisten virtual inlineListens the socket on the given address.
functionshutdown virtual inlineSends the shutdown packet which should result is socket closure via callback.
functionsendOwned virtualSends an owned payload buffer to the connected peer.
functionsendOwned virtual
functionclose virtualCloses the underlying socket.
functionaddress virtual constThe locally bound address.
functionpeerAddress virtual constThe connected peer address.
functiontransport virtual constThe transport protocol: TCP, UDP or SSLTCP.
functionsetError virtualSets the socket error.
functionerror virtual constReturn the socket error if any.
functionclosed virtual constReturns true if the native socket handle is closed.
functionloop virtual constReturns the socket event loop.
variable_af
functioninit virtualInitializes the underlying socket context.
functionreset virtualResets the socket context for reuse.
typedefPtr
typedefVec

Inherited from SocketAdapter

KindNameDescription
variablepriorityThe priority of this adapter for STL sort operations.
functionSocketAdapterCreates the SocketAdapter.
function~SocketAdapter virtual noexceptDestroys the SocketAdapter.
functionsend virtualSends 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.
functionsend virtual
functionsendOwned virtualSends an owned payload buffer to the connected peer.
functionsendOwned virtual
functionsendPacket virtualSends 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.
functionsendPacket virtual
functionsendPacket virtualSends 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.
functionsetSender virtualSets the pointer to the outgoing data adapter. Send methods proxy data to this adapter by default.
functionsenderReturns the output SocketAdapter pointer.
functionaddReceiver virtualSets the pointer to the incoming data adapter. Events proxy data to this adapter by default.
functionremoveReceiver virtualRemove the given receiver.
functionhasReceiver virtualReturns true if the given receiver is connected.
functionreceiversReturns all currently registered input SocketAdapter pointers. Dead (removed) entries are excluded from the returned list.
functiononSocketConnect virtualCalled 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.
functiononSocketRecv virtualCalled when data is received from the socket. Forwards the event to all registered receivers in priority order.
functiononSocketError virtualCalled when the socket encounters an error. Forwards the event to all registered receivers in priority order.
functiononSocketClose virtualCalled when the socket is closed. Forwards the event to all registered receivers in priority order.
variable_sender
variable_receivers
variable_dirty
functioncleanupReceivers virtual

Friends

NameDescription
net::SSLAdapter

net::SSLAdapter

friend class net::SSLAdapter

Defined in src/net/include/icy/net/sslsocket.h:169

Public Methods

ReturnNameDescription
SSLSocketConstructs an SSLSocket that acquires its context from SSLManager on first use.
SSLSocketConstructs an SSLSocket with an explicit SSL context.
SSLSocketConstructs an SSLSocket with an explicit context and a prior session for resumption.
voidconnect virtual overrideInitialize the SSLSocket with the given SSLContext.
voidconnect virtual overrideResolves host and initiates a secure connection.
voidbind virtual overrideBinds the socket to address for server-side use. Throws std::logic_error if the context is not a server context.
voidlisten virtual overrideStarts listening for incoming connections. Throws std::logic_error if the context is not a server context.
boolshutdown virtual overrideShuts down the connection by attempting an orderly SSL shutdown, then actually shutting down the TCP connection.
voidclose virtual overrideCloses the socket forcefully.
ssize_tsend virtual overrideEncrypts and sends len bytes to the connected peer.
ssize_tsendOwned virtual overrideSends an owned payload buffer to the connected peer.
ssize_tsend virtual overrideEncrypts and sends len bytes, ignoring peerAddress (TCP is connected).
ssize_tsendOwned virtual override
voidsetHostnameSet the expected peer hostname for certificate verification and SNI. Must be called before connect() to enable hostname verification.
voiduseContextUse the given SSL context for this socket.
SSLContext::Ptrcontext constReturns the SSL context used for this socket.
voiduseSessionSets the SSL session to use for the next connection. Setting a previously saved Session object is necessary to enable session caching.
SSLSession::PtrcurrentSessionReturns the SSL session of the current connection, for reuse in a future connection (if session caching is enabled).
boolsessionWasReusedReturns true if a reused session was negotiated during the handshake.
intavailable constReturns the number of bytes available from the SSL buffer for immediate reading.
X509 *peerCertificate constReturns the peer's X.509 certificate, or nullptr if no certificate was presented.
net::TransportTypetransport virtual const overrideReturns the SSLTCP transport protocol identifier.
voidacceptConnection virtual overrideAccepts a pending client connection, initializes the server-side SSL context on the new socket, and fires the AcceptConnection signal.
voidonConnect virtual overrideCalled when the TCP connection is established; starts reading and initiates the client-side SSL handshake.
voidonRead virtual overrideFeeds 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

  • 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

  • sslContext The SSL context to use for this connection.

  • 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

  • sslContext The SSL context to use for this connection.

  • session A previously saved session to attempt resumption with.

  • loop Event loop to use; defaults to the default loop.


connect

virtual override

virtual void connect(const Address & peerAddress) override

Defined 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.

Parameters

  • peerAddress The remote address to connect to.
Reimplements

connect

virtual override

virtual void connect(std::string_view host, uint16_t port) override

Defined 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.

Parameters

  • host Hostname or IP address string.

  • port Destination port.

Reimplements

bind

virtual override

virtual void bind(const net::Address & address, unsigned flags = 0) override

Defined 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.

Parameters

  • address Local address to bind to.

  • flags Optional bind flags (passed to uv_tcp_bind).

Reimplements

listen

virtual override

virtual void listen(int backlog = 64) override

Defined 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.

Parameters

  • backlog Maximum number of pending connections.
Reimplements

shutdown

virtual override

virtual bool shutdown() override

Defined 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() override

Defined 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) override

Defined in src/net/include/icy/net/sslsocket.h:95

Encrypts and sends len bytes to the connected peer.

Parameters

  • data Pointer to the plaintext payload.

  • len Number of bytes to send.

  • flags Reserved; currently unused.

Returns

Number of plaintext bytes accepted, or -1 on error.

Reimplements

sendOwned

virtual override

virtual ssize_t sendOwned(Buffer && buffer, int flags = 0) override

Defined 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) override

Defined in src/net/include/icy/net/sslsocket.h:104

Encrypts and sends len bytes, ignoring peerAddress (TCP is connected).

Parameters

  • data Pointer to the plaintext payload.

  • len Number of bytes to send.

  • peerAddress Ignored for SSL/TCP; present for interface conformance.

  • flags Reserved; currently unused.

Returns

Number of plaintext bytes accepted, or -1 on error.

Reimplements

sendOwned

virtual override

virtual ssize_t sendOwned(Buffer && buffer, const net::Address & peerAddress, int flags = 0) override

Defined 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() const

Defined 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() const

Defined 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() const

Defined 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 override

Defined in src/net/include/icy/net/sslsocket.h:148

Returns the SSLTCP transport protocol identifier.

Reimplements

acceptConnection

virtual override

virtual void acceptConnection() override

Defined 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() override

Defined 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) override

Defined 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.

Parameters

  • data Pointer to the encrypted bytes.

  • len Number of bytes received.

Reimplements

Protected Attributes

ReturnNameDescription
net::SSLContext::Ptr_sslContext
net::SSLSession::Ptr_sslSession
net::SSLAdapter_sslAdapter

_sslContext

net::SSLContext::Ptr _sslContext

Defined in src/net/include/icy/net/sslsocket.h:165


_sslSession

net::SSLSession::Ptr _sslSession

Defined in src/net/include/icy/net/sslsocket.h:166


_sslAdapter

net::SSLAdapter _sslAdapter

Defined in src/net/include/icy/net/sslsocket.h:167

Public Types

NameDescription
Ptr
Vec

Ptr

using Ptr = std::shared_ptr< SSLSocket >

Defined in src/net/include/icy/net/sslsocket.h:33


Vec

using Vec = std::vector< Ptr >

Defined in src/net/include/icy/net/sslsocket.h:34