MAK RTIspy API Documentation for HLA 1516
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions
DtTcpMsgSocketMgr Class Reference
+ Inheritance diagram for DtTcpMsgSocketMgr:
+ Collaboration diagram for DtTcpMsgSocketMgr:

List of all members.

Public Member Functions

 DtTcpMsgSocketMgr (DtBoost::shared_ptr< DtMsgHeaderReader > hdrReader, size_t recvBufferSize=20000, int maxQueuedMsgs=-1)
 Constructor. Will not open a server socket.
virtual ~DtTcpMsgSocketMgr ()
 Destructor.
virtual bool openServerSocket (DtU16 localPort, DtInetDevice *hostIf=NULL, DtInetUtils::DtInetAddrFamily family=DtInetUtils::DtInetAddrFamily_IPv4, DtU32 flags=(DtDefaultSockOpts|DtSockOptNonBlocking))
 Opens a server socket if not already open.
virtual void processConnections ()
 Check for incoming connection attempts.
virtual void addSocket (DtTcpMsgSocket *sock)
 Add a new socket to be managed that was created and opened outside of this class.
bool socketAdded (DtInetSocket *sock)
bool socketRemoved (DtInetSocket *sock)
virtual void removeAndDelete (DtTcpMsgSocket *sock)
 Remove the specified socket from the list and delete it.
virtual void enableBundling (size_t maxBundleSize)
 Enables message bundling and sets the maximum bundle size.
virtual void disableBundling ()
 Disables message bundling.
virtual void enableCompression (DtU8 compressionLevel)
 Enables message compression and sets the compression level.
virtual void disableCompression ()
 Disables message compression.
virtual void setTcpNoDelay (bool enable)
 Changes the setting of the TCP_NODELAY option.
virtual void setSendBufferSize (DtU32 size)
 Sets the socket send buffer size.
virtual void setRecvBufferSize (DtU32 size)
 Sets the socket receive buffer size.
virtual DtInetSockState serverSocketState () const
 Returns the state of the server socket.
virtual DtU32 maxMsgSize () const
 Gets the maximum message size.
DtTcpMsgSocketMapsocketSet ()
 Returns the list of sockets managed by this manager.
DtTcpMsgSocketMap::iterator socketIter (DtTcpMsgSocket *sock)
 Returns the iterator for the given socket, if the socket is managed by this manager.
DtString getLastError () const
 Get a description of the last error.
bool isListening () const
 Returns true if the socket is open.
Add / Delete Socket Addition Callbacks

Add/remove socket addition callback to be invoked when a new socket connection is accepted.

virtual void addSocketAdditionCallback (DtTcpSocketAdditionCallback cb, void *usr)
virtual void removeSocketAdditionCallback (DtTcpSocketAdditionCallback cb, void *usr)
Add / Delete Socket Removal Callbacks

Add/remove socket removal callback to be invoked when a managed socket connection is removed.

virtual void addSocketRemovalCallback (DtTcpSocketRemovalCallback cb, void *usr)
virtual void removeSocketRemovalCallback (DtTcpSocketRemovalCallback cb, void *usr)

Static Public Member Functions

static bool socketAdded (DtInetSocket *sock, void *usr)
 Callback handler for socket addition callbacks from DtInetSocketMgr.
static bool socketRemoved (DtInetSocket *sock, void *usr)
 Callback handler for socket removal callbacks from DtInetSocketMgr.

Protected Attributes

std::auto_ptr< DtInetSocketMgr > mySocketMgr
 The underlying socket manager.
DtTcpMsgSocketMap mySockets
 List of sockets managed by this manager, mapped by the underlying DtInetTcpSocket.
DtBoost::shared_ptr
< DtMsgHeaderReader
myHeaderReader
 The message header reader to be used by all managed sockets.
int myMaxQueuedMessages
 The maximum size the send queue for each socket is allowed to reach.
size_t myRecvBufferSize
 The size of the sockets' receive buffers.
bool myTcpNoDelay
 The sockets' TCP_NODELAY setting.
size_t myMaxBundleSize
 The maximum size of outgoing message bundles.
