join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::BasicTlsStream< Protocol > Class Template Reference

TLS stream class. More...

#include <tls_stream.hpp>

Inheritance diagram for join::BasicTlsStream< Protocol >:
Collaboration diagram for join::BasicTlsStream< Protocol >:

Public Types

using Endpoint = typename Protocol::Endpoint
 
using Socket = typename Protocol::Socket
 
using Transport = typename Protocol::Transport::Socket
 
using Mode = typename Socket::Mode
 
- Public Types inherited from join::BasicSocketStream< Protocol >
using SocketStreambuf = BasicSocketStreambuf<Protocol>
 
using Endpoint = typename Protocol::Endpoint
 
using Socket = typename Protocol::Socket
 

Public Member Functions

 BasicTlsStream ()
 default constructor.
 
 BasicTlsStream (TlsContext ctx, Mode mode=Mode::NonBlocking)
 construct the TLS stream instance using the given context.
 
 BasicTlsStream (Socket &&socket)
 construct the TLS stream by moving an already wrapped TLS socket in.
 
 BasicTlsStream (Transport &&socket, TlsContext ctx=TlsContext{})
 construct the TLS stream by wrapping an already connected transport socket.
 
 BasicTlsStream (const BasicTlsStream &other)=delete
 copy constructor.
 
BasicTlsStreamoperator= (const BasicTlsStream &other)=delete
 copy assignment operator.
 
 BasicTlsStream (BasicTlsStream &&other)
 move constructor.
 
BasicTlsStreamoperator= (BasicTlsStream &&other)
 move assignment operator.
 
virtual ~BasicTlsStream ()=default
 destroy the TLS stream instance.
 
void handshake ()
 perform the TLS handshake.
 
void shutdown ()
 perform the TLS shutdown (send a close_notify alert).
 
bool encrypted ()
 check if the stream is encrypted.
 
- Public Member Functions inherited from join::BasicSocketStream< Protocol >
 BasicSocketStream ()
 default constructor.
 
 BasicSocketStream (Socket &&socket)
 construct the socket stream by moving an existing socket in.
 
 BasicSocketStream (const BasicSocketStream &other)=delete
 copy constructor.
 
BasicSocketStreamoperator= (const BasicSocketStream &other)=delete
 copy assignment operator.
 
 BasicSocketStream (BasicSocketStream &&other)
 move constructor.
 
BasicSocketStreamoperator= (BasicSocketStream &&other)
 move assignment operator.
 
virtual ~BasicSocketStream ()=default
 destroy the socket stream instance.
 
virtual void bind (const Endpoint &endpoint)
 assigns the specified endpoint to the socket.
 
virtual void connect (const Endpoint &endpoint)
 make a connection to the given endpoint.
 
virtual void disconnect ()
 shutdown the connection.
 
virtual void close ()
 close the connection.
 
Endpoint localEndpoint ()
 determine the local endpoint associated with this socket.
 
Endpoint remoteEndpoint ()
 determine the remote endpoint associated with this socket.
 
bool opened ()
 check if the socket is opened.
 
bool connected ()
 check if the socket is connected.
 
void timeout (std::chrono::nanoseconds timeout)
 set the socket timeout.
 
std::chrono::nanoseconds timeout () const
 get the current timeout duration.
 
Socketsocket ()
 get the nested socket.
 

Additional Inherited Members

- Protected Attributes inherited from join::BasicSocketStream< Protocol >
SocketStreambuf _sockbuf
 associated stream buffer.
 

Detailed Description

template<class Protocol>
class join::BasicTlsStream< Protocol >

TLS stream class.

Member Typedef Documentation

◆ Endpoint

template<class Protocol >
using join::BasicTlsStream< Protocol >::Endpoint = typename Protocol::Endpoint

◆ Mode

template<class Protocol >
using join::BasicTlsStream< Protocol >::Mode = typename Socket::Mode

◆ Socket

template<class Protocol >
using join::BasicTlsStream< Protocol >::Socket = typename Protocol::Socket

◆ Transport

template<class Protocol >
using join::BasicTlsStream< Protocol >::Transport = typename Protocol::Transport::Socket

Constructor & Destructor Documentation

◆ BasicTlsStream() [1/6]

template<class Protocol >
join::BasicTlsStream< Protocol >::BasicTlsStream ( )
inline

default constructor.

◆ BasicTlsStream() [2/6]

template<class Protocol >
join::BasicTlsStream< Protocol >::BasicTlsStream ( TlsContext ctx,
Mode mode = Mode::NonBlocking )
inlineexplicit

construct the TLS stream instance using the given context.

Parameters
ctxTLS context to use.
modesocket blocking mode.

◆ BasicTlsStream() [3/6]

template<class Protocol >
join::BasicTlsStream< Protocol >::BasicTlsStream ( Socket && socket)
inlineexplicit

construct the TLS stream by moving an already wrapped TLS socket in.

Parameters
socketTLS socket to move in.

◆ BasicTlsStream() [4/6]

template<class Protocol >
join::BasicTlsStream< Protocol >::BasicTlsStream ( Transport && socket,
TlsContext ctx = TlsContext{} )
inlineexplicit

construct the TLS stream by wrapping an already connected transport socket.

Parameters
socketconnected transport socket to move in (e.g. as returned by accept ()).
ctxTLS context to use for the encryption layer.

◆ BasicTlsStream() [5/6]

template<class Protocol >
join::BasicTlsStream< Protocol >::BasicTlsStream ( const BasicTlsStream< Protocol > & other)
delete

copy constructor.

Parameters
otherother object to copy.

◆ BasicTlsStream() [6/6]

template<class Protocol >
join::BasicTlsStream< Protocol >::BasicTlsStream ( BasicTlsStream< Protocol > && other)
inline

move constructor.

Parameters
otherother object to move.

◆ ~BasicTlsStream()

template<class Protocol >
virtual join::BasicTlsStream< Protocol >::~BasicTlsStream ( )
virtualdefault

destroy the TLS stream instance.

Member Function Documentation

◆ encrypted()

template<class Protocol >
bool join::BasicTlsStream< Protocol >::encrypted ( )
inline

check if the stream is encrypted.

Returns
true if the stream is encrypted, false otherwise.

◆ handshake()

template<class Protocol >
void join::BasicTlsStream< Protocol >::handshake ( )
inline

perform the TLS handshake.

◆ operator=() [1/2]

template<class Protocol >
BasicTlsStream & join::BasicTlsStream< Protocol >::operator= ( BasicTlsStream< Protocol > && other)
inline

move assignment operator.

Parameters
otherother object to assign.
Returns
current object.

◆ operator=() [2/2]

template<class Protocol >
BasicTlsStream & join::BasicTlsStream< Protocol >::operator= ( const BasicTlsStream< Protocol > & other)
delete

copy assignment operator.

Parameters
otherother object to assign.
Returns
current object.

◆ shutdown()

template<class Protocol >
void join::BasicTlsStream< Protocol >::shutdown ( )
inline

perform the TLS shutdown (send a close_notify alert).


The documentation for this class was generated from the following files: