RakNet::Router2 Class Reference
[Router2]

Class interface for the Router2 system. More...

#include <Router2.h>

Inheritance diagram for RakNet::Router2:

PluginInterface2

List of all members.

Public Member Functions

void EstablishRouting (RakNetGUID endpointGuid)
 Query all connected systems to connect through them to a third system. System will return ID_ROUTER_2_FORWARDING_NO_PATH if unable to connect. Else you will get ID_ROUTER_2_FORWARDING_ESTABLISHED.
void SetMaximumForwardingRequests (int max)
virtual PluginReceiveResult OnReceive (Packet *packet)
virtual void Update (void)
 Update is called every time a packet is checked for .
virtual void OnClosedConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void OnFailedConnectionAttempt (SystemAddress systemAddress, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual void OnNewConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void OnShutdown (void)
 Called when RakPeer is shutdown.


Detailed Description

Class interface for the Router2 system.

Member Function Documentation

void RakNet::Router2::EstablishRouting ( RakNetGUID  endpointGuid  ) 

Query all connected systems to connect through them to a third system. System will return ID_ROUTER_2_FORWARDING_NO_PATH if unable to connect. Else you will get ID_ROUTER_2_FORWARDING_ESTABLISHED.

On ID_ROUTER_2_FORWARDING_ESTABLISHED, EstablishRouting as follows:

RakNet::BitStream bs(packet->data, packet->length, false); bs.IgnoreBytes(sizeof(MessageID)); RakNetGUID endpointGuid; bs.Read(endpointGuid); unsigned short sourceToDestPort; bs.Read(sourceToDestPort); char ipAddressString[32]; packet->systemAddress.ToString(false, ipAddressString); rakPeerInterface->EstablishRouting(ipAddressString, sourceToDestPort, 0,0);

Note:
The SystemAddress for a connection should not be used - always use RakNetGuid as the address can change at any time. When the address changes, you will get ID_ROUTER_2_REROUTED

virtual void RakNet::Router2::OnClosedConnection ( SystemAddress  systemAddress,
RakNetGUID  rakNetGUID,
PI2_LostConnectionReason  lostConnectionReason 
) [virtual]

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters:
[in] systemAddress The system whose connection was closed
[in] rakNetGuid The guid of the specified system
[in] lostConnectionReason How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from PluginInterface2.

virtual void RakNet::Router2::OnFailedConnectionAttempt ( SystemAddress  systemAddress,
PI2_FailedConnectionAttemptReason  failedConnectionAttemptReason 
) [virtual]

Called when a connection attempt fails

Parameters:
[in] systemAddress Address of the connection
[in] failedConnectionReason Why the connection failed

Reimplemented from PluginInterface2.

virtual void RakNet::Router2::OnNewConnection ( SystemAddress  systemAddress,
RakNetGUID  rakNetGUID,
bool  isIncoming 
) [virtual]

Called when we got a new connection

Parameters:
[in] systemAddress Address of the new connection
[in] rakNetGuid The guid of the specified system
[in] isIncoming If true, this is ID_NEW_INCOMING_CONNECTION, or the equivalent

Reimplemented from PluginInterface2.

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

OnReceive is called for every packet.

Parameters:
[in] packet the 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 PluginInterface2.

void RakNet::Router2::SetMaximumForwardingRequests ( int  max  ) 

Set the maximum number of bidirectional connections this system will support Defaults to 0


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

Generated on Mon Mar 15 21:29:01 2010 for RakNet by  doxygen 1.5.7.1