Sese Framework
2.3.0
A cross-platform framework
|
Completion port sub-service based on sese-event. More...
#include <IOCPServer_V1.h>
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::TimeoutEvent * | setTimeoutEvent (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::BaseEvent * | createEventEx (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 | |
IOCPServer * | master {} |
std::set< event::BaseEvent * > | eventSet |
Completion port sub-service based on sese-event.
|
explicit |
Initialize sub-service
master | Master server |
active_release_mode | Active release mode |
References alpnCallbackFunction(), sese::iocp::v1::IOCPServer::getServCtx(), and master.
|
override |
|
static |
ALPN negotiation callback function
ssl | SSL context |
out | Expected content from peer |
out_length | Length of expected content from peer |
in | Response content |
in_length | Length of response content |
service | Associated sub-service |
References in(), master, and sese::iocp::v1::IOCPServer::onAlpnSelect().
Referenced by IOCPService().
|
private |
References eventSet.
Referenced by postRead(), and postWrite().
|
private |
References eventSet.
Referenced by releaseContext().
|
overrideprivate |
|
static |
Sub-server connection access completion callback function
ctx | Operation context |
References sese::iocp::v1::IOCPServer::onAcceptCompleted(), and sese::iocp::v1::Context::self.
Referenced by onAccept().
|
static |
ALPN negotiation completion callback function
ctx | Operation context |
in | Negotiation content |
in_length | Negotiation content length |
References in(), sese::iocp::v1::IOCPServer::onAlpnGet(), and sese::iocp::v1::Context::self.
Referenced by onAccept(), and onWrite().
|
overrideprivate |
References CTX, and releaseContext().
|
static |
Connection event callback function
ctx | Operation context |
References sese::iocp::v1::IOCPServer::onConnected(), and sese::iocp::v1::Context::self.
Referenced by onWrite().
|
static |
Sub-service read event trigger callback function
ctx | Operation context |
References sese::iocp::v1::IOCPServer::onPreRead(), and sese::iocp::v1::Context::self.
Referenced by onRead().
|
overrideprivate |
References CTX, MTU_VALUE, onPreRead(), onReadCompleted(), read(), and releaseContext().
|
static |
Sub-service read event completion trigger callback function
ctx | Operation context |
References sese::iocp::v1::IOCPServer::onReadCompleted(), and sese::iocp::v1::Context::self.
Referenced by onRead().
|
static |
Sub-service timeout callback function
ctx | Operation context |
References sese::iocp::v1::IOCPServer::onTimeout(), sese::iocp::v1::Context::self, and sese::iocp::v1::Context::timeoutEvent.
Referenced by onTimeout().
|
overrideprivatevirtual |
Timeout callback function
event | Event |
Reimplemented from sese::service::v2::TimerableService.
References CTX, and onTimeout().
|
overrideprivate |
|
static |
Sub-service write event completion trigger callback function
ctx | Operation context |
References sese::iocp::v1::IOCPServer::onWriteCompleted(), and sese::iocp::v1::Context::self.
Referenced by onWrite().
void IOCPService::postClose | ( | Context * | ctx | ) |
Submit close event to the master server
ctx | Operation context |
References sese::iocp::v1::Context::fd, and releaseContext().
Referenced by sese::iocp::v1::IOCPServer::postClose().
void IOCPService::postRead | ( | Context * | ctx | ) |
Submit read event to the master server
ctx | Operation context |
References createEventEx(), sese::event::BaseEvent::data, sese::iocp::v1::Context::event, EVENT_READ, sese::event::BaseEvent::events, and sese::iocp::v1::Context::fd.
Referenced by sese::iocp::v1::IOCPServer::postRead().
void IOCPService::postWrite | ( | Context * | ctx | ) |
Submit write event to the master server
ctx | Operation context |
References createEventEx(), sese::event::BaseEvent::data, sese::iocp::v1::Context::event, EVENT_WRITE, sese::event::BaseEvent::events, and sese::iocp::v1::Context::fd.
Referenced by onWrite(), and sese::iocp::v1::IOCPServer::postWrite().
|
staticprivate |
References sese::net::Socket::read().
Referenced by onRead().
|
private |
References sese::service::v2::TimerableService::cancelTimeoutEvent(), sese::iocp::v1::Context::client, sese::net::Socket::close(), sese::iocp::v1::Context::event, sese::iocp::v1::Context::fd, freeEventEx(), sese::iocp::v1::IOCPServer::getDeleteContextCallback(), sese::iocp::v1::Context::self, sese::iocp::v1::Context::ssl, and sese::iocp::v1::Context::timeoutEvent.
Referenced by onClose(), onRead(), onWrite(), and postClose().
|
staticprivate |
References sese::net::Socket::write().
Referenced by onWrite().
|
private |
Referenced by createEventEx(), freeEventEx(), and ~IOCPService().
|
private |
Referenced by alpnCallbackFunction(), IOCPService(), and onAccept().