Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "NativeFeatureIncludes.h"
00015 #if _RAKNET_SUPPORT_UDPProxyClient==1
00016
00017 #ifndef __UDP_PROXY_CLIENT_H
00018 #define __UDP_PROXY_CLIENT_H
00019
00020 #include "Export.h"
00021 #include "DS_Multilist.h"
00022 #include "RakNetTypes.h"
00023 #include "PluginInterface2.h"
00024
00029
00030 namespace RakNet
00031 {
00032 class UDPProxyClient;
00033
00036 struct UDPProxyClientResultHandler
00037 {
00038 UDPProxyClientResultHandler() {}
00039 virtual ~UDPProxyClientResultHandler() {}
00040
00049 virtual void OnForwardingSuccess(const char *proxyIPAddress, unsigned short proxyPort, unsigned short reverseProxyPort,
00050 SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNet::UDPProxyClient *proxyClientPlugin)=0;
00051
00061 virtual void OnForwardingNotification(const char *proxyIPAddress, unsigned short proxyPort, unsigned short reverseProxyPort,
00062 SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNet::UDPProxyClient *proxyClientPlugin)=0;
00063
00069 virtual void OnNoServersOnline(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNet::UDPProxyClient *proxyClientPlugin)=0;
00070
00077 virtual void OnRecipientNotConnected(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, RakNet::UDPProxyClient *proxyClientPlugin)=0;
00078
00085 virtual void OnAllServersBusy(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNet::UDPProxyClient *proxyClientPlugin)=0;
00086
00093 virtual void OnForwardingInProgress(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNet::UDPProxyClient *proxyClientPlugin)=0;
00094 };
00095
00096
00104 class RAK_DLL_EXPORT UDPProxyClient : public PluginInterface2
00105 {
00106 public:
00107 UDPProxyClient();
00108 ~UDPProxyClient();
00109
00113 void SetResultHandler(UDPProxyClientResultHandler *rh);
00114
00127 bool RequestForwarding(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddressAsSeenFromCoordinator, RakNetTimeMS timeoutOnNoDataMS, RakNet::BitStream *serverSelectionBitstream=0);
00128
00131 bool RequestForwarding(SystemAddress proxyCoordinator, SystemAddress sourceAddress, RakNetGUID targetGuid, RakNetTimeMS timeoutOnNoDataMS, RakNet::BitStream *serverSelectionBitstream=0);
00132
00134 virtual void Update(void);
00135 virtual PluginReceiveResult OnReceive(Packet *packet);
00136 virtual void OnRakPeerShutdown(void);
00137
00138 struct ServerWithPing
00139 {
00140 unsigned short ping;
00141 SystemAddress serverAddress;
00142 };
00143 struct SenderAndTargetAddress
00144 {
00145 SystemAddress senderClientAddress;
00146 SystemAddress targetClientAddress;
00147 };
00148 struct PingServerGroup
00149 {
00150 SenderAndTargetAddress sata;
00151 RakNetTime startPingTime;
00152 SystemAddress coordinatorAddressForPings;
00153 DataStructures::Multilist<ML_UNORDERED_LIST, ServerWithPing> serversToPing;
00154 bool AreAllServersPinged(void) const;
00155 void SendPingedServersToCoordinator(RakPeerInterface *rakPeerInterface);
00156 };
00157 DataStructures::Multilist<ML_UNORDERED_LIST, PingServerGroup*> pingServerGroups;
00158 protected:
00159
00160 void OnPingServers(Packet *packet);
00161 void Clear(void);
00162 UDPProxyClientResultHandler *resultHandler;
00163
00164 };
00165
00166 }
00167
00168 #endif
00169
00170 #endif // _RAKNET_SUPPORT_*