![]() |
MAK RTIspy API Documentation for HLA 1.3
|
The DtPeerToPeerTcpSockMgr adds the ability to act as a client as well as a server to the DtTcpMsgSocketMgr base class. More...
Inheritance diagram for DtPeerToPeerTcpSockMgr:
Collaboration diagram for DtPeerToPeerTcpSockMgr:Public Member Functions | |
| DtPeerToPeerTcpSockMgr (int port, DtBoost::shared_ptr< DtMsgHeaderReader > hdrRdr, size_t recvBufferSize, int maxForwarderQueue) | |
| Constructor, networkInterface defaults to INADDR_ANY. | |
| virtual | ~DtPeerToPeerTcpSockMgr () |
| Destructor. | |
| virtual DtTcpMsgSocket * | connectToPeer (const MAKRti::DtInetAddr &addr, DtInetDevice *hostIf=0) |
| Establish a new connection to a remote host at port = myPort. | |
| virtual DtTcpMsgSocket * | connectToPeer (const MAKRti::DtInetAddr &addr, int port, DtInetDevice *hostIf=0) |
| Establish a new connection to a remote host at port Returns a socket pending connection (ie - may not be fully connected yet) (returned socket will be valid but unusable until non-blocking conn status can be resolved) | |
| virtual void | removeAndDeletePeerConnection (DtTcpMsgSocket *sock, bool abort=true) |
| Remove a peer socket connection (may still be pending) | |
| unsigned int | abortPendingConnections () |
| Remove all pending peer sockets. | |
| unsigned int | pendingConnectionsAborted () |
| Return count of aborted connections. | |
| virtual void | processConnections () |
| Check to see if any clients or peers are trying to connect. | |
| virtual void | addSocketEstablishedCallback (DtSocketEstablishedCallback cb, void *usr) |
| Call this method when a new socket connection is established to add a callback to the socket established function which will be called when a new socket connection is accepted and vetted. | |
| virtual void | removeSocketEstablishedCallback (DtSocketEstablishedCallback cb, void *usr) |
| Call this method when a socket connection is deleted to remove the callback to the socket established function which was added when the connection was created. | |
Protected Attributes | |
| int | myPort |
| Data Members. | |
| MAKRti::DtClock | myClock |
| Clock used for socket timeouts. | |
| unsigned int | myPendingConnectionsAborted |
| Count of socket connections which were aborted before successful establishment. | |
| std::map< DtTcpMsgSocket *, MAKRti::DtTime > | myPendingConnections |
| Map of outgoing peer connections that have not been fully established to the time at which they were initiated. | |
| bool | myProcessingConnections |
| When processing an add connection callback, prevent recursive connection processing. | |
| std::list< DtSocketCbInfo > | myEstablishedCallbacks |
| list of callbacks to call when sockets become established | |
Private Member Functions | |
| DtPeerToPeerTcpSockMgr (const DtPeerToPeerTcpSockMgr &orig) | |
| Copy Constructor and Assignment operator not implemented. Copy not allowed. | |
| DtPeerToPeerTcpSockMgr & | operator= (const DtPeerToPeerTcpSockMgr &orig) |
The DtPeerToPeerTcpSockMgr adds the ability to act as a client as well as a server to the DtTcpMsgSocketMgr base class.
This socket manager is able to actively create socket connections as well as passively listen. It also supports creation of specialized sockets. All socket addition and removal callbacks will be called for actively opened connections as well as incoming connections.
| DtPeerToPeerTcpSockMgr::DtPeerToPeerTcpSockMgr | ( | int | port, |
| DtBoost::shared_ptr< DtMsgHeaderReader > | hdrRdr, | ||
| size_t | recvBufferSize, | ||
| int | maxForwarderQueue | ||
| ) |
Constructor, networkInterface defaults to INADDR_ANY.
References myClock.
| DtPeerToPeerTcpSockMgr::~DtPeerToPeerTcpSockMgr | ( | ) | [virtual] |
Destructor.
| DtPeerToPeerTcpSockMgr::DtPeerToPeerTcpSockMgr | ( | const DtPeerToPeerTcpSockMgr & | orig | ) | [private] |
Copy Constructor and Assignment operator not implemented. Copy not allowed.
| unsigned int DtPeerToPeerTcpSockMgr::abortPendingConnections | ( | ) |
Remove all pending peer sockets.
References myPendingConnections, myPendingConnectionsAborted, and removeAndDeletePeerConnection().
Referenced by DtInOutForwarderPort::abortPendingConnections().
| void DtPeerToPeerTcpSockMgr::addSocketEstablishedCallback | ( | DtSocketEstablishedCallback | cb, |
| void * | usr | ||
| ) | [virtual] |
Call this method when a new socket connection is established to add a callback to the socket established function which will be called when a new socket connection is accepted and vetted.
References myEstablishedCallbacks.
Referenced by DtInOutForwarderPort::DtInOutForwarderPort().
| DtTcpMsgSocket * DtPeerToPeerTcpSockMgr::connectToPeer | ( | const MAKRti::DtInetAddr & | addr, |
| DtInetDevice * | hostIf = 0 |
||
| ) | [virtual] |
Establish a new connection to a remote host at port = myPort.
References myPort.
Referenced by DtInOutForwarderPort::addSocketUsingRoutesFile(), and DtInOutForwarderPort::connectToPeer().
| DtTcpMsgSocket * DtPeerToPeerTcpSockMgr::connectToPeer | ( | const MAKRti::DtInetAddr & | addr, |
| int | port, | ||
| DtInetDevice * | hostIf = 0 |
||
| ) | [virtual] |
Establish a new connection to a remote host at port Returns a socket pending connection (ie - may not be fully connected yet) (returned socket will be valid but unusable until non-blocking conn status can be resolved)
References DtTcpMsgSocket::enableBundling(), DtTcpMsgSocket::enableCompression(), DtTcpMsgSocket::isConnected(), DtTcpMsgSocket::isConnectionInProgress(), myClock, DtTcpMsgSocketMgr::myCompressionLevel, DtTcpMsgSocketMgr::myHeaderReader, DtTcpMsgSocketMgr::myMaxBundleSize, DtTcpMsgSocketMgr::myMaxQueuedMessages, myPendingConnections, DtTcpMsgSocketMgr::myRecvBufferSize, DtTcpMsgSocketMgr::mySockRecvBufferSize, DtTcpMsgSocketMgr::mySockSendBufferSize, DtTcpMsgSocketMgr::myTcpNoDelay, NULL, DtTcpMsgSocket::openClientSocket(), DtMsgSocket::setRecvBufferSize(), and DtMsgSocket::setSendBufferSize().
| DtPeerToPeerTcpSockMgr& DtPeerToPeerTcpSockMgr::operator= | ( | const DtPeerToPeerTcpSockMgr & | orig | ) | [private] |
| unsigned int DtPeerToPeerTcpSockMgr::pendingConnectionsAborted | ( | ) |
Return count of aborted connections.
References myPendingConnectionsAborted.
Referenced by DtInOutForwarderPort::pendingConnectionsAborted().
| void DtPeerToPeerTcpSockMgr::processConnections | ( | ) | [virtual] |
Check to see if any clients or peers are trying to connect.
If so, add new DtTcpSockets to handle the connections. Check to see if any pending outgoing connections have been established. If so, add them to the list of connections.
Reimplemented from DtTcpMsgSocketMgr.
References DtTcpMsgSocketMgr::addSocket(), DtTcpMsgSocket::destination(), DtTcpMsgSocket::isConnected(), DtTcpMsgSocket::isConnectionInProgress(), myEstablishedCallbacks, myPendingConnections, myPendingConnectionsAborted, myProcessingConnections, DtTcpMsgSocketMgr::myRemovalCallbacks, and DtTcpMsgSocket::testConnectionStatus().
Referenced by DtInOutForwarderPort::checkConnectionStatus(), DtInOutForwarderPort::getNextMsg(), DtInOutForwarderPort::processInitializationMessages(), and DtInOutForwarderPort::updateRoutes().
| void DtPeerToPeerTcpSockMgr::removeAndDeletePeerConnection | ( | DtTcpMsgSocket * | sock, |
| bool | abort = true |
||
| ) | [virtual] |
Remove a peer socket connection (may still be pending)
References DtTcpMsgSocketMgr::addSocket(), myPendingConnections, myPendingConnectionsAborted, and DtTcpMsgSocketMgr::removeAndDelete().
Referenced by abortPendingConnections(), DtInOutForwarderPort::addSocketUsingRoutesFile(), DtInOutForwarderPort::socketAdditionCb(), and DtInOutForwarderPort::socketEstablishedCb().
| void DtPeerToPeerTcpSockMgr::removeSocketEstablishedCallback | ( | DtSocketEstablishedCallback | cb, |
| void * | usr | ||
| ) | [virtual] |
Call this method when a socket connection is deleted to remove the callback to the socket established function which was added when the connection was created.
References myEstablishedCallbacks.
Referenced by DtInOutForwarderPort::~DtInOutForwarderPort().
MAKRti::DtClock DtPeerToPeerTcpSockMgr::myClock [protected] |
Clock used for socket timeouts.
Referenced by connectToPeer(), and DtPeerToPeerTcpSockMgr().
std::list<DtSocketCbInfo> DtPeerToPeerTcpSockMgr::myEstablishedCallbacks [protected] |
list of callbacks to call when sockets become established
Referenced by addSocketEstablishedCallback(), processConnections(), and removeSocketEstablishedCallback().
std::map<DtTcpMsgSocket*, MAKRti::DtTime> DtPeerToPeerTcpSockMgr::myPendingConnections [protected] |
Map of outgoing peer connections that have not been fully established to the time at which they were initiated.
Referenced by abortPendingConnections(), connectToPeer(), processConnections(), and removeAndDeletePeerConnection().
unsigned int DtPeerToPeerTcpSockMgr::myPendingConnectionsAborted [protected] |
Count of socket connections which were aborted before successful establishment.
Referenced by abortPendingConnections(), pendingConnectionsAborted(), processConnections(), and removeAndDeletePeerConnection().
int DtPeerToPeerTcpSockMgr::myPort [protected] |
Data Members.
The Listening port and default port for peer connections
Referenced by connectToPeer().
bool DtPeerToPeerTcpSockMgr::myProcessingConnections [protected] |
When processing an add connection callback, prevent recursive connection processing.
Referenced by processConnections().