Easy Simple Network Library  0.3.7
All Classes Functions Modules
Public Member Functions | List of all members
esnlib::Session Class Referenceabstract

Session class (interface) More...

#include <Session.h>

Public Member Functions

virtual void Open ()=0
 Open the session.
 
virtual void Close (bool rightnow=true)=0
 
virtual bool Connected ()=0
 
virtual void Write (boost::shared_ptr< IoBuffer > data)=0
 
virtual void Write (const char *buf, int bufsize)=0
 
virtual void Write (void *data)=0
 
virtual void WriteData (void *data)=0
 
virtual void WriteBuffer (boost::shared_ptr< IoBuffer > data)=0
 
virtual void Broadcast (boost::shared_ptr< IoBuffer > data)=0
 
virtual void Broadcast (void *data)=0
 
virtual int GetSessionCount ()=0
 
virtual int GetSessions (std::vector< boost::shared_ptr< Session > > &sessions)=0
 
virtual boost::shared_ptr< SessionGetSessionById (int id)=0
 
virtual bool TestIdle (int idletype, int idletime)=0
 
virtual int GetId ()=0
 
virtual void SetId (int id)=0
 
virtual bool GetOrderlyHandling (int optype)=0
 
virtual void SetOrderlyHandling (int optype, bool value)=0
 
virtual int GetMaxMessageQueueSize (int optype)=0
 
virtual void SetMaxMessageQueueSize (int optype, int value)=0
 
virtual int GetState ()=0
 
virtual boost::shared_ptr< IoFilterGetIoFilter ()=0
 
virtual boost::shared_ptr< IoHandlerGetIoHandler ()=0
 
virtual boost::shared_ptr< IoBufferGetReadCache ()=0
 
virtual boost::shared_ptr< IoBufferGetFreeBuffer (int bufsize)=0
 
virtual void TakeBack (boost::shared_ptr< IoBuffer > buf)=0
 
virtual void TakeBack (boost::shared_ptr< Buffer > buf)=0
 
virtual boost::shared_ptr< IoBufferEncodeBuffer (void *data)=0
 
virtual void * DecodeBuffer (boost::shared_ptr< IoBuffer > data)=0
 
virtual bool HasSsl ()=0
 
virtual bool HasData ()=0
 
virtual CommonDataPtr GetData ()=0
 
virtual bool HasGlobalData ()=0
 
virtual CommonDataPtr GetGlobalData ()=0
 
virtual std::string GetRemoteIp ()=0
 
virtual int GetRemotePort ()=0
 
virtual std::string GetLocalIp ()=0
 
virtual int GetLocalPort ()=0
 
virtual void ProcessIncomingData (bool asynccall)=0
 
virtual void ProcessOutgoingData (bool asynccall)=0
 

Detailed Description

Session class (interface)

Member Function Documentation

virtual void esnlib::Session::Broadcast ( boost::shared_ptr< IoBuffer data)
pure virtual

Broadcast data

Parameters
dataThe data (a buffer pointer)
virtual void esnlib::Session::Broadcast ( void *  data)
pure virtual

Broadcast data

Parameters
dataThe data (a common pointer)
virtual void esnlib::Session::Close ( bool  rightnow = true)
pure virtual

Close the session

Parameters
rightnowWhether close the session immediately
virtual bool esnlib::Session::Connected ( )
pure virtual

Check whether the valid connection of the session is created

Returns
Return true if the connection is created
virtual void* esnlib::Session::DecodeBuffer ( boost::shared_ptr< IoBuffer data)
pure virtual

Decode buffer

Parameters
dataThe pointer of the encoded buffer (IO buffer)
Returns
The original buffer (a common pointer)
virtual boost::shared_ptr<IoBuffer> esnlib::Session::EncodeBuffer ( void *  data)
pure virtual

Encode buffer

Parameters
dataThe buffer (a common pointer)
Returns
The pointer of the encoded buffer (IO buffer)
virtual CommonDataPtr esnlib::Session::GetData ( )
pure virtual

Get the local data of the session

Returns
The pointer of the local data
virtual boost::shared_ptr<IoBuffer> esnlib::Session::GetFreeBuffer ( int  bufsize)
pure virtual

Get a free buffer

Parameters
bufsizeThe size of the free buffer
Returns
The pointer of the free buffer (IO buffer)
virtual CommonDataPtr esnlib::Session::GetGlobalData ( )
pure virtual

Get the global data of the session

Returns
The pointer of the global data
virtual int esnlib::Session::GetId ( )
pure virtual

Get the session's ID

Returns
The session ID
virtual boost::shared_ptr<IoFilter> esnlib::Session::GetIoFilter ( )
pure virtual

Get the IO filter

Returns
The pointer of the IO filter
virtual boost::shared_ptr<IoHandler> esnlib::Session::GetIoHandler ( )
pure virtual

