Sese Framework  x.y.z
A cross-platform framework
载入中...
搜索中...
未找到
sese::security::SecuritySocket类 参考final

安全套接字 更多...

#include <SecuritySocket.h>

类 sese::security::SecuritySocket 继承关系图:
sese::net::Socket sese::io::Stream sese::io::PeekableStream sese::io::Closeable sese::io::InputStream sese::io::OutputStream

Public 类型

using Socket = sese::net::Socket
 
using Address = sese::net::Address
 
- Public 类型 继承自 sese::net::Socket
enum class  Type { TCP = SOCK_STREAM , UDP = SOCK_DGRAM }
 套接字类型 更多...
 
enum class  Family { IPv4 = AF_INET , IPv6 = AF_INET6 }
 协议族 更多...
 
enum class  ShutdownMode { READ = SHUT_RD , WRITE = SHUT_WR , BOTH = SHUT_RDWR }
 断开模式 更多...
 
using Ptr = std::shared_ptr<Socket>
 
- Public 类型 继承自 sese::io::Stream
typedef std::shared_ptr< StreamPtr
 
- Public 类型 继承自 sese::io::InputStream
typedef std::shared_ptr< InputStreamPtr
 
- Public 类型 继承自 sese::io::OutputStream
typedef std::shared_ptr< OutputStreamPtr
 
- Public 类型 继承自 sese::io::PeekableStream
typedef std::shared_ptr< PeekableStreamPtr
 

Public 成员函数

 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 成员函数 继承自 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 成员函数 继承自 sese::io::InputStream
virtual ~InputStream () noexcept=default
 
- Public 成员函数 继承自 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 成员函数 继承自 sese::io::PeekableStream
virtual ~PeekableStream ()=default
 
- Public 成员函数 继承自 sese::io::Closeable
virtual ~Closeable ()=default
 

Private 属性

std::shared_ptr< SSLContextcontext
 
void * ssl = nullptr
 

额外继承的成员函数

- 静态 Public 成员函数 继承自 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
 

详细描述

安全套接字

成员类型定义说明

◆ Address

◆ Socket

构造及析构函数说明

◆ 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

成员函数说明

◆ accept()

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

◆ close()

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

实现了 sese::io::Closeable.

◆ connect()

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

◆ getSSL()

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

引用了 ssl.

◆ read()

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

◆ shutdown()

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

◆ write()

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

类成员变量说明

◆ context

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

被这些函数引用 accept().

◆ ssl

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

被这些函数引用 getSSL().


该类的文档由以下文件生成: