![]() |
MAK RTIspy API Documentation for HLA 1516
|
DtRtiSmSocket provides access to shared memory via a subscribable message queue tailored to the need of the RTI. More...
Inheritance diagram for DtRtiSmSocket:
Collaboration diagram for DtRtiSmSocket:Classes | |
| class | DtRtiSmSocketBundleBuff |
Public Member Functions | |
| DtRtiSmSocket (const char *sharename, DtBoost::shared_ptr< DtMsgHeaderReader > hdrReader) | |
| virtual | ~DtRtiSmSocket () |
| virtual bool | initializeSmQueue (DtU32 id=DtSM_INVALID_SUBSCRIBER_ID, bool forceSubscribe=false) |
| Attach to RTI specific variant of shared memory message queue. | |
| virtual bool | initializeSmQueue (DtU32 numBuckets, DtU32 payloadSize, bool reliableQueue, DtU32 id=DtSM_INVALID_SUBSCRIBER_ID, bool forceSubscribe=false) |
| The following version of initializeSmQueue() is specific to management of the shared memory subscribable message queue which the socket interfaces with. | |
| virtual int | sendMessage (caddr_t msg, size_t msgSize, bool deleteAfterSend, unsigned int flags, const DtInetAddr &destAddr=DtInetAddr::inaddrAny()) |
| The send method takes an extra flags parameter which identifies the transport method (DtReliable or DtBestEffort) and priority. | |
| virtual bool | flush () |
| Send buffered messages. | |
| virtual int | getMsgTransportInfo (DtInetAddr *addr, DtU32 *transAndPriority) |
| This receive method returns the size of the next message in shared memory as well as additional information needed by a forwarder or shared memory queue manager net I/O handler to pass messages to the network. | |
| virtual DtSmSubscribableMessageQueue__rti__ * | msgQueue () const |
| Return pointer to the attached queue. | |
| virtual bool | queueIsReliable () const |
| Query the queue to see if it is configured to operate in reliable mode. | |
| virtual int | waitForMessages (MAKRti::DtTime waitTime=0.0) |
| These methods are substitutes for using 'select()' calls on net sockets to check for messages. | |
| virtual int | waitUntilFull (MAKRti::DtTime waitTime=0.0) |
| Wait (block) for the specified time until the shared memory is full. | |
| virtual void | setReceiveMask (DtU32 rcvMask) |
| Set the message retrieval characteristics for this socket. | |
| virtual void | setAnonFilter (bool onOrOff) |
| Enable or disable filtering of anonymous MOM messages. | |
| virtual DtInetSockState | state () const |
| Returns the state of the socket. | |
Public Member Functions inherited from DtSmSocket__rti__ | |
| DtSmSocket__rti__ (const char *sharename, DtBoost::shared_ptr< DtMsgHeaderReader > hdrReader) | |
| virtual | ~DtSmSocket__rti__ () |
| virtual bool | initializeSmQueue (DtU32 numBuckets, DtU32 payloadSize, DtU32 id=DtSM_INVALID_SUBSCRIBER_ID, bool forceSubscribe=false) |
| The following version of initializeSmQueue() is specific to management of the shared memory subscribable message queue which the socket interfaces with. | |
| virtual int | sendMessage (caddr_t msg, size_t msgSize, bool deleteAfterSend, const DtInetAddr ¬Used=DtInetAddr::inaddrAny()) |
| The send method sendMessage() ignores the destination address and does not promulgate any transport method. | |
| virtual void | openSocket (const DtInetEndpoint &dest, DtU32 flags=DtDefaultSockOpts, DtU16 localPort=0, DtInetDevice *hostIf=NULL) |
| These methods do nothing but must be overridden to prevent parent class from attempting to perform setsockopt on non-existent socket. | |
| 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 bool | isOpen () const |
| Returns true if the socket is open. | |
| virtual int | subscribe (DtU32 id=DtSM_INVALID_SUBSCRIBER_ID) |
| The following methods are for use by all subscribers the the shared memory subscribable message queue the socket interfaces with. | |
| virtual void | unsubscribe (DtU32 id) |
| virtual bool | shutdownQueue (bool ruthless=false) |
| The following methods are specific to management of the shared memory subscribable message queue which the socket interfaces with. | |
| virtual int | subscriberCount () const |
Public Member Functions inherited from DtUdpMsgSocket | |
| DtUdpMsgSocket (DtBoost::shared_ptr< DtMsgHeaderReader > hdrReader, size_t maxPacketSize=DtDefaultMaxPacketSize) | |
| Constructor. | |
| virtual | ~DtUdpMsgSocket () |
| Destructor. | |
| 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 DtU32 | maxMsgSize () const |
| Gets the maximum message size. | |
| 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. | |
| 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 Types | |
| typedef std::vector< char > | Buffer |
| typedef std::map < MAKRti::DtInetAddr, DtRtiSmSocketBundleBuff > | RtiBufferMap |
Protected Member Functions | |
| DtRtiSmSocket (const DtRtiSmSocket &) | |
| Not Implemented. | |
| DtRtiSmSocket & | operator= (const DtRtiSmSocket &) |
| Not Implemented. | |
| virtual int | recv (caddr_t *buffptr, DtInetEndpoint *ep) |
| Gets the next message from the incoming data. | |
| virtual bool | filterAnonMsgs (caddr_t buffptr, DtU32 msgSenderId) |
Protected Member Functions inherited from DtSmSocket__rti__ | |
| DtSmSocket__rti__ (const DtSmSocket__rti__ &) | |
| Not Implemented. | |
| DtSmSocket__rti__ & | operator= (const DtSmSocket__rti__ &) |
| Not Implemented. | |
Protected Member Functions inherited from DtUdpMsgSocket | |
| 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. | |
Protected Member Functions inherited from DtMsgSocket | |
| void | expandRecvBuffer (size_t sizeNeeded) |
| Expands the receive buffer to accommodate the given size message. | |
Protected Attributes | |
| MAKRti::DtString | mySharedMemName |
| DtRtiSubscribableMessageQueue * | myRtiSmMsgQueue |
| DtU32 | myRecvMask |
| bool | myAnonFilterEnabled |
| RtiBufferMap | myRtiBufferMap |
| DtInetSockState | myState |
| The current state of the socket. | |
Protected Attributes inherited from DtSmSocket__rti__ | |
| MAKRti::DtString | mySharedMemName |
| DtSmSubscribableMessageQueue__rti__ * | mySmMsgQueue |
Protected Attributes inherited from DtUdpMsgSocket | |
| 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. | |
Friends | |
| class | DtRtiSmSocketBundleBuff |
DtRtiSmSocket provides access to shared memory via a subscribable message queue tailored to the need of the RTI.
DtRtiSmSocket isn't really a socket in the classical 'BSD sockets' sense. It is an interface abstraction that mirrors socket functionality to allow applications to easily use either network I/O or shared memory for communication using the same general interface. Where this flexibility is not a paramount concern direct access to the subscribable message queue is more efficient.
|
protected |
|
protected |
| DtRtiSmSocket::DtRtiSmSocket | ( | const char * | sharename, |
| DtBoost::shared_ptr< DtMsgHeaderReader > | hdrReader | ||
| ) |
|
virtual |
References myRtiSmMsgQueue.
|
protected |
Not Implemented.
|
protectedvirtual |
References DtNetMsgHeader::fedHandle.
Referenced by recv().
|
virtual |
Send buffered messages.
Returns indication of whether flush is complete or incomplete.
Reimplemented from DtSmSocket__rti__.
References myRtiBufferMap, and sendMessage().
Referenced by DtSmRtiConnection::flush().
|
virtual |
This receive method returns the size of the next message in shared memory as well as additional information needed by a forwarder or shared memory queue manager net I/O handler to pass messages to the network.
References DtRtiSubscribableMessageQueue::getRcvMsgTransportInfo(), DtRtiSubscribableMessageQueue::isEmpty(), and myRtiSmMsgQueue.
Referenced by DtSmRtiConnection::getMessageNetInfo().
|
virtual |
Attach to RTI specific variant of shared memory message queue.
If 'id' is not specified one will be assigned automatically. For use by non- manager subscribers.
Reimplemented from DtSmSocket__rti__.
References DtSMQ_FETCH_ALL, myRtiSmMsgQueue, mySharedMemName, myState, and DtRtiSubscribableMessageQueue::subscribe().
Referenced by DtSmConnectionMgr::createSharedMemConn(), and initializeSmQueue().
|
virtual |
The following version of initializeSmQueue() is specific to management of the shared memory subscribable message queue which the socket interfaces with.
These should only be used by a queue manager, not by ordinary subscribers. It must be called once and only once prior to use of the message queue.
References DtSMQ_SKIP_MINE, DtSmqEnqueueReliableMode, initializeSmQueue(), DtRtiSubscribableMessageQueue::initSyncVars(), myRtiSmMsgQueue, myState, DtRtiSubscribableMessageQueue::resetQueue(), and DtRtiSubscribableMessageQueue::setEnqueueMode().
|
virtual |
Return pointer to the attached queue.
Reimplemented from DtSmSocket__rti__.
References myRtiSmMsgQueue.
Referenced by recv().
|
protected |
Not Implemented.
|
virtual |
Query the queue to see if it is configured to operate in reliable mode.
References myRtiSmMsgQueue, and DtRtiSubscribableMessageQueue::queueIsReliable().
Referenced by DtSmRtiConnection::isReliable(), and DtSmRtiConnection::send().
|
protectedvirtual |
Gets the next message from the incoming data.
Reimplemented from DtSmSocket__rti__.
References filterAnonMsgs(), DtRtiSubscribableMessageQueue::getRcvMsgSenderInfo(), msgQueue(), myAnonFilterEnabled, DtMsgSocket::myRecvBuffer, myRtiSmMsgQueue, and NULL.
|
virtual |
The send method takes an extra flags parameter which identifies the transport method (DtReliable or DtBestEffort) and priority.
References myRtiSmMsgQueue, and DtRtiSubscribableMessageQueue::sendMessage().
Referenced by DtSmRtiConnection::flush(), flush(), and DtSmRtiConnection::send().
|
virtual |
Enable or disable filtering of anonymous MOM messages.
Enabled by default for federate LRCs employing shared memory. Must be disabled by shared memory queue manager connection manager to allow these messages to be forwarded to the network.
References myAnonFilterEnabled.
|
virtual |
Set the message retrieval characteristics for this socket.
Options allow for all messages or only a subset of messages in shared memory to be retrieved based on message originator, transport method, or priority
References myRecvMask.
Referenced by DtSmConnectionMgr::createSharedMemConn().
|
virtual |
|
virtual |
These methods are substitutes for using 'select()' calls on net sockets to check for messages.
The Win32 implementation of shared memory does not provide a way to get a file descriptor suitable for use in a select() call (shm_open() should work in Unix/Linux). Wait (block) for the specified time until a message can be read. Return status: 0 if messages are ready, > 0 if wait expired, or < 0 if error
References myRtiSmMsgQueue, and DtRtiSubscribableMessageQueue::waitForMessages().
Referenced by DtSmRtiConnection::waitForMessages().
|
virtual |
Wait (block) for the specified time until the shared memory is full.
Return status: 0 if full, > 0 if wait expired, or < 0 if error
References myRtiSmMsgQueue, and DtRtiSubscribableMessageQueue::waitUntilFull().
Referenced by DtSmRtiConnection::waitUntilFull().
|
friend |
|
protected |
Referenced by recv(), and setAnonFilter().
|
protected |
Referenced by setReceiveMask().
|
protected |
Referenced by flush().
|
protected |
Referenced by getMsgTransportInfo(), initializeSmQueue(), msgQueue(), queueIsReliable(), recv(), sendMessage(), waitForMessages(), waitUntilFull(), and ~DtRtiSmSocket().
|
protected |
Referenced by initializeSmQueue().
|
protected |
The current state of the socket.
Referenced by initializeSmQueue(), and state().