MAK RTIspy API Documentation for HLA 1516
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
peerToPeerSockMgr.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1992, 1997 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: peerToPeerSockMgr.h,v $ $Revision: 1.10 $ $State: Exp $
7 *********************************************************************/
8 #ifndef DtPeerToPeerTcpSockMgr_H_
9 #define DtPeerToPeerTcpSockMgr_H_
10 
14 
15 #include "rtiMsConfig.h"
16 #include <vector>
17 #include <map>
18 #include <vlutil/vlTime.h>
19 #include <tcpMsgSocketMgr.h>
20 
21 typedef void (*DtSocketEstablishedCallback)(DtTcpMsgSocket* sock, void* usr);
22 
24 {
25 public:
26 
28  {
29  myCb = cb;
30  myUsr = usr;
31  }
32 
34  void *myUsr;
35 };
36 
46 {
47 public:
48 
50  DtPeerToPeerTcpSockMgr( int port,
51  DtBoost::shared_ptr<DtMsgHeaderReader> hdrRdr,
52  size_t recvBufferSize, int maxForwarderQueue, int reconnectTries = 0, float reconnectDelay = 0.0f);
53 
55  virtual ~DtPeerToPeerTcpSockMgr();
56 
58  virtual DtTcpMsgSocket* connectToPeer( const MAKRti::DtInetAddr& addr,
59  DtInetDevice* hostIf = 0 );
60 
65  virtual DtTcpMsgSocket* connectToPeer( const MAKRti::DtInetAddr& addr,
66  int port, DtInetDevice* hostIf = 0 );
67 
69  virtual void removeAndDeletePeerConnection(DtTcpMsgSocket* sock,
70  bool abort = true );
71 
73  unsigned int abortPendingConnections();
74 
76  unsigned int pendingConnectionsAborted();
77 
78  virtual bool repairPeerSocket(DtTcpMsgSocket* oldSock);
79 
84  virtual void processConnections();
85 
86  void unlockProcessConnections()
87  {
88  myProcessingConnections = false;
89  }
90 
91  void lockProcessConnections()
92  {
93  myProcessingConnections = true;
94  }
95 
96 
97 
101  virtual void addSocketEstablishedCallback(
102  DtSocketEstablishedCallback cb, void* usr);
106  virtual void removeSocketEstablishedCallback(
107  DtSocketEstablishedCallback cb, void* usr);
108 
109  //virtual void replacePeerSocket(DtTcpMsgSocket* oldSock, DtTcpMsgSocket* newSock);
110 
111 private:
115 
116 protected:
117 
119 
121  int myPort;
122 
124  MAKRti::DtClock myClock;
125 
129 
132  std::map<DtTcpMsgSocket*, MAKRti::DtTime> myPendingConnections;
133 
136 
138  std::list<DtSocketCbInfo> myEstablishedCallbacks;
139 
140 
143 
144 
147 };
148 
149 #endif

Document ID: Generated on Mon Jul 9 10:30:41 EDT 2018 from SVN revision 190224
Copyright © 2005-2018 VT MÄK Inc. All Rights Reserved (www.mak.com)