MAK RTIspy API Documentation for HLA Evolved
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions
DtRtiAssistantServer Class Reference

Manages the server connections of the RTI Assistant. More...

+ Collaboration diagram for DtRtiAssistantServer:

List of all members.

Public Member Functions

 DtRtiAssistantServer (DtNotifyLevelType level, int port=DtASSISTANT_DEFAULT_PORT, const MAKRti::DtInetAddr &networkInterface=MAKRti::DtInetAddr())
 Constructor, networkInterface defaults to INADDR_ANY.
virtual ~DtRtiAssistantServer ()
 Destructor.
bool isOk () const
 Returns true if the server was successfully started.
virtual void addMsgCallback (DtAssistantMsgKind msgKind, DtAssistantMsgCbMgr::DtCallbackFcn fcn, void *usr)
 Message Callbacks These callback functions operate on all of the connections.
virtual void removeMsgCallback (DtAssistantMsgKind msgKind, DtAssistantMsgCbMgr::DtCallbackFcn fcn, void *usr)
virtual void addWildcardMsgCallback (DtAssistantMsgCbMgr::DtCallbackFcn fcn, void *usr)
virtual void removeWildcardMsgCallback (DtAssistantMsgCbMgr::DtCallbackFcn fcn, void *usr)
virtual void addSocketAdditionCallback (DtAssistantSocketAdditionCb cb, void *usr)
 These functions add callbacks for notification of the addition or removal of Assistant socket connections.
virtual void removeSocketAdditionCallback (DtAssistantSocketAdditionCb cb, void *usr)
virtual void addSocketRemovalCallback (DtAssistantSocketRemovalCb cb, void *usr)
virtual void removeSocketRemovalCallback (DtAssistantSocketRemovalCb cb, void *usr)
virtual bool tick (unsigned int timeout=0)
 Do the actual message processing.
virtual unsigned int numConnections () const
 Return the number of current RTI component connections.
virtual void sendMsgOnConn (int compId, const DtAssistantMsg &msg)
 Send the message over the specified connection.
virtual void sendBroadcast (const DtAssistantMsg &msg)
 Send the message over the all connections.
virtual void sendConnMsg (int compId, bool disconnect=false, const MAKRti::DtString &display=MAKRti::DtString::nullString())
 Sends a component ID back to a connecting component.
virtual void sendConnRespMsg (int compId, const DtRtiConnectionInfoDataPair &conn, const DtRtiConnectionConfigurationInfo &config, bool accepted)
 Sends a connection query response message.
virtual void sendLicRespMsg (int compId, bool runUnlicensed, const MAKRti::DtString &server, int port, bool accepted)
 Sends a license query response message.
virtual void sendAssistantCommandResponseMsg (int compId, const MAKRti::DtString &formattedData)
 Sends a response to an assistant command message.
virtual void sendNtfyLvlUpdateMsg (int compId, DtNotifyLevelType notifyLevel)
 Sends a notify level update message.
virtual void sendLatencyTestRequestMsg (int compId, bool runTest, bool continuous, bool shouldHalt, bool observing, unsigned int interactionPeriod, unsigned int numInteractions, unsigned int payloadBytes, unsigned long federationHandle=0, unsigned long initFedHandle=0)
 Sends an initiate latency test request message.
virtual void sendNetworkTestEnableMsg (int compId, int federationHdl, bool enable)
 Sends a message enabling or disabling network testing for the given federation.
virtual void sendLogEnableMsg (int compId, bool enable)
 Sends a logging enable message.
virtual void sendObserveRtiexecMsg (int compId, bool isObserved, unsigned int timeStateIntervalMs)
 Sends a message to tell an rtiexec that it should either start or stop sending its information.
virtual void sendObserveRtiexecLogMsg (int connId, bool isObserved)
 Sends a message to tell an rtiexec that it should either start or stop sending its log information.
virtual void sendObserveRtiForwarderMsg (int compId, bool isObserved, unsigned int timeStateIntervalMs, int defunctRemovalTime)
 Sends a message to tell an RTI Forwarder that it should either start or stop sending its information.
virtual void sendSingleObserveRtiExecMsg (int compId)
 Sends a message to tell a local rtiExec that it should send its data one time only.
