INET Framework for OMNeT++/OMNEST
|
Small utility class for managing a large number of TCPSocket objects. More...
#include <TCPSocketMap.h>
Public Member Functions | |
TCPSocketMap () | |
Constructor. More... | |
~TCPSocketMap () | |
Destructor. More... | |
TCPSocket * | findSocketFor (cMessage *msg) |
Finds the socket (by connId) for the given message. More... | |
void | addSocket (TCPSocket *socket) |
Registers the given socket. More... | |
TCPSocket * | removeSocket (TCPSocket *socket) |
Removes the given socket from the data structure. More... | |
unsigned int | size () const |
Returns the number of sockets stored. More... | |
void | deleteSockets () |
Deletes the socket objects. More... | |
Protected Types | |
typedef std::map< int, TCPSocket * > | SocketMap |
Protected Attributes | |
SocketMap | socketMap |
Small utility class for managing a large number of TCPSocket objects.
|
protected |
|
inline |
void inet::TCPSocketMap::addSocket | ( | TCPSocket * | socket | ) |
Registers the given socket.
Should not be called multiple times for one socket object.
Referenced by inet::TCPSrvHostApp::handleMessage(), inet::httptools::HttpServer::handleMessage(), inet::bgp::BGPRouting::openTCPConnectionToPeer(), inet::LDP::openTCPConnectionToPeer(), inet::bgp::BGPRouting::processMessageFromTCP(), inet::LDP::processMessageFromTCP(), and inet::httptools::HttpBrowser::submitToSocket().
void inet::TCPSocketMap::deleteSockets | ( | ) |
Deletes the socket objects.
Referenced by inet::httptools::HttpServer::finish(), and inet::httptools::HttpBrowser::~HttpBrowser().
TCPSocket * inet::TCPSocketMap::findSocketFor | ( | cMessage * | msg | ) |
Finds the socket (by connId) for the given message.
The message must have arrived from TCP, and must contain a TCPCommand control info object. The method returns nullptr if the socket was not found, and throws an error if the message doesn't contain a TCPCommand.
Referenced by inet::TCPSrvHostApp::handleMessage(), inet::httptools::HttpServer::handleMessage(), inet::httptools::HttpBrowser::handleMessage(), inet::bgp::BGPRouting::processMessageFromTCP(), and inet::LDP::processMessageFromTCP().
Removes the given socket from the data structure.
Referenced by inet::bgp::BGPRouting::listenConnectionFromPeer(), inet::bgp::BGPRouting::openTCPConnectionToPeer(), inet::TCPSrvHostApp::removeThread(), inet::httptools::HttpServer::socketClosed(), inet::httptools::HttpBrowser::socketClosed(), inet::httptools::HttpServer::socketFailure(), and inet::httptools::HttpBrowser::socketFailure().
|
inline |
|
protected |
Referenced by addSocket(), deleteSockets(), findSocketFor(), and removeSocket().