MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends
DtRtiSmSocket Class Reference

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 &notUsed=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 sendMessage (caddr_t msg, size_t msgSize, bool deleteAfterSend, const DtInetAddr &destAddr=DtInetAddr::inaddrAny(), int port=0)
 Sends a message.
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.
virtual void setFilterPort (int port)
 Sets the filter port. All messages sent from this port on this machine will be filtered.
- 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.
unsigned 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.
DtRtiSmSocketoperator= (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(), int port=0)
 Sends a single packet; handle retries if necessary.
virtual int doSendPacket (caddr_t msg, size_t msgSize, const DtInetAddr &destAddr=DtInetAddr::inaddrAny(), int port=0)
 Just do the send packet part dealing with destination and port.
virtual int retrySendTo (caddr_t msg, size_t msgSize, const DtInetAddr &destAddr=DtInetAddr::inaddrAny(), int port=0)
 Retry 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
DtRtiSubscribableMessageQueuemyRtiSmMsgQueue
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

Detailed Description

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.

Member Typedef Documentation

typedef std::vector<char> DtRtiSmSocket::Buffer
protected
typedef std::map< MAKRti::DtInetAddr, DtRtiSmSocketBundleBuff > DtRtiSmSocket::RtiBufferMap
protected

Constructor & Destructor Documentation

DtRtiSmSocket::DtRtiSmSocket ( const char *  sharename,
DtBoost::shared_ptr< DtMsgHeaderReader hdrReader 
)
virtual DtRtiSmSocket::~DtRtiSmSocket ( )
virtual
DtRtiSmSocket::DtRtiSmSocket ( const DtRtiSmSocket )
protected

Not Implemented.

Member Function Documentation

virtual bool DtRtiSmSocket::filterAnonMsgs ( caddr_t  buffptr,
DtU32  msgSenderId 
)
protectedvirtual
virtual bool DtRtiSmSocket::flush ( )
virtual

Send buffered messages.

Returns indication of whether flush is complete or incomplete.

Reimplemented from DtSmSocket__rti__.

virtual int DtRtiSmSocket::getMsgTransportInfo ( DtInetAddr *  addr,
DtU32 *  transAndPriority 
)
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.

virtual bool DtRtiSmSocket::initializeSmQueue ( DtU32  id = DtSM_INVALID_SUBSCRIBER_ID,
bool  forceSubscribe = false 
)
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__.

virtual bool DtRtiSmSocket::initializeSmQueue ( DtU32  numBuckets,
DtU32  payloadSize,
bool  reliableQueue,
DtU32  id = DtSM_INVALID_SUBSCRIBER_ID,
bool  forceSubscribe = false 
)
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.

virtual DtSmSubscribableMessageQueue__rti__* DtRtiSmSocket::msgQueue ( ) const
virtual

Return pointer to the attached queue.

Reimplemented from DtSmSocket__rti__.

DtRtiSmSocket& DtRtiSmSocket::operator= ( const DtRtiSmSocket )
protected

Not Implemented.

virtual bool DtRtiSmSocket::queueIsReliable ( ) const
virtual

Query the queue to see if it is configured to operate in reliable mode.

virtual int DtRtiSmSocket::recv ( caddr_t *  buffptr,
DtInetEndpoint *  ep 
)
protectedvirtual

Gets the next message from the incoming data.

Reimplemented from DtSmSocket__rti__.

virtual int DtRtiSmSocket::sendMessage ( caddr_t  msg,
size_t  msgSize,
bool  deleteAfterSend,
unsigned int  flags,
const DtInetAddr &  destAddr = DtInetAddr::inaddrAny() 
)
virtual

The send method takes an extra flags parameter which identifies the transport method (DtReliable or DtBestEffort) and priority.

virtual void DtRtiSmSocket::setAnonFilter ( bool  onOrOff)
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.

virtual void DtRtiSmSocket::setReceiveMask ( DtU32  rcvMask)
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

virtual DtInetSockState DtRtiSmSocket::state ( ) const
virtual

Returns the state of the socket.

Reimplemented from DtMsgSocket.

virtual int DtRtiSmSocket::waitForMessages ( MAKRti::DtTime  waitTime = 0.0)
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

virtual int DtRtiSmSocket::waitUntilFull ( MAKRti::DtTime  waitTime = 0.0)
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

Friends And Related Function Documentation

friend class DtRtiSmSocketBundleBuff
friend

Member Data Documentation

bool DtRtiSmSocket::myAnonFilterEnabled
protected
DtU32 DtRtiSmSocket::myRecvMask
protected
RtiBufferMap DtRtiSmSocket::myRtiBufferMap
protected
DtRtiSubscribableMessageQueue* DtRtiSmSocket::myRtiSmMsgQueue
protected
MAKRti::DtString DtRtiSmSocket::mySharedMemName
protected
DtInetSockState DtRtiSmSocket::myState
protected

The current state of the socket.


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

Document ID: Generated on Fri Sep 27 00:57:56 EDT 2019 from SVN revision 201708
Copyright © 2005-2018 VT MÄK Inc. All Rights Reserved (www.mak.com)