|
INET Framework for OMNeT++/OMNEST
|
Hosts a server application, to be subclassed from TCPServerProcess (which is a sSimpleModule).
More...
#include <TcpServerHostApp.h>
Hosts a server application, to be subclassed from TCPServerProcess (which is a sSimpleModule).
Creates one instance (using dynamic module creation) for each incoming connection. More info in the corresponding NED file.
◆ ThreadSet
◆ ~TcpServerHostApp()
| virtual inet::TcpServerHostApp::~TcpServerHostApp |
( |
| ) |
|
|
inlinevirtual |
◆ finish()
| void inet::TcpServerHostApp::finish |
( |
| ) |
|
|
overrideprotectedvirtual |
◆ handleCrashOperation()
◆ handleMessageWhenUp()
| void inet::TcpServerHostApp::handleMessageWhenUp |
( |
cMessage * |
msg | ) |
|
|
overrideprotectedvirtual |
Implements inet::OperationalMixin< cSimpleModule >.
69 if (msg->isSelfMessage()) {
72 throw cRuntimeError(
"Invalid thread pointer in the timer (msg->contextPointer is invalid)");
73 thread->timerExpired(msg);
78 socket->processMessage(msg);
83 EV_ERROR <<
"message " << msg->getFullName() <<
"(" << msg->getClassName() <<
") arrived for unknown socket \n";
◆ handleStartOperation()
◆ handleStopOperation()
◆ initialize()
| void inet::TcpServerHostApp::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
◆ numInitStages()
| virtual int inet::TcpServerHostApp::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
◆ refreshDisplay()
| void inet::TcpServerHostApp::refreshDisplay |
( |
| ) |
const |
|
overrideprotectedvirtual |
◆ removeThread()
◆ socketAvailable()
Implements inet::TcpSocket::ICallback.
99 TcpSocket *newSocket =
new TcpSocket(availableInfo);
100 newSocket->setOutputGate(gate(
"socketOut"));
102 const char *serverThreadModuleType = par(
"serverThreadModuleType");
103 cModuleType *moduleType = cModuleType::get(serverThreadModuleType);
105 sprintf(name,
"thread_%i", newSocket->getSocketId());
106 TcpServerThreadBase *proc = check_and_cast<TcpServerThreadBase *>(moduleType->create(name,
this));
107 proc->finalizeParameters();
108 proc->callInitialize();
110 newSocket->setCallback(proc);
111 proc->init(
this, newSocket);
116 socket->accept(availableInfo->getNewSocketId());
◆ socketClosed()
| void inet::TcpServerHostApp::socketClosed |
( |
TcpSocket * |
socket | ) |
|
|
overrideprotectedvirtual |
◆ socketDataArrived()
| virtual void inet::TcpServerHostApp::socketDataArrived |
( |
TcpSocket * |
socket, |
|
|
Packet * |
packet, |
|
|
bool |
urgent |
|
) |
| |
|
inlineoverrideprotectedvirtual |
Notifies about data arrival, packet ownership is transferred to the callee.
Implements inet::TcpSocket::ICallback.
39 {
throw cRuntimeError(
"Unexpected data"); }
◆ socketDeleted()
| virtual void inet::TcpServerHostApp::socketDeleted |
( |
TcpSocket * |
socket | ) |
|
|
inlineoverrideprotectedvirtual |
◆ socketEstablished()
| virtual void inet::TcpServerHostApp::socketEstablished |
( |
TcpSocket * |
socket | ) |
|
|
inlineoverrideprotectedvirtual |
◆ socketFailure()
| virtual void inet::TcpServerHostApp::socketFailure |
( |
TcpSocket * |
socket, |
|
|
int |
code |
|
) |
| |
|
inlineoverrideprotectedvirtual |
◆ socketPeerClosed()
| virtual void inet::TcpServerHostApp::socketPeerClosed |
( |
TcpSocket * |
socket | ) |
|
|
inlineoverrideprotectedvirtual |
◆ socketStatusArrived()
|
|
inlineoverrideprotectedvirtual |
◆ threadClosed()
◆ TcpServerThreadBase
◆ serverSocket
| TcpSocket inet::TcpServerHostApp::serverSocket |
|
protected |
◆ socketMap
◆ threadSet
The documentation for this class was generated from the following files:
State operationalState
Definition: OperationalMixin.h:23
TcpSocket serverSocket
Definition: TcpServerHostApp.h:28
ThreadSet threadSet
Definition: TcpServerHostApp.h:31
void setCallback(ICallback *cb)
Sets a callback object, to be used with processMessage().
Definition: TcpSocket.cc:276
friend class TcpServerThreadBase
Definition: TcpServerHostApp.h:57
cModule * getContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:40
virtual void initialize(int stage) override
Definition: OperationalMixinImpl.h:26
virtual bool isOpen() const override
Definition: TcpSocket.cc:257
SocketMap socketMap
Definition: TcpServerHostApp.h:29
void deleteSockets()
Deletes the socket objects.
Definition: SocketMap.cc:44
virtual bool belongsToSocket(cMessage *msg) const override
Returns true if the message belongs to this socket instance (message has a TcpCommand as getControlIn...
Definition: TcpSocket.cc:365
ISocket * findSocketFor(cMessage *msg)
Finds the socket for the given message.
Definition: SocketMap.cc:19
void addSocket(ISocket *socket)
Adds the given socket.
Definition: SocketMap.cc:28
unsigned int size() const
Returns the number of sockets stored.
Definition: SocketMap.h:52
bool contains(const std::vector< T > &v, const Tk &a)
Definition: stlutils.h:65
virtual void removeThread(TcpServerThreadBase *thread)
Definition: TcpServerHostApp.cc:125
void listen(bool fork)
Definition: TcpSocket.cc:95
void processMessage(cMessage *msg) override
Examines the message (which should have arrived from TCP), updates socket state, and if there is a ca...
Definition: TcpSocket.cc:281
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
virtual void destroy() override
Destroy the connection.
Definition: TcpSocket.cc:186
virtual void delayActiveOperationFinish(simtime_t timeout)
Definition: OperationalMixinImpl.h:161
virtual void startActiveOperationExtraTimeOrFinish(simtime_t extraTime)
Definition: OperationalMixinImpl.h:179
void bind(int localPort)
Bind the socket to a local port number.
Definition: TcpSocket.cc:69
void setOutputGate(cGate *toTcp)
Sets the gate on which to send to TCP.
Definition: TcpSocket.h:242
void close() override
Closes the local end of the connection.
Definition: TcpSocket.cc:161
virtual void refreshDisplay() const override
Definition: OperationalMixinImpl.h:200
virtual void socketClosed(TcpSocket *socket) override
Definition: TcpServerHostApp.cc:119
ISocket * removeSocket(ISocket *socket)
Removes the given socket.
Definition: SocketMap.cc:34