MAK RTIspy API Documentation for HLA 1516
Public Member Functions | Protected Attributes | Private Member Functions
DtPeerToPeerTcpSockMgr Class Reference

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:

List of all members.

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 DtTcpMsgSocketconnectToPeer (const MAKRti::DtInetAddr &addr, DtInetDevice *hostIf=0)
 Establish a new connection to a remote host at port = myPort.
virtual DtTcpMsgSocketconnectToPeer (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< DtSocketCbInfomyEstablishedCallbacks
 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.
DtPeerToPeerTcpSockMgroperator= (const DtPeerToPeerTcpSockMgr &orig)

Detailed Description

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.


Constructor & Destructor Documentation

DtPeerToPeerTcpSockMgr::DtPeerToPeerTcpSockMgr ( int  port,
DtBoost::shared_ptr< DtMsgHeaderReader hdrRdr,
size_t  recvBufferSize,
int  maxForwarderQueue 
)

Constructor, networkInterface defaults to INADDR_ANY.

References myClock.

Destructor.

Copy Constructor and Assignment operator not implemented. Copy not allowed.


Member Function Documentation

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]
DtPeerToPeerTcpSockMgr& DtPeerToPeerTcpSockMgr::operator= ( const DtPeerToPeerTcpSockMgr orig) [private]

Return count of aborted connections.

References myPendingConnectionsAborted.

Referenced by DtInOutForwarderPort::pendingConnectionsAborted().

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().


Member Data Documentation

MAKRti::DtClock DtPeerToPeerTcpSockMgr::myClock [protected]

Clock used for socket timeouts.

Referenced by connectToPeer(), and DtPeerToPeerTcpSockMgr().

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().

Count of socket connections which were aborted before successful establishment.

Referenced by abortPendingConnections(), pendingConnectionsAborted(), processConnections(), and removeAndDeletePeerConnection().

Data Members.

The Listening port and default port for peer connections

Referenced by connectToPeer().

When processing an add connection callback, prevent recursive connection processing.

Referenced by processConnections().


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

Document ID: Generated on Thu Jun 14 14:15:04 EDT 2012 from SVN revision 116116
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)