virtual void sendSingleObserveForwarderMsg (int compId)
 Sends a message to tell a local forwarder that it should send its data one time only.
virtual void sendFederateResignMsg (int compId, int federationHdl, int federateHdl)
 Sends a force federate resign message to an rtiexec.
virtual void sendFederationDestroyMsg (int compId, int federationHdl)
 Sends a force federation destroy message to an rtiexec.
virtual void sendDeleteFederateMsg (int compId, DtU16 fedexHandle, DtU16 fedHandle)
 Sends a message to tell an rtiexec that it shold delete a federate.
virtual void sendRidParamsRequestMsg (int compId)
 Sends a RID parameter request to an rtiexec.
virtual void sendLogRequestMsg (int compId, unsigned maxLogSize)
 Sends a log request to an rtiexec.
virtual void sendExitMsg (int compId=-1)
 Sends an exit command message for the specified component, or for all components if none specified.
virtual void sendDoNotWaitForForwardersMsg (int compId)
 Sends a message to the specified forwarder telling it to proceed without waiting for any more forwarders to connect.
virtual void forwardMsg (const DtAssistantMsg &msg)
 Forwards a message from a remote assistant to the local component that is its final destination.
virtual void sendSignalTickIntervalMsg (int compId, float signalTickInterval)
 sends the signal tick interval
virtual int currentCompId () const
 Returns the component ID from which the current message being processed was received, or -1 if there is no such message.
virtual void closeConn (int compId)
 Close the connection with the given component ID.
virtual int port () const
 Returns the Assistant server port.
virtual DtU32 maxMsgSize () const
 Gets the maximum message size.

Static Public Member Functions

static void tcpSocketAdditionCb (DtTcpMsgSocket *sock, void *usr)
 Callbacks on addition/removal of TCP sockets.
static void tcpSocketRemovalCb (DtTcpMsgSocket *sock, void *usr)

Protected Types

typedef std::map< int,
DtTcpMsgSocket * > 
CompIdToSocketMap
 Maps of the connections and component IDs.
typedef std::map
< DtTcpMsgSocket *, int > 
SocketToCompIdMap

Protected Member Functions

virtual void sendMsg (DtTcpMsgSocket *sock, const DtAssistantMsg &msg)
 Sends the message over the specified socket.
virtual void testConnections ()
 Verify connection status and mark bad connections for removal.
virtual bool readAndProcess (DtTime maxTimePerSocket)
 Make a single pass over the socket list allocating up to max.
virtual void tcpSocketAdditionCb (DtTcpMsgSocket *sock)
 Callbacks on addition/removal of TCP sockets.
virtual void tcpSocketRemovalCb (DtTcpMsgSocket *sock)
virtual std::auto_ptr
< DtAssistantMsg
netRead (DtTcpMsgSocket *sock, int *retCode) const
 Read a message from a socket.
virtual void setMsgFactory (DtAssistantMessageFactory *fact)
 Get/Set the message factory .
virtual DtAssistantMessageFactorymsgFactory () const

Protected Attributes

SocketToCompIdMap myIdsByConnection
 Map of component IDs by connection.
CompIdToSocketMap myConnectionsById
 Map of connections by component ID.
int myNextCompId
 Next component ID to use.
DtAssistantMessageFactorymyMessageFactory
 The message factory.
DtAssistantDfltMsgFactory myDefaultMessageFactory
 Default message factory.
DtTcpMsgSocketmyCurrentSocket
 The socket on which the current message being processed was received.
unsigned int myPort
 Port to which RTI components may connect.
DtClock myClock
 Clock for timeouts.
DtTime myConnTestInterval
 Interval at which connections should be tested.
DtTime myTimeToTestConnections
 Next time to test connections.
std::auto_ptr< DtTcpMsgSocketMgrmySocketMgr
 Manager for the sockets.
std::list< DtTcpMsgSocket * > mySocketsToDisconnect
 List of sockets to be disconnected before next read.
DtAssistantMsgCbMgr myMsgCbMgr
 Message callback manager.
std::map< int, MAKRti::DtString > myDisconnectReasons
 List of reasons for socket disconnects.
