MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
connInfoMgr.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2016 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include "rtiMsConfig.h"
13 #include "assistantMgr.h"
14 #include "assistantLicServerInfo.h"
15 #include "assistantMsgQueue.h"
16 #include "connectionsCache.h"
17 #include "rtiAssistantClient.h"
20 #include <boost/uuid/uuid.hpp>
21 #include "assistantAppUtil.h"
22 
24 class DtRtiAssistantPeer;
28 class DtAssistantInfoMsg;
33 
35 {
42  std::map<int, DtRtiConnectionInfo> rtiexecs;
43  std::map<int, DtRtiConnectionInfo> forwarders;
44 };
45 
50 { Q_OBJECT;
51 public:
52 
54  DtAssistantConnectionInfoMgr( DtBoost::shared_ptr<DtRtiAssistantServer> server,
55  DtBoost::shared_ptr<DtRtiAssistantPeer> peer,
56  DtAssistantSignalRouter& signalRouter,
57  const MAKRti::DtFilename& configDir,
58  const MAKRti::DtString& logFileName);
59 
62 
63  struct cmpByBoostUuid {
64  bool operator()(const DtAssistantInfo& a, const DtAssistantInfo& b) const {
65  return *reinterpret_cast<const boost::uuids::uuid*>(&a.uuid()) < *reinterpret_cast<const boost::uuids::uuid*>(&b.uuid());
66  }
67  };
68  typedef std::map< DtAssistantInfo, DtAssistantState, cmpByBoostUuid > DtAssistantStateMap;
69  typedef std::pair< DtAssistantInfo, DtAssistantState > DtAssistantStatePair;
70 
71 private:
72 
75 
78 
79 public:
80 
82  virtual void initialize();
83 
85  virtual void tick();
86 
88  virtual void startShutdown();
89 
91  virtual bool isCacheFileVersionOld() const;
92 
94  virtual unsigned int lightweightMemoryPeriod() const;
95 
97  virtual unsigned int lightweightHeartbeatInterval() const;
98 
100  virtual unsigned int assistantMemoryPeriod() const;
101 
104  virtual unsigned int assistantHeartbeatInterval() const;
105 
108  virtual unsigned int requestedAssistantHeartbeatInterval() const;
109 
111  virtual bool acceptRemoteCommands() const;
112 
114  virtual bool sendForeignQuery() const;
115 
117  virtual bool remoteAssistantAcceptsCommands( const DtAssistantInfo& assistant ) const;
118 
121  virtual bool hostHasARemoteAssistantThatAcceptsCommands(
122  const DtHostNameAddress& host, const DtInetAddr& publicAddr, const MAKRti::DtInetAddr& interfaceAddr) const;
123 
125  virtual int getRemoteAssistants(const DtString& hostName, DtAssistantInfoSet& assistants) const;
126 
128  virtual int getRemoteAssistants(const DtInetAddr& hostIp, DtAssistantInfoSet& assistants) const;
129 
131  virtual const DtAssistantInfo* remoteAssistant(const DtString& hostName) const;
132 
134  virtual const DtAssistantInfo* remoteAssistant(const DtInetAddr& hostIp) const;
135 
137  virtual const DtAssistantInfo* remoteAssistant(const DtAssistantUuid& uuid) const;
138 
141  virtual const DtInetAddr& assistantPublicAddress(const DtInetAddr& inetAddr) const;
142 
145  virtual int localRtiexecCompId( const DtRtiConnectionInfo& conn ) const;
146 
148  //1 or returns -1 if not found.
149  virtual int localRtiForwarderCompId( const DtRtiConnectionInfo& conn ) const;
150 
153  virtual bool getRemoteRtiexecLocation( const DtRtiConnectionInfo& conn,
154  DtAssistantInfo& assistant, int& id ) const;
155 
159  virtual bool getRtiExecConnection(const DtRtiConnectionInfo& conn, DtRtiConnectionInfo& rtiExecConn) const;
160 
163  virtual bool getRemoteRtiForwarderLocation( const DtRtiConnectionInfo& conn,
164  DtAssistantInfo& assistant, int& id ) const;
165 
168  virtual bool getRemoteRtiexecConnInfo( const DtAssistantInfo& assistant,
169  int id, DtRtiConnectionInfoDataPair& conn ) const;
170 
173  virtual bool getRemoteForwarderConnInfo( const DtAssistantInfo& assistant,
174  int id, DtRtiConnectionInfoDataPair& conn ) const;
175 
177  virtual bool getChosenConnection( DtRtiConnectionInfoDataPair& conn );
178 
180  virtual bool getChosenConfiguration( DtRtiConfigurationInfoDataPair& config );
181 
184  virtual bool getConnectionInfo( DtRtiConnectionInfoDataPair& conn );
185 
189  virtual bool getConfigurationForConn( const DtRtiConnectionInfo& conn,
191 
193  virtual MAKRti::DtString connectionName( const DtRtiConnectionInfo& conn );
194 
198  virtual bool isStillDefaultChosen() const;
199 
201  virtual const DtRtiConnectionAndConfiguration& connectionsAndConfigurations();
202 
204  virtual void addUserDefinedConnections( const DtRtiConnectionAndConfiguration& conns );
205 
207  virtual void removeUserDeletedConnections( const DtRtiConnectionAndConfiguration& conns );
208 
210  virtual void removeAllLocalRtiexecsForwarders();
211 
213  virtual void removeAllLocalLightweightConns();
214 
218  virtual bool isConnConflicting( const DtRtiConnectionInfo& conn,
219  MAKRti::DtString& reason ) const;
220 
222  void saveConnections();
223 
224  DtNetU128 rawUuid() const;
225 
226 protected:
227 
230 
231  static void processQueryMsg(const DtAssistantQueryMsg& queryMsg, void* usr);
233  virtual void processQueryMsg(const DtAssistantQueryMsg& queryMsg);
234 
236  static void processInfoMsg(const DtAssistantInfoMsg& infoMsg, void* usr);
237  virtual void processInfoMsg(const DtAssistantInfoMsg& infoMsg);
238 
240  static void processLightweightInfoMsg(const DtAssistantLightweightInfoMsg& infoMsg, void* usr);
241  virtual void processLightweightInfoMsg(const DtAssistantLightweightInfoMsg& infoMsg);
242 
244  static void processRemovalMsg(const DtAssistantRemovalMsg& remMsg, void* usr);
245  virtual void processRemovalMsg(const DtAssistantRemovalMsg& remMsg);
246 
248  static void processStartRtiexecMsg(const DtAssistantStartRtiexecMsg& msg, void* usr);
249  virtual void processStartRtiexecMsg(const DtAssistantStartRtiexecMsg& msg );
250 
252  static void processStartRtiForwarderMsg(const DtAssistantStartRtiForwarderMsg& msg, void* usr);
253  virtual void processStartRtiForwarderMsg(const DtAssistantStartRtiForwarderMsg& msg );
254 
256 
258  static void processInterfaceFound( void* usr );
259 
262  virtual void processInterfaceFound();
263 
264 signals:
265 
268  void heartbeat();
269 
272  void prune();
273 
275  void connectionsAddedOrUpdated( const DtRtiConnectionAndConfiguration& conns );
276 
278  void connectionsAboutToBeRemoved( const DtRtiConnectionAndConfiguration& conns );
279 
281  void connectionsRemoved( const DtRtiConnectionAndConfiguration& conns );
282 
284  void assistantFound( const DtAssistantInfo& info );
285 
287  void assistantLost( const DtAssistantInfo& info );
288 
290  void rtiexecStartupRequested( const DtRtiConnectionInfoDataPair&,
291  const DtRtiConnectionConfigurationInfo&, bool );
292 
294  void rtiForwarderStartupRequested( const DtRtiConnectionInfoDataPair&,
295  const DtRtiConnectionConfigurationInfo&, bool );
296 
297  void assistantConnectionInformationUpdated(const DtAssistantConnectionStruct&, const DtAssistantConnectionStruct&);
298 
299 public slots:
300 
302  void processLocalRtiComponentConnected( const DtAssistantComponentInfo* compInfo );
303 
305  void processLocalRtiComponentNotConnected( const DtAssistantComponentInfo* compInfo );
306 
308  void processLocalForwarderHasRtiexec( const DtAssistantComponentInfo* compInfo );
309 
311  void processLocalForwarderHasNoRtiexec( const DtAssistantComponentInfo* compInfo );
312 
314  void processNewChosenConnection( const DtRtiConnectionInfo& conn );
315 
317  void processNewChosenConfiguration( const DtRtiConnectionConfigurationInfo& config );
318 
320  void processLocalInterfaceConfiguration(const DtRtiConnectionInfoDataPair& config, const DtRtiConnectionConfigurationInfo& configInfo);
321 
323  void processClearChosenConnection();
324 
326  void setLightweightMemory( unsigned int newVal );
327 
329  void setAssistantUpdateInterval( unsigned int newVal );
330 
332  void setAcceptRemoteCommands( bool newVal );
333 
335  void setSendForeignQuery( bool newVal );
336 
338  void provideAssistantInfo(const DtAssistantUuid& assistantUuid, DtAssistantInfo* infoIn);
339 
344  void recoverConnection(const DtRtiConnectionInfo& connInfo, DtRtiConnectionInfo& recoveredConn);
345 
347  virtual void addAssistantConnection(const DtAssistantConnectionStruct& connection);
348  virtual bool remoteAddAssistantConnection(const DtAssistantConnectionStruct& connection);
349  virtual void removeAssistantConnection(const DtAssistantConnectionStruct& connection);
350 
351  virtual bool isRemoteAddressAssistantConnection(const DtInetAddr& localDeviceAddr, const DtInetAddr& remoteAddr);
352 
353  void assistantToAssistantConnectionUpdated(const DtAssistantConnectionStruct&, DtAssistantConnectionState);
354 protected:
355 
357  virtual void heartbeatAssistant();
358 
360  virtual void heartbeatLightweightConnections();
361 
364  virtual void pruneStaleLightweightConns();
365 
368  virtual void checkForStaleAssistantsExecsFwrdrs();
369 
370  virtual void pruneStaleAssistantExecsFwrdrs(DtRtiConnectionAndConfiguration& connsToRemove,
371  DtRtiConnectionAndConfiguration& updatedConns);
372 
376  virtual void determineHeartbeatIntervals();
377 
379  virtual DtAssistantStateMap::iterator addRemoteAssistant( const DtAssistantInfo& assistant);
380 
384  virtual void unverifyRtiexecsForwardersForAssistant(const DtAssistantState& assistantState,
385  DtRtiConnectionAndConfiguration& connsToRemove,
386  DtRtiConnectionAndConfiguration& updatedConns );
387 
392  virtual void unverifyListedRtiexecsForwardersForAssistant(
393  const DtRtiConnectionAndConfiguration& removeList,
394  DtAssistantStateMap::iterator astntIter,
395  DtRtiConnectionAndConfiguration& connsToRemove,
396  DtRtiConnectionAndConfiguration& updatedConns );
397 
402  virtual void addListedRtiexecsForwardersForAssistant(
403  const DtRtiConnectionAndConfiguration& addList,
404  DtAssistantStateMap::iterator astntIter,
405  DtRtiConnectionAndConfiguration& connsToRemove,
406  DtRtiConnectionAndConfiguration& updatedConns );
407 
409  virtual void checkForConflictingConns( DtRtiConnectionAndConfiguration& updatedConns );
410 
412  virtual void removeConnections( const DtRtiConnectionAndConfiguration& connsToRemove );
413 
415  virtual void setInterfaceForPredefinedConns( const MAKRti::DtInetAddr& interfaceAddr );
416 
417 
418 protected:
419 
421  DtBoost::shared_ptr<DtConnectionCache> myConnectionCache;
422 
425 
428 
430  DtClock myClock;
431 
435 
439 
443 
447 
450 
453 
457 
461 
463  MAKRti::DtString myHostName;
464 
467 
470 
473 
478 
482 
486 
490 
492  MAKRti::DtString myLogFileName;
493 
494 };
DtAssistantStateMap myRemoteAssistantStates
All known remote assistants and their current rtiexecs and forwarders.
Definition: connInfoMgr.h:469
This file contains the declaration of DtAssistantInfo.
DtUuid DtAssistantUuid
Definition: assistantUtil.h:17
Contains the DtRtiConnectionAndConfiguration class declaration.
The DtAssistantInfoMsg defines a wrapper for the RTI Assistant information message used by the Assist...
Definition: assistantInfoMsg.h:33
The DtAssistantRemovalMsg defines a wrapper for the RTI Assistant removal message used by Assistants ...
Definition: assistantRemovalMsg.h:29
unsigned int myLightweightRemovalPeriod
Interval at which we will check for remote lightweight connections that have not been heartbeated...
Definition: connInfoMgr.h:460
At startup all of the assistant manager classes will register their signals and slots with the signal...
Definition: assistantSignalRouter.h:29
std::set< DtAssistantInfo > DtAssistantInfoSet
Definition: assistantInfo.h:25
unsigned int assistantInactivePeriod
Definition: connInfoMgr.h:40
unsigned int myAssistantInfoRemovalPeriod
Interval at which we will check for remote assistants, rtiexecs, and forwarders have not been heartbe...
Definition: connInfoMgr.h:456
Stores basic information about a remote assistant.
Definition: assistantInfo.h:96
std::pair< DtRtiConnectionInfo, DtRtiAssociatedConnectionData > DtRtiConnectionInfoDataPair
Pair of connection with associated data.
Definition: assistantConnectionInfo.h:29
Structure Remote Assistant to be displayed.
Definition: assistantInfo.h:39
The DtAssistantStartRtiexecMsg defines a wrapper for the RTI Assistant message used to instruct anoth...
Definition: assistantStartRtiexecMsg.h:30
DtTime myNextLightweightRemovalTime
Time at which we will next remove any un-heartbeated remote lightweight connections.
Definition: connInfoMgr.h:446
DtRtiConnectionAndConfiguration myConnsAndConfigs
All of the connections and configurations.
Definition: connInfoMgr.h:472
bool operator()(const DtAssistantInfo &a, const DtAssistantInfo &b) const
Definition: connInfoMgr.h:64
virtual void startShutdown()
Performs any necessary processing at the start of shutdown.
Definition: assistantMgr.h:62
unsigned int lightweightInactivePeriod
Definition: connInfoMgr.h:39
std::pair< DtAssistantInfo, DtAssistantState > DtAssistantStatePair
Definition: connInfoMgr.h:69
MAKRti::DtString myHostName
Name of this host.
Definition: connInfoMgr.h:463
DtTime myNextLightweightHeartbeatTime
Time at which we will next send information on our own local lightweight connections.
Definition: connInfoMgr.h:438
The DtAssistantQueryMsg defines a wrapper for the RTI Assistant query message used by Assistants to r...
Definition: assistantQueryMsg.h:34
bool acceptsRemoteCommands
Definition: connInfoMgr.h:41
Stores information on any RTI components.
Definition: compInfo.h:25
virtual void initialize()
Initializes this manager just prior to beginning assistant processing.
Definition: assistantMgr.h:56
Base class for all classes which perform management activities for the Assistant. ...
Definition: assistantMgr.h:31
This file contains the declaration of DtAssistantMgr.
DtRtiAssistantPeer manages the sharing of information between one Assistant to other Assistants using...
Definition: rtiAssistantPeer.h:82
Contains the DtRtiAssistantClient class declaration.
Maintains lists of known RTI connections.
Definition: connInfoMgr.h:49
Manages the server connections of the RTI Assistant.
Definition: rtiAssistantServer.h:45
std::map< DtAssistantInfo, DtAssistantState, cmpByBoostUuid > DtAssistantStateMap
Definition: connInfoMgr.h:68
DtAssistantMgr & operator=(DtAssistantMgr const &)
Assignment not implemented – Assignment Not Allowed!
bool mySendForeignQuery
Whether queries to foreign assistants should be sent at startup.
Definition: connInfoMgr.h:427
std::pair< DtRtiConnectionConfigurationInfo, DtRtiAssociatedConfigurationData > DtRtiConfigurationInfoDataPair
Pair of configuration with associated data.
Definition: assistantConnectionConfigurationInfo.h:58
DtHostNameAddress stores information on a host, input as either hostname, IP address, or both.
Definition: hostNameAddress.h:23
std::map< int, DtRtiConnectionInfo > rtiexecs
Definition: connInfoMgr.h:42
Stores the information on an RTI configuration known by the Assistant.
Definition: assistantConnectionConfigurationInfo.h:61
Definition: assistantStartRtiexecMsg.h:210
virtual void tick()
Performs tasks that need to be completed periodically.
Definition: assistantMgr.h:59
The DtAssistantLightweightInfoMsg defines a wrapper for the RTI Assistant lightweight connection info...
Definition: assistantLightweightInfoMsg.h:35
Contains useful functions specific to the rtiAssistant.
unsigned int myAssistantHeartbeatInterval
Interval, in secs, at which we will send assistant info heartbeat msgs.
Definition: connInfoMgr.h:449
DtRtiConnectionAndConfiguration myRemovedLocalExecsAndFwrdrs
Sets of removed local rtiexecs and forwarders.
Definition: connInfoMgr.h:466
bool myAcceptRemoteCmds
Whether or not remote commands are accepted.
Definition: connInfoMgr.h:424
const DtAssistantUuid & uuid() const
std::map< int, DtRtiConnectionInfo > forwarders
Definition: connInfoMgr.h:43
DtClock myClock
Clock for timeouts and periodic update messages.
Definition: connInfoMgr.h:430
Definition: connInfoMgr.h:34
DtTime mySetPredefinedConnsInterfaceTime
Time at which predefined connections should be set with the myPotentialPredefinedConnsInterface.
Definition: connInfoMgr.h:489
DtTime myNextAssistantInfoRemovalTime
Time at which we will next remove any un-heartbeated remote assistants, rtiexecs, and forwarders...
Definition: connInfoMgr.h:442
#define DT_DLL_ASSISTANTAPP
Definition: rtiMsConfig.h:122
MAKRti::DtString myLogFileName
The name of the log file.
Definition: connInfoMgr.h:492
bool myStillDefaultChosen
Indicates that the default chosen connection state is still in use (no connection file existed and us...
Definition: connInfoMgr.h:477
bool myPredefinedConnsNeedInterface
If there was no network interface when the assistant started, the predefined connections will be inva...
Definition: connInfoMgr.h:481
Stores the information on an RTI connection and possibly matching configuration known by the Assistan...
Definition: connectionAndConfiguration.h:22
bool heartbeated
Definition: connInfoMgr.h:38
This file contains the declaration of DtAssistantMsgQueue.
DtTime myNextAssistantHeartbeatTime
Time at which we will next send information on our own assistant and local rtiexecs, forwarders, and licenses.
Definition: connInfoMgr.h:434
DtAssistantConnectionState
Definition: assistantAppUtil.h:18
This file contains the declaration of DtLicServerInfo.
DtBoost::shared_ptr< DtConnectionCache > myConnectionCache
The cached rtiexec and lightweight connections.
Definition: connInfoMgr.h:421
DtAssistantState()
Definition: connInfoMgr.h:36
MAKRti::DtInetAddr myPotentialPredefinedConnsInterface
A network interface to potentially use for the predefined connections, if it stays active long enough...
Definition: connInfoMgr.h:485
Stores the information on an RTI connection known by the Assistant.
Definition: assistantConnectionInfo.h:36
unsigned int myLightweightHeartbeatInterval
Interval, in secs, at which we will send lightweight conn heartbeat msgs.
Definition: connInfoMgr.h:452

Document ID: Generated on Thu May 11 15:55:32 EDT 2023 from SVN revision 254743
Copyright © 2005-2020 MAK Technologies Inc. All Rights Reserved (www.mak.com)