MAKRti::DtU8 myCompressionLevel
 The maximum size of outgoing message bundles.
MAKRti::DtU32 mySockRecvBufferSize
 The receive buffer size for managed sockets.
MAKRti::DtU32 mySockSendBufferSize
 The send buffer size for managed sockets.
std::list< DtTcpSocketMgrCbInfomyAdditionCallbacks
 Socket addition callbacks.
std::list< DtTcpSocketMgrCbInfomyRemovalCallbacks
 Socket removal callbacks.
DtString myLastError
 Description of the last error.

Private Member Functions

 DtTcpMsgSocketMgr (const DtTcpMsgSocketMgr &)
DtTcpMsgSocketMgroperator= (const DtTcpMsgSocketMgr &)

Constructor & Destructor Documentation

DtTcpMsgSocketMgr::DtTcpMsgSocketMgr ( DtBoost::shared_ptr< DtMsgHeaderReader hdrReader,
size_t  recvBufferSize = 20000,
int  maxQueuedMsgs = -1 
)

Constructor. Will not open a server socket.

Destructor.

References mySockets, and removeAndDelete().


Member Function Documentation

void DtTcpMsgSocketMgr::addSocket ( DtTcpMsgSocket sock) [virtual]

Add a new socket to be managed that was created and opened outside of this class.

References DtTcpMsgSocket::inetTcpSocket(), mySocketMgr, and mySockets.

Referenced by DtPeerToPeerTcpSockMgr::processConnections(), and DtPeerToPeerTcpSockMgr::removeAndDeletePeerConnection().

Disables message bundling.

References myMaxBundleSize, and mySockets.

Disables message compression.

References myCompressionLevel, and mySockets.

void DtTcpMsgSocketMgr::enableBundling ( size_t  maxBundleSize) [virtual]

Enables message bundling and sets the maximum bundle size.

References myMaxBundleSize, and mySockets.

Referenced by DtRtiMsgForwarder::setEnableBundling(), and DtFilteredTcpForwarder::setEnablePacketBundling().

void DtTcpMsgSocketMgr::enableCompression ( DtU8  compressionLevel) [virtual]

Enables message compression and sets the compression level.

References myCompressionLevel, and mySockets.

Referenced by DtFilteredTcpForwarder::setEnableCompression().

DtString DtTcpMsgSocketMgr::getLastError ( ) const [inline]

Get a description of the last error.

Returns true if the socket is open.

Referenced by DtInOutForwarderPort::DtInOutForwarderPort().

DtU32 DtTcpMsgSocketMgr::maxMsgSize ( ) const [virtual]

Gets the maximum message size.

References mySocketMgr.

bool DtTcpMsgSocketMgr::openServerSocket ( DtU16  localPort,
DtInetDevice *  hostIf = NULL,
DtInetUtils::DtInetAddrFamily  family = DtInetUtils::DtInetAddrFamily_IPv4,
DtU32  flags = (DtDefaultSockOpts | DtSockOptNonBlocking) 
) [virtual]

Opens a server socket if not already open.

Takes a port number to listen on, a pointer to the local network interface device the socket will be bound to, an address family indication (IPv4 or IPv6), socket option flags, and a trigger to open the socket immediately. If no host interface is specified the socket will be bound to INADDR_ANY (or IN6ADDR_ANY). Socket will be opened immediately. Returns false if unsuccessful.

References mySocketMgr, myTcpNoDelay, serverSocketState(), socketAdded(), and socketRemoved().

Referenced by DtFilteredTcpForwarder::DtFilteredTcpForwarder(), and DtInOutForwarderPort::DtInOutForwarderPort().

DtTcpMsgSocketMgr& DtTcpMsgSocketMgr::operator= ( const DtTcpMsgSocketMgr ) [private]

Check for incoming connection attempts.

Any socket addition callbacks registered by the application will be invoked. The new connections will be automatically added to the list of managed connections if all socket addition callbacks return true.

Reimplemented in DtPeerToPeerTcpSockMgr.

References mySocketMgr.

