INET Framework for OMNeT++/OMNEST
inet::TcpServerSocketIo Class Reference

#include <TcpServerSocketIo.h>

Inheritance diagram for inet::TcpServerSocketIo:
inet::TcpSocket::ICallback

Public Member Functions

virtual ~TcpServerSocketIo ()
 
virtual TcpSocketgetSocket ()
 
virtual void acceptSocket (TcpAvailableInfo *availableInfo)
 
virtual void socketDataArrived (TcpSocket *socket, Packet *packet, bool urgent) override
 Notifies about data arrival, packet ownership is transferred to the callee. More...
 
virtual void socketAvailable (TcpSocket *socket, TcpAvailableInfo *availableInfo) override
 
virtual void socketEstablished (TcpSocket *socket) override
 
virtual void socketPeerClosed (TcpSocket *socket) override
 
virtual void socketClosed (TcpSocket *socket) override
 
virtual void socketFailure (TcpSocket *socket, int code) override
 
virtual void socketStatusArrived (TcpSocket *socket, TcpStatusInfo *status) override
 
virtual void socketDeleted (TcpSocket *socket) override
 
- Public Member Functions inherited from inet::TcpSocket::ICallback
virtual ~ICallback ()
 

Protected Member Functions

virtual void handleMessage (cMessage *message) override
 

Protected Attributes

TcpSocketsocket = nullptr
 

Constructor & Destructor Documentation

◆ ~TcpServerSocketIo()

virtual inet::TcpServerSocketIo::~TcpServerSocketIo ( )
inlinevirtual
24 { delete socket; }

Member Function Documentation

◆ acceptSocket()

void inet::TcpServerSocketIo::acceptSocket ( TcpAvailableInfo availableInfo)
virtual
18 {
19  Enter_Method("acceptSocket");
20  socket = new TcpSocket(availableInfo);
21  socket->setOutputGate(gate("socketOut"));
22  socket->setCallback(this);
23  socket->accept(availableInfo->getNewSocketId());
24 }

◆ getSocket()

virtual TcpSocket* inet::TcpServerSocketIo::getSocket ( )
inlinevirtual
26 { return socket; }

Referenced by inet::TcpServerListener::connectionClosed().

◆ handleMessage()

void inet::TcpServerSocketIo::handleMessage ( cMessage *  message)
overrideprotectedvirtual
27 {
28  if (message->arrivedOn("socketIn")) {
29  ASSERT(socket != nullptr && socket->belongsToSocket(message));
30  socket->processMessage(message);
31  }
32  else if (message->arrivedOn("trafficIn"))
33  socket->send(check_and_cast<Packet *>(message));
34  else
35  throw cRuntimeError("Unknown message");
36 }

◆ socketAvailable()

virtual void inet::TcpServerSocketIo::socketAvailable ( TcpSocket socket,
TcpAvailableInfo availableInfo 
)
inlineoverridevirtual

Implements inet::TcpSocket::ICallback.

30 {}

◆ socketClosed()

virtual void inet::TcpServerSocketIo::socketClosed ( TcpSocket socket)
inlineoverridevirtual

Implements inet::TcpSocket::ICallback.

33 {}

◆ socketDataArrived()

void inet::TcpServerSocketIo::socketDataArrived ( TcpSocket socket,
Packet packet,
bool  urgent 
)
overridevirtual

Notifies about data arrival, packet ownership is transferred to the callee.

Implements inet::TcpSocket::ICallback.

39 {
40  packet->removeTag<SocketInd>();
41  send(packet, "trafficOut");
42 }

◆ socketDeleted()

virtual void inet::TcpServerSocketIo::socketDeleted ( TcpSocket socket)
inlineoverridevirtual

Implements inet::TcpSocket::ICallback.

36 {}

◆ socketEstablished()

virtual void inet::TcpServerSocketIo::socketEstablished ( TcpSocket socket)
inlineoverridevirtual

Implements inet::TcpSocket::ICallback.

31 {}

◆ socketFailure()

virtual void inet::TcpServerSocketIo::socketFailure ( TcpSocket socket,
int  code 
)
inlineoverridevirtual

Implements inet::TcpSocket::ICallback.

34 {}

◆ socketPeerClosed()

virtual void inet::TcpServerSocketIo::socketPeerClosed ( TcpSocket socket)
inlineoverridevirtual

Implements inet::TcpSocket::ICallback.

32 {}

◆ socketStatusArrived()

virtual void inet::TcpServerSocketIo::socketStatusArrived ( TcpSocket socket,
TcpStatusInfo status 
)
inlineoverridevirtual

Implements inet::TcpSocket::ICallback.

35 {}

Member Data Documentation

◆ socket

TcpSocket* inet::TcpServerSocketIo::socket = nullptr
protected

Referenced by acceptSocket(), and handleMessage().


The documentation for this class was generated from the following files:
inet::TcpSocket::send
virtual void send(Packet *msg) override
Sends data packet.
Definition: TcpSocket.cc:147
inet::TcpSocket::setCallback
void setCallback(ICallback *cb)
Sets a callback object, to be used with processMessage().
Definition: TcpSocket.cc:276
inet::TcpSocket::accept
void accept(int socketId)
Accepts a new incoming connection reported as available.
Definition: TcpSocket.cc:114
inet::TcpSocket::belongsToSocket
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
inet::TcpServerSocketIo::socket
TcpSocket * socket
Definition: TcpServerSocketIo.h:18
inet::TcpSocket::processMessage
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
Enter_Method
#define Enter_Method(...)
Definition: SelfDoc.h:71
inet::TcpSocket::setOutputGate
void setOutputGate(cGate *toTcp)
Sets the gate on which to send to TCP.
Definition: TcpSocket.h:242