INET Framework for OMNeT++/OMNEST
inet::TCPServerThreadBase Class Referenceabstract

Abstract base class for server processes to be used with TCPSrvHostApp. More...

#include <TCPSrvHostApp.h>

Inheritance diagram for inet::TCPServerThreadBase:
inet::TCPSocket::CallbackInterface inet::TCPGenericSrvThread

Public Member Functions

 TCPServerThreadBase ()
 
virtual ~TCPServerThreadBase ()
 
virtual void init (TCPSrvHostApp *hostmodule, TCPSocket *socket)
 
virtual TCPSocketgetSocket ()
 
virtual TCPSrvHostAppgetHostModule ()
 
virtual void scheduleAt (simtime_t t, cMessage *msg)
 Schedule an event. More...
 
virtual void cancelEvent (cMessage *msg)
 
virtual void established ()=0
 Called when connection is established. More...
 
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)
 
- Public Member Functions inherited from inet::TCPSocket::CallbackInterface
virtual ~CallbackInterface ()
 
virtual void socketDeleted (int connId, void *yourPtr)
 

Protected Member Functions

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

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

inet::TCPServerThreadBase::TCPServerThreadBase ( )
inline
78 { sock = nullptr; hostmod = nullptr; }
TCPSrvHostApp * hostmod
Definition: TCPSrvHostApp.h:65
TCPSocket * sock
Definition: TCPSrvHostApp.h:66
virtual inet::TCPServerThreadBase::~TCPServerThreadBase ( )
inlinevirtual
79 {}

Member Function Documentation

virtual void inet::TCPServerThreadBase::cancelEvent ( cMessage *  msg)
inlinevirtual
103 { hostmod->cancelEvent(msg); }
TCPSrvHostApp * hostmod
Definition: TCPSrvHostApp.h:65
virtual void inet::TCPServerThreadBase::closed ( )
inlinevirtual
130 { hostmod->removeThread(this); }
TCPSrvHostApp * hostmod
Definition: TCPSrvHostApp.h:65
virtual void removeThread(TCPServerThreadBase *thread)
Definition: TCPSrvHostApp.cc:89
virtual void inet::TCPServerThreadBase::dataArrived ( cMessage *  msg,
bool  urgent 
)
pure virtual

Implemented in inet::TCPGenericSrvThread.

virtual void inet::TCPServerThreadBase::established ( )
pure virtual

Called when connection is established.

To be redefined.

Implemented in inet::TCPGenericSrvThread.

virtual void inet::TCPServerThreadBase::failure ( int  code)
inlinevirtual
136 { hostmod->removeThread(this); }
TCPSrvHostApp * hostmod
Definition: TCPSrvHostApp.h:65
virtual void removeThread(TCPServerThreadBase *thread)
Definition: TCPSrvHostApp.cc:89
virtual TCPSrvHostApp* inet::TCPServerThreadBase::getHostModule ( )
inlinevirtual
92 { return hostmod; }
TCPSrvHostApp * hostmod
Definition: TCPSrvHostApp.h:65
virtual TCPSocket* inet::TCPServerThreadBase::getSocket ( )
inlinevirtual

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

87 { return sock; }
TCPSocket * sock
Definition: TCPSrvHostApp.h:66
virtual void inet::TCPServerThreadBase::init ( TCPSrvHostApp hostmodule,
TCPSocket socket 
)
inlinevirtual

Referenced by inet::TCPSrvHostApp::handleMessage().

82 { hostmod = hostmodule; sock = socket; }
TCPSrvHostApp * hostmod
Definition: TCPSrvHostApp.h:65
TCPSocket * sock
Definition: TCPSrvHostApp.h:66
virtual void inet::TCPServerThreadBase::peerClosed ( )
inlinevirtual
124 { getSocket()->close(); }
virtual TCPSocket * getSocket()
Definition: TCPSrvHostApp.h:87
void close()
Closes the local end of the connection.
Definition: TCPSocket.cc:192
virtual void inet::TCPServerThreadBase::scheduleAt ( simtime_t  t,
cMessage *  msg 
)
inlinevirtual

Schedule an event.

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

98 { msg->setContextPointer(this); hostmod->scheduleAt(t, msg); }
TCPSrvHostApp * hostmod
Definition: TCPSrvHostApp.h:65
virtual void inet::TCPServerThreadBase::socketClosed ( int  ,
void *   
)
inlineoverrideprotectedvirtual

Reimplemented from inet::TCPSocket::CallbackInterface.

72 { closed(); }
virtual void closed()
Definition: TCPSrvHostApp.h:130
virtual void inet::TCPServerThreadBase::socketDataArrived ( int  ,
void *  ,
cPacket *  msg,
bool  urgent 
)
inlineoverrideprotectedvirtual

Implements inet::TCPSocket::CallbackInterface.

69 { dataArrived(msg, urgent); }
virtual void dataArrived(cMessage *msg, bool urgent)=0
virtual void inet::TCPServerThreadBase::socketEstablished ( int  ,
void *   
)
inlineoverrideprotectedvirtual

Reimplemented from inet::TCPSocket::CallbackInterface.

70 { established(); }
virtual void established()=0
Called when connection is established.
virtual void inet::TCPServerThreadBase::socketFailure ( int  ,
void *  ,
int  code 
)
inlineoverrideprotectedvirtual

Reimplemented from inet::TCPSocket::CallbackInterface.

73 { failure(code); }
virtual void failure(int code)
Definition: TCPSrvHostApp.h:136
virtual void inet::TCPServerThreadBase::socketPeerClosed ( int  ,
void *   
)
inlineoverrideprotectedvirtual

Reimplemented from inet::TCPSocket::CallbackInterface.

71 { peerClosed(); }
virtual void peerClosed()
Definition: TCPSrvHostApp.h:124
virtual void inet::TCPServerThreadBase::socketStatusArrived ( int  ,
void *  ,
TCPStatusInfo status 
)
inlineoverrideprotectedvirtual

Reimplemented from inet::TCPSocket::CallbackInterface.

74 { statusArrived(status); }
virtual void statusArrived(TCPStatusInfo *status)
Definition: TCPSrvHostApp.h:143
virtual void inet::TCPServerThreadBase::statusArrived ( TCPStatusInfo status)
inlinevirtual
143 { delete status; }
virtual void inet::TCPServerThreadBase::timerExpired ( cMessage *  timer)
pure virtual

Member Data Documentation

TCPSrvHostApp* inet::TCPServerThreadBase::hostmod
protected
TCPSocket* inet::TCPServerThreadBase::sock
protected

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