TCPServerThreadBase Class Reference

#include <TCPSrvHostApp.h>

Inheritance diagram for TCPServerThreadBase:

TCPSocket::CallbackInterface TCPGenericSrvThread List of all members.

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


Public Member Functions

void init (TCPSrvHostApp *hostmodule, TCPSocket *socket)
 TCPServerThreadBase ()
virtual ~TCPServerThreadBase ()
TCPSocketsocket ()
TCPSrvHostApphostModule ()
void scheduleAt (simtime_t t, cMessage *msg)
void cancelEvent (cMessage *msg)
simtime_t simTime ()
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 *, cMessage *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)

Private Attributes

TCPSrvHostApphostmod
TCPSocketsock


Constructor & Destructor Documentation

TCPServerThreadBase::TCPServerThreadBase (  )  [inline]

00071 {sock=NULL;}

virtual TCPServerThreadBase::~TCPServerThreadBase (  )  [inline, virtual]

00072 {}


Member Function Documentation

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

Cancel an event

00087 {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.

00119 {hostmod->removeThread(this);}

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.

00125 {hostmod->removeThread(this);}

TCPSrvHostApp* TCPServerThreadBase::hostModule (  )  [inline]

Returns pointer to the host module

00078 {return hostmod;}

void TCPServerThreadBase::init ( TCPSrvHostApp hostmodule,
TCPSocket socket 
) [inline]

00068 {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.

00113 {socket()->close();}

void TCPServerThreadBase::scheduleAt ( simtime_t  t,
cMessage *  msg 
) [inline]

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

00084 {msg->setContextPointer(this); hostmod->scheduleAt(t,msg);}

simtime_t TCPServerThreadBase::simTime (  )  [inline]

Returns simulation time

00090 {return hostmod->simTime();}

TCPSocket* TCPServerThreadBase::socket (  )  [inline]

Returns the socket object

00075 {return sock;}

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

Reimplemented from TCPSocket::CallbackInterface.

00063 {closed();}

virtual void TCPServerThreadBase::socketDataArrived ( int  ,
void *  ,
cMessage *  msg,
bool  urgent 
) [inline, protected, virtual]

Implements TCPSocket::CallbackInterface.

00060 {dataArrived(msg,urgent);}

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

Reimplemented from TCPSocket::CallbackInterface.

00061 {established();}

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

Reimplemented from TCPSocket::CallbackInterface.

00064 {failure(code);}

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

Reimplemented from TCPSocket::CallbackInterface.

00062 {peerClosed();}

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

Reimplemented from TCPSocket::CallbackInterface.

00065 {statusArrived(status);}

virtual void TCPServerThreadBase::statusArrived ( TCPStatusInfo status  )  [inline, virtual]

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

00132 {delete status;}

virtual void TCPServerThreadBase::timerExpired ( cMessage *  timer  )  [pure virtual]

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

Implemented in TCPGenericSrvThread.


Member Data Documentation

TCPSrvHostApp* TCPServerThreadBase::hostmod [private]

TCPSocket* TCPServerThreadBase::sock [private]


The documentation for this class was generated from the following file:
Generated on Wed Apr 4 13:20:24 2007 for INET Framework for OMNeT++/OMNEST by  doxygen 1.4.7