MAK RTIspy API Documentation for HLA 4
 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  std::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  MAKRti::DtInetDevice* hostIf = 0);
60 
65  virtual DtTcpMsgSocket* connectToPeer( const MAKRti::DtInetAddr& addr,
66  int port, MAKRti::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 
87  {
88  myProcessingConnections = false;
89  }
90 
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
int myPort
Data Members.
Definition: peerToPeerSockMgr.h:121
void * myUsr
Definition: peerToPeerSockMgr.h:34
bool myProcessingConnections
When processing an add connection callback, prevent recursive connection processing.
Definition: peerToPeerSockMgr.h:135
Definition: tcpMsgSocketMgr.h:43
The DtPeerToPeerTcpSockMgr adds the ability to act as a client as well as a server to the DtTcpMsgSoc...
Definition: peerToPeerSockMgr.h:45
std::list< DtSocketCbInfo > myEstablishedCallbacks
list of callbacks to call when sockets become established
Definition: peerToPeerSockMgr.h:138
DtSocketEstablishedCallback myCb
Definition: peerToPeerSockMgr.h:33
void(* DtSocketEstablishedCallback)(DtTcpMsgSocket *sock, void *usr)
Definition: peerToPeerSockMgr.h:21
virtual void processConnections()
Check for incoming connection attempts.
void unlockProcessConnections()
Definition: peerToPeerSockMgr.h:86
DtSocketCbInfo(DtSocketEstablishedCallback cb, void *usr)
Definition: peerToPeerSockMgr.h:27
DtTcpMsgSocketMgr & operator=(const DtTcpMsgSocketMgr &)
The DtTcpMsgSocket class provides an address family independent TCP socket that handles RTI messages...
Definition: tcpMsgSocket.h:40
Definition: peerToPeerSockMgr.h:23
float myReconnectDelay
The time it will try to sleep (seconds) between reconnect tries.
Definition: peerToPeerSockMgr.h:146
MAKRti::DtClock myClock
Clock used for socket timeouts.
Definition: peerToPeerSockMgr.h:124
int myReconnectTries
The number of times it will try to repair a socket via reconnect if a TCP connection is lost...
Definition: peerToPeerSockMgr.h:142
#define DT_DLL_FORWARDER
Definition: rtiMsConfig.h:153
unsigned int myPendingConnectionsAborted
Count of socket connections which were aborted before successful establishment.
Definition: peerToPeerSockMgr.h:128
void lockProcessConnections()
Definition: peerToPeerSockMgr.h:91
std::map< DtTcpMsgSocket *, MAKRti::DtTime > myPendingConnections
Map of outgoing peer connections that have not been fully established to the time at which they were ...
Definition: peerToPeerSockMgr.h:132

Document ID: Generated on Sun Jul 20 16:15:30 EDT 2025 from SVN revision 277985
Copyright © 2005-2025 MAK Technologies Inc. All Rights Reserved (www.mak.com)