Shadowrun: Awakened 29 September 2011 - Build 871
UDPProxyClient.h
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 
00048     virtual void OnForwardingSuccess(const char *proxyIPAddress, unsigned short proxyPort,
00049         SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNet::UDPProxyClient *proxyClientPlugin)=0;
00050 
00059     virtual void OnForwardingNotification(const char *proxyIPAddress, unsigned short proxyPort,
00060         SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNet::UDPProxyClient *proxyClientPlugin)=0;
00061 
00067     virtual void OnNoServersOnline(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNet::UDPProxyClient *proxyClientPlugin)=0;
00068 
00075     virtual void OnRecipientNotConnected(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNetGUID targetGuid, RakNet::UDPProxyClient *proxyClientPlugin)=0;
00076 
00083     virtual void OnAllServersBusy(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNet::UDPProxyClient *proxyClientPlugin)=0;
00084 
00091     virtual void OnForwardingInProgress(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddress, RakNet::UDPProxyClient *proxyClientPlugin)=0;
00092 };
00093 
00094 
00102 class RAK_DLL_EXPORT UDPProxyClient : public PluginInterface2
00103 {
00104 public:
00105     // GetInstance() and DestroyInstance(instance*)
00106     STATIC_FACTORY_DECLARATIONS(UDPProxyClient)
00107 
00108     UDPProxyClient();
00109     ~UDPProxyClient();
00110 
00114     void SetResultHandler(UDPProxyClientResultHandler *rh);
00115 
00128     bool RequestForwarding(SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddressAsSeenFromCoordinator, RakNet::TimeMS timeoutOnNoDataMS, RakNet::BitStream *serverSelectionBitstream=0);
00129 
00132     bool RequestForwarding(SystemAddress proxyCoordinator, SystemAddress sourceAddress, RakNetGUID targetGuid, RakNet::TimeMS timeoutOnNoDataMS, RakNet::BitStream *serverSelectionBitstream=0);
00133 
00135     virtual void Update(void);
00136     virtual PluginReceiveResult OnReceive(Packet *packet);
00137     virtual void OnRakPeerShutdown(void);
00138     
00139     struct ServerWithPing
00140     {
00141         unsigned short ping;
00142         SystemAddress serverAddress;
00143     };
00144     struct SenderAndTargetAddress
00145     {
00146         SystemAddress senderClientAddress;
00147         SystemAddress targetClientAddress;
00148     };
00149     struct PingServerGroup
00150     {
00151         SenderAndTargetAddress sata;
00152         RakNet::TimeMS startPingTime;
00153         SystemAddress coordinatorAddressForPings;
00154         DataStructures::Multilist<ML_UNORDERED_LIST, ServerWithPing> serversToPing;
00155         bool AreAllServersPinged(void) const;
00156         void SendPingedServersToCoordinator(RakPeerInterface *rakPeerInterface);
00157     };
00158     DataStructures::Multilist<ML_UNORDERED_LIST, PingServerGroup*> pingServerGroups;
00159 protected:
00160 
00161     void OnPingServers(Packet *packet);
00162     void Clear(void);
00163     UDPProxyClientResultHandler *resultHandler;
00164 
00165 };
00166 
00167 } // End namespace
00168 
00169 #endif
00170 
00171 #endif // _RAKNET_SUPPORT_*

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net