Public Member Functions | Protected Member Functions | Protected Attributes

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

Definition at line 53 of file TCPSrvHostApp.h.


Constructor & Destructor Documentation

TCPServerThreadBase::TCPServerThreadBase (  )  [inline]

Definition at line 72 of file TCPSrvHostApp.h.

{sock=NULL;}

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

Definition at line 73 of file TCPSrvHostApp.h.

{}


Member Function Documentation

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

Cancel an event

Definition at line 88 of file TCPSrvHostApp.h.

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

Definition at line 117 of file TCPSrvHostApp.h.

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.

Definition at line 123 of file TCPSrvHostApp.h.

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

Returns pointer to the host module

Definition at line 79 of file TCPSrvHostApp.h.

{return hostmod;}

virtual TCPSocket* TCPServerThreadBase::getSocket (  )  [inline, virtual]

Returns the socket object

Definition at line 76 of file TCPSrvHostApp.h.

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

{return sock;}

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

Definition at line 69 of file TCPSrvHostApp.h.

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.

Definition at line 111 of file TCPSrvHostApp.h.

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

Definition at line 85 of file TCPSrvHostApp.h.

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

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

Reimplemented from TCPSocket::CallbackInterface.

Definition at line 64 of file TCPSrvHostApp.h.

{closed();}

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

Implements TCPSocket::CallbackInterface.

Definition at line 61 of file TCPSrvHostApp.h.

{dataArrived(msg,urgent);}

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

Reimplemented from TCPSocket::CallbackInterface.

Definition at line 62 of file TCPSrvHostApp.h.

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

Reimplemented from TCPSocket::CallbackInterface.

Definition at line 65 of file TCPSrvHostApp.h.

{failure(code);}

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

Reimplemented from TCPSocket::CallbackInterface.

Definition at line 63 of file TCPSrvHostApp.h.

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

Reimplemented from TCPSocket::CallbackInterface.

Definition at line 66 of file TCPSrvHostApp.h.

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

Definition at line 130 of file TCPSrvHostApp.h.

{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

Definition at line 56 of file TCPSrvHostApp.h.

Definition at line 57 of file TCPSrvHostApp.h.


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