MAK RTIspy API Documentation for HLA Evolved
assistantMsg.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 1998 MaK Technologies, Inc.
00003 ** All rights reserved.
00004 *********************************************************************/
00005 /*********************************************************************
00006 ** $RCSfile: assistantMsg.h,v $ $Revision: 1.41 $ $State: Exp $
00007 *********************************************************************/
00008 
00011 
00012 #ifndef DtAssistantMsg_H_
00013 #define DtAssistantMsg_H_
00014 
00015 #include <memory>
00016 
00017 #include <vlutil/vlBaseMsg.h>
00018 #include <vlutil/vlString.h>
00019 #include <vlutil/vlInetAddr.h>
00020 
00021 #include <internalTypes.h>
00022 
00023 #include "netAssistantMsgHdr.h"
00024 
00025 class DtNetAssistantSrcDestInfo;
00026 
00027 // Default port for all assistant communication
00028 // When this is changed you must also update DtRIDParameters::verifyPortsAreUnique
00029 #define DtASSISTANT_DEFAULT_PORT 6003
00030 
00031 // Default multicast address for communication between assistants
00032 #define DtASSISTANT_DEFAULT_IPV4_ADDR "229.7.7.10"
00033 #define DtASSISTANT_DEFAULT_IPV6_ADDR "ff02::7:10"
00034 
00035 // RTI 4.1.1  DtAssistantMessageVersion = 14
00036 #define DtAssistantMessageVersion 14
00037 
00038 enum DtAssistantMsgKind
00039 {
00040    DtAssistantConnMsgKind                  = 0,
00041    DtAssistantLrcCompInfoMsgKind           = 1,
00042    DtAssistantRtiexecCompInfoMsgKind       = 2,
00043    DtAssistantNotifyMsgKind                = 3,
00044    DtAssistantConnQueryMsgKind             = 4,
00045    DtAssistantNtfyLvlUpdateMsgKind         = 5,
00046    DtAssistantExitMsgKind                  = 6,
00047    DtAssistantLicQueryMsgKind              = 7,
00048    DtAssistantPopupMsgKind                 = 8,
00049    DtAssistantShmCompInfoMsgKind           = 9,
00050    DtAssistantWwwCompInfoMsgKind           = 10,
00051    DtAssistantRtiForwarderCompInfoMsgKind  = 11,
00052    DtAssistantLogEnableMsgKind             = 12,
00053    DtAssistantChangeLatencyTestModeMsgKind = 13,
00054    DtAssistantLatencyReportMsgKind         = 14,
00055    DtAssistantTestMgrStatusMsgKind         = 15,
00056    DtAssistantShutdownMsgKind              = 16,
00057    DtAssistantStateObserveMsgKind          = 17,
00058    DtAssistantDeleteFederateMsgKind        = 18,
00059    DtAssistantDeleteFederationMsgKind      = 19,
00060    DtAssistantNetworkTestEnableMsgKind     = 20,
00061    DtAssistantFederationStateMsgKind       = 21,
00062    DtAssistantFederateStateMsgKind         = 22,
00063    DtAssistantTimeStateMsgKind             = 23,
00064    DtAssistantSyncPtUpdateMsgKind          = 24,
00065    DtAssistantCommandMsgKind               = 25,
00066    DtAssistantExecStateMsgKind             = 26,
00067    DtAssistantForwarderStateMsgKind        = 27,
00068    DtAssistantRidParamsMsgKind             = 28,
00069    DtAssistantLogRequestMsgKind            = 29,
00070    DtAssistantLogMsgKind                   = 30,
00071    DtAssistantShowDialogMsgKind            = 31,
00072    DtAssistantFederateSignalTickIntervalMsgKind    = 32,
00073    DtAssistantSignalTickedMsgKind          = 33,
00074    DtAssistantAwaitingForwardersMsgKind    = 34,
00075    DtAssistantNotifyObserveMsgKind         = 35,
00076 
00077 
00078    // Assistant to Assistant messages
00079    DtAssistantQueryMsgKind                 = 254,
00080    DtAssistantInfoMsgKind                  = 253,
00081    DtAssistantRemovalMsgKind               = 252,
00082    DtAssistantStartRtiexecMsgKind          = 251,
00083    DtAssistantExecObserveRspMsgKind        = 250,
00084    DtAssistantLightweightInfoMsgKind       = 249,
00085    DtAssistantLicServerInfoMsgKind         = 248,
00086 
00091    DtInvalidAssistantMsgKind               = 255
00092 };
00093 
00094 enum DtAssistantMsgReadStatus
00095 {
00096    DtASSISTANT_READ_SUCCESS = 0,
00097    DtASSISTANT_READ_NO_PACKETS,
00098    DtASSISTANT_READ_BAD_PACKET,
00099    DtASSISTANT_READ_SERVER_MSG,
00100    DtASSISTANT_READ_SIZE_MISMATCH,
00101    DtASSISTANT_READ_FILTERED_PACKET,
00102    DtASSISTANT_QUEUED_PACKET,
00103    DtASSISTANT_INVALID_VERSION,
00104    DtASSISTANT_UNKNOWN_ERROR,
00105    DtASSISTANT_BUFFER_TOO_SMALL
00106 };
00108 class DT_DLL_ASSISTANT DtAssistantMsg : public MAKRti::DtBaseMsg
00109 {
00110 public:
00111 
00113    virtual ~DtAssistantMsg();
00114 
00118    virtual DtAssistantMsg* clone(bool copy = true) const=0; 
00119 
00121    virtual DtNetAssistantMsgHeader* netHeader() const;
00122            
00124    virtual int version() const;
00125 
00127    virtual bool isValidVersion() const;
00128 
00130    virtual DtAssistantMsgKind msgKind() const;
00131 
00133    virtual void print() const; 
00134    virtual void printHeader() const;
00135    virtual void printData() const;
00136 
00138    virtual bool isOk() const;
00139 
00142    bool isAssistantToAssistantMessage() const;
00143 
00146    virtual MAKRti::DtInetAddr sourceAddr() const;
00147    virtual void setSourceAddr(const MAKRti::DtInetAddr& addr);
00148 
00151    virtual int sourceId() const;
00152    virtual void setSourceId(int id);
00153 
00156    virtual MAKRti::DtString sourceHost() const;
00157    virtual void setSourceHost(const MAKRti::DtString& addr);
00158 
00161    virtual MAKRti::DtInetAddr destAddr() const;
00162    virtual void setDestAddr(const MAKRti::DtInetAddr& addr);
00163 
00166    virtual int destId() const;
00167    virtual void setDestId(int id);
00168 
00171    virtual int compId() const;
00172    virtual void setCompId( int compId );
00173 
00174 public:
00175 
00177    static const char* kindToString(DtAssistantMsgKind kind);
00178 
00179 protected:
00180 
00182    DtAssistantMsg();
00183 
00184    virtual DtAssistantMsgKind internalMsgKind() = 0;
00185    
00188    virtual void sizeChanged(int size);
00189 
00191    void initAssistantMsg(int size, DtAssistantMsgKind msgKindVal, DtBufferPtr buffer);
00192    void initAssistantMsg(const void *initial, int size, DtBufferPtr buffer);
00193    void initAssistantMsg(const DtNetAssistantMsgHeader *header, DtBufferPtr buffer);
00194 
00197    virtual void adjustBytes(int offset, int numBytes);
00198 
00202    virtual void adjustBytes(void *address, int numBytes);
00203 
00206    virtual void resizeForSrcDestInfo();
00207 
00210    virtual const DtNetAssistantSrcDestInfo* srcDestInfoPtr() const;
00211    virtual DtNetAssistantSrcDestInfo* srcDestInfoPtr();
00212 
00214    virtual void setSourceHostSize( unsigned long size );
00215    virtual unsigned long sourceHostSize() const;
00216 
00218    virtual const char* sourceHostPtr() const;
00219    virtual char* sourceHostPtr();
00220 
00221 };
00222 
00223 inline DtNetAssistantMsgHeader* DtAssistantMsg::netHeader() const
00224 {
00225    return (DtNetAssistantMsgHeader*) netRep();
00226 }
00227 
00228 inline DtAssistantMsgKind DtAssistantMsg::msgKind() const
00229 {
00230    return DtAssistantMsgKind((DtU32) (DtU8) netHeader()->msgKind);
00231 }
00232 
00233 inline bool DtAssistantMsg::isOk() const
00234 {
00235    return true;
00236 }
00237 
00238 inline void DtAssistantMsg::adjustBytes(int offset, int numBytes)
00239 {
00240    if (numBytes > 0)
00241    {
00242       insertBytes(offset, numBytes);
00243    }
00244    else if (numBytes < 0)
00245    {
00246       deleteBytes(offset, -numBytes);
00247    }
00248 }
00249 
00250 inline void DtAssistantMsg::adjustBytes(void *address, int numBytes)
00251 {
00252    if (numBytes > 0)
00253    {
00254       insertBytes(address, numBytes);
00255    }
00256    else if (numBytes < 0)
00257    {
00258       deleteBytes(address, -numBytes);
00259    }
00260 }
00261 
00262 #endif
00263 

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)