INET Framework for OMNeT++/OMNEST
TCPServerThreadBase Class Reference

#include <TCPSrvHostApp.h>

Inheritance diagram for TCPServerThreadBase:
TCPSocket::CallbackInterface TCPGenericSrvThread

List of all members.

Public Member Functions

virtual void init (TCPSrvHostApp *hostmodule, TCPSocket *socket)
 TCPServerThreadBase ()
virtual ~TCPServerThreadBase ()
virtual TCPSocketgetSocket ()
virtual TCPSrvHostAppgetHostModule ()
virtual void scheduleAt (simtime_t t, cMessage *msg)
virtual void cancelEvent (cMessage *msg)
Callback methods, called on different socket events.
virtual void established ()=0
virtual void dataArrived (cMessage *msg, bool urgent)=0
virtual void timerExpired (cMessage *timer)=0
virtual void peerClosed ()
virtual void closed ()
virtual void failure (int code)
virtual void statusArrived (TCPStatusInfo *status)

Protected Member Functions

virtual void socketDataArrived (int, void *, cPacket *msg, bool urgent)
virtual void socketEstablished (int, void *)
virtual void socketPeerClosed (int, void *)
virtual void socketClosed (int, void *)
virtual void socketFailure (int, void *, int code)
virtual void socketStatusArrived (int, void *, TCPStatusInfo *status)

Protected Attributes

TCPSrvHostApphostmod
TCPSocketsock

Detailed Description

Abstract base class for server processes to be used with TCPSrvHostApp. Subclasses need to be registered using the Register_Class() macro.

See also:
TCPSrvHostApp

Constructor & Destructor Documentation

TCPServerThreadBase::TCPServerThreadBase ( ) [inline]
{sock=NULL;}
virtual TCPServerThreadBase::~TCPServerThreadBase ( ) [inline, virtual]
{}

Member Function Documentation

virtual void TCPServerThreadBase::cancelEvent ( cMessage *  msg) [inline, virtual]

Cancel an event

{hostmod->cancelEvent(msg);}
virtual void TCPServerThreadBase::closed ( ) [inline, virtual]

Called when the connection closes (successful TCP teardown). By default it deletes this thread, but it can be redefined to do something different.

virtual void TCPServerThreadBase::dataArrived ( cMessage *  msg,
bool  urgent 
) [pure virtual]

Called when a data packet arrives. To be redefined.

Implemented in TCPGenericSrvThread.

virtual void TCPServerThreadBase::established ( ) [pure virtual]

Called when connection is established. To be redefined.

Implemented in TCPGenericSrvThread.

virtual void TCPServerThreadBase::failure ( int  code) [inline, virtual]

Called when the connection breaks (TCP error). By default it deletes this thread, but it can be redefined to do something different.

virtual TCPSrvHostApp* TCPServerThreadBase::getHostModule ( ) [inline, virtual]

Returns pointer to the host module

{return hostmod;}
virtual TCPSocket* TCPServerThreadBase::getSocket ( ) [inline, virtual]

Returns the socket object

Referenced by TCPGenericSrvThread::dataArrived(), and TCPSrvHostApp::removeThread().

{return sock;}
virtual void TCPServerThreadBase::init ( TCPSrvHostApp hostmodule,
TCPSocket socket 
) [inline, virtual]

Referenced by TCPSrvHostApp::handleMessage().

{hostmod=hostmodule; sock=socket;}
virtual void TCPServerThreadBase::peerClosed ( ) [inline, virtual]

Called when the client closes the connection. By default it closes our side too, but it can be redefined to do something different.

{getSocket()->close();}
virtual void TCPServerThreadBase::scheduleAt ( simtime_t  t,
cMessage *  msg 
) [inline, virtual]

Schedule an event. Do not use getContextPointer() of cMessage, because TCPServerThreadBase uses it for its own purposes.

{msg->setContextPointer(this); hostmod->scheduleAt(t,msg);}
virtual void TCPServerThreadBase::socketClosed ( int  ,
void *   
) [inline, protected, virtual]

Reimplemented from TCPSocket::CallbackInterface.

{closed();}
virtual void TCPServerThreadBase::socketDataArrived ( int  ,
void *  ,
cPacket *  msg,
bool  urgent 
) [inline, protected, virtual]

Implements TCPSocket::CallbackInterface.

{dataArrived(msg,urgent);}
virtual void TCPServerThreadBase::socketEstablished ( int  ,
void *   
) [inline, protected, virtual]

Reimplemented from TCPSocket::CallbackInterface.

virtual void TCPServerThreadBase::socketFailure ( int  ,
void *  ,
int  code 
) [inline, protected, virtual]

Reimplemented from TCPSocket::CallbackInterface.

{failure(code);}
virtual void TCPServerThreadBase::socketPeerClosed ( int  ,
void *   
) [inline, protected, virtual]

Reimplemented from TCPSocket::CallbackInterface.

virtual void TCPServerThreadBase::socketStatusArrived ( int  ,
void *  ,
TCPStatusInfo *  status 
) [inline, protected, virtual]

Reimplemented from TCPSocket::CallbackInterface.

{statusArrived(status);}
virtual void TCPServerThreadBase::statusArrived ( TCPStatusInfo *  status) [inline, virtual]

Called when a status arrives in response to getSocket()->getStatus(). By default it deletes the status object, redefine it to add code to examine the status.

{delete status;}
virtual void TCPServerThreadBase::timerExpired ( cMessage *  timer) [pure virtual]

Called when a timer (scheduled via scheduleAt()) expires. To be redefined.

Implemented in TCPGenericSrvThread.

Referenced by TCPSrvHostApp::handleMessage().


Member Data Documentation


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