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

Completion port sub-service based on sese-event. More...

#include <IOCPServer_V1.h>

Inheritance diagram for sese::iocp::v1::IOCPService:
sese::service::v2::TimerableService

Public Member Functions

 IOCPService (IOCPServer *master, bool active_release_mode)
 
 ~IOCPService () override
 
void postRead (Context *ctx)
 
void postWrite (Context *ctx)
 
void postClose (Context *ctx)
 
- Public Member Functions inherited from sese::service::v2::TimerableService
void dispatch (uint32_t timeout) override
 
v2::TimeoutEventsetTimeoutEvent (int64_t seconds, void *data)
 
void cancelTimeoutEvent (v2::TimeoutEvent *event)
 

Static Public Member Functions

static void onAcceptCompleted (Context *ctx)
 
static void onPreRead (Context *ctx)
 
static void onReadCompleted (Context *ctx)
 
static void onWriteCompleted (Context *ctx)
 
static void onTimeout (Context *ctx)
 
static void onConnected (Context *ctx)
 
static void onAlpnGet (Context *ctx, const uint8_t *in, uint32_t in_length)
 
static int alpnCallbackFunction (void *ssl, const uint8_t **out, uint8_t *out_length, const uint8_t *in, uint32_t in_length, IOCPService *service)
 

Private Member Functions

void onAccept (int fd) override
 
void onRead (event::BaseEvent *event) override
 
void onWrite (event::BaseEvent *event) override
 
void onClose (event::BaseEvent *event) override
 
void onTimeout (service::v2::TimeoutEvent *event) override
 
event::BaseEventcreateEventEx (int fd, unsigned int events, void *data)
 
void freeEventEx (sese::event::BaseEvent *event)
 
void releaseContext (Context *ctx)
 

Static Private Member Functions

static int64_t read (int fd, void *buffer, size_t len, void *ssl)
 
static int64_t write (int fd, const void *buffer, size_t len, void *ssl)
 

Private Attributes

IOCPServermaster {}
 
std::set< event::BaseEvent * > eventSet
 

Detailed Description

Completion port sub-service based on sese-event.

Constructor & Destructor Documentation

◆ IOCPService()

IOCPService::IOCPService ( IOCPServer * master,
bool active_release_mode )
explicit

Initialize sub-service

Parameters
masterMaster server
active_release_modeActive release mode

References alpnCallbackFunction(), sese::iocp::v1::IOCPServer::getServCtx(), and master.

◆ ~IOCPService()

IOCPService::~IOCPService ( )
override

Member Function Documentation

◆ alpnCallbackFunction()

int IOCPService::alpnCallbackFunction ( void * ssl,
const uint8_t ** out,
uint8_t * out_length,
const uint8_t * in,
uint32_t in_length,
IOCPService * service )
static

ALPN negotiation callback function

Parameters
sslSSL context
outExpected content from peer
out_lengthLength of expected content from peer
inResponse content
in_lengthLength of response content
serviceAssociated sub-service
Returns
ALPN status code

References in(), master, and sese::iocp::v1::IOCPServer::onAlpnSelect().

Referenced by IOCPService().

◆ createEventEx()

sese::event::BaseEvent * IOCPService::createEventEx ( int fd,
unsigned int events,
void * data )
private

References eventSet.

Referenced by postRead(), and postWrite().

◆ freeEventEx()

void IOCPService::freeEventEx ( sese::event::BaseEvent * event)
private

References eventSet.

Referenced by releaseContext().

◆ onAccept()

◆ onAcceptCompleted()

void IOCPService::onAcceptCompleted ( Context * ctx)
static

Sub-server connection access completion callback function

Parameters
ctxOperation context

References sese::iocp::v1::IOCPServer::onAcceptCompleted(), and sese::iocp::v1::Context::self.

Referenced by onAccept().

◆ onAlpnGet()

void IOCPService::onAlpnGet ( Context * ctx,
const uint8_t * in,
uint32_t in_length )
static

ALPN negotiation completion callback function

Parameters
ctxOperation context
inNegotiation content
in_lengthNegotiation content length

References in(), sese::iocp::v1::IOCPServer::onAlpnGet(), and sese::iocp::v1::Context::self.

Referenced by onAccept(), and onWrite().

◆ onClose()

void IOCPService::onClose ( event::BaseEvent * event)
overrideprivate

References CTX, and releaseContext().

◆ onConnected()

void IOCPService::onConnected ( Context * ctx)
static

Connection event callback function

Parameters
ctxOperation context

References sese::iocp::v1::IOCPServer::onConnected(), and sese::iocp::v1::Context::self.

Referenced by onWrite().

◆ onPreRead()

void IOCPService::onPreRead ( Context * ctx)
static

Sub-service read event trigger callback function

Parameters
ctxOperation context

References sese::iocp::v1::IOCPServer::onPreRead(), and sese::iocp::v1::Context::self.

Referenced by onRead().

◆ onRead()

void IOCPService::onRead ( event::BaseEvent * event)
overrideprivate

◆ onReadCompleted()

void IOCPService::onReadCompleted ( Context * ctx)
static

Sub-service read event completion trigger callback function

Parameters
ctxOperation context

References sese::iocp::v1::IOCPServer::onReadCompleted(), and sese::iocp::v1::Context::self.

Referenced by onRead().

◆ onTimeout() [1/2]

void IOCPService::onTimeout ( Context * ctx)
static

Sub-service timeout callback function

Parameters
ctxOperation context

References sese::iocp::v1::IOCPServer::onTimeout(), sese::iocp::v1::Context::self, and sese::iocp::v1::Context::timeoutEvent.

Referenced by onTimeout().

◆ onTimeout() [2/2]

void IOCPService::onTimeout ( service::v2::TimeoutEvent * event)
overrideprivatevirtual

Timeout callback function

Parameters
eventEvent

Reimplemented from sese::service::v2::TimerableService.

References CTX, and onTimeout().

◆ onWrite()

◆ onWriteCompleted()

void IOCPService::onWriteCompleted ( Context * ctx)
static

Sub-service write event completion trigger callback function

Parameters
ctxOperation context

References sese::iocp::v1::IOCPServer::onWriteCompleted(), and sese::iocp::v1::Context::self.

Referenced by onWrite().

◆ postClose()

void IOCPService::postClose ( Context * ctx)

Submit close event to the master server

Parameters
ctxOperation context

References sese::iocp::v1::Context::fd, and releaseContext().

Referenced by sese::iocp::v1::IOCPServer::postClose().

◆ postRead()

void IOCPService::postRead ( Context * ctx)

◆ postWrite()

void IOCPService::postWrite ( Context * ctx)

◆ read()

int64_t IOCPService::read ( int fd,
void * buffer,
size_t len,
void * ssl )
staticprivate

References sese::net::Socket::read().

Referenced by onRead().

◆ releaseContext()

◆ write()

int64_t IOCPService::write ( int fd,
const void * buffer,
size_t len,
void * ssl )
staticprivate

References sese::net::Socket::write().

Referenced by onWrite().

Member Data Documentation

◆ eventSet

std::set<event::BaseEvent *> sese::iocp::v1::IOCPService::eventSet
private

◆ master

IOCPServer* sese::iocp::v1::IOCPService::master {}
private

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