Shadowrun: Awakened 29 September 2011 - Build 871
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
RakNet::UDPProxyClient Class Reference

Communicates with UDPProxyCoordinator, in order to find a UDPProxyServer to forward our datagrams. More...

#include <UDPProxyClient.h>

Inheritance diagram for RakNet::UDPProxyClient:

List of all members.

Classes

struct  PingServerGroup
struct  SenderAndTargetAddress
struct  ServerWithPing

Public Member Functions

virtual void OnRakPeerShutdown (void)
 Called when RakPeer is shutdown.
virtual PluginReceiveResult OnReceive (Packet *packet)
bool RequestForwarding (SystemAddress proxyCoordinator, SystemAddress sourceAddress, RakNetGUID targetGuid, RakNet::TimeMS timeoutOnNoDataMS, RakNet::BitStream *serverSelectionBitstream=0)
bool RequestForwarding (SystemAddress proxyCoordinator, SystemAddress sourceAddress, SystemAddress targetAddressAsSeenFromCoordinator, RakNet::TimeMS timeoutOnNoDataMS, RakNet::BitStream *serverSelectionBitstream=0)
void SetResultHandler (UDPProxyClientResultHandler *rh)
 UDPProxyClient ()
virtual void Update (void)
 Update is called every time a packet is checked for .
 ~UDPProxyClient ()

Static Public Member Functions

static void DestroyInstance (UDPProxyClient *i)
static UDPProxyClientGetInstance (void)

Public Attributes

DataStructures::Multilist
< ML_UNORDERED_LIST,
PingServerGroup * > 
pingServerGroups

Protected Member Functions

void Clear (void)
void OnPingServers (Packet *packet)

Protected Attributes

UDPProxyClientResultHandlerresultHandler

Detailed Description

When NAT Punchthrough fails, it is possible to use a non-NAT system to forward messages from us to the recipient, and vice-versa.
The class to forward messages is UDPForwarder, and it is triggered over the network via the UDPProxyServer plugin.
The UDPProxyClient connects to UDPProxyCoordinator to get a list of servers running UDPProxyServer, and the coordinator will relay our forwarding request

See also:
NatPunchthroughServer
NatPunchthroughClient

Definition at line 102 of file UDPProxyClient.h.


Constructor & Destructor Documentation

RakNet::UDPProxyClient::UDPProxyClient ( )
RakNet::UDPProxyClient::~UDPProxyClient ( )

Member Function Documentation

void RakNet::UDPProxyClient::Clear ( void  ) [protected]
static void RakNet::UDPProxyClient::DestroyInstance ( UDPProxyClient i) [static]
static UDPProxyClient* RakNet::UDPProxyClient::GetInstance ( void  ) [static]
void RakNet::UDPProxyClient::OnPingServers ( Packet packet) [protected]
virtual void RakNet::UDPProxyClient::OnRakPeerShutdown ( void  ) [virtual]

Reimplemented from RakNet::PluginInterface2.

virtual PluginReceiveResult RakNet::UDPProxyClient::OnReceive ( Packet packet) [virtual]

OnReceive is called for every packet.

Parameters:
[in]packetthe packet that is being returned to the user
Returns:
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from RakNet::PluginInterface2.

bool RakNet::UDPProxyClient::RequestForwarding ( SystemAddress  proxyCoordinator,
SystemAddress  sourceAddress,
RakNetGUID  targetGuid,
RakNet::TimeMS  timeoutOnNoDataMS,
RakNet::BitStream serverSelectionBitstream = 0 
)

Same as above, but specify the target with a GUID, in case you don't know what its address is to the coordinator If requesting forwarding to a RakNet enabled system, then it is easier to use targetGuid instead of targetAddressAsSeenFromCoordinator

bool RakNet::UDPProxyClient::RequestForwarding ( SystemAddress  proxyCoordinator,
SystemAddress  sourceAddress,
SystemAddress  targetAddressAsSeenFromCoordinator,
RakNet::TimeMS  timeoutOnNoDataMS,
RakNet::BitStream serverSelectionBitstream = 0 
)

Sends a request to proxyCoordinator to find a server and have that server setup UDPForwarder::StartForwarding() on our address to targetAddressAsSeenFromCoordinator The forwarded datagrams can be from any UDP source, not just RakNet

Precondition:
Must be connected to proxyCoordinator
Systems running UDPProxyServer must be connected to proxyCoordinator and logged in via UDPProxyCoordinator::LoginServer() or UDPProxyServer::LoginToCoordinator()
Note:
May still fail, if all proxy servers have no open connections.
RakNet's protocol will ensure a message is sent at least every 5 seconds, so if routing RakNet messages, it is a reasonable value for timeoutOnNoDataMS, plus an extra few seconds for latency.
Parameters:
[in]proxyCoordinatorSystem we are connected to that is running the UDPProxyCoordinator plugin
[in]sourceAddressExternal IP address of the system we want to forward messages from. This does not have to be our own system. To specify our own system, you can pass UNASSIGNED_SYSTEM_ADDRESS which the coordinator will treat as our external IP address.
[in]targetAddressAsSeenFromCoordinatorExternal IP address of the system we want to forward messages to. If this system is connected to UDPProxyCoordinator at this address using RakNet, that system will ping the server and thus open the router for incoming communication. In any other case, you are responsible for doing your own network communication to have that system ping the server. See also targetGuid in the other version of RequestForwarding(), to avoid the need to know the IP address to the coordinator of the destination.
[in]timeoutOnNoDataIf no data is sent by the forwarded systems, how long before removing the forward entry from UDPForwarder? UDP_FORWARDER_MAXIMUM_TIMEOUT is the maximum value. Recommended high enough to not drop valid connections, but low enough to not waste forwarding slots on the proxy server.
[in]serverSelectionBitstreamIf you want to send data to UDPProxyCoordinator::GetBestServer(), write it here
Returns:
true if the request was sent, false if we are not connected to proxyCoordinator
void RakNet::UDPProxyClient::SetResultHandler ( UDPProxyClientResultHandler rh)

Receives the results of calling RequestForwarding() Set before calling RequestForwarding or you won't know what happened

Parameters:
[in]resultHandler
virtual void RakNet::UDPProxyClient::Update ( void  ) [virtual]

Reimplemented from RakNet::PluginInterface2.


Member Data Documentation

Definition at line 158 of file UDPProxyClient.h.

Definition at line 163 of file UDPProxyClient.h.


The documentation for this class was generated from the following file:

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