![]() |
MAK RTIspy API Documentation for HLA 1.3
|
00001 /********************************************************************* 00002 ** Copyright (c) 1992, 1997 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: peerToPeerSockMgr.h,v $ $Revision: 1.10 $ $State: Exp $ 00007 *********************************************************************/ 00008 #ifndef DtPeerToPeerTcpSockMgr_H_ 00009 #define DtPeerToPeerTcpSockMgr_H_ 00010 00014 00015 #include "rtiMsConfig.h" 00016 #include <vector> 00017 #include <map> 00018 #include <vlutil/vlTime.h> 00019 #include <tcpMsgSocketMgr.h> 00020 00021 typedef void (*DtSocketEstablishedCallback)(DtTcpMsgSocket* sock, void* usr); 00022 00023 class DtSocketCbInfo 00024 { 00025 public: 00026 00027 DtSocketCbInfo(DtSocketEstablishedCallback cb, void* usr) 00028 { 00029 myCb = cb; 00030 myUsr = usr; 00031 } 00032 00033 DtSocketEstablishedCallback myCb; 00034 void *myUsr; 00035 }; 00036 00045 class DT_DLL_FORWARDER DtPeerToPeerTcpSockMgr : public DtTcpMsgSocketMgr 00046 { 00047 public: 00048 00050 DtPeerToPeerTcpSockMgr( int port, 00051 DtBoost::shared_ptr<DtMsgHeaderReader> hdrRdr, 00052 size_t recvBufferSize, int maxForwarderQueue); 00053 00055 virtual ~DtPeerToPeerTcpSockMgr(); 00056 00058 virtual DtTcpMsgSocket* connectToPeer( const MAKRti::DtInetAddr& addr, 00059 DtInetDevice* hostIf = 0 ); 00060 00065 virtual DtTcpMsgSocket* connectToPeer( const MAKRti::DtInetAddr& addr, 00066 int port, DtInetDevice* hostIf = 0 ); 00067 00069 virtual void removeAndDeletePeerConnection(DtTcpMsgSocket* sock, 00070 bool abort = true ); 00071 00073 unsigned int abortPendingConnections(); 00074 00076 unsigned int pendingConnectionsAborted(); 00077 00082 virtual void processConnections(); 00083 00084 00088 virtual void addSocketEstablishedCallback( 00089 DtSocketEstablishedCallback cb, void* usr); 00093 virtual void removeSocketEstablishedCallback( 00094 DtSocketEstablishedCallback cb, void* usr); 00095 00096 00097 private: 00099 DtPeerToPeerTcpSockMgr( const DtPeerToPeerTcpSockMgr& orig ); 00100 DtPeerToPeerTcpSockMgr& operator=( const DtPeerToPeerTcpSockMgr& orig ); 00101 00102 protected: 00103 00105 00107 int myPort; 00108 00110 MAKRti::DtClock myClock; 00111 00114 unsigned int myPendingConnectionsAborted; 00115 00118 std::map<DtTcpMsgSocket*, MAKRti::DtTime> myPendingConnections; 00119 00121 bool myProcessingConnections; 00122 00124 std::list<DtSocketCbInfo> myEstablishedCallbacks; 00125 00126 }; 00127 00128 #endif //! DtPeerToPeerTcpSockMgr_H_