![]() |
MAK RTIspy API Documentation for HLA Evolved
|
Inheritance diagram for DtTcpMsgSocketMgr:
Collaboration diagram for DtTcpMsgSocketMgr: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. | |
| DtTcpMsgSocketMap & | socketSet () |
| 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< DtTcpSocketMgrCbInfo > | myAdditionCallbacks |
| Socket addition callbacks. | |
| std::list< DtTcpSocketMgrCbInfo > | myRemovalCallbacks |
| Socket removal callbacks. | |
| DtString | myLastError |
| Description of the last error. | |
Private Member Functions | |
| DtTcpMsgSocketMgr (const DtTcpMsgSocketMgr &) | |
| DtTcpMsgSocketMgr & | operator= (const DtTcpMsgSocketMgr &) |
| DtTcpMsgSocketMgr::DtTcpMsgSocketMgr | ( | DtBoost::shared_ptr< DtMsgHeaderReader > | hdrReader, |
| size_t | recvBufferSize = 20000, |
||
| int | maxQueuedMsgs = -1 |
||
| ) |
Constructor. Will not open a server socket.
|
virtual |
Destructor.
References mySockets, and removeAndDelete().
|
private |
|
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().
|
virtual |
References myAdditionCallbacks.
Referenced by DtInOutForwarderPort::DtInOutForwarderPort().
|
virtual |
References myRemovalCallbacks.
Referenced by DtInOutForwarderPort::DtInOutForwarderPort().
|
virtual |
Disables message bundling.
References myMaxBundleSize, and mySockets.
|
virtual |
Disables message compression.
References myCompressionLevel, and mySockets.
|
virtual |
Enables message bundling and sets the maximum bundle size.
References myMaxBundleSize, and mySockets.
Referenced by DtRtiMsgForwarder::setEnableBundling(), and DtFilteredTcpForwarder::setEnablePacketBundling().
|
virtual |
Enables message compression and sets the compression level.
References myCompressionLevel, and mySockets.
Referenced by DtFilteredTcpForwarder::setEnableCompression().
|
inline |
Get a description of the last error.
|
inline |
Returns true if the socket is open.
Referenced by DtInOutForwarderPort::DtInOutForwarderPort().
|
virtual |
Gets the maximum message size.
References mySocketMgr.
|
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().
|
private |
|
virtual |
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().
|
virtual |
Remove the specified socket from the list and delete it.
References DtMsgSocket::inetSocket(), and mySocketMgr.
Referenced by DtRtiMsgForwarder::closeAllConnectionsIfRequested(), DtInOutForwarderPort::flush(), DtExtendedRtiMsgForwarder::getNextMsg(), DtInOutForwarderPort::processLostConnection(), DtTcpForwarder__vl__::readAndForward(), DtPeerToPeerTcpSockMgr::removeAndDeletePeerConnection(), DtRtiMsgForwarder::requestKillSingleConnection(), DtFilteredTcpForwarder::updateQueuedSockets(), and ~DtTcpMsgSocketMgr().
|
virtual |
References myAdditionCallbacks.
Referenced by DtInOutForwarderPort::~DtInOutForwarderPort(), and DtRtiMsgForwarder::~DtRtiMsgForwarder().
|
virtual |
References myRemovalCallbacks.
Referenced by DtInOutForwarderPort::~DtInOutForwarderPort(), and DtRtiMsgForwarder::~DtRtiMsgForwarder().
|
virtual |
|
virtual |
Sets the socket receive buffer size.
References mySockRecvBufferSize, and socketSet().
Referenced by DtFilteredTcpForwarder::DtFilteredTcpForwarder(), and DtInOutForwarderPort::DtInOutForwarderPort().
|
virtual |
Sets the socket send buffer size.
References mySockSendBufferSize, and socketSet().
Referenced by DtFilteredTcpForwarder::DtFilteredTcpForwarder(), and DtInOutForwarderPort::DtInOutForwarderPort().
|
virtual |
Changes the setting of the TCP_NODELAY option.
References mySocketMgr, myTcpNoDelay, and socketSet().
|
static |
Callback handler for socket addition callbacks from DtInetSocketMgr.
Referenced by openServerSocket().
| bool DtTcpMsgSocketMgr::socketAdded | ( | DtInetSocket * | sock | ) |
References DtTcpMsgSocket::enableBundling(), DtTcpMsgSocket::enableCompression(), myAdditionCallbacks, myCompressionLevel, myHeaderReader, myMaxBundleSize, myMaxQueuedMessages, myRecvBufferSize, mySockets, mySockRecvBufferSize, mySockSendBufferSize, myTcpNoDelay, DtMsgSocket::setRecvBufferSize(), DtMsgSocket::setSendBufferSize(), and DtTcpMsgSocket::setTcpNoDelay().
|
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().
|
static |
Callback handler for socket removal callbacks from DtInetSocketMgr.
Referenced by openServerSocket().
| bool DtTcpMsgSocketMgr::socketRemoved | ( | DtInetSocket * | sock | ) |
References myRemovalCallbacks, and mySockets.
|
inline |
Returns the list of sockets managed by this manager.
Referenced by DtRtiMsgForwarder::closeAllConnectionsIfRequested(), DtFilteredTcpForwarder::filter(), DtExtendedRtiMsgForwarder::getNextMsg(), DtTcpForwarder__vl__::readAndForward(), DtFilteredTcpForwarder::readAndForward(), DtTcpForwarder__vl__::sendToAll(), DtFilteredTcpForwarder::sendToAll(), DtFilteredTcpForwarder::sendToList(), setRecvBufferSize(), setSendBufferSize(), setTcpNoDelay(), and DtRtiMsgForwarder::waitForIo().
|
protected |
Socket addition callbacks.
Referenced by addSocketAdditionCallback(), removeSocketAdditionCallback(), and socketAdded().
|
protected |
The maximum size of outgoing message bundles.
Referenced by DtPeerToPeerTcpSockMgr::connectToPeer(), disableCompression(), enableCompression(), and socketAdded().
|
protected |
The message header reader to be used by all managed sockets.
Referenced by DtPeerToPeerTcpSockMgr::connectToPeer(), and socketAdded().
|
protected |
Description of the last error.
|
protected |
The maximum size of outgoing message bundles.
Referenced by DtPeerToPeerTcpSockMgr::connectToPeer(), disableBundling(), enableBundling(), and socketAdded().
|
protected |
The maximum size the send queue for each socket is allowed to reach.
Referenced by DtPeerToPeerTcpSockMgr::connectToPeer(), and socketAdded().
|
protected |
The size of the sockets' receive buffers.
Referenced by DtPeerToPeerTcpSockMgr::connectToPeer(), and socketAdded().
|
protected |
Socket removal callbacks.
Referenced by addSocketRemovalCallback(), DtPeerToPeerTcpSockMgr::processConnections(), removeSocketRemovalCallback(), and socketRemoved().
|
protected |
The underlying socket manager.
Referenced by addSocket(), maxMsgSize(), openServerSocket(), processConnections(), removeAndDelete(), serverSocketState(), and setTcpNoDelay().
|
protected |
List of sockets managed by this manager, mapped by the underlying DtInetTcpSocket.
Referenced by addSocket(), disableBundling(), disableCompression(), enableBundling(), enableCompression(), socketAdded(), socketRemoved(), and ~DtTcpMsgSocketMgr().
|
protected |
The receive buffer size for managed sockets.
Referenced by DtPeerToPeerTcpSockMgr::connectToPeer(), setRecvBufferSize(), and socketAdded().
|
protected |
The send buffer size for managed sockets.
Referenced by DtPeerToPeerTcpSockMgr::connectToPeer(), setSendBufferSize(), and socketAdded().
|
protected |
The sockets' TCP_NODELAY setting.
Referenced by DtPeerToPeerTcpSockMgr::connectToPeer(), openServerSocket(), setTcpNoDelay(), and socketAdded().