![]() |
MAK RTIspy API Documentation for HLA Evolved
|
The DtUdpMsgSocket class provides an address family independent UDP socket that handles RTI messages. More...
Inheritance diagram for DtUdpMsgSocket:
Collaboration diagram for DtUdpMsgSocket:Public Member Functions | |
| DtUdpMsgSocket (DtBoost::shared_ptr< DtMsgHeaderReader > hdrReader, size_t maxPacketSize=DtDefaultMaxPacketSize) | |
| Constructor. | |
| virtual | ~DtUdpMsgSocket () |
| Destructor. | |
| virtual void | openSocket (const DtInetEndpoint &dest, DtU32 flags=DtDefaultSockOpts, DtU16 localPort=0, DtInetDevice *hostIf=NULL) |
| Opens the socket if not already open. | |
| virtual int | sendMessage (caddr_t msg, size_t msgSize, bool deleteAfterSend, const DtInetAddr &destAddr=DtInetAddr::inaddrAny()) |
| Sends a message. | |
| virtual bool | flush () |
| Attempts to send any queued messages and bundled messages. | |
| virtual int | recvMessage (caddr_t *buffptr) |
| Gets the next message from the incoming data. | |
| virtual int | recvMessageWithSrc (caddr_t *buffptr, DtInetEndpoint &src) |
| Gets the next message from the incoming data. | |
| 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 bool | joinMulticastGroup (const DtInetAddr &grpAddr, DtInetDevice *device=NULL) |
| Join / drop subscription to multicast group. | |
| virtual bool | joinMulticastGroup (const DtInetEndpoint &grpEndpoint, DtInetDevice *device=NULL) |
| virtual bool | dropMulticastGroup (const DtInetAddr &grpAddr, DtInetDevice *device=NULL) |
| virtual bool | dropMulticastGroup (const DtInetEndpoint &grpEndpoint, DtInetDevice *device=NULL) |
| virtual bool | setMcastTtlOption (DtU32 ttl) |
| Change the default time-to-live on outbound multicast packets sent from this socket. | |
| virtual void | setRetryOnSend (unsigned int numRetries, double waitPeriod) |
| Enables/disables send retries on failure. | |
| virtual DtU32 | maxMsgSize () const |
| Gets the maximum message size. | |
| virtual bool | isOpen () const |
| Returns true if the socket is open. | |
| DtInetUdpSocket * | inetUdpSocket () |
| Returns a pointer to the DtInetUdpSocket. | |
| void | setFilterPort (int port) |
| Sets the filter port. | |
Public Member Functions inherited from DtMsgSocket | |
| DtMsgSocket (DtBoost::shared_ptr< DtMsgHeaderReader > hdrReader, size_t recvBuffSize) | |
| Constructor. | |
| DtMsgSocket (std::auto_ptr< DtInetSocket > socket, DtBoost::shared_ptr< DtMsgHeaderReader > hdrReader, size_t recvBuffSize) | |
| Constructor which takes a pre-created DtInetSocket pointer. | |
| virtual | ~DtMsgSocket () |
| Destructor. | |
| virtual bool | closeSocket () |
| Close a socket. Returns true on successful close or false on failure. | |
| virtual DtInetSockState | state () const |
| Returns the state of the socket. | |
| void | printStateToStream (MAKRti::DtOutputStream &stream) const |
| prints state to stream | |
| const DtString & | lastError () const |
| Returns a description of the last error. | |
| const DtInetEndpoint & | localEndpoint () const |
| Gets the local endpoint for the socket. | |
| void | setSendBufferSize (DtU32 size) |
| Sets the socket send buffer size. | |
| void | setRecvBufferSize (DtU32 size) |
| Sets the socket receive buffer size. | |
| DtU32 | maxSendMsgSize () const |
| Gets the maximum socket send size. | |
| int | descriptor () const |
| Get's the socket file descriptor. | |
| DtInetSocket * | inetSocket () |
| Returns a pointer to the DtInetSocket. | |
Protected Member Functions | |
| virtual int | sendPacket (caddr_t msg, size_t msgSize, const DtInetAddr &destAddr=DtInetAddr::inaddrAny()) |
| Sends a single packet. | |
| virtual int | retrySendTo (caddr_t msg, size_t msgSize, const DtInetAddr &destAddr=DtInetAddr::inaddrAny()) |
| Retries sending a message which failed to send. | |
| virtual int | recv (caddr_t *buffptr, DtInetEndpoint *ep) |
| Gets the next message from the incoming data. | |
Protected Member Functions inherited from DtMsgSocket | |
| void | expandRecvBuffer (size_t sizeNeeded) |
| Expands the receive buffer to accommodate the given size message. | |
Protected Attributes | |
| DtInetEndpoint | myEndpoint |
| The current endpoint to send to. | |
| std::map< DtInetAddr, DtMsgBundler * > | myMsgBundlers |
| Message bundlers for outgoing messages for each destination address. | |
| DtMsgBundler | myDefaultMsgBundler |
| Message bundler for the default destination. | |
| bool | myBundlingEnabled |
| Whether message bundling is enabled. | |
| DtMsgCompressor | myMsgCompressor |
| Message compressor and uncompressor. | |
| bool | myCompressionEnabled |
| Whether message compression is enabled. | |
| DtInetEndpoint | myLastSourceEndpoint |
| Source endpoint of last data received. | |
| size_t | myMaxPacketSize |
| The maximum packet size. | |
| unsigned int | myMaxSendRetries |
| The maximum number of times to try resending. | |
| double | mySendRetryPeriod |
| The wait period between send retries. | |
| int | myFilterPort |
| All messages sent from this port on this machine will be filtered. | |
Protected Attributes inherited from DtMsgSocket | |
| std::auto_ptr < MAKRti::DtInetSocket > | mySocket |
| The socket. | |
| DtInetBuffer | myRecvBuffer |
| The buffer to store received data in. | |
| DtString | myLastError |
| Description of last error. | |
| DtBoost::shared_ptr < DtMsgHeaderReader > | myHeaderReader |
| Reads data from message header. | |
The DtUdpMsgSocket class provides an address family independent UDP socket that handles RTI messages.
| DtUdpMsgSocket::DtUdpMsgSocket | ( | DtBoost::shared_ptr< DtMsgHeaderReader > | hdrReader, |
| size_t | maxPacketSize = DtDefaultMaxPacketSize |
||
| ) |
Constructor.
Requires a header reader to extract information from message headers. Does NOT open the socket. A call to openSocket() is required.
|
virtual |
Destructor.
|
virtual |
Disables message bundling.
Implements DtMsgSocket.
Reimplemented in DtSmSocket__rti__.
References myBundlingEnabled.
|
virtual |
Disables message compression.
Implements DtMsgSocket.
Reimplemented in DtSmSocket__rti__.
References myCompressionEnabled.
|
virtual |
Reimplemented in DtSmSocket__rti__.
References inetUdpSocket().
Referenced by DtExtendedRtiMsgForwarder::dropMulticastGroup().
|
virtual |
Reimplemented in DtSmSocket__rti__.
References inetUdpSocket().
|
virtual |
Enables message bundling and sets the maximum bundle size.
Implements DtMsgSocket.
Reimplemented in DtSmSocket__rti__.
References myBundlingEnabled, myDefaultMsgBundler, myMsgBundlers, and DtMsgBundler::setMaxSendBundleSize().
Referenced by DtConnectionMgr::createBestEffortConn(), DtExtendedRtiMsgForwarder::init(), and DtInOutForwarderPort::initializeConnections().
|
virtual |
Enables message compression and sets the compression level.
Implements DtMsgSocket.
Reimplemented in DtSmSocket__rti__.
References myCompressionEnabled, myMsgCompressor, and DtMsgCompressor::setCompressionLevel().
Referenced by DtConnectionMgr::createBestEffortConn(), DtExtendedRtiMsgForwarder::init(), and DtInOutForwarderPort::initializeConnections().
|
virtual |
Attempts to send any queued messages and bundled messages.
Returns true if all queued and bundled messages were sent.
Implements DtMsgSocket.
Reimplemented in DtSmSocket__rti__, and DtRtiSmSocket.
References DtMsgBundler::getBundle(), myBundlingEnabled, myDefaultMsgBundler, myMsgBundlers, DtMsgSocket::mySocket, and sendPacket().
Referenced by DtExtendedRtiMsgForwarder::flush(), and DtMulitcastDiscoveryMgr::requestAddress().
|
inline |
Returns a pointer to the DtInetUdpSocket.
Referenced by dropMulticastGroup(), joinMulticastGroup(), DtRtiAssistantPeer::netRead(), and setMcastTtlOption().
|
virtual |
Returns true if the socket is open.
Reimplemented in DtSmSocket__rti__.
References DtMsgSocket::mySocket.
Referenced by DtRtiAssistantPeer::addSocketsForInterfaces(), DtConnectionMgr::createBestEffortConn(), DtExtendedRtiMsgForwarder::flush(), DtMulitcastDiscoveryMgr::init(), DtInOutForwarderPort::initializeConnections(), and DtRtiAssistantPeer::sendMsg().
|
virtual |
Join / drop subscription to multicast group.
Socket will join group identified by the multicast address in grpAddr or grpEndpoint. If an object is passed in the port value of the endpoint will be ignored and the socket will join from the same port the socket's local endpoint uses. If no interface is specified in the join it will join on the host's default multicast interface.
Reimplemented in DtSmSocket__rti__.
References inetUdpSocket().
Referenced by DtExtendedRtiMsgForwarder::listenToMulticastGroup().
|
virtual |
Reimplemented in DtSmSocket__rti__.
References inetUdpSocket().
|
virtual |
Gets the maximum message size.
References DtMsgSocket::mySocket.
|
virtual |
Opens the socket if not already open.
Takes a DtInetEndpoint (containing the destination address, protocol - TCP or UDP, and destination port number), a source port number to use, a pointer to the local network interface device the socket will be bound to, and socket option flags. The address family (IPv4 or IPv6) is assumed from the dest endpoint object. If the specified local port is 0 an ephemeral port will be chosen for the connection UNLESS the destination is a broadcast or multicast address, in which case the destination port is used as the local port also. If no host interface is specified the most appropriate interface will be chosen based on the destination. If the destination endpoint specifies a multicast address the multicast group is joined automatically when the socket is opened and the group member- ship is dropped when the socket is closed. This ctor will not throw exceptions on failure. Check the socket status by calling state() to determine if the socket is ready.
Reimplemented in DtSmSocket__rti__.
References myEndpoint, DtMsgSocket::myLastError, and DtMsgSocket::mySocket.
Referenced by DtRtiAssistantPeer::addSocketsForInterfaces(), DtConnectionMgr::createBestEffortConn(), DtMulitcastDiscoveryMgr::init(), DtExtendedRtiMsgForwarder::init(), and DtInOutForwarderPort::initializeConnections().
|
protectedvirtual |
Gets the next message from the incoming data.
Reimplemented in DtRtiSmSocket, and DtSmSocket__rti__.
References DtDefaultInterfaceAddr(), DtMsgBundler::isBundled(), DtMsgCompressor::isCompressed(), myDefaultMsgBundler, myFilterPort, DtMsgSocket::myLastError, myLastSourceEndpoint, myMsgCompressor, DtMsgSocket::myRecvBuffer, DtMsgSocket::mySocket, DtMsgBundler::recvNextMsgFromBundle(), DtMsgBundler::unbundle(), and DtMsgCompressor::uncompressMsg().
Referenced by recvMessage(), and recvMessageWithSrc().
|
virtual |
Gets the next message from the incoming data.
Implements DtMsgSocket.
References recv().
Referenced by DtInOutForwarderPort::getNextMsg(), DtExtendedRtiMsgForwarder::getNextMsg(), DtRtiAssistantPeer::netRead(), DtMulitcastDiscoveryMgr::requestAddress(), and DtMulitcastDiscoveryMgr::tick().
|
virtual |
|
protectedvirtual |
Retries sending a message which failed to send.
References myEndpoint, myMaxSendRetries, mySendRetryPeriod, and DtMsgSocket::mySocket.
Referenced by sendPacket().
|
virtual |
Sends a message.
Implements DtMsgSocket.
Reimplemented in DtSmSocket__rti__.
References DtMsgBundler::addToBundle(), DtMsgCompressor::compressMsg(), DtMsgBundler::getBundle(), DtMsgBundler::maxSendBundleSize(), myBundlingEnabled, myCompressionEnabled, myDefaultMsgBundler, DtMsgSocket::myHeaderReader, DtMsgSocket::myLastError, myMsgBundlers, myMsgCompressor, DtMsgSocket::mySocket, and sendPacket().
Referenced by DtMulitcastDiscoveryMgr::requestAddress(), DtGsRtiConnection::send(), DtExtendedRtiMsgForwarder::sendBestEffort(), DtRtiAssistantPeer::sendMsg(), DtGsRtiConnection::sendToAllRemoteSites(), and DtMulitcastDiscoveryMgr::tick().
|
protectedvirtual |
Sends a single packet.
References myEndpoint, DtMsgSocket::mySocket, and retrySendTo().
Referenced by flush(), and sendMessage().
|
inline |
Sets the filter port.
All messages sent from this port on this machine will be filtered.
Referenced by DtExtendedRtiMsgForwarder::init().
|
virtual |
Change the default time-to-live on outbound multicast packets sent from this socket.
Reimplemented in DtSmSocket__rti__.
References inetUdpSocket().
Referenced by DtRtiAssistantPeer::addSocketsForInterfaces(), DtConnectionMgr::createBestEffortConn(), DtMulitcastDiscoveryMgr::init(), and DtExtendedRtiMsgForwarder::init().
|
virtual |
Enables/disables send retries on failure.
Reimplemented in DtSmSocket__rti__.
References myMaxSendRetries, and mySendRetryPeriod.
Referenced by DtConnectionMgr::createBestEffortConn(), DtMulitcastDiscoveryMgr::init(), and DtExtendedRtiMsgForwarder::init().
|
protected |
Whether message bundling is enabled.
Referenced by disableBundling(), enableBundling(), flush(), and sendMessage().
|
protected |
Whether message compression is enabled.
Referenced by disableCompression(), enableCompression(), and sendMessage().
|
protected |
Message bundler for the default destination.
Also handles unbundling of all incoming data.
Referenced by enableBundling(), flush(), recv(), and sendMessage().
|
protected |
The current endpoint to send to.
Referenced by openSocket(), retrySendTo(), and sendPacket().
|
protected |
All messages sent from this port on this machine will be filtered.
Referenced by recv().
|
protected |
Source endpoint of last data received.
Referenced by recv().
|
protected |
The maximum packet size.
|
protected |
The maximum number of times to try resending.
Referenced by retrySendTo(), and setRetryOnSend().
|
protected |
Message bundlers for outgoing messages for each destination address.
Referenced by enableBundling(), flush(), and sendMessage().
|
protected |
Message compressor and uncompressor.
Referenced by enableCompression(), recv(), and sendMessage().
|
protected |
The wait period between send retries.
Referenced by retrySendTo(), and setRetryOnSend().