MAK RTIspy API Documentation for HLA 1516
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
extendedRtiMsgForwarder.h
Go to the documentation of this file.
1 /*******************************************************************************
2  ** Copyright (c) 2005 MaK Technologies, Inc.
3  ** All rights reserved.
4  *******************************************************************************/
5 /*******************************************************************************
6  ** $RCSfile: extendedRtiMsgForwarder.h,v $ $Revision: 1.7 $ $State: Exp $
7  *******************************************************************************/
10 
11 #ifndef DtExtendedRtiMsgForwarder_H_
12 #define DtExtendedRtiMsgForwarder_H_
13 
14 #include "forwarderPort.h"
15 #include "rtiMsConfig.h"
16 #include "rtiMessageForwarder.h"
17 #include "vlThreadedObject.h"
18 #include <vlutil/vlRunnable.h>
19 #include "vlThreadSafeQueue.h"
21 #include <vlutil/vlTime.h>
22 #include <udpMsgSocket.h>
23 #include <set>
24 
25 class DtRIDParameters;
26 class DtMessageBufferFilter;
28 class DtNetworkMapLanRequestFilter;
29 
31 {
32 protected:
33 
35  DtExtendedRtiMsgForwarder( unsigned long id, const DtRIDParameters& params, bool postMessagesToParent = true );
36 
37 public:
38 
40 
45  static DtExtendedRtiMsgForwarder* create( unsigned int id, const DtRIDParameters& params, bool postMessagesToParent = true );
46 
48  virtual ~DtExtendedRtiMsgForwarder();
49 
52  virtual void applyFilters();
53 
55  virtual void sendByTransport( const DtForwarderPort::DtForwarderMsg& msg );
56 
58  virtual void sendToAllReliable( const DtForwarderPort::DtForwarderMsg& msg );
59 
61  virtual void sendBestEffort( const DtForwarderPort::DtForwarderMsg& msg );
62 
65  virtual void sendMessageToWan( const DtRtiMsg& msg );
66 
69  virtual inline bool flush();
70 
73  virtual const DtCharBufferQueue::Buffer* getNextMsg();
74 
77  virtual void selectParams( MAKRti::DtSelectParamWithWrite& selectParams );
78 
80  virtual DtForwarderPort::DtAddressPortList newConnections() const;
81 
83  virtual DtForwarderPort::DtAddressPortList droppedConnections() const;
84 
86  virtual DtForwarderPort::DtAddressPortList connections() const;
87 
89  virtual void listenToMulticastGroup( const MAKRti::DtInetAddr& mcastAddr );
90  virtual void dropMulticastGroup( const MAKRti::DtInetAddr& mcastAddr );
91 
92 
94  virtual void federateJoined(const MAKRti::DtString&, const MAKRti::DtString&,
95  const MAKRti::DtString&,
96  unsigned int, unsigned int, const DtInetAddrAndPort&,
97  const MAKRti::DtString&, unsigned int, const MAKRti::DtString&,
98  const MAKRti::DtString&, DtHlaVersionId);
99  virtual void federateResigned(const MAKRti::DtString&,
100  const MAKRti::DtString&, unsigned int, unsigned int,
101  const DtInetAddrAndPort& );
102  virtual void updateSocketQueueStatus( unsigned int connId, int connQueueStatus);
103 
104  virtual void addFederateJoinedCb(
105  DtForwarderPort::DtFederateAddedCb callback, void* usr );
106  virtual void addFederateResignedCb(
107  DtForwarderPort::DtFederateRemovedCb callback, void* usr ) ;
108 
109  virtual void addSocketAdditionCb(
111  virtual void addSocketRemovalCb(
113 
114  virtual void addSocketQueueCb(
115  DtForwarderPort::DtSocketQueueCb cb, void* usr );
116 
118  virtual void addExecConnectionEstablishedCb(
119  DtForwarderPort::DtExecAddChangeCb callback, void* usr );
120  virtual void removeExecConnectionEstablishedCb(
121  DtForwarderPort::DtExecAddChangeCb callback, void* usr );
122 
124  virtual void addExecConnectionLostCb(
125  DtForwarderPort::DtExecRemovedChangeCb callback, void* usr );
126  virtual void removeExecConnectionLostCb(
127  DtForwarderPort::DtExecRemovedChangeCb callback, void* usr );
128 
129  virtual const DtFederateTrackingFilter* fedHandleTrackingFilter() const { return myFedHandleTracker; }
130 
131 
132 protected:
133 
135  virtual void init();
136 
138  virtual void tcpSocketAdditionCb(DtTcpMsgSocket* sock);
139  virtual void tcpSocketRemovalCb(DtTcpMsgSocket* sock);
140 
147  virtual void refreshConnectionList() const;
148 
149 public:
150 
152  static const unsigned int theForwarderId;
153 
154 protected:
155 
156  typedef std::pair< DtInetAddrAndPort, int > DtAddressAndSockIdPair;
157 
160 
161  std::auto_ptr<DtCharBufferQueue::Buffer> myLastReceivedMsg;
164  DtMessageBufferFilter* myOutMsgFilter;
166 
168  DtClock myClock;
169 
171  MAKRti::DtTime myLastDiscoveryTickTime;
172 
175 
177 
181 
186  typedef std::pair< bool, DtAddressAndSockIdPair > DtBoolAddressSocketIdPair;
188  mutable std::set< DtAddressAndSockIdPair > myConnections;
191 
192 
196 };
197 
199 {
200  bool status = true;
204  if ( myUdpSendSocket->isOpen() )
205  {
206  status = myUdpSendSocket->flush();
207  }
208 
209  return status;
210 }
211 #endif
212 
int(* DtSocketQueueCb)(unsigned int, int, void *)
Definition: forwarderPort.h:82
DtForwarderPort::DtFederateRemovedCallbackList myFederateResignedCbs
Definition: extendedRtiMsgForwarder.h:174
std::vector< std::pair< DtConnectionChangeCb, void * > > DtConnectionChangeCallbackList
Definition: forwarderPort.h:89
std::pair< MAKRti::DtInetAddr, int > DtInetAddrAndPort
Definition: rtiUtil.h:147
Definition: extendedRtiMsgForwarder.h:30
std::pair< DtInetAddrAndPort, int > DtAddressAndSockIdPair
Definition: extendedRtiMsgForwarder.h:156
DtForwarderPort::DtConnectionAddRemoveCallbackList mySocketAddedCbs
Definition: extendedRtiMsgForwarder.h:178
virtual bool isOpen() const
Returns true if the socket is open.
void(* DtFederateRemovedCb)(const MAKRti::DtString &, const MAKRti::DtString &, unsigned int, unsigned int, const DtInetAddrAndPort &, void *)
Definition: forwarderPort.h:74
DtCharBufferQueue myOutMsgQueue
Definition: extendedRtiMsgForwarder.h:163
std::vector< std::pair< DtFederateRemovedCb, void * > > DtFederateRemovedCallbackList
Definition: forwarderPort.h:91
int(* DtExecAddChangeCb)(const MAKRti::DtString &, unsigned int, const DtInetAddrAndPort &, const MAKRti::DtString &, bool, void *)
Definition: forwarderPort.h:78
static const unsigned int theForwarderId
Address space for connection IDs for this LAN.
Definition: extendedRtiMsgForwarder.h:152
void(* DtFederateAddedCb)(const MAKRti::DtString &, const MAKRti::DtString &, const MAKRti::DtString &, unsigned int, unsigned int, const DtInetAddrAndPort &, const MAKRti::DtString &, unsigned int, const MAKRti::DtString &, const MAKRti::DtString &, DtHlaVersionId, void *)
Definition: forwarderPort.h:69
This class manages the RTI&#39;s start-up configuration using both MTL variables and functions.
Definition: RIDparams.h:87
virtual const DtFederateTrackingFilter * fedHandleTrackingFilter() const
Definition: extendedRtiMsgForwarder.h:129
DtClock myClock
Local timer.
Definition: extendedRtiMsgForwarder.h:168
DtUdpMsgSocket * myUdpRcvSocket
Definition: extendedRtiMsgForwarder.h:158
DtCharBufferQueue myInMsgQueue
Definition: extendedRtiMsgForwarder.h:162
Helper class captures DtNetJoinResponseMsg Messages and maps the associated federate ID to the connId...
Definition: federateTrackingFilter.h:23
DtMessageBufferFilter * myOutMsgFilter
Definition: extendedRtiMsgForwarder.h:164
This file contains the declaration of the DtRtiMsgForwarder class which implements a distributed TCP ...
DtHlaVersionId
Definition: rtiVersion.h:41
DtThreadSafeQueue< DtBoolAddressSocketIdPair > mySocketListChanges
Definition: extendedRtiMsgForwarder.h:187
DtThreadSafeBufferQueue< char > DtCharBufferQueue
Definition: extendedRtiMsgForwarder.h:39
This file contains the declaration of the DtUdpMsgSocket base class.
bool myForwardMessagesToParent
Should the local forwarder pass a copy of all messages on to the Parent or simply forward within the ...
Definition: extendedRtiMsgForwarder.h:195
DtForwarderPort::DtAddressPortList myDroppedConnections
Definition: extendedRtiMsgForwarder.h:190
DtForwarderPort::DtFederateAddedCallbackList myFederateJoinedCbs
Definition: extendedRtiMsgForwarder.h:173
int(* DtExecRemovedChangeCb)(const MAKRti::DtString &, unsigned int, const DtInetAddrAndPort &, void *)
Definition: forwarderPort.h:80
Definition: forwarderPort.h:44
std::set< DtAddressAndSockIdPair > myConnections
Definition: extendedRtiMsgForwarder.h:188
std::auto_ptr< DtCharBufferQueue::Buffer > myLastReceivedMsg
Definition: extendedRtiMsgForwarder.h:161
std::vector< char > Buffer
Definition: vlThreadSafeBufferQueue.h:34
static void tcpSocketAdditionCb(DtTcpMsgSocket *sock, void *usr)
Callbacks on addition/removal of TCP sockets.
std::vector< std::pair< DtSocketQueueCb, void * > > DtSocketQueueCallbackList
Definition: forwarderPort.h:95
DtRouteMap::DtAddressPortList DtAddressPortList
Definition: forwarderPort.h:51
DtRtiMsg is the base class for messages between RTI components.
Definition: rtiMsg.h:45
DtFederateTrackingFilter * myFedHandleTracker
Definition: extendedRtiMsgForwarder.h:165
The DtTcpMsgSocket class provides an address family independent TCP socket that handles RTI messages...
Definition: tcpMsgSocket.h:42
DtForwarderPort::DtAddressPortList myNewConnections
Definition: extendedRtiMsgForwarder.h:189
virtual bool flush()
Send buffered messages.
Definition: extendedRtiMsgForwarder.h:198
static void tcpSocketRemovalCb(DtTcpMsgSocket *sock, void *usr)
MAKRti::DtTime myLastDiscoveryTickTime
Time of last pass for mcast discovery.
Definition: extendedRtiMsgForwarder.h:171
DtRtiMsgForwarder manages connections and message distribution to local federates and remote Forwarde...
Definition: rtiMessageForwarder.h:58
DtForwarderPort::DtConnectionAddRemoveCallbackList mySocketRemovedCbs
Definition: extendedRtiMsgForwarder.h:179
std::pair< bool, DtAddressAndSockIdPair > DtBoolAddressSocketIdPair
These lists are mutable since they are simply used to cache a reflection of back-end thread lists (ra...
Definition: extendedRtiMsgForwarder.h:186
static DtRtiMsgForwarder * create(unsigned long id, const DtRIDParameters &params)
Create an instance of a DtRtiMsgForwarder.
int(* DtConnectionAddRemoveCb)(const MAKRti::DtString &, const MAKRti::DtString &, unsigned int, const std::pair< DtInetAddrAndPort, DtInetAddrAndPort > &, void *)
Definition: forwarderPort.h:61
std::vector< std::pair< DtConnectionAddRemoveCb, void * > > DtConnectionAddRemoveCallbackList
Definition: forwarderPort.h:86
DtUdpMsgSocket * myUdpSendSocket
Definition: extendedRtiMsgForwarder.h:159
std::vector< std::pair< DtFederateAddedCb, void * > > DtFederateAddedCallbackList
Definition: forwarderPort.h:90
Defines a ThreadedObject which can run a DtRunnable object in a thread.
#define DT_DLL_FORWARDER
Definition: rtiMsConfig.h:124
The DtUdpMsgSocket class provides an address family independent UDP socket that handles RTI messages...
Definition: udpMsgSocket.h:28
DtForwarderPort::DtSocketQueueCallbackList mySocketQueueCbs
Definition: extendedRtiMsgForwarder.h:176
DtForwarderPort::DtConnectionChangeCallbackList mySocketChangedCbs
Definition: extendedRtiMsgForwarder.h:180
virtual void init()
Initialize the forwarder (called by creator)
virtual bool flush()
Attempts to send any queued messages and bundled messages.

Document ID: Generated on Mon Sep 7 15:40:32 EDT 2020 from SVN revision 217499
Copyright © 2005-2020 MAK Technologies Inc. All Rights Reserved (www.mak.com)