DtAssistantSocketAdditionCallbackList myAdditionCallbacks
 Lists of pointers to socket addition and socket removal callbacks.
DtAssistantSocketRemovalCallbackList myRemovalCallbacks
unsigned myNumMsgsSent
 Total messages sent.
unsigned myNumMsgsReceived
 Total messages received.

Private Member Functions

 DtRtiAssistantServer (const DtRtiAssistantServer &)
 Copy and Assignment unimplemented.
DtRtiAssistantServeroperator= (const DtRtiAssistantServer &)

Detailed Description

Manages the server connections of the RTI Assistant.

DtRtiAssistantServer manages the connections of the RTI Assistant. It also provides methods for packaging and sending messages to the connected RTI components.


Member Typedef Documentation

typedef std::map< int, DtTcpMsgSocket* > DtRtiAssistantServer::CompIdToSocketMap [protected]

Maps of the connections and component IDs.

typedef std::map< DtTcpMsgSocket*, int > DtRtiAssistantServer::SocketToCompIdMap [protected]

Constructor & Destructor Documentation

DtRtiAssistantServer::DtRtiAssistantServer ( DtNotifyLevelType  level,
int  port = DtASSISTANT_DEFAULT_PORT,
const MAKRti::DtInetAddr &  networkInterface = MAKRti::DtInetAddr() 
)

Constructor, networkInterface defaults to INADDR_ANY.

References myPort, mySocketMgr, tcpSocketAdditionCb(), and tcpSocketRemovalCb().

Copy and Assignment unimplemented.


Member Function Documentation

void DtRtiAssistantServer::addMsgCallback ( DtAssistantMsgKind  msgKind,
DtAssistantMsgCbMgr::DtCallbackFcn  fcn,
void *  usr 
) [virtual]

These functions add callbacks for notification of the addition or removal of Assistant socket connections.

References myAdditionCallbacks.

References myRemovalCallbacks.

void DtRtiAssistantServer::addWildcardMsgCallback ( DtAssistantMsgCbMgr::DtCallbackFcn  fcn,
void *  usr 
) [virtual]

References myMsgCbMgr.

void DtRtiAssistantServer::closeConn ( int  compId) [virtual]

Close the connection with the given component ID.

References myConnectionsById, and mySocketsToDisconnect.

Referenced by readAndProcess().

int DtRtiAssistantServer::currentCompId ( ) const [virtual]

Returns the component ID from which the current message being processed was received, or -1 if there is no such message.

References myCurrentSocket, and myIdsByConnection.

Referenced by readAndProcess().

void DtRtiAssistantServer::forwardMsg ( const DtAssistantMsg msg) [virtual]

Forwards a message from a remote assistant to the local component that is its final destination.

References DtAssistantMsg::compId(), DtAssistantMsg::isAssistantToAssistantMessage(), and sendMsgOnConn().

Returns true if the server was successfully started.

References mySocketMgr.

DtU32 DtRtiAssistantServer::maxMsgSize ( ) const [virtual]

Gets the maximum message size.

References mySocketMgr.

std::auto_ptr< DtAssistantMsg > DtRtiAssistantServer::netRead ( DtTcpMsgSocket sock,
int *  retCode 
) const [protected, virtual]
unsigned int DtRtiAssistantServer::numConnections ( ) const [virtual]

Return the number of current RTI component connections.

References myIdsByConnection.

DtRtiAssistantServer& DtRtiAssistantServer::operator= ( const DtRtiAssistantServer ) [private]
int DtRtiAssistantServer::port ( ) const [virtual]

Returns the Assistant server port.

References myPort.

bool DtRtiAssistantServer::readAndProcess ( DtTime  maxTimePerSocket) [protected, virtual]
void DtRtiAssistantServer::removeMsgCallback ( DtAssistantMsgKind  msgKind,
DtAssistantMsgCbMgr::DtCallbackFcn  fcn,
void *  usr 
) [virtual]
void DtRtiAssistantServer::removeWildcardMsgCallback ( DtAssistantMsgCbMgr::DtCallbackFcn  fcn,
void *  usr 
) [virtual]

References myMsgCbMgr.

void DtRtiAssistantServer::sendAssistantCommandResponseMsg ( int  compId,
const MAKRti::DtString &  formattedData 
) [virtual]

