MAK RTIspy API Documentation for HLA Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
assistantMsg.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1998 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: assistantMsg.h,v $ $Revision: 1.41 $ $State: Exp $
7 *********************************************************************/
8 
11 
12 #ifndef DtAssistantMsg_H_
13 #define DtAssistantMsg_H_
14 
15 #include <memory>
16 
17 #include <vlutil/vlBaseMsg.h>
18 #include <vlutil/vlString.h>
19 #include <vlutil/vlInetAddr.h>
20 
21 #include <internalTypes.h>
22 
23 #include "assistantUtil.h"
24 #include "netAssistantMsgHdr.h"
25 
27 
28 // Default port for all assistant communication
29 // When this is changed you must also update DtRIDParameters::verifyPortsAreUnique
30 #define DtASSISTANT_DEFAULT_PORT 6003
31 
32 // Default destination id (everyone)
33 #define DtASSISTANT_DEFAULT_DEST_ID 0
34 
35 // Default multicast address for communication between assistants
36 #define DtASSISTANT_DEFAULT_IPV4_ADDR "229.7.7.10"
37 #define DtASSISTANT_DEFAULT_IPV6_ADDR "ff12::7:10"
38 
39 // Default TTL for all assistant communication
40 #define DtASSISTANT_DEFAULT_TTL 1
41 
42 // RTI 4.1.1 DtAssistantMessageVersion = 14
43 // RTI 4.2pr DtAssistantMessageVersion = 15 (pre-release)
44 // RTI 4.2 DtAssistantMessageVersion = 16
45 // RTI 4.3 DtAssistantMessageVersion = 17
46 // RTI 4.4 DtAssistantMessageVersion = 18
47 // RTI 4.4.x DtAssistantMessageVersion = 19
48 // RTI 4.5 DtAssistantMessageVersion = 20
49 // Making this 21 for testing TODO change back to 20
50 #define DtAssistantMessageVersion 21
51 
53 {
105 
106  // Assistant to Assistant messages
118 
124 };
125 
127 {
139 };
140 
141 // These status are sent by the Forwarder to Assistants.
142 // When a forwarder sends its state msg, it has a vector of clientStatus.
144 {
149 };
150 
152 class DT_DLL_ASSISTANT DtAssistantMsg : public MAKRti::DtBaseMsg
153 {
154 public:
155 
157  virtual ~DtAssistantMsg();
158 
162  virtual DtAssistantMsg* clone(bool copy = true) const=0;
163 
165  virtual DtNetAssistantMsgHeader* netHeader() const;
166 
168  virtual int version() const;
169 
171  virtual bool isValidVersion() const;
172 
174  virtual DtAssistantMsgKind msgKind() const;
175 
177  virtual void print() const;
178  virtual void printHeader() const;
179  virtual void printSrcDest() const;
180  virtual void printData() const;
181 
183  virtual bool isOk() const;
184 
187  bool isAssistantToAssistantMessage() const;
188 
191  virtual MAKRti::DtInetAddr sourceAddr() const;
192  virtual void setSourceAddr(const MAKRti::DtInetAddr& addr);
193 
196  virtual int sourceId() const;
197  virtual void setSourceId(int id);
198 
201  virtual MAKRti::DtString sourceHost() const;
202  virtual void setSourceHost(const MAKRti::DtString& addr);
203 
206  virtual MAKRti::DtInetAddr destAddr() const;
207  virtual void setDestAddr(const MAKRti::DtInetAddr& addr);
208 
211  virtual int destId() const;
212  virtual void setDestId(int id);
213 
216  virtual int compId() const;
217  virtual void setCompId( int compId );
218 
221  virtual const DtAssistantUuid& sourceUuid() const;
222  virtual void setSourceUuid(const DtAssistantUuid& uuid);
223 
226  virtual bool isForeign() const;
227  virtual void setIsForeign( bool isForeignDestination);
228 
231  virtual DtU32 sequence() const;
232  virtual void setSequence(DtU32 sequenceNumber);
233 
234 
235 public:
236 
238  static const char* kindToString(DtAssistantMsgKind kind);
239 
240 protected:
241 
243  DtAssistantMsg();
244 
245  virtual DtAssistantMsgKind internalMsgKind() = 0;
246 
249  virtual void sizeChanged(int size);
250 
252  void initAssistantMsg(int size, DtAssistantMsgKind msgKindVal, DtBufferPtr buffer);
253  void initAssistantMsg(const void *initial, int size, DtBufferPtr buffer);
254  void initAssistantMsg(const DtNetAssistantMsgHeader *header, DtBufferPtr buffer);
255 
258  virtual void adjustBytes(int offset, int numBytes);
259 
263  virtual void adjustBytes(void *address, int numBytes);
264 
267  virtual void resizeForSrcDestInfo();
268 
271  virtual const DtNetAssistantSrcDestInfo* srcDestInfoPtr() const;
272  virtual DtNetAssistantSrcDestInfo* srcDestInfoPtr();
273 
275  virtual void setSourceHostSize( unsigned long size );
276  virtual unsigned long sourceHostSize() const;
277 
279  virtual const char* sourceHostPtr() const;
280  virtual char* sourceHostPtr();
281 
282 };
283 
285 {
286  return (DtNetAssistantMsgHeader*) netRep();
287 }
288 
290 {
291  return DtAssistantMsgKind((DtU32) (DtU8) netHeader()->msgKind);
292 }
293 
294 inline bool DtAssistantMsg::isOk() const
295 {
296  return true;
297 }
298 
299 inline void DtAssistantMsg::adjustBytes(int offset, int numBytes)
300 {
301  if (numBytes > 0)
302  {
303  insertBytes(offset, numBytes);
304  }
305  else if (numBytes < 0)
306  {
307  deleteBytes(offset, -numBytes);
308  }
309 }
310 
311 inline void DtAssistantMsg::adjustBytes(void *address, int numBytes)
312 {
313  if (numBytes > 0)
314  {
315  insertBytes(address, numBytes);
316  }
317  else if (numBytes < 0)
318  {
319  deleteBytes(address, -numBytes);
320  }
321 }
322 
323 #endif
324 

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)