Get the IO handler

Returns
The pointer of the IO handler
virtual std::string esnlib::Session::GetLocalIp ( )
pure virtual

Get the local IP of the session

Returns
The local IP of the session
virtual int esnlib::Session::GetLocalPort ( )
pure virtual

Get the port of the local side

Returns
The port of the local side
virtual int esnlib::Session::GetMaxMessageQueueSize ( int  optype)
pure virtual

Get max message queue size

Parameters
optypeThe operation type: 1 for read, 2 for write
Returns
The max message queue size
virtual bool esnlib::Session::GetOrderlyHandling ( int  optype)
pure virtual

Check whether the session will process messages sequentially

Parameters
optypeThe operation type: 1 for read, 2 for write
Returns
Whether the session will process messages sequentially
virtual boost::shared_ptr<IoBuffer> esnlib::Session::GetReadCache ( )
pure virtual

Get the read cache

Returns
The pointer of the read cache (IO buffer)
virtual std::string esnlib::Session::GetRemoteIp ( )
pure virtual

Get the IP of the remote side

Returns
The IP of the remote side
virtual int esnlib::Session::GetRemotePort ( )
pure virtual

Get the port of the remote side

Returns
The port of the remote side
virtual boost::shared_ptr<Session> esnlib::Session::GetSessionById ( int  id)
pure virtual

Get a session by its ID

Parameters
idThe session ID
Returns
The pointer of the session
virtual int esnlib::Session::GetSessionCount ( )
pure virtual

Get total number of all sessions

Returns
Total number of all sessions
virtual int esnlib::Session::GetSessions ( std::vector< boost::shared_ptr< Session > > &  sessions)
pure virtual

Get all sessions

Parameters
sessionsThe vector used to save all the sessions
Returns
Total number of all sessions
virtual int esnlib::Session::GetState ( )
pure virtual

Get the session's state

Returns
The session state
virtual bool esnlib::Session::HasData ( )
pure virtual

Check whether the session has local data

Returns
Return true if the session has local data
virtual bool esnlib::Session::HasGlobalData ( )
pure virtual

Check whether the session has global data attached

Returns
Return true if the session has global data
virtual bool esnlib::Session::HasSsl ( )
pure virtual

Check whether the session has SSL(Secure Sockets Layer)

Returns
Return true if the session has SSL
virtual void esnlib::Session::ProcessIncomingData ( bool  asynccall)
pure virtual

Process incoming data

Parameters
asynccallIt is an async call or not
virtual void esnlib::Session::ProcessOutgoingData ( bool  asynccall)
pure virtual

Process outgoing data

Parameters
asynccallIt is an async call or not
virtual void esnlib::Session::SetId ( int  id)
pure virtual

Set the session's ID

Parameters
idThe session ID
virtual void esnlib::Session::SetMaxMessageQueueSize ( int  optype,
int  value 
)
pure virtual

Set max message queue size

Parameters
optypeThe operation type: 1 for read, 2 for write, 0 for both
valueThe max message queue size
virtual void esnlib::Session::SetOrderlyHandling ( int  optype,
bool  value 
)
pure virtual

Set whether the session will process messages sequentially

Parameters
optypeThe operation type: 1 for read, 2 for write, 0 for both
valueWhether the session will process messages sequentially
virtual void esnlib::Session::TakeBack ( boost::shared_ptr< IoBuffer buf)
pure virtual

Take back the buffer (back to the memory pool)

Parameters
bufThe pointer of the buffer (IO buffer)
virtual void esnlib::Session::TakeBack ( boost::shared_ptr< Buffer buf)
pure virtual

Take back the buffer (back to the memory pool)

Parameters
bufThe pointer of the buffer
virtual bool esnlib::Session::TestIdle ( int  idletype,
int  idletime 
)
pure virtual

Check whether the session is idle (with specific idle type and idle time)

Parameters
idletypeThe idle type: 1 for read idle, 2 for write idle, 0 for both
idletimeThe idle time (in second)
Returns
Return true if the session is idle
virtual void esnlib::Session::Write ( boost::shared_ptr< IoBuffer data)
pure virtual

Write data

Parameters
dataThe data (a buffer pointer)
virtual void esnlib::Session::Write ( const char *  buf,
int  bufsize 
)
pure virtual

Write buffer

Parameters
bufThe buffer (a char pointer)
bufsizeThe size of the buffer
virtual void esnlib::Session::Write ( void *  data)
pure virtual

Write data

Parameters
dataThe data (a common pointer)
virtual void esnlib::Session::WriteBuffer ( boost::shared_ptr< IoBuffer data)
pure virtual

Write buffer

Parameters
dataThe pointer of the buffer
virtual void esnlib::Session::WriteData ( void *  data)
pure virtual

Write data

Parameters
dataThe data (a common pointer)

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