SLikeNet  0.1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConnectionGraph2.h
Go to the documentation of this file.
1 /*
2  * Original work: Copyright (c) 2014, Oculus VR, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7  * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8  *
9  *
10  * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11  *
12  * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13  * license found in the license.txt file in the root directory of this source tree.
14  */
15 
19 
20 
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_ConnectionGraph2==1
23 
24 #ifndef __CONNECTION_GRAPH_2_H
25 #define __CONNECTION_GRAPH_2_H
26 
27 #include "memoryoverride.h"
28 #include "types.h"
29 #include "PluginInterface2.h"
30 #include "DS_List.h"
31 #include "DS_WeightedGraph.h"
32 #include "GetTime.h"
33 #include "Export.h"
34 
35 namespace SLNet
36 {
38 class RakPeerInterface;
39 
46 {
47 public:
48 
49  // GetInstance() and DestroyInstance(instance*)
51 
54 
61  bool GetConnectionListForRemoteSystem(RakNetGUID remoteSystemGuid, SystemAddress *saOut, RakNetGUID *guidOut, unsigned int *outLength);
62 
64  bool ConnectionExists(RakNetGUID g1, RakNetGUID g2);
65 
67  uint16_t GetPingBetweenSystems(RakNetGUID g1, RakNetGUID g2) const;
68 
71  RakNetGUID GetLowestAveragePingSystem(void) const;
72 
76  void SetAutoProcessNewConnections(bool b);
77 
80  bool GetAutoProcessNewConnections(void) const;
81 
87  void AddParticipant(const SystemAddress &systemAddress, RakNetGUID rakNetGUID);
88 
91  void GetParticipantList(DataStructures::OrderedList<RakNetGUID, RakNetGUID> &participantList);
92 
95  {
99  };
101  static int SystemAddressAndGuidComp( const SystemAddressAndGuid &key, const SystemAddressAndGuid &data );
102 
105  {
108  };
110  static int RemoteSystemComp( const RakNetGUID &key, RemoteSystem * const &data );
111 
112 protected:
114  virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
116  virtual void OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming);
118  virtual PluginReceiveResult OnReceive(Packet *packet);
119 
120  // List of systems I am connected to, which in turn stores which systems they are connected to
122 
124 
125 };
126 
127 } // namespace SLNet
128 
129 #endif // #ifndef __CONNECTION_GRAPH_2_H
130 
131 #endif // _RAKNET_SUPPORT_*