Easy Simple Network Library  0.3.7
Public Member Functions | List of all members
esnlib::IoHandler Class Referenceabstract

IO Handler class (interface) More...

#include <IoHandler.h>

Inheritance diagram for esnlib::IoHandler:
esnlib::MessageHandler esnlib::StringHandler

Public Member Functions

virtual int OnRead (SessionPtr session, IoBufferPtr data)=0
 
virtual int OnWrite (SessionPtr session, IoBufferPtr data)=0
 
virtual void OnConnect (SessionPtr session)=0
 
virtual void OnDisconnect (SessionPtr session)=0
 
virtual void OnIdle (SessionPtr session, int idleType)=0
 
virtual void OnError (SessionPtr session, int errorType, int errorCode, const std::string &errorMsg)=0
 

Detailed Description

IO Handler class (interface)

Member Function Documentation

virtual void esnlib::IoHandler::OnConnect ( SessionPtr  session)
pure virtual

The callback function for the Connect event

Parameters
sessionCurrent session

Implemented in esnlib::MessageHandler, and esnlib::StringHandler.

virtual void esnlib::IoHandler::OnDisconnect ( SessionPtr  session)
pure virtual

The callback function for the Disconnect event

Parameters
sessionCurrent session

Implemented in esnlib::MessageHandler, and esnlib::StringHandler.

virtual void esnlib::IoHandler::OnError ( SessionPtr  session,
int  errorType,
int  errorCode,
const std::string &  errorMsg 
)
pure virtual

The callback function for the Error event

Parameters
sessionCurrent session
errorTypeThe error type (1 for read error, 2 for write error, 0 for connect error)
errorCodeThe error code (if error type == 0 and error code == 0, that means connect timeout)
errorMsgThe error message

Implemented in esnlib::MessageHandler, and esnlib::StringHandler.

virtual void esnlib::IoHandler::OnIdle ( SessionPtr  session,
int  idleType 
)
pure virtual

The callback function for the Idle event

Parameters
sessionCurrent session
idleTypeThe idle type (1 for read idle, 2 for write idle, 0 for both)

Implemented in esnlib::MessageHandler, and esnlib::StringHandler.

virtual int esnlib::IoHandler::OnRead ( SessionPtr  session,
IoBufferPtr  data 
)
pure virtual

The callback function for the Read event

Parameters
sessionCurrent session
dataThe buffer pointer of the useful data read
Returns
The flags of the event processing: 1 = async, 2 = concurrent, 3 = both 1 and 2

Implemented in esnlib::MessageHandler, and esnlib::StringHandler.

virtual int esnlib::IoHandler::OnWrite ( SessionPtr  session,
IoBufferPtr  data 
)
pure virtual

The callback function for the Write event

Parameters
sessionCurrent session
dataThe buffer pointer of the data written
Returns
The flags of the event processing: 1 = async, 2 = concurrent, 3 = both 1 and 2

Implemented in esnlib::MessageHandler, and esnlib::StringHandler.


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