![]() |
MAK RTIspy API Documentation for HLA Evolved
|
00001 /********************************************************************* 00002 ** Copyright (c) 2006 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: tcpRtiConnMgr.h,v $ $Revision: 1.9 $ $State: Exp $ 00007 *******************************************************************************/ 00010 00011 #ifndef DtTcpRtiConnectionMgr_H_ 00012 #define DtTcpRtiConnectionMgr_H_ 00013 00014 #include <rtiMsConfig.h> 00015 #include "wwwSpyRtiConnMgr.h" 00016 #include "webSpyUtils.h" 00017 #include <vlutil/vlString.h> 00018 #include <memory> 00019 #include <map> 00020 00022 00023 class DtWebSpyServer; 00024 class DtRtiMsg; 00025 class DtTcpMsgSocket; 00026 class DtTcpMsgSocketMgr; 00027 00028 00033 class DT_DLL_WWW DtTcpRtiConnectionMgr : public DtWebSpyRtiConnectionMgr 00034 { 00035 private: 00037 DtTcpRtiConnectionMgr( const DtTcpRtiConnectionMgr& ); 00039 DtTcpRtiConnectionMgr& operator=( DtTcpRtiConnectionMgr& ); 00040 00041 public: 00042 00044 static DtWebSpyRtiConnectionMgr* create( DtWebSpyServer& parent ); 00045 00046 public: 00048 virtual ~DtTcpRtiConnectionMgr(); 00049 00052 virtual bool tick( unsigned int timeout = 0 ); 00053 00055 virtual unsigned int numConnections() const; 00056 00057 00060 virtual void postCommand( const DtWebSpyUtils::ConnectionIdentifier& connInfo, 00061 std::auto_ptr<DtRtiMsg> command ); 00062 00063 public: 00064 00066 static void tcpSocketAdditionCb( DtTcpMsgSocket* sock, void* usr ); 00067 static void tcpSocketRemovalCb( DtTcpMsgSocket* sock, void* usr ); 00068 00069 protected: 00070 00072 DtTcpRtiConnectionMgr( DtWebSpyServer& parent ); 00073 00075 virtual void testConnections(); 00076 00078 virtual bool readAndForward( DtTime maxTimePerSocket ); 00079 00081 virtual void tcpSocketAdditionCb( DtTcpMsgSocket* sock ); 00082 virtual void tcpSocketRemovalCb( DtTcpMsgSocket* sock ); 00083 00087 virtual DtWebSpyUtils::ConnectionIdentifier establishConnection( DtTcpMsgSocket* sock ); 00088 00089 00091 virtual std::auto_ptr<DtRtiMsg> netRead( DtTcpMsgSocket* sock, int *retCode) const; 00092 00093 protected: 00094 00095 typedef std::map< DtTcpMsgSocket*, DtWebSpyUtils::ConnectionIdentifier > SocketToConnIdMap; 00096 typedef std::map< DtWebSpyUtils::ConnectionIdentifier, DtTcpMsgSocket* > ConnIdToSocketMap; 00097 00098 SocketToConnIdMap myIdsByConnection; 00099 ConnIdToSocketMap myConnectionsById; 00100 MAKRti::DtTime myTimeToTestConnections; 00101 std::auto_ptr<DtTcpMsgSocketMgr> mySocketMgr; 00102 }; 00103 00104 #endif //! DtTcpRtiConnectionMgr_H_