Sends a response to an assistant command message.

References DtAssistantCommandMsgKind, msgFactory(), sendMsgOnConn(), and DtAssistantCommandMsg::setMessageString().

void DtRtiAssistantServer::sendBroadcast ( const DtAssistantMsg msg) [virtual]

Send the message over the all connections.

References DtAssistantMsg::kindToString(), DtAssistantMsg::msgKind(), myNumMsgsSent, mySocketMgr, and sendMsg().

Referenced by sendExitMsg().

void DtRtiAssistantServer::sendConnMsg ( int  compId,
bool  disconnect = false,
const MAKRti::DtString &  display = MAKRti::DtString::nullString() 
) [virtual]

Sends a component ID back to a connecting component.

References DtAssistantConnMsgKind, msgFactory(), sendMsgOnConn(), DtAssistantConnMsg::setDisconnect(), and DtAssistantConnMsg::setDisplay().

void DtRtiAssistantServer::sendConnRespMsg ( int  compId,
const DtRtiConnectionInfoDataPair conn,
const DtRtiConnectionConfigurationInfo config,
bool  accepted 
) [virtual]
void DtRtiAssistantServer::sendDeleteFederateMsg ( int  compId,
DtU16  fedexHandle,
DtU16  fedHandle 
) [virtual]

Sends a message to the specified forwarder telling it to proceed without waiting for any more forwarders to connect.

References DtAssistantAwaitingForwardersMsgKind, msgFactory(), sendMsgOnConn(), and DtAssistantAwaitingForwardersMsg::setIsWaitingForForwarders().

void DtRtiAssistantServer::sendExitMsg ( int  compId = -1) [virtual]

Sends an exit command message for the specified component, or for all components if none specified.

References DtAssistantExitMsgKind, msgFactory(), sendBroadcast(), and sendMsgOnConn().

void DtRtiAssistantServer::sendFederateResignMsg ( int  compId,
int  federationHdl,
int  federateHdl 
) [virtual]
void DtRtiAssistantServer::sendFederationDestroyMsg ( int  compId,
int  federationHdl 
) [virtual]

Sends a force federation destroy message to an rtiexec.

References DtAssistantDeleteFederationMsgKind, msgFactory(), sendMsgOnConn(), and DtAssistantDeleteFederationMsg::setFederationHandle().

void DtRtiAssistantServer::sendLatencyTestRequestMsg ( int  compId,
bool  runTest,
bool  continuous,
bool  shouldHalt,
bool  observing,
unsigned int  interactionPeriod,
unsigned int  numInteractions,
unsigned int  payloadBytes,
unsigned long  federationHandle = 0,
unsigned long  initFedHandle = 0 
) [virtual]
void DtRtiAssistantServer::sendLicRespMsg ( int  compId,
bool  runUnlicensed,
const MAKRti::DtString &  server,
int  port,
bool  accepted 
) [virtual]
void DtRtiAssistantServer::sendLogEnableMsg ( int  compId,
bool  enable 
) [virtual]
void DtRtiAssistantServer::sendLogRequestMsg ( int  compId,
unsigned  maxLogSize 
) [virtual]

Sends a log request to an rtiexec.

The response will contain either the entire rtiexec log, or at most recent maxLogSize bytes.

References DtAssistantLogRequestMsgKind, msgFactory(), sendMsgOnConn(), and DtAssistantLogRequestMsg::setMaxLogSize().

void DtRtiAssistantServer::sendMsg ( DtTcpMsgSocket sock,
const DtAssistantMsg msg 
) [protected, virtual]

Sends the message over the specified socket.

References myNumMsgsSent, and DtTcpMsgSocket::sendMessage().

Referenced by readAndProcess(), sendBroadcast(), and sendMsgOnConn().

