![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
00001 00002 00003 00004 00005 00006 00007 00008 #include "NativeFeatureIncludes.h" 00009 #if _RAKNET_SUPPORT_ConnectionGraph2==1 00010 00011 #ifndef __CONNECTION_GRAPH_2_H 00012 #define __CONNECTION_GRAPH_2_H 00013 00014 #include "RakMemoryOverride.h" 00015 #include "RakNetTypes.h" 00016 #include "PluginInterface2.h" 00017 #include "DS_List.h" 00018 #include "DS_WeightedGraph.h" 00019 #include "GetTime.h" 00020 #include "Export.h" 00021 00022 namespace RakNet 00023 { 00025 class RakPeerInterface; 00026 00032 class RAK_DLL_EXPORT ConnectionGraph2 : public PluginInterface2 00033 { 00034 public: 00035 00036 // GetInstance() and DestroyInstance(instance*) 00037 STATIC_FACTORY_DECLARATIONS(ConnectionGraph2) 00038 00039 ConnectionGraph2(); 00040 ~ConnectionGraph2(); 00041 00048 bool GetConnectionListForRemoteSystem(RakNetGUID remoteSystemGuid, SystemAddress *saOut, RakNetGUID *guidOut, unsigned int *outLength); 00049 00051 bool ConnectionExists(RakNetGUID g1, RakNetGUID g2); 00052 00054 uint16_t GetPingBetweenSystems(RakNetGUID g1, RakNetGUID g2) const; 00055 00058 RakNetGUID GetLowestAveragePingSystem(void) const; 00059 00063 void SetAutoProcessNewConnections(bool b); 00064 00067 bool GetAutoProcessNewConnections(void) const; 00068 00074 void AddParticipant(const SystemAddress &systemAddress, RakNetGUID rakNetGUID); 00075 00078 void GetParticipantList(DataStructures::OrderedList<RakNetGUID, RakNetGUID> &participantList); 00079 00081 struct SystemAddressAndGuid 00082 { 00083 SystemAddress systemAddress; 00084 RakNetGUID guid; 00085 uint16_t sendersPingToThatSystem; 00086 }; 00088 static int SystemAddressAndGuidComp( const SystemAddressAndGuid &key, const SystemAddressAndGuid &data ); 00089 00091 struct RemoteSystem 00092 { 00093 DataStructures::OrderedList<SystemAddressAndGuid,SystemAddressAndGuid,ConnectionGraph2::SystemAddressAndGuidComp> remoteConnections; 00094 RakNetGUID guid; 00095 }; 00097 static int RemoteSystemComp( const RakNetGUID &key, RemoteSystem * const &data ); 00098 00099 protected: 00101 virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason ); 00103 virtual void OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming); 00105 virtual PluginReceiveResult OnReceive(Packet *packet); 00106 00107 // List of systems I am connected to, which in turn stores which systems they are connected to 00108 DataStructures::OrderedList<RakNetGUID, RemoteSystem*, ConnectionGraph2::RemoteSystemComp> remoteSystems; 00109 00110 bool autoProcessNewConnections; 00111 00112 }; 00113 00114 } // namespace RakNet 00115 00116 #endif // #ifndef __CONNECTION_GRAPH_2_H 00117 00118 #endif // _RAKNET_SUPPORT_*
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.