Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::security::SecuritySocket Class Referencefinal

Security socket class. More...

#include <SecuritySocket.h>

Inheritance diagram for sese::security::SecuritySocket:
sese::net::Socket sese::io::Stream sese::io::PeekableStream sese::io::Closeable sese::io::InputStream sese::io::OutputStream

Public Types

using Socket = sese::net::Socket
 
using Address = sese::net::Address
 
- Public Types inherited from sese::net::Socket
enum class  Type { TCP = SOCK_STREAM , UDP = SOCK_DGRAM }
 Socket type. More...
 
enum class  Family { IPv4 = AF_INET , IPv6 = AF_INET6 }
 Address family. More...
 
enum class  ShutdownMode { READ = SHUT_RD , WRITE = SHUT_WR , BOTH = SHUT_RDWR }
 Shutdown mode. More...
 
using Ptr = std::shared_ptr<Socket>
 
- Public Types inherited from sese::io::Stream
typedef std::shared_ptr< StreamPtr
 
- Public Types inherited from sese::io::InputStream
typedef std::shared_ptr< InputStreamPtr
 
- Public Types inherited from sese::io::OutputStream
typedef std::shared_ptr< OutputStreamPtr
 
- Public Types inherited from sese::io::PeekableStream
typedef std::shared_ptr< PeekableStreamPtr
 

Public Member Functions

 SecuritySocket (std::shared_ptr< SSLContext > context, Socket::Family family, int32_t flags) noexcept
 
 SecuritySocket (std::shared_ptr< SSLContext > context, void *ssl, socket_t fd) noexcept
 
int32_t connect (Address::Ptr address) noexcept override
 
Socket::Ptr accept () const override
 
int32_t shutdown (ShutdownMode mode) const override
 
int64_t read (void *buffer, size_t length) override
 
int64_t write (const void *buffer, size_t length) override
 
void close () override
 
void * getSSL () const
 
- Public Member Functions inherited from sese::net::Socket
 Socket (Family family, Type type, int32_t protocol=IPPROTO_IP) noexcept
 
 Socket (socket_t handle, Address::Ptr address) noexcept
 
 ~Socket () noexcept override
 
virtual int32_t bind (Address::Ptr address) noexcept
 
virtual int32_t listen (int32_t backlog) const noexcept
 
bool setNonblocking () const noexcept
 
int64_t read (void *buffer, size_t length) override
 
int64_t write (const void *buffer, size_t length) override
 
int64_t send (void *buffer, size_t length, const IPAddress::Ptr &to, int32_t flags) const
 
int64_t recv (void *buffer, size_t length, const IPAddress::Ptr &from, int32_t flags) const
 
int64_t peek (void *buffer, size_t length) override
 
int64_t trunc (size_t length) override
 
int64_t writeInt16 (int16_t value)
 
int64_t writeInt32 (int32_t value)
 
int64_t writeInt64 (int64_t value)
 
int64_t writeUint16 (uint16_t value)
 
int64_t writeUint32 (uint32_t value)
 
int64_t writeUint64 (uint64_t value)
 
int64_t readInt16 (int16_t &value)
 
int64_t readInt32 (int32_t &value)
 
int64_t readInt64 (int64_t &value)
 
int64_t readUint16 (uint16_t &value)
 
int64_t readUint32 (uint32_t &value)
 
int64_t readUint64 (uint64_t &value)
 
void close () override
 
const socket_tgetRawSocket () const
 
const Address::PtrgetAddress () const
 
- Public Member Functions inherited from sese::io::InputStream
virtual ~InputStream () noexcept=default
 
- Public Member Functions inherited from sese::io::OutputStream
virtual ~OutputStream () noexcept=default
 
int64_t write (const std::string_view &buffer)
 
int64_t write (const text::StringView &buffer)
 
template<typename T >
int64_t write (std::vector< T > &buffer)
 
template<typename T , size_t N>
int64_t write (std::array< T, N > &buffer)
 
- Public Member Functions inherited from sese::io::PeekableStream
virtual ~PeekableStream ()=default
 
- Public Member Functions inherited from sese::io::Closeable
virtual ~Closeable ()=default
 

Private Attributes

std::shared_ptr< SSLContextcontext
 
void * ssl = nullptr
 

Additional Inherited Members

- Static Public Member Functions inherited from sese::net::Socket
static socket_t socket (int family, int type, int protocol) noexcept
 
static int bind (socket_t socket, const sockaddr *addr, socklen_t addr_len) noexcept
 
static socket_t accept (socket_t socket, sockaddr *addr=nullptr, socklen_t *len=nullptr) noexcept
 
static int connect (socket_t socket, const sockaddr *addr, socklen_t addr_len) noexcept
 
static int64_t write (socket_t socket, const void *buffer, size_t len, int flags) noexcept
 
static int64_t read (socket_t socket, void *buffer, size_t len, int flags) noexcept
 
static int listen (socket_t socket, int backlog) noexcept
 
static int setNonblocking (socket_t socket) noexcept
 
static void close (socket_t socket) noexcept
 
static int shutdown (socket_t socket, ShutdownMode mode) noexcept
 

Detailed Description

Security socket class.

Member Typedef Documentation

◆ Address

◆ Socket

Constructor & Destructor Documentation

◆ SecuritySocket() [1/2]

sese::security::SecuritySocket::SecuritySocket ( std::shared_ptr< SSLContext > context,
Socket::Family family,
int32_t flags )
noexcept

◆ SecuritySocket() [2/2]

sese::security::SecuritySocket::SecuritySocket ( std::shared_ptr< SSLContext > context,
void * ssl,
socket_t fd )
noexcept

Member Function Documentation

◆ accept()

sese::net::Socket::Ptr sese::security::SecuritySocket::accept ( ) const
nodiscardoverridevirtual

◆ close()

void sese::security::SecuritySocket::close ( )
overridevirtual

Implements sese::io::Closeable.

◆ connect()

int32_t sese::security::SecuritySocket::connect ( Address::Ptr address)
overridevirtualnoexcept

◆ getSSL()

void * sese::security::SecuritySocket::getSSL ( ) const
inlinenodiscard

References ssl.

◆ read()

int64_t sese::security::SecuritySocket::read ( void * buffer,
size_t length )
overridevirtual

Implements sese::io::InputStream.

◆ shutdown()

int32_t sese::security::SecuritySocket::shutdown ( ShutdownMode mode) const
nodiscardoverridevirtual

Reimplemented from sese::net::Socket.

◆ write()

int64_t sese::security::SecuritySocket::write ( const void * buffer,
size_t length )
overridevirtual

Member Data Documentation

◆ context

std::shared_ptr<SSLContext> sese::security::SecuritySocket::context
private

Referenced by accept().

◆ ssl

void* sese::security::SecuritySocket::ssl = nullptr
private

Referenced by getSSL().


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