void DtRtiAssistantServer::sendMsgOnConn ( int  compId,
const DtAssistantMsg msg 
) [virtual]
void DtRtiAssistantServer::sendNetworkTestEnableMsg ( int  compId,
int  federationHdl,
bool  enable 
) [virtual]
void DtRtiAssistantServer::sendNtfyLvlUpdateMsg ( int  compId,
DtNotifyLevelType  notifyLevel 
) [virtual]
void DtRtiAssistantServer::sendObserveRtiexecLogMsg ( int  connId,
bool  isObserved 
) [virtual]
void DtRtiAssistantServer::sendObserveRtiexecMsg ( int  compId,
bool  isObserved,
unsigned int  timeStateIntervalMs 
) [virtual]
void DtRtiAssistantServer::sendObserveRtiForwarderMsg ( int  compId,
bool  isObserved,
unsigned int  timeStateIntervalMs,
int  defunctRemovalTime 
) [virtual]
void DtRtiAssistantServer::sendRidParamsRequestMsg ( int  compId) [virtual]

Sends a RID parameter request to an rtiexec.

References DtAssistantRidParamsMsgKind, msgFactory(), sendMsgOnConn(), and DtAssistantRidParamsMsg::setIsRequest().

void DtRtiAssistantServer::sendSignalTickIntervalMsg ( int  compId,
float  signalTickInterval 
) [virtual]
void DtRtiAssistantServer::sendSingleObserveRtiExecMsg ( int  compId) [virtual]
void DtRtiAssistantServer::setMsgFactory ( DtAssistantMessageFactory fact) [protected, virtual]

Get/Set the message factory .

References myMessageFactory.

void DtRtiAssistantServer::tcpSocketAdditionCb ( DtTcpMsgSocket sock,
void *  usr 
) [static]

Callbacks on addition/removal of TCP sockets.

Referenced by DtRtiAssistantServer(), and ~DtRtiAssistantServer().

void DtRtiAssistantServer::tcpSocketAdditionCb ( DtTcpMsgSocket sock) [protected, virtual]
void DtRtiAssistantServer::tcpSocketRemovalCb ( DtTcpMsgSocket sock,
void *  usr 
) [static]
void DtRtiAssistantServer::tcpSocketRemovalCb ( DtTcpMsgSocket sock) [protected, virtual]
void DtRtiAssistantServer::testConnections ( ) [protected, virtual]

Verify connection status and mark bad connections for removal.

References mySocketMgr, and DtTcpMsgSocket::testConnectionStatus().

Referenced by tick().

bool DtRtiAssistantServer::tick ( unsigned int  timeout = 0) [virtual]

Do the actual message processing.

  • RTI connections are treated as synchronous in main thread.

References myClock, myConnTestInterval, mySocketMgr, myTimeToTestConnections, readAndProcess(), and testConnections().


Member Data Documentation

Lists of pointers to socket addition and socket removal callbacks.

Referenced by addSocketAdditionCallback(), removeSocketAdditionCallback(), and tcpSocketAdditionCb().

DtClock DtRtiAssistantServer::myClock [protected]

Clock for timeouts.

Referenced by readAndProcess(), tcpSocketAdditionCb(), and tick().

Map of connections by component ID.

Referenced by closeConn(), sendMsgOnConn(), tcpSocketAdditionCb(), and tcpSocketRemovalCb().

Interval at which connections should be tested.

Referenced by tick().

The socket on which the current message being processed was received.

Responses to this message should use this socket.

Referenced by currentCompId(), and readAndProcess().

Default message factory.

std::map<int, MAKRti::DtString> DtRtiAssistantServer::myDisconnectReasons [protected]

List of reasons for socket disconnects.

Referenced by readAndProcess(), and tcpSocketRemovalCb().

Map of component IDs by connection.

Referenced by currentCompId(), numConnections(), tcpSocketAdditionCb(), and tcpSocketRemovalCb().

The message factory.

Referenced by msgFactory(), and setMsgFactory().

Next component ID to use.

Referenced by tcpSocketAdditionCb().

Total messages received.

Referenced by readAndProcess().

Total messages sent.

Referenced by sendBroadcast(), sendMsg(), and sendMsgOnConn().

unsigned int DtRtiAssistantServer::myPort [protected]

Port to which RTI components may connect.

Referenced by DtRtiAssistantServer(), and port().

List of sockets to be disconnected before next read.

Referenced by closeConn(), and readAndProcess().

Next time to test connections.

Referenced by tick().


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

Document ID: Generated on Thu Jun 14 14:15:04 EDT 2012 from SVN revision 116116
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)