Referenced by DtExtendedRtiMsgForwarder::getNextMsg(), and DtRtiMsgForwarder::run().

DtInetSockState DtTcpMsgSocketMgr::serverSocketState ( ) const [virtual]

Returns the state of the server socket.

References mySocketMgr.

Referenced by openServerSocket().

void DtTcpMsgSocketMgr::setRecvBufferSize ( DtU32  size) [virtual]
void DtTcpMsgSocketMgr::setSendBufferSize ( DtU32  size) [virtual]
void DtTcpMsgSocketMgr::setTcpNoDelay ( bool  enable) [virtual]

Changes the setting of the TCP_NODELAY option.

References mySocketMgr, myTcpNoDelay, and socketSet().

bool DtTcpMsgSocketMgr::socketAdded ( DtInetSocket *  sock,
void *  usr 
) [static]

Callback handler for socket addition callbacks from DtInetSocketMgr.

Referenced by openServerSocket().

bool DtTcpMsgSocketMgr::socketAdded ( DtInetSocket *  sock)
DtTcpMsgSocketMap::iterator DtTcpMsgSocketMgr::socketIter ( DtTcpMsgSocket sock) [inline]

Returns the iterator for the given socket, if the socket is managed by this manager.

If not, the end of the set is returned.

References DtTcpMsgSocket::inetTcpSocket().

Referenced by DtTcpForwarder__vl__::readAndForward().

bool DtTcpMsgSocketMgr::socketRemoved ( DtInetSocket *  sock,
void *  usr 
) [static]

Callback handler for socket removal callbacks from DtInetSocketMgr.

Referenced by openServerSocket().

bool DtTcpMsgSocketMgr::socketRemoved ( DtInetSocket *  sock)

References myRemovalCallbacks, and mySockets.


Member Data Documentation

Socket addition callbacks.

Referenced by addSocketAdditionCallback(), removeSocketAdditionCallback(), and socketAdded().

MAKRti::DtU8 DtTcpMsgSocketMgr::myCompressionLevel [protected]

The maximum size of outgoing message bundles.

Referenced by DtPeerToPeerTcpSockMgr::connectToPeer(), disableCompression(), enableCompression(), and socketAdded().

DtBoost::shared_ptr<DtMsgHeaderReader> DtTcpMsgSocketMgr::myHeaderReader [protected]

The message header reader to be used by all managed sockets.

Referenced by DtPeerToPeerTcpSockMgr::connectToPeer(), and socketAdded().

DtString DtTcpMsgSocketMgr::myLastError [protected]

Description of the last error.

The maximum size of outgoing message bundles.

Referenced by DtPeerToPeerTcpSockMgr::connectToPeer(), disableBundling(), enableBundling(), and socketAdded().

The maximum size the send queue for each socket is allowed to reach.

Referenced by DtPeerToPeerTcpSockMgr::connectToPeer(), and socketAdded().

The size of the sockets' receive buffers.

Referenced by DtPeerToPeerTcpSockMgr::connectToPeer(), and socketAdded().

std::auto_ptr<DtInetSocketMgr> DtTcpMsgSocketMgr::mySocketMgr [protected]

List of sockets managed by this manager, mapped by the underlying DtInetTcpSocket.

Referenced by addSocket(), disableBundling(), disableCompression(), enableBundling(), enableCompression(), socketAdded(), socketRemoved(), and ~DtTcpMsgSocketMgr().

MAKRti::DtU32 DtTcpMsgSocketMgr::mySockRecvBufferSize [protected]

The receive buffer size for managed sockets.

Referenced by DtPeerToPeerTcpSockMgr::connectToPeer(), setRecvBufferSize(), and socketAdded().

MAKRti::DtU32 DtTcpMsgSocketMgr::mySockSendBufferSize [protected]

The send buffer size for managed sockets.

Referenced by DtPeerToPeerTcpSockMgr::connectToPeer(), setSendBufferSize(), and socketAdded().

The sockets' TCP_NODELAY setting.

Referenced by DtPeerToPeerTcpSockMgr::connectToPeer(), openServerSocket(), setTcpNoDelay(), and socketAdded().


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)