Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::service::TcpTransporter Class Referenceabstract

TCP transporter. More...

#include <TcpTransporter.h>

Inheritance diagram for sese::service::TcpTransporter:
sese::service::v1::TimerableService

Public Member Functions

 TcpTransporter (TcpTransporterConfig *transporter_config) noexcept
 
 ~TcpTransporter () override
 
- Public Member Functions inherited from sese::service::v1::TimerableService
 ~TimerableService () override
 
bool init () override
 
void dispatch (uint32_t timeout) override
 
TimeoutEventcreateTimeoutEvent (int fd, void *data, uint64_t seconds)
 
void setTimeoutEvent (TimeoutEvent *timeout_event, uint64_t seconds)
 
TimeoutEventgetTimeoutEventByFd (int fd)
 
void cancelTimeoutEvent (TimeoutEvent *timeout_event)
 
void freeTimeoutEvent (TimeoutEvent *timeout_event)
 

Protected 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 (v1::TimeoutEvent *timeout_event) override
 
virtual void postRead (TcpConnection *conn)
 
virtual void postWrite (TcpConnection *conn)
 
virtual int onProcAlpnSelect (const uint8_t **out, uint8_t *out_length, const uint8_t *in, uint32_t in_length)=0
 
virtual void onProcAlpnGet (TcpConnection *conn, const uint8_t *in, uint32_t in_length)=0
 
virtual void onProcHandle (TcpConnection *conn)=0
 
virtual void onProcClose (TcpConnection *conn)=0
 
event::BaseEventcreateEventEx (int fd, unsigned int events, TcpConnection *conn) noexcept
 
void freeEventEx (event::BaseEvent *event) noexcept
 

Static Protected Member Functions

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

Protected Attributes

TcpTransporterConfigconfig = nullptr
 
std::map< int, event::BaseEvent * > eventMap
 

Static Private Member Functions

static int alpnCallbackFunction (void *ssl, const uint8_t **out, uint8_t *out_length, const uint8_t *in, uint32_t in_length, TcpTransporter *transporter)
 

Detailed Description

TCP transporter.

Constructor & Destructor Documentation

◆ TcpTransporter()

sese::service::TcpTransporter::TcpTransporter ( TcpTransporterConfig * transporter_config)
explicitnoexcept

◆ ~TcpTransporter()

sese::service::TcpTransporter::~TcpTransporter ( )
override

Member Function Documentation

◆ alpnCallbackFunction()

int sese::service::TcpTransporter::alpnCallbackFunction ( void * ssl,
const uint8_t ** out,
uint8_t * out_length,
const uint8_t * in,
uint32_t in_length,
TcpTransporter * transporter )
staticprivate

References in(), and onProcAlpnSelect().

◆ createEventEx()

sese::event::BaseEvent * sese::service::TcpTransporter::createEventEx ( int fd,
unsigned int events,
TcpConnection * conn )
protectednoexcept

◆ freeEventEx()

void sese::service::TcpTransporter::freeEventEx ( event::BaseEvent * event)
protectednoexcept

◆ onAccept()

void sese::service::TcpTransporter::onAccept ( int fd)
overrideprotected

◆ onClose()

void sese::service::TcpTransporter::onClose ( event::BaseEvent * event)
overrideprotected

If a connection is processed asynchronously, the peer closure event should not release resources for the connection

See also
tcp_connection_delay_close_by_async

References sese::net::Socket::close(), and sese::event::BaseEvent::fd.

◆ onProcAlpnGet()

virtual void sese::service::TcpTransporter::onProcAlpnGet ( TcpConnection * conn,
const uint8_t * in,
uint32_t in_length )
protectedpure virtual

◆ onProcAlpnSelect()

virtual int sese::service::TcpTransporter::onProcAlpnSelect ( const uint8_t ** out,
uint8_t * out_length,
const uint8_t * in,
uint32_t in_length )
protectedpure virtual

Referenced by alpnCallbackFunction().

◆ onProcClose()

virtual void sese::service::TcpTransporter::onProcClose ( TcpConnection * conn)
protectedpure virtual

◆ onProcHandle()

virtual void sese::service::TcpTransporter::onProcHandle ( TcpConnection * conn)
protectedpure virtual

◆ onRead()

void sese::service::TcpTransporter::onRead ( event::BaseEvent * event)
overrideprotected

◆ onTimeout()

void sese::service::TcpTransporter::onTimeout ( v1::TimeoutEvent * timeout_event)
overrideprotectedvirtual

Triggered when a timeout event occurs

Parameters
timeout_eventTimeout event

Reimplemented from sese::service::v1::TimerableService.

References sese::net::Socket::close(), and sese::service::v1::TimeoutEvent::data.

◆ onWrite()

◆ postRead()

void sese::service::TcpTransporter::postRead ( TcpConnection * conn)
protectedvirtual

◆ postWrite()

void sese::service::TcpTransporter::postWrite ( TcpConnection * conn)
protectedvirtual

◆ read()

int64_t sese::service::TcpTransporter::read ( int fd,
void * buffer,
size_t len,
void * ssl )
staticprotectednoexcept

◆ write()

int64_t sese::service::TcpTransporter::write ( int fd,
const void * buffer,
size_t len,
void * ssl )
staticprotectednoexcept

Member Data Documentation

◆ config

TcpTransporterConfig* sese::service::TcpTransporter::config = nullptr
protected

◆ eventMap

std::map<int, event::BaseEvent *> sese::service::TcpTransporter::eventMap
protected

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