MAK RTIspy API Documentation for HLA Evolved
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
DtSmSocket__rti__ Class Reference

DtSmSocket provides access to shared memory via a subscribable message queue. More...

+ Inheritance diagram for DtSmSocket__rti__:
+ Collaboration diagram for DtSmSocket__rti__:

Public Member Functions

 DtSmSocket__rti__ (const char *sharename, DtBoost::shared_ptr< DtMsgHeaderReader > hdrReader)
virtual ~DtSmSocket__rti__ ()
virtual bool initializeSmQueue (DtU32 id=DtSM_INVALID_SUBSCRIBER_ID, bool forceSubscribe=false)
 Attach to shared memory message queue.
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 bool flush ()
 Send buffered messages.
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
DtSmSubscribableMessageQueue__rti__
msgQueue () const
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.
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 recv (caddr_t *buffptr, DtInetEndpoint *ep)
 Gets the next message from the incoming data.
 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
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.

Detailed Description

DtSmSocket provides access to shared memory via a subscribable message queue.

DtSmSocket 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.

Constructor & Destructor Documentation

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

References flush(), and mySmMsgQueue.

DtSmSocket__rti__::DtSmSocket__rti__ ( const DtSmSocket__rti__ )
protected

Not Implemented.

Member Function Documentation

void DtSmSocket__rti__::disableBundling ( )
virtual

Disables message bundling.

Reimplemented from DtUdpMsgSocket.

void DtSmSocket__rti__::disableCompression ( )
virtual

Disables message compression.

Reimplemented from DtUdpMsgSocket.

bool DtSmSocket__rti__::dropMulticastGroup ( const DtInetAddr &  grpAddr,
DtInetDevice *  device = NULL 
)
virtual

Reimplemented from DtUdpMsgSocket.

bool DtSmSocket__rti__::dropMulticastGroup ( const DtInetEndpoint &  grpEndpoint,
DtInetDevice *  device = NULL 
)
virtual

Reimplemented from DtUdpMsgSocket.

void DtSmSocket__rti__::enableBundling ( size_t  maxBundleSize)
virtual

Enables message bundling and sets the maximum bundle size.

Reimplemented from DtUdpMsgSocket.

void DtSmSocket__rti__::enableCompression ( DtU8  compressionLevel)
virtual

Enables message compression and sets the compression level.

Reimplemented from DtUdpMsgSocket.

bool DtSmSocket__rti__::flush ( )
virtual

Send buffered messages.

Returns the indication of whether flush is complete or incomplete.

Reimplemented from DtUdpMsgSocket.

Reimplemented in DtRtiSmSocket.

Referenced by ~DtSmSocket__rti__().

bool DtSmSocket__rti__::initializeSmQueue ( DtU32  id = DtSM_INVALID_SUBSCRIBER_ID,
bool  forceSubscribe = false 
)
virtual

Attach to shared memory message queue.

If 'id' is not specified one will be assigned automatically. For use by non-manager subscribers.

Reimplemented in DtRtiSmSocket.

References msgQueue(), mySharedMemName, mySmMsgQueue, and subscribe().

Referenced by initializeSmQueue().

bool DtSmSocket__rti__::initializeSmQueue ( DtU32  numBuckets,
DtU32  payloadSize,
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.

References initializeSmQueue(), and msgQueue().

bool DtSmSocket__rti__::isOpen ( ) const
virtual

Returns true if the socket is open.

Reimplemented from DtUdpMsgSocket.

References DtSm_QUEUE_STATE_SHUTDOWN, and msgQueue().

Referenced by DtSmRtiConnection::send().

bool DtSmSocket__rti__::joinMulticastGroup ( const DtInetAddr &  grpAddr,
DtInetDevice *  device = NULL 
)
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 from DtUdpMsgSocket.

bool DtSmSocket__rti__::joinMulticastGroup ( const DtInetEndpoint &  grpEndpoint,
DtInetDevice *  device = NULL 
)
virtual

Reimplemented from DtUdpMsgSocket.

DtSmSubscribableMessageQueue__rti__ * DtSmSocket__rti__::msgQueue ( ) const
virtual
void DtSmSocket__rti__::openSocket ( const DtInetEndpoint &  dest,
DtU32  flags = DtDefaultSockOpts,
DtU16  localPort = 0,
DtInetDevice *  hostIf = NULL 
)
virtual

These methods do nothing but must be overridden to prevent parent class from attempting to perform setsockopt on non-existent socket.

Reimplemented from DtUdpMsgSocket.

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

Not Implemented.

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

Gets the next message from the incoming data.

Reimplemented from DtUdpMsgSocket.

Reimplemented in DtRtiSmSocket.

References msgQueue(), DtMsgSocket::myRecvBuffer, and NULL.

int DtSmSocket__rti__::sendMessage ( caddr_t  msg,
size_t  msgSize,
bool  deleteAfterSend,
const DtInetAddr &  notUsed = DtInetAddr::inaddrAny() 
)
virtual

The send method sendMessage() ignores the destination address and does not promulgate any transport method.

It doesn't matter if the socket is intended to emulate a TCP socket or a UDP socket, once copied to shared memory by an instance of this generic DtSmSocket class a message can only be read by other shared memory queue subscribers. If it must be forwarded to another destination by a certain means (i.e. reliable transport over a network) then this generic shared memory socket must be subclassed and the derived class must provide that capability.

Reimplemented from DtUdpMsgSocket.

References msgQueue().

bool DtSmSocket__rti__::setMcastTtlOption ( DtU32  ttl)
virtual

Change the default time-to-live on outbound multicast packets sent from this socket.

Reimplemented from DtUdpMsgSocket.

void DtSmSocket__rti__::setRetryOnSend ( unsigned int  numRetries,
double  waitPeriod 
)
virtual

Enables/disables send retries on failure.

Reimplemented from DtUdpMsgSocket.

bool DtSmSocket__rti__::shutdownQueue ( bool  ruthless = false)
virtual

The following methods are specific to management of the shared memory subscribable message queue which the socket interfaces with.

These should primarily be used by a queue manager, not by ordinary subscribers

References msgQueue().

Referenced by DtSmRtiConnection::sm_shutdown().

int DtSmSocket__rti__::subscribe ( DtU32  id = DtSM_INVALID_SUBSCRIBER_ID)
virtual

The following methods are for use by all subscribers the the shared memory subscribable message queue the socket interfaces with.

References msgQueue().

Referenced by initializeSmQueue().

int DtSmSocket__rti__::subscriberCount ( ) const
virtual
void DtSmSocket__rti__::unsubscribe ( DtU32  id)
virtual

References msgQueue().

Member Data Documentation

MAKRti::DtString DtSmSocket__rti__::mySharedMemName
protected

Referenced by initializeSmQueue().

DtSmSubscribableMessageQueue__rti__* DtSmSocket__rti__::mySmMsgQueue
protected

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

Document ID: Generated on Tue May 7 16:26:47 EDT 2013 from SVN revision 126903
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)