Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::_windows::iocp::v1::NativeContext Class Referencefinal

Native IOCP operational context. More...

#include <NativeIOCPServer_V1.h>

Inheritance diagram for sese::_windows::iocp::v1::NativeContext:
sese::io::InputStream sese::io::OutputStream sese::io::PeekableStream

Public Member Functions

 NativeContext (OverlappedWrapper *p_wrapper)
 
 ~NativeContext () override
 
int64_t read (void *buffer, size_t length) override
 
int64_t write (const void *buffer, size_t length) override
 
int64_t peek (void *buffer, size_t length) override
 
int64_t trunc (size_t length) override
 
int32_t getFd () const
 
void * getData () const
 
void setData (void *p_data)
 
- 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
 

Private Types

enum class  Type {
  READ , WRITE , CONNECT , READY ,
  CLOSE
}
 
using IOBuf = sese::iocp::IOBuf
 
using Node = std::unique_ptr<sese::iocp::IOBufNode>
 

Private Attributes

OverlappedWrapperpWrapper {}
 
WSABUF wsabufRead {}
 
WSABUF wsabufWrite {}
 
Type type {Type::READ}
 
SOCKET fd {INVALID_SOCKET}
 
NativeIOCPServerself {}
 
TimeoutEventtimeoutEvent {}
 
void * ssl {}
 
void * bio {}
 
Node readNode
 
IOBuf recv {}
 
io::ByteBuilder send {IOCP_WSABUF_SIZE, IOCP_WSABUF_SIZE}
 
void * data {}
 

Friends

class NativeIOCPServer
 

Additional Inherited Members

- 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
 

Detailed Description

Native IOCP operational context.

Member Typedef Documentation

◆ IOBuf

◆ Node

Member Enumeration Documentation

◆ Type

Enumerator
READ 
WRITE 
CONNECT 
READY 
CLOSE 

Constructor & Destructor Documentation

◆ NativeContext()

NativeContext::NativeContext ( OverlappedWrapper * p_wrapper)
explicit

Context initialization

Parameters
p_wrapperOverlapped wrapper

References IOCP_WSABUF_SIZE, and wsabufWrite.

◆ ~NativeContext()

NativeContext::~NativeContext ( )
override

References free(), and wsabufWrite.

Member Function Documentation

◆ getData()

void * sese::_windows::iocp::v1::NativeContext::getData ( ) const
inlinenodiscard

Get the additional data of the current context

Returns
The additional data

References data.

◆ getFd()

int32_t sese::_windows::iocp::v1::NativeContext::getFd ( ) const
inlinenodiscard

Get the file descriptor of the current context connection

Returns
The file descriptor

References fd.

◆ peek()

int64_t NativeContext::peek ( void * buffer,
size_t length )
overridevirtual

Read content from the current connection without advancing

Parameters
bufferThe buffer
lengthThe size of the buffer
Returns
The actual amount of data read

Implements sese::io::PeekableStream.

References sese::iocp::IOBuf::peek(), recv, and ssl.

◆ read()

int64_t NativeContext::read ( void * buffer,
size_t length )
overridevirtual

Read content from the current connection

Parameters
bufferThe buffer
lengthThe size of the buffer
Returns
The actual amount of data read

Implements sese::io::InputStream.

References sese::iocp::IOBuf::read(), recv, and ssl.

◆ setData()

void sese::_windows::iocp::v1::NativeContext::setData ( void * p_data)
inline

Set the additional data of the current context

Parameters
p_dataThe additional data

References data.

◆ trunc()

int64_t NativeContext::trunc ( size_t length)
overridevirtual

Advance in the current connection without reading content

Parameters
lengthThe amount to advance
Returns
The actual amount advanced

Implements sese::io::PeekableStream.

References recv, ssl, and sese::iocp::IOBuf::trunc().

◆ write()

int64_t NativeContext::write ( const void * buffer,
size_t length )
overridevirtual

Write content to the current connection

Parameters
bufferThe buffer
lengthThe size of the buffer
Returns
The actual amount of data written

Implements sese::io::OutputStream.

References send, ssl, and sese::io::AbstractByteBuffer::write().

Friends And Related Symbol Documentation

◆ NativeIOCPServer

friend class NativeIOCPServer
friend

Member Data Documentation

◆ bio

void* sese::_windows::iocp::v1::NativeContext::bio {}
private

◆ data

void* sese::_windows::iocp::v1::NativeContext::data {}
private

Referenced by getData(), and setData().

◆ fd

◆ pWrapper

◆ readNode

Node sese::_windows::iocp::v1::NativeContext::readNode
private

◆ recv

IOBuf sese::_windows::iocp::v1::NativeContext::recv {}
private

Referenced by peek(), read(), and trunc().

◆ self

NativeIOCPServer* sese::_windows::iocp::v1::NativeContext::self {}
private

◆ send

io::ByteBuilder sese::_windows::iocp::v1::NativeContext::send {IOCP_WSABUF_SIZE, IOCP_WSABUF_SIZE}
private

◆ ssl

void* sese::_windows::iocp::v1::NativeContext::ssl {}
private

Referenced by peek(), read(), trunc(), and write().

◆ timeoutEvent

TimeoutEvent* sese::_windows::iocp::v1::NativeContext::timeoutEvent {}
private

◆ type

◆ wsabufRead

WSABUF sese::_windows::iocp::v1::NativeContext::wsabufRead {}
private

◆ wsabufWrite

WSABUF sese::_windows::iocp::v1::NativeContext::wsabufWrite {}
private

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