MAK RTIspy API Documentation for HLA 1516
rtiExecHandshakeProcessor.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 2005 MaK Technologies, Inc.
00003 ** All rights reserved.
00004 *********************************************************************/
00005 /*********************************************************************
00006 ** $RCSfile: rtiExecHandshakeProcessor.h,v $ $Revision: 1.8 $ $State: Exp $
00007 *********************************************************************/
00010 
00011 #ifndef DtRtiExecHandshakeProcessor_H_
00012 #define DtRtiExecHandshakeProcessor_H_
00013 
00014 #include "forwarderNode.h"
00015 #include "execHandshakeMsg.h"
00016 #include "routeMap.h"
00017 #include "rtiMsConfig.h"
00018 
00019 #include <vlutil/vlUtil.h>
00020 #include <map>
00021 #include <set>
00022 
00023 class DtRtiExecHandshakeFilter;
00024 class DtRtiExecHandshakeMsg;
00025 template< typename ParentType > class DtRtiExecConnectionFilter;
00026 class DtRtiExecConnectMsg;
00027 class DtRtiExecDisconnectMsg;
00028 
00037 class DT_DLL_FORWARDER DtRtiExecHandshakeProcessor
00038 {
00039 public:
00041    typedef bool (DtRtiExecHandshakeProcessor::* HandshakeMsgHandlerMemberCb)(
00042       const DtInetAddrAndPort& src, const DtRtiExecHandshakeMsg& msg  );
00043    typedef bool (DtRtiExecHandshakeProcessor::* DestinationProcessingMemberCb)(
00044       const DtInetAddrAndPort& src, DtForwarderPort::DtAddressPortList& destinations );
00045 
00047    DtRtiExecHandshakeProcessor( DtBoost::shared_ptr<DtForwarderNode> parent );
00048    
00050    virtual ~DtRtiExecHandshakeProcessor();
00051 
00053    virtual bool gotMsgToLanPort( const DtInetAddrAndPort& src,
00054       const DtRtiExecHandshakeMsg& msg );
00055    
00057    virtual bool gotMsgToOutPort( const DtInetAddrAndPort& src,
00058       const DtRtiExecHandshakeMsg& msg );
00059    
00061    virtual bool gotRtiExecConnect( const DtInetAddrAndPort& src,
00062       const DtRtiExecConnectMsg& msg );
00063 
00065    virtual bool gotRtiExecDisconnect( const DtInetAddrAndPort& src,
00066       const DtRtiExecDisconnectMsg& msg );
00067 
00070    virtual bool processExecHandshakeDestinations ( const DtInetAddrAndPort& src,
00071       DtForwarderPort::DtAddressPortList& destinations );
00072 
00075    virtual bool ignoreExecHandshakeDestinations ( const DtInetAddrAndPort& src, 
00076       DtForwarderPort::DtAddressPortList& destinations );
00077 
00080    virtual bool ignoreExecConnectDestinations ( const DtInetAddrAndPort& src,
00081       DtForwarderPort::DtAddressPortList& destinations );
00082 
00084    virtual bool isLocalGroupMember( const DtInetAddrAndPort& addr );
00085    virtual DtInetAddrAndPort locateGroupPortal( const DtInetAddrAndPort& addr );
00086 
00088    virtual DtInetAddrAndPort localNodeAddress();
00089 
00090 public:
00091 
00093    static int lostConnection( const MAKRti::DtString& connName, unsigned int connID, 
00094       const DtInetAddrAndPort& connAddr, void* usr );
00095 
00096 protected:
00097 
00099    virtual int lostConnection( const MAKRti::DtString& connName,
00100       unsigned int connID, const DtInetAddrAndPort& connAddr );
00101    
00104    virtual void sendResponseMsg( DtRtiExecHandshakeMsg::DtHandshakeStatus status,
00105       DtHandle src, DtHandle dest, const MAKRti::DtString& hostName, bool fullyCompliant,
00106       const DtInetAddrAndPort* addr = 0 );
00107 
00109    virtual bool processInToOutMsg( const DtInetAddrAndPort& src,
00110       const DtRtiExecHandshakeMsg& msg );
00111    
00113    virtual bool processLanToOutMsg( const DtInetAddrAndPort& src,
00114       const DtRtiExecHandshakeMsg& msg );
00115 
00116    
00117 protected:
00118 
00119    class PendingRequest;
00120    typedef std::set< unsigned int >                 DtConnIdList;
00121    typedef std::map< unsigned int, PendingRequest > DtConnIdToRequestMap;
00122 
00124    class PendingRequest
00125    {
00126    public:
00127       typedef std::set< unsigned int >              DtConnIdList;
00128       
00129       PendingRequest() :
00130          currentStatus( DtRtiExecHandshakeMsg::HsResponseGranted ),
00131          destinationHandle( 0 ),
00132          sourceHandle( 0 ),
00133          sourceAddress(),
00134          pendingOutResponses(),
00135          pendingLanResponses() {}
00136          
00137       PendingRequest( const DtInetAddrAndPort& src, DtHandle destHandle,
00138                       DtHandle srcHandle,
00139                       const DtRouteMap::DtAddressPortList& expectedOutResponses,
00140                       const DtConnIdList& expectedLanResponses ) :
00141          currentStatus( DtRtiExecHandshakeMsg::HsResponseGranted ),
00142          destinationHandle( destHandle ),
00143          sourceHandle( srcHandle ),
00144          sourceAddress( src ),
00145          pendingOutResponses( expectedOutResponses ),
00146          pendingLanResponses( expectedLanResponses ) {}
00147          
00148       DtRtiExecHandshakeMsg::DtHandshakeStatus currentStatus;
00149       DtHandle                                 destinationHandle;
00150       DtHandle                                 sourceHandle;
00151       DtInetAddrAndPort                        sourceAddress;
00152       DtRouteMap::DtAddressPortList            pendingOutResponses;
00153       DtConnIdList                             pendingLanResponses;
00154    };
00155 
00156 
00157 protected:
00158 
00159    DtBoost::shared_ptr<DtForwarderNode>  myParent;
00160    DtRtiExecHandshakeFilter*  myMsgToLanFilter;
00161    DtRtiExecHandshakeFilter*  myMsgToOutFilter;
00162    DtRtiExecConnectionFilter<DtRtiExecHandshakeProcessor>* myRtiExecConnectionFilter;
00163 
00165    DtConnIdList               myLocalRtiExecConnIds;
00166 
00168    DtConnIdToRequestMap       myPendingRequests;
00169 
00171    unsigned long myConnectionIdOfLocalRtiExec;
00172    bool myHaveConnectionIdOfLocalRtiExec;
00173    
00174 };
00175 
00176 #endif //! DtRtiExecHandshakeProcessor_H_